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
This commit is contained in:
Will Charczuk 2017-05-12 17:12:23 -07:00 committed by GitHub
parent 43212f871f
commit 03708a90ef
100 changed files with 1687 additions and 1055 deletions

View file

@ -3,6 +3,8 @@ package chart
import (
"fmt"
"time"
util "github.com/wcharczuk/go-chart/util"
)
// TimeSeries is a line on a chart.
@ -31,16 +33,16 @@ func (ts TimeSeries) Len() int {
return len(ts.XValues)
}
// GetValue gets a value at a given index.
func (ts TimeSeries) GetValue(index int) (x, y float64) {
x = Time.ToFloat64(ts.XValues[index])
// GetValues gets a value at a given index.
func (ts TimeSeries) GetValues(index int) (x, y float64) {
x = util.Time.ToFloat64(ts.XValues[index])
y = ts.YValues[index]
return
}
// GetLastValue gets the last value.
func (ts TimeSeries) GetLastValue() (x, y float64) {
x = Time.ToFloat64(ts.XValues[len(ts.XValues)-1])
// GetLastValues gets the last value.
func (ts TimeSeries) GetLastValues() (x, y float64) {
x = util.Time.ToFloat64(ts.XValues[len(ts.XValues)-1])
y = ts.YValues[len(ts.YValues)-1]
return
}