adding lastvalueprovider interface and relevant methods.

This commit is contained in:
Will Charczuk 2016-07-18 12:57:10 -07:00
parent c14ab6a4b2
commit 2603c67e10
5 changed files with 27 additions and 5 deletions

View file

@ -29,12 +29,19 @@ func (ts TimeSeries) Len() int {
}
// GetValue gets a value at a given index.
func (ts TimeSeries) GetValue(index int) (x float64, y float64) {
func (ts TimeSeries) GetValue(index int) (x, y float64) {
x = TimeToFloat64(ts.XValues[index])
y = ts.YValues[index]
return
}
// GetLastValue gets the last value.
func (ts TimeSeries) GetLastValue() (x, y float64) {
x = TimeToFloat64(ts.XValues[len(ts.XValues)-1])
y = ts.YValues[len(ts.YValues)-1]
return
}
// GetValueFormatters returns value formatter defaults for the series.
func (ts TimeSeries) GetValueFormatters() (x, y ValueFormatter) {
x = TimeValueFormatter