go-chart/value_provider.go

47 lines
1.5 KiB
Go
Raw Normal View History

2016-07-10 10:11:47 +02:00
package chart
2017-04-15 02:43:52 +02:00
import "github.com/wcharczuk/go-chart/drawing"
// ValuesProvider is a type that produces values.
type ValuesProvider interface {
2016-07-10 10:11:47 +02:00
Len() int
2017-05-15 01:33:48 +02:00
GetValues(index int) (x float64, y float64)
2016-07-10 10:11:47 +02:00
}
2016-07-15 18:02:50 +02:00
// BoundedValuesProvider allows series to return a range.
type BoundedValuesProvider interface {
2016-07-15 18:02:50 +02:00
Len() int
GetBoundedValues(index int) (x, y1, y2 float64)
2016-07-15 18:02:50 +02:00
}
// LastValuesProvider is a special type of value provider that can return it's (potentially computed) last value.
type LastValuesProvider interface {
GetLastValues() (x, y float64)
}
// BoundedLastValuesProvider is a special type of value provider that can return it's (potentially computed) bounded last value.
type BoundedLastValuesProvider interface {
GetBoundedLastValues() (x, y1, y2 float64)
}
2016-07-18 23:53:29 +02:00
// FullValuesProvider is an interface that combines `ValuesProvider` and `LastValuesProvider`
type FullValuesProvider interface {
ValuesProvider
LastValuesProvider
2016-07-18 23:53:29 +02:00
}
// FullBoundedValuesProvider is an interface that combines `BoundedValuesProvider` and `BoundedLastValuesProvider`
type FullBoundedValuesProvider interface {
BoundedValuesProvider
BoundedLastValuesProvider
2016-07-18 23:53:29 +02:00
}
2017-04-15 02:43:52 +02:00
// SizeProvider is a provider for integer size.
2017-04-20 00:27:31 +02:00
type SizeProvider func(xrange, yrange Range, index int, x, y float64) float64
2017-04-15 02:43:52 +02:00
// 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.
2017-04-20 00:27:31 +02:00
type DotColorProvider func(xrange, yrange Range, index int, x, y float64) drawing.Color