Beispiel #1
0
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...)
}
Beispiel #2
0
// Thumbnail draws a line in the given style down the
// center of a DrawArea as a thumbnail representation
// of the LineStyle of the function.
func (f Function) Thumbnail(da *plot.DrawArea) {
	y := da.Center().Y
	da.StrokeLine2(f.LineStyle, da.Min.X, y, da.Max().X, y)
}
Beispiel #3
0
// Thumbnail the thumbnail for the Line,
// implementing the plot.Thumbnailer interface.
func (pts *Line) Thumbnail(da *plot.DrawArea) {
	y := da.Center().Y
	da.StrokeLine2(pts.LineStyle, da.Min.X, y, da.Max().X, y)
}