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"
2016-07-10 10:11:47 +02:00
// ValueProvider is a type that produces values.
type ValueProvider interface {
Len() int
GetValue(index int) (float64, float64)
}
2016-07-15 18:02:50 +02:00
// BoundedValueProvider allows series to return a range.
type BoundedValueProvider interface {
Len() int
GetBoundedValue(index int) (x, y1, y2 float64)
}
// LastValueProvider is a special type of value provider that can return it's (potentially computed) last value.
type LastValueProvider interface {
GetLastValue() (x, y float64)
}
// BoundedLastValueProvider is a special type of value provider that can return it's (potentially computed) bounded last value.
type BoundedLastValueProvider interface {
2016-07-19 00:44:22 +02:00
GetBoundedLastValue() (x, y1, y2 float64)
}
2016-07-18 23:53:29 +02:00
// FullValueProvider is an interface that combines `ValueProvider` and `LastValueProvider`
type FullValueProvider interface {
ValueProvider
LastValueProvider
}
2016-07-18 23:54:03 +02:00
// FullBoundedValueProvider is an interface that combines `BoundedValueProvider` and `BoundedLastValueProvider`
2016-07-18 23:53:29 +02:00
type FullBoundedValueProvider interface {
2016-07-18 23:53:45 +02:00
BoundedValueProvider
BoundedLastValueProvider
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