本文整理匯總了Golang中github.com/vron/plotinum/plot.DrawArea.ContainsX方法的典型用法代碼示例。如果您正苦於以下問題:Golang DrawArea.ContainsX方法的具體用法?Golang DrawArea.ContainsX怎麽用?Golang DrawArea.ContainsX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/vron/plotinum/plot.DrawArea
的用法示例。
在下文中一共展示了DrawArea.ContainsX方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: 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.Point{xmin, ymin})
outline := da.ClipLinesY(pts)
da.StrokeLines(b.LineStyle, outline...)
}
}
示例2: Plot
func (b *BoxPlot) Plot(da plot.DrawArea, plt *plot.Plot) {
trX, trY := plt.Transforms(&da)
x := trX(b.Location)
if !da.ContainsX(x) {
return
}
med := trY(b.Median)
q1 := trY(b.Quartile1)
q3 := trY(b.Quartile3)
aLow := trY(b.AdjLow)
aHigh := trY(b.AdjHigh)
box := da.ClipLinesY([]plot.Point{
{x - b.Width/2, q1},
{x - b.Width/2, q3},
{x + b.Width/2, q3},
{x + b.Width/2, q1},
{x - b.Width/2 - b.BoxStyle.Width/2, q1},
})
da.StrokeLines(b.BoxStyle, box...)
medLine := da.ClipLinesY([]plot.Point{
{x - b.Width/2, med},
{x + b.Width/2, med},
})
da.StrokeLines(b.MedianStyle, medLine...)
cap := b.CapWidth / 2
whisks := da.ClipLinesY([]plot.Point{{x, q3}, {x, aHigh}},
[]plot.Point{{x - cap, aHigh}, {x + cap, aHigh}},
[]plot.Point{{x, q1}, {x, aLow}},
[]plot.Point{{x - cap, aLow}, {x + cap, aLow}})
da.StrokeLines(b.WhiskerStyle, whisks...)
for _, out := range b.Outside {
y := trY(b.Value(out))
da.DrawGlyph(b.GlyphStyle, plot.Point{x, y})
}
}