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,
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user