mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
TimeSeries: Fix stacking opacity accumulation on exit from PanelEdit (#80006)
This commit is contained in:
@@ -379,8 +379,6 @@ describe('UPlotConfigBuilder', () => {
|
|||||||
max: 100,
|
max: 100,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(builder.getConfig().scales!['scale-y']!.auto).toEqual(false);
|
|
||||||
|
|
||||||
builder.addScale({
|
builder.addScale({
|
||||||
isTime: false,
|
isTime: false,
|
||||||
scaleKey: 'scale-y2',
|
scaleKey: 'scale-y2',
|
||||||
@@ -391,6 +389,7 @@ describe('UPlotConfigBuilder', () => {
|
|||||||
softMin: -50,
|
softMin: -50,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
expect(builder.getConfig().scales!['scale-y']!.auto).toEqual(false);
|
||||||
expect(builder.getConfig().scales!['scale-y2']!.auto).toEqual(true);
|
expect(builder.getConfig().scales!['scale-y2']!.auto).toEqual(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ export class UPlotConfigBuilder {
|
|||||||
private tooltipInterpolator: PlotTooltipInterpolator | undefined = undefined;
|
private tooltipInterpolator: PlotTooltipInterpolator | undefined = undefined;
|
||||||
private padding?: Padding = undefined;
|
private padding?: Padding = undefined;
|
||||||
|
|
||||||
|
private cachedConfig?: PlotConfig;
|
||||||
|
|
||||||
prepData: PrepData | undefined = undefined;
|
prepData: PrepData | undefined = undefined;
|
||||||
|
|
||||||
constructor(timeZone: TimeZone = DefaultTimeZone) {
|
constructor(timeZone: TimeZone = DefaultTimeZone) {
|
||||||
@@ -190,6 +192,10 @@ export class UPlotConfigBuilder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getConfig() {
|
getConfig() {
|
||||||
|
if (this.cachedConfig) {
|
||||||
|
return this.cachedConfig;
|
||||||
|
}
|
||||||
|
|
||||||
const config: PlotConfig = {
|
const config: PlotConfig = {
|
||||||
...DEFAULT_PLOT_CONFIG,
|
...DEFAULT_PLOT_CONFIG,
|
||||||
mode: this.mode,
|
mode: this.mode,
|
||||||
@@ -244,18 +250,18 @@ export class UPlotConfigBuilder {
|
|||||||
config.padding = this.padding;
|
config.padding = this.padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.stackingGroups.length) {
|
this.stackingGroups.forEach((group) => {
|
||||||
this.stackingGroups.forEach((group) => {
|
getStackingBands(group).forEach((band) => {
|
||||||
getStackingBands(group).forEach((band) => {
|
this.addBand(band);
|
||||||
this.addBand(band);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
|
||||||
if (this.bands.length) {
|
if (this.bands.length) {
|
||||||
config.bands = this.bands;
|
config.bands = this.bands;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.cachedConfig = config;
|
||||||
|
|
||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user