forked from wcharczuk/go-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
/
value_provider.go
51 lines (40 loc) · 1.69 KB
/
value_provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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)
}
// 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)
}
// 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