go-chart/value_provider.go

52 lines
1.7 KiB
Go
Raw Permalink Normal View History

2016-07-10 10:11:47 +02:00
package chart
import "git.fireandbrimst.one/aw/go-chart/drawing"
2017-04-15 02:43:52 +02:00
// ValuesProvider is a type that produces values.
type ValuesProvider interface {
2016-07-10 10:11:47 +02:00
Len() int
GetValues(index int) (float64, 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
}
2018-09-07 21:52:30 +02:00
// FirstValuesProvider is a special type of value provider that can return it's (potentially computed) first value.
type FirstValuesProvider interface {
GetFirstValues() (x, y float64)
}
// 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