本文整理汇总了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})
}
}