本文整理汇总了Golang中github.com/Tradnaiofh/plotinum/plot.DrawArea.ContainsX方法的典型用法代码示例。如果您正苦于以下问题:Golang DrawArea.ContainsX方法的具体用法?Golang DrawArea.ContainsX怎么用?Golang DrawArea.ContainsX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Tradnaiofh/plotinum/plot.DrawArea
的用法示例。
在下文中一共展示了DrawArea.ContainsX方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Plot
func (b *QuartPlot) Plot(da plot.DrawArea, plt *plot.Plot) {
trX, trY := plt.Transforms(&da)
x := trX(b.Location)
if !da.ContainsX(x) {
return
}
x += b.Offset
med := plot.Pt(x, trY(b.Median))
q1 := trY(b.Quartile1)
q3 := trY(b.Quartile3)
aLow := trY(b.AdjLow)
aHigh := trY(b.AdjHigh)
da.StrokeLine2(b.WhiskerStyle, x, aHigh, x, q3)
if da.ContainsY(med.Y) {
da.DrawGlyphNoClip(b.MedianStyle, med)
}
da.StrokeLine2(b.WhiskerStyle, x, aLow, x, q1)
ostyle := b.MedianStyle
ostyle.Radius = b.MedianStyle.Radius / 2
for _, out := range b.Outside {
y := trY(b.Value(out))
if da.ContainsY(y) {
da.DrawGlyphNoClip(ostyle, plot.Pt(x, y))
}
}
}
示例2: Plot
// Plot implements the plot.Plotter interface.
func (b *BarChart) Plot(da plot.DrawArea, plt *plot.Plot) {
trX, trY := plt.Transforms(&da)
for i, ht := range b.Values {
x := b.XMin + float64(i)
xmin := trX(float64(x))
if !da.ContainsX(xmin) {
continue
}
xmin = xmin - b.Width/2 + b.Offset
xmax := xmin + b.Width
bottom := b.stackedOn.BarHeight(i)
ymin := trY(bottom)
ymax := trY(bottom + ht)
pts := []plot.Point{
{xmin, ymin},
{xmin, ymax},
{xmax, ymax},
{xmax, ymin},
}
poly := da.ClipPolygonY(pts)
da.FillPolygon(b.Color, poly)
pts = append(pts, plot.Pt(xmin, ymin))
outline := da.ClipLinesY(pts)
da.StrokeLines(b.LineStyle, outline...)
}
}
示例3: Plot
func (b HorizBoxPlot) Plot(da plot.DrawArea, plt *plot.Plot) {
trX, trY := plt.Transforms(&da)
y := trY(b.Location)
if !da.ContainsY(y) {
return
}
y += b.Offset
med := trX(b.Median)
q1 := trX(b.Quartile1)
q3 := trX(b.Quartile3)
aLow := trX(b.AdjLow)
aHigh := trX(b.AdjHigh)
box := da.ClipLinesX([]plot.Point{
{q1, y - b.Width/2},
{q3, y - b.Width/2},
{q3, y + b.Width/2},
{q1, y + b.Width/2},
{q1, y - b.Width/2 - b.BoxStyle.Width/2},
})
da.StrokeLines(b.BoxStyle, box...)
medLine := da.ClipLinesX([]plot.Point{
{med, y - b.Width/2},
{med, y + b.Width/2},
})
da.StrokeLines(b.MedianStyle, medLine...)
cap := b.CapWidth / 2
whisks := da.ClipLinesX([]plot.Point{{q3, y}, {aHigh, y}},
[]plot.Point{{aHigh, y - cap}, {aHigh, y + cap}},
[]plot.Point{{q1, y}, {aLow, y}},
[]plot.Point{{aLow, y - cap}, {aLow, y + cap}})
da.StrokeLines(b.WhiskerStyle, whisks...)
for _, out := range b.Outside {
x := trX(b.Value(out))
if da.ContainsX(x) {
da.DrawGlyphNoClip(b.GlyphStyle, plot.Pt(x, y))
}
}
}