diff --git a/_examples/scatter/main.go b/_examples/scatter/main.go index de8ef3a..4347868 100644 --- a/_examples/scatter/main.go +++ b/_examples/scatter/main.go @@ -12,7 +12,7 @@ import ( func drawChart(res http.ResponseWriter, req *http.Request) { - viridisByY := func(xr, yr chart.Range, x, y float64) drawing.Color { + viridisByY := func(xr, yr chart.Range, index int, x, y float64) drawing.Color { return chart.Viridis(y, yr.GetMin(), yr.GetMax()) } diff --git a/draw.go b/draw.go index 3f06cde..3185086 100644 --- a/draw.go +++ b/draw.go @@ -66,11 +66,11 @@ func (d draw) LineSeries(r Renderer, canvasBox Box, xrange, yrange Range, style dotWidth := defaultDotWidth if style.DotWidthProvider != nil { - dotWidth = style.DotWidthProvider(xrange, yrange, vx, vy) + dotWidth = style.DotWidthProvider(xrange, yrange, i, vx, vy) } if style.DotColorProvider != nil { - dotColor := style.DotColorProvider(xrange, yrange, vx, vy) + dotColor := style.DotColorProvider(xrange, yrange, i, vx, vy) r.SetFillColor(dotColor) r.SetStrokeColor(dotColor) diff --git a/value_provider.go b/value_provider.go index 030e802..f6e7824 100644 --- a/value_provider.go +++ b/value_provider.go @@ -37,10 +37,10 @@ type FullBoundedValueProvider interface { } // SizeProvider is a provider for integer size. -type SizeProvider func(xrange, yrange Range, x, y float64) float64 +type SizeProvider func(xrange, yrange Range, index int, x, y float64) float64 // ColorProvider is a general provider for color ranges based on values. type ColorProvider func(v, vmin, vmax float64) drawing.Color // DotColorProvider is a provider for dot color. -type DotColorProvider func(xrange, yrange Range, x, y float64) drawing.Color +type DotColorProvider func(xrange, yrange Range, index int, x, y float64) drawing.Color