func (ts TimeSeries) Validate() error {
	if len(ts.XValues) == 0 {
		return fmt.Errorf("time series must have xvalues set")
	}
	if len(ts.YValues) == 0 {
		return fmt.Errorf("time series must have yvalues set")
	}
	return nil
}
Validate validates the series.
package chart
import (
	"fmt"
	"time"
)
var (
	_ Series                 = (*TimeSeries)(nil)
	_ FirstValuesProvider    = (*TimeSeries)(nil)
	_ LastValuesProvider     = (*TimeSeries)(nil)
	_ ValueFormatterProvider = (*TimeSeries)(nil)
)
type TimeSeries struct {
	Name  string
	Style Style
	YAxis YAxisType
	XValues []time.Time
	YValues []float64
}
func (ts TimeSeries) GetName() string {
	return ts.Name
}
func (ts TimeSeries) GetStyle() Style {
	return ts.Style
}
func (ts TimeSeries) Len() int {
	return len(ts.XValues)
}
func (ts TimeSeries) GetValues(index int) (x, y float64) {
	x = TimeToFloat64(ts.XValues[index])
	y = ts.YValues[index]
	return
}
func (ts TimeSeries) GetFirstValues() (x, y float64) {
	x = TimeToFloat64(ts.XValues[0])
	y = ts.YValues[0]
	return
}
func (ts TimeSeries) GetLastValues() (x, y float64) {
	x = TimeToFloat64(ts.XValues[len(ts.XValues)-1])
	y = ts.YValues[len(ts.YValues)-1]
	return
}
func (ts TimeSeries) GetValueFormatters() (x, y ValueFormatter) {
	x = TimeValueFormatter
	y = FloatValueFormatter
	return
}
func (ts TimeSeries) GetYAxis() YAxisType {
	return ts.YAxis
}
func (ts TimeSeries) Render(r Renderer, canvasBox Box, xrange, yrange Range, defaults Style) {
	style := ts.Style.InheritFrom(defaults)
	Draw.LineSeries(r, canvasBox, xrange, yrange, style, ts)
}