Ejemplo n.º 1
0
func (pts *VerticalLine) Plot(da plot.DrawArea, plt *plot.Plot) {
	trX, _ := plt.Transforms(&da)
	ps := make([]plot.Point, 2)
	ps[0].X = trX(pts.X)
	ps[1].X = ps[0].X

	ps[0].Y = da.Min.Y
	ps[1].Y = da.Max().Y

	da.StrokeLines(pts.LineStyle, da.ClipLinesXY(ps)...)
}
Ejemplo n.º 2
0
func (pts *HorizontalLine) Plot(da plot.DrawArea, plt *plot.Plot) {
	_, trY := plt.Transforms(&da)
	ps := make([]plot.Point, 2)

	ps[0].X = da.Min.X
	ps[1].X = da.Max().X

	ps[0].Y = trY(pts.Y)
	ps[1].Y = ps[0].Y

	da.StrokeLines(pts.LineStyle, da.ClipLinesXY(ps)...)
}
Ejemplo n.º 3
0
// 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)
	}
}
Ejemplo n.º 4
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.Pt(da.Min.X, da.Min.Y))
	outline := da.ClipLinesY(pts)
	da.StrokeLines(b.LineStyle, outline...)
}
Ejemplo n.º 5
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)
}
Ejemplo n.º 6
0
func (l *LineThumbnailer) Thumbnail(da *plot.DrawArea) {
	y := da.Center().Y
	da.StrokeLine2(l.LineStyle, da.Min.X, y, da.Max().X, y)
}
Ejemplo n.º 7
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)
}