func (s *SparklineGroup) Draw(buf *ui.Buffer) {
	s.Block.Draw(buf)
	sparklineHeight := s.Inner.Dy() / len(s.Sparklines)
	for i, sl := range s.Sparklines {
		heightOffset := (sparklineHeight * (i + 1))
		barHeight := sparklineHeight
		if i == len(s.Sparklines)-1 {
			heightOffset = s.Inner.Dy()
			barHeight = s.Inner.Dy() - (sparklineHeight * i)
		}
		if sl.Title != "" {
			barHeight--
		}
		maxVal := sl.MaxVal
		if maxVal == 0 {
			maxVal, _ = ui.GetMaxFloat64FromSlice(sl.Data)
		}
		if sl.Reverse {
			heightOffset -= sparklineHeight
		}
		index := len(sl.Data) - 1
		for j := s.Inner.Dx() - 1; index >= 0 && j >= 0; j-- {
			data := sl.Data[index]
			index--
			height := int((data / maxVal) * float64(barHeight))
			sparkChar := ui.BARS[len(ui.BARS)-1]
			for k := 0; k < height; k++ {
				yBarCoord := s.Inner.Min.Y - 1 + heightOffset - k
				if sl.Reverse {
					yBarCoord = s.Inner.Min.Y - 1 + heightOffset + k
				}
				buf.SetCell(
					ui.NewCell(sparkChar, ui.NewStyle(sl.LineColor)),
					image.Pt(j+s.Inner.Min.X, yBarCoord),
				)
			}
			if height == 0 {
				if sl.Reverse {
					sparkChar = ui.IRREGULAR_BLOCKS[3]
				} else {
					sparkChar = ui.IRREGULAR_BLOCKS[12]
				}
				buf.SetCell(
					ui.NewCell(sparkChar, ui.NewStyle(sl.LineColor)),
					image.Pt(j+s.Inner.Min.X, s.Inner.Min.Y-1+heightOffset),
				)
			}
		}
		if sl.Title != "" {
			yTitleCoord := s.Inner.Min.Y - 1 + heightOffset - barHeight
			if sl.Reverse {
				yTitleCoord = s.Inner.Min.Y - 1 + heightOffset + sparklineHeight
			}
			buf.SetString(
				ui.TrimString(sl.Title, s.Inner.Dx()),
				sl.TitleStyle,
				image.Pt(s.Inner.Min.X, yTitleCoord),
			)
		}
	}
}
Draw helps draw the Sparkline widget onto the UI buffer
package utils
import (
	"image"
	ui "github.com/gizak/termui/v3"
)
type Sparkline struct {
	Data       []float64
	Title      string
	TitleStyle ui.Style
	LineColor  ui.Color
	MaxVal     float64
	MaxHeight  int  
	Reverse    bool
}
type SparklineGroup struct {
	*ui.Block
	Sparklines []*Sparkline
}
func NewSparkline() *Sparkline {
	return &Sparkline{
		TitleStyle: ui.Theme.Sparkline.Title,
		LineColor:  ui.Theme.Sparkline.Line,
		Reverse:    false,
	}
}
func NewSparklineGroup(sls ...*Sparkline) *SparklineGroup {
	return &SparklineGroup{
		Block:      ui.NewBlock(),
		Sparklines: sls,
	}
}