sparkchart.go
func (b *SparkChart) SetData(data []float64) {
	b.mtx.Lock()
	defer b.mtx.Unlock()

	b.data = make([]float64, len(data))
	copy(b.data, data)

	_, width := b.calculateBarArea()
	if len(b.data) > width {
		b.data = b.data[len(b.data)-width:]
	}
}
func (b *SparkChart) SetData(data []float64) {
	b.mtx.Lock()
	defer b.mtx.Unlock()

	b.data = make([]float64, len(data))
	copy(b.data, data)

	_, width := b.calculateBarArea()
	if len(b.data) > width {
		b.data = b.data[len(b.data)-width:]
	}
}
func ( b * SparkChart ) SetData ( data [ ] float64 ) { b . mtx . Lock ( ) defer b . mtx . Unlock ( ) b . data = make ( [ ] float64 , len ( data ) ) copy ( b . data , data ) _ , width := b . calculateBarArea ( ) if len ( b . data ) > width { b . data = b . data [ len ( b . data ) - width : ] } }
// SetData assign a new bar list to a chart
SetData assign a new bar list to a chart