go-chart/value_provider.go

52 lines
1.7 KiB
Go
Raw Permalink Normal View History

2016-07-10 04:11:47 -04:00
package chart
2024-10-27 22:52:38 -04:00
import "git.smarteching.com/zeni/go-chart/v2/drawing"
2017-04-14 20:43:52 -04:00
// ValuesProvider is a type that produces values.
type ValuesProvider interface {
2016-07-10 04:11:47 -04:00
Len() int
GetValues(index int) (float64, float64)
2016-07-10 04:11:47 -04:00
}
2016-07-15 12:02:50 -04:00
// BoundedValuesProvider allows series to return a range.
type BoundedValuesProvider interface {
2016-07-15 12:02:50 -04:00
Len() int
GetBoundedValues(index int) (x, y1, y2 float64)
2016-07-15 12:02:50 -04:00
}
2018-09-07 15:52:30 -04: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 17:53:29 -04:00
// FullValuesProvider is an interface that combines `ValuesProvider` and `LastValuesProvider`
type FullValuesProvider interface {
ValuesProvider
LastValuesProvider
2016-07-18 17:53:29 -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
// 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