go-chart/value_provider.go
Will Charczuk 03708a90ef Helper API refactor (#40)
* api cleaup

* updates

* wtf

* updates

* snapshot.

* tweaks

* snapshot

* api tweaks.

* updates

* updates

* updates

* changes.

* updates

* updates

* sequence => seq

* dont need to use curl, just using wget

* fixing examples
2017-05-12 17:12:23 -07:00

47 lines
1.5 KiB
Go

package chart
import "github.com/wcharczuk/go-chart/drawing"
// ValuesProvider is a type that produces values.
type ValuesProvider interface {
Len() int
GetValues(index int) (float64, float64)
}
// BoundedValuesProvider allows series to return a range.
type BoundedValuesProvider interface {
Len() int
GetBoundedValues(index int) (x, y1, y2 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)
}
// FullValuesProvider is an interface that combines `ValuesProvider` and `LastValuesProvider`
type FullValuesProvider interface {
ValuesProvider
LastValuesProvider
}
// FullBoundedValuesProvider is an interface that combines `BoundedValuesProvider` and `BoundedLastValuesProvider`
type FullBoundedValuesProvider interface {
BoundedValuesProvider
BoundedLastValuesProvider
}
// SizeProvider is a provider for integer size.
type SizeProvider func(xrange, yrange Range, index int, x, y float64) float64
// 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.
type DotColorProvider func(xrange, yrange Range, index int, x, y float64) drawing.Color