parameterize by index.
This commit is contained in:
parent
cee1a66a50
commit
0cbbd0887a
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
4
draw.go
4
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)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user