本文整理汇总了Golang中github.com/Tradnaiofh/plotinum/plot.DrawArea.FillPolygon方法的典型用法代码示例。如果您正苦于以下问题:Golang DrawArea.FillPolygon方法的具体用法?Golang DrawArea.FillPolygon怎么用?Golang DrawArea.FillPolygon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/Tradnaiofh/plotinum/plot.DrawArea
的用法示例。
在下文中一共展示了DrawArea.FillPolygon方法的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.Pt(xmin, ymin))
outline := da.ClipLinesY(pts)
da.StrokeLines(b.LineStyle, outline...)
}
}
示例2: 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.Pt(da.Min.X, da.Min.Y))
outline := da.ClipLinesY(pts)
da.StrokeLines(b.LineStyle, outline...)
}
示例3: Plot
// Plot implements the Plotter interface, drawing a line
// that connects each point in the Line.
func (h *Histogram) Plot(da plot.DrawArea, p *plot.Plot) {
trX, trY := p.Transforms(&da)
for _, bin := range h.Bins {
pts := []plot.Point{
{trX(bin.Min), trY(0)},
{trX(bin.Max), trY(0)},
{trX(bin.Max), trY(bin.Weight)},
{trX(bin.Min), trY(bin.Weight)},
}
if h.FillColor != nil {
da.FillPolygon(h.FillColor, da.ClipPolygonXY(pts))
}
pts = append(pts, plot.Pt(trX(bin.Min), trY(0)))
da.StrokeLines(h.LineStyle, da.ClipLinesXY(pts)...)
}
}
示例4: Thumbnail
// Thumbnail the thumbnail for the Line,
// implementing the plot.Thumbnailer interface.
func (pts *Line) Thumbnail(da *plot.DrawArea) {
if pts.ShadeColor != nil {
points := []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(points)
da.FillPolygon(*pts.ShadeColor, poly)
points = append(points, plot.Pt(da.Min.X, da.Min.Y))
} else {
y := da.Center().Y
da.StrokeLine2(pts.LineStyle, da.Min.X, y, da.Max().X, y)
}
}