sparkchart.go
func (b *SparkChart) AddData(val float64) {
	b.mtx.Lock()
	defer b.mtx.Unlock()

	b.data = append(b.data, val)

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

	b.data = append(b.data, val)

	_, width := b.calculateBarArea()
	if len(b.data) > width {
		b.data = b.data[len(b.data)-width:]
	}
}
func ( b * SparkChart ) AddData ( val float64 ) { b . mtx . Lock ( ) defer b . mtx . Unlock ( ) b . data = append ( b . data , val ) _ , width := b . calculateBarArea ( ) if len ( b . data ) > width { b . data = b . data [ len ( b . data ) - width : ] } }
// AddData appends a new bar to a chart
AddData appends a new bar to a chart