TimeSeries: Fix stacking opacity accumulation on exit from PanelEdit (#80006)

This commit is contained in:
Leon Sorokin
2024-01-03 22:56:03 -06:00
committed by GitHub
parent dd77ff6bcd
commit 7210e378b8
2 changed files with 13 additions and 8 deletions

View File

@@ -379,8 +379,6 @@ describe('UPlotConfigBuilder', () => {
max: 100,
});
expect(builder.getConfig().scales!['scale-y']!.auto).toEqual(false);
builder.addScale({
isTime: false,
scaleKey: 'scale-y2',
@@ -391,6 +389,7 @@ describe('UPlotConfigBuilder', () => {
softMin: -50,
});
expect(builder.getConfig().scales!['scale-y']!.auto).toEqual(false);
expect(builder.getConfig().scales!['scale-y2']!.auto).toEqual(true);
});

View File

@@ -58,6 +58,8 @@ export class UPlotConfigBuilder {
private tooltipInterpolator: PlotTooltipInterpolator | undefined = undefined;
private padding?: Padding = undefined;
private cachedConfig?: PlotConfig;
prepData: PrepData | undefined = undefined;
constructor(timeZone: TimeZone = DefaultTimeZone) {
@@ -190,6 +192,10 @@ export class UPlotConfigBuilder {
}
getConfig() {
if (this.cachedConfig) {
return this.cachedConfig;
}
const config: PlotConfig = {
...DEFAULT_PLOT_CONFIG,
mode: this.mode,
@@ -244,18 +250,18 @@ export class UPlotConfigBuilder {
config.padding = this.padding;
}
if (this.stackingGroups.length) {
this.stackingGroups.forEach((group) => {
getStackingBands(group).forEach((band) => {
this.addBand(band);
});
this.stackingGroups.forEach((group) => {
getStackingBands(group).forEach((band) => {
this.addBand(band);
});
}
});
if (this.bands.length) {
config.bands = this.bands;
}
this.cachedConfig = config;
return config;
}