Adds the ability to draw an XY scatter plot. (#27)
* works more or less * updating comment * removing debugging printf * adding output * tweaks * missed a couple series validations * testing auto coloring * updated output.png * color tests etc. * sanity check tests. * should not use unkeyed fields anyway.
This commit is contained in:
parent
17b28beae8
commit
b713ff85cc
22 changed files with 511 additions and 72 deletions
|
|
@ -50,7 +50,7 @@ func (sma SMASeries) GetPeriod(defaults ...int) int {
|
|||
|
||||
// GetValue gets a value at a given index.
|
||||
func (sma SMASeries) GetValue(index int) (x, y float64) {
|
||||
if sma.InnerSeries == nil {
|
||||
if sma.InnerSeries == nil || sma.InnerSeries.Len() == 0 {
|
||||
return
|
||||
}
|
||||
px, _ := sma.InnerSeries.GetValue(index)
|
||||
|
|
@ -62,7 +62,7 @@ func (sma SMASeries) GetValue(index int) (x, y float64) {
|
|||
// GetLastValue computes the last moving average value but walking back window size samples,
|
||||
// and recomputing the last moving average chunk.
|
||||
func (sma SMASeries) GetLastValue() (x, y float64) {
|
||||
if sma.InnerSeries == nil {
|
||||
if sma.InnerSeries == nil || sma.InnerSeries.Len() == 0 {
|
||||
return
|
||||
}
|
||||
seriesLen := sma.InnerSeries.Len()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue