feat: support null value for line chart

This commit is contained in:
vicanso 2022-09-15 20:09:00 +08:00
parent bb9af986be
commit 50605907c7
5 changed files with 32 additions and 2 deletions

View file

@ -438,11 +438,18 @@ func (p *Painter) MeasureTextMaxWidthHeight(textList []string) (int, int) {
}
func (p *Painter) LineStroke(points []Point) *Painter {
shouldMoveTo := false
for index, point := range points {
x := point.X
y := point.Y
if index == 0 {
if y == math.MaxInt {
p.Stroke()
shouldMoveTo = true
continue
}
if shouldMoveTo || index == 0 {
p.MoveTo(x, y)
shouldMoveTo = false
} else {
p.LineTo(x, y)
}