|
|
|
@ -40,7 +40,6 @@ export class UPlotConfigBuilder { |
|
|
|
|
private scales: UPlotScaleBuilder[] = []; |
|
|
|
|
private bands: Band[] = []; |
|
|
|
|
private cursor: Cursor | undefined; |
|
|
|
|
private isStacking = false; |
|
|
|
|
private select: uPlot.Select | undefined; |
|
|
|
|
private hasLeftAxis = false; |
|
|
|
|
private hooks: Hooks.Arrays = {}; |
|
|
|
@ -122,10 +121,6 @@ export class UPlotConfigBuilder { |
|
|
|
|
this.select = select; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setStacking(enabled = true) { |
|
|
|
|
this.isStacking = enabled; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
addSeries(props: SeriesProps) { |
|
|
|
|
this.series.push(new UPlotSeriesBuilder(props)); |
|
|
|
|
} |
|
|
|
@ -224,24 +219,8 @@ export class UPlotConfigBuilder { |
|
|
|
|
config.tzDate = this.tzDate; |
|
|
|
|
config.padding = this.padding; |
|
|
|
|
|
|
|
|
|
if (this.isStacking) { |
|
|
|
|
// Let uPlot handle bands and fills
|
|
|
|
|
if (this.bands.length) { |
|
|
|
|
config.bands = this.bands; |
|
|
|
|
} else { |
|
|
|
|
// When fillBelowTo option enabled, handle series bands fill manually
|
|
|
|
|
if (this.bands?.length) { |
|
|
|
|
config.bands = this.bands; |
|
|
|
|
const killFill = new Set<number>(); |
|
|
|
|
for (const b of config.bands) { |
|
|
|
|
killFill.add(b.series[1]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for (let i = 1; i < config.series.length; i++) { |
|
|
|
|
if (killFill.has(i)) { |
|
|
|
|
config.series[i].fill = undefined; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return config; |
|
|
|
|