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

@ -10,7 +10,7 @@ type MinSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries ValueProvider
InnerSeries ValuesProvider
minValue *float64
}
@ -35,10 +35,10 @@ func (ms MinSeries) Len() int {
return ms.InnerSeries.Len()
}
// GetValue gets a value at a given index.
func (ms *MinSeries) GetValue(index int) (x, y float64) {
// GetValues gets a value at a given index.
func (ms *MinSeries) GetValues(index int) (x, y float64) {
ms.ensureMinValue()
x, _ = ms.InnerSeries.GetValue(index)
x, _ = ms.InnerSeries.GetValues(index)
y = *ms.minValue
return
}
@ -54,7 +54,7 @@ func (ms *MinSeries) ensureMinValue() {
minValue := math.MaxFloat64
var y float64
for x := 0; x < ms.InnerSeries.Len(); x++ {
_, y = ms.InnerSeries.GetValue(x)
_, y = ms.InnerSeries.GetValues(x)
if y < minValue {
minValue = y
}
@ -76,7 +76,7 @@ type MaxSeries struct {
Name string
Style Style
YAxis YAxisType
InnerSeries ValueProvider
InnerSeries ValuesProvider
maxValue *float64
}
@ -101,10 +101,10 @@ func (ms MaxSeries) Len() int {
return ms.InnerSeries.Len()
}
// GetValue gets a value at a given index.
func (ms *MaxSeries) GetValue(index int) (x, y float64) {
// GetValues gets a value at a given index.
func (ms *MaxSeries) GetValues(index int) (x, y float64) {
ms.ensureMaxValue()
x, _ = ms.InnerSeries.GetValue(index)
x, _ = ms.InnerSeries.GetValues(index)
y = *ms.maxValue
return
}
@ -120,7 +120,7 @@ func (ms *MaxSeries) ensureMaxValue() {
maxValue := -math.MaxFloat64
var y float64
for x := 0; x < ms.InnerSeries.Len(); x++ {
_, y = ms.InnerSeries.GetValue(x)
_, y = ms.InnerSeries.GetValues(x)
if y > maxValue {
maxValue = y
}