本文整理匯總了Golang中github.com/vron/plotinum/plot.DrawArea.ClipLinesY方法的典型用法代碼示例。如果您正苦於以下問題:Golang DrawArea.ClipLinesY方法的具體用法?Golang DrawArea.ClipLinesY怎麽用?Golang DrawArea.ClipLinesY使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/vron/plotinum/plot.DrawArea
的用法示例。
在下文中一共展示了DrawArea.ClipLinesY方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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
// Plot implements the Plotter interface, drawing labels.
func (e *YErrorBars) Plot(da plot.DrawArea, p *plot.Plot) {
trX, trY := p.Transforms(&da)
for i, err := range e.YErrors {
x := trX(e.XYs[i].X)
ylow := trY(e.XYs[i].Y - err.Low)
yhigh := trY(e.XYs[i].Y + err.High)
bar := da.ClipLinesY([]plot.Point{{x, ylow}, {x, yhigh}})
da.StrokeLines(e.LineStyle, bar...)
e.drawCap(&da, x, ylow)
e.drawCap(&da, x, yhigh)
}
}
示例3: Thumbnail
func (b *BarChart) Thumbnail(da *plot.DrawArea) {
pts := []plot.Point{
{da.Min.X, da.Min.Y},
{da.Min.X, da.Max().Y},
{da.Max().X, da.Max().Y},
{da.Max().X, da.Min.Y},
}
poly := da.ClipPolygonY(pts)
da.FillPolygon(b.Color, poly)
pts = append(pts, plot.Point{da.Min.X, da.Min.Y})
outline := da.ClipLinesY(pts)
da.StrokeLines(b.LineStyle, outline...)
}
示例4: 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})
}
}