2016-07-10 04:11:47 -04:00
|
|
|
package chart
|
|
|
|
|
2017-04-14 20:43:52 -04:00
|
|
|
import "github.com/wcharczuk/go-chart/drawing"
|
|
|
|
|
2016-07-10 04:11:47 -04:00
|
|
|
// ValueProvider is a type that produces values.
|
|
|
|
type ValueProvider interface {
|
|
|
|
Len() int
|
|
|
|
GetValue(index int) (float64, float64)
|
|
|
|
}
|
2016-07-15 12:02:50 -04:00
|
|
|
|
|
|
|
// BoundedValueProvider allows series to return a range.
|
|
|
|
type BoundedValueProvider interface {
|
|
|
|
Len() int
|
|
|
|
GetBoundedValue(index int) (x, y1, y2 float64)
|
|
|
|
}
|
2016-07-18 15:57:10 -04:00
|
|
|
|
|
|
|
// 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-18 18:44:22 -04:00
|
|
|
GetBoundedLastValue() (x, y1, y2 float64)
|
2016-07-18 15:57:10 -04:00
|
|
|
}
|
2016-07-18 17:53:29 -04:00
|
|
|
|
|
|
|
// FullValueProvider is an interface that combines `ValueProvider` and `LastValueProvider`
|
|
|
|
type FullValueProvider interface {
|
|
|
|
ValueProvider
|
|
|
|
LastValueProvider
|
|
|
|
}
|
|
|
|
|
2016-07-18 17:54:03 -04:00
|
|
|
// FullBoundedValueProvider is an interface that combines `BoundedValueProvider` and `BoundedLastValueProvider`
|
2016-07-18 17:53:29 -04:00
|
|
|
type FullBoundedValueProvider interface {
|
2016-07-18 17:53:45 -04:00
|
|
|
BoundedValueProvider
|
|
|
|
BoundedLastValueProvider
|
2016-07-18 17:53:29 -04:00
|
|
|
}
|
2017-04-14 20:43:52 -04:00
|
|
|
|
|
|
|
// SizeProvider is a provider for integer size.
|
|
|
|
type SizeProvider func(rx, ry, x, y float64) float64
|
|
|
|
|
|
|
|
// ColorProvider is a provider for dot size.
|
|
|
|
type ColorProvider func(rx, ry, x, y float64) drawing.Color
|