refactor: add index to series

This commit is contained in:
vicanso 2022-02-03 08:45:55 +08:00
parent 5ccc497ad3
commit 445a781b04
2 changed files with 12 additions and 8 deletions

View file

@ -51,7 +51,11 @@ func lineChartRender(opt ChartOption, result *basicRenderResult) (*Draw, error)
Y: y,
X: xRange.getWidth(float64(j)),
})
seriesColor := theme.GetSeriesColor(i + result.seriesOffset)
index := series.index
if index == 0 {
index = i
}
seriesColor := theme.GetSeriesColor(index)
dotFillColor := drawing.ColorWhite
if theme.IsDark() {
dotFillColor = seriesColor