From 7b5bb6e952ce4c38c09067fc937a0d2ad6e2be2b Mon Sep 17 00:00:00 2001 From: Will Charczuk Date: Sat, 30 Jul 2016 23:14:19 -0700 Subject: [PATCH] changing how `Draw.LineSeries` handles the 0 line --- draw.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/draw.go b/draw.go index 890fad4..25ca38c 100644 --- a/draw.go +++ b/draw.go @@ -22,12 +22,14 @@ func (d draw) LineSeries(r Renderer, canvasBox Box, xrange, yrange Range, style x0 := cl + xrange.Translate(v0x) y0 := cb - yrange.Translate(v0y) + yv0 := yrange.Translate(0) + var vx, vy float64 var x, y int fill := style.GetFillColor() if !fill.IsZero() { - r.SetFillColor(fill) + style.GetFillOptions().WriteToRenderer(r) r.MoveTo(x0, y0) for i := 1; i < vs.Len(); i++ { vx, vy = vs.GetValue(i) @@ -35,9 +37,9 @@ func (d draw) LineSeries(r Renderer, canvasBox Box, xrange, yrange Range, style y = cb - yrange.Translate(vy) r.LineTo(x, y) } - r.LineTo(x, cb) - r.LineTo(x0, cb) - r.Close() + r.LineTo(x, Math.MinInt(cb, cb-yv0)) + r.LineTo(x0, Math.MinInt(cb, cb-yv0)) + r.LineTo(x0, y0) r.Fill() }