Esempio n. 1
0
// DrawGlyph implements the GlyphDrawer interface.
func (c CircleGlyph) DrawGlyph(da *DrawArea, sty GlyphStyle, pt Point) {
	var p vg.Path
	p.Move(pt.X+sty.Radius, pt.Y)
	p.Arc(pt.X, pt.Y, sty.Radius, 0, 2*math.Pi)
	p.Close()
	da.Fill(p)
}
Esempio n. 2
0
// DrawGlyph implements the Glyph interface.
func (RingGlyph) DrawGlyph(da *DrawArea, sty GlyphStyle, pt Point) {
	da.SetLineStyle(LineStyle{Color: sty.Color, Width: vg.Points(0.5)})
	var p vg.Path
	p.Move(pt.X+sty.Radius, pt.Y)
	p.Arc(pt.X, pt.Y, sty.Radius, 0, 2*math.Pi)
	p.Close()
	da.Stroke(p)
}
Esempio n. 3
0
// Plot implements the Plot method of the plot.Plotter interface.
func (bs *Bubbles) Plot(da plot.DrawArea, plt *plot.Plot) {
	trX, trY := plt.Transforms(&da)

	da.SetColor(bs.Color)

	for _, d := range bs.XYZs {
		x := trX(d.X)
		y := trY(d.Y)
		if !da.Contains(plot.Pt(x, y)) {
			continue
		}

		rad := bs.radius(d.Z)

		// draw a circle centered at x, y
		var p vg.Path
		p.Move(x+rad, y)
		p.Arc(x, y, rad, 0, 2*math.Pi)
		p.Close()
		da.Fill(p)
	}
}