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"
|
|
|
|
|
2017-04-28 19:07:36 -04:00
|
|
|
// ValuesProvider is a type that produces values.
|
|
|
|
type ValuesProvider interface {
|
2016-07-10 04:11:47 -04:00
|
|
|
Len() int
|
2017-04-28 19:07:36 -04:00
|
|
|
GetValues(index int) (float64, float64)
|
2016-07-10 04:11:47 -04:00
|
|
|
}
|
2016-07-15 12:02:50 -04:00
|
|
|
|
2017-04-28 19:07:36 -04:00
|
|
|
// BoundedValuesProvider allows series to return a range.
|
|
|
|
type BoundedValuesProvider interface {
|
2016-07-15 12:02:50 -04:00
|
|
|
Len() int
|
2017-04-28 19:07:36 -04:00
|
|
|
GetBoundedValues(index int) (x, y1, y2 float64)
|
2016-07-15 12:02:50 -04:00
|
|
|
}
|
2016-07-18 15:57:10 -04:00
|
|
|
|
2017-04-28 19:07:36 -04: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)
|
2016-07-18 15:57:10 -04:00
|
|
|
}
|
|
|
|
|
2017-04-28 19:07:36 -04:00
|
|
|
// 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 15:57:10 -04:00
|
|
|
}
|
2016-07-18 17:53:29 -04:00
|
|
|
|
2017-04-28 19:07:36 -04:00
|
|
|
// FullValuesProvider is an interface that combines `ValuesProvider` and `LastValuesProvider`
|
|
|
|
type FullValuesProvider interface {
|
|
|
|
ValuesProvider
|
|
|
|
LastValuesProvider
|
2016-07-18 17:53:29 -04:00
|
|
|
}
|
|
|
|
|
2017-04-28 19:07:36 -04:00
|
|
|
// FullBoundedValuesProvider is an interface that combines `BoundedValuesProvider` and `BoundedLastValuesProvider`
|
|
|
|
type FullBoundedValuesProvider interface {
|
|
|
|
BoundedValuesProvider
|
|
|
|
BoundedLastValuesProvider
|
2016-07-18 17:53:29 -04:00
|
|
|
}
|
2017-04-14 20:43:52 -04:00
|
|
|
|
|
|
|
// SizeProvider is a provider for integer size.
|
2017-04-19 18:27:31 -04:00
|
|
|
type SizeProvider func(xrange, yrange Range, index int, x, y float64) float64
|
2017-04-14 20:43:52 -04:00
|
|
|
|
2017-04-17 19:21:02 -04: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-19 18:27:31 -04:00
|
|
|
type DotColorProvider func(xrange, yrange Range, index int, x, y float64) drawing.Color
|