mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
datatrails: throttle the resetting of yaxis (#85117)
fix: throttle the resetting of yaxis
This commit is contained in:
parent
7c03cc83c6
commit
2e06677240
@ -1,5 +1,5 @@
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
import { min, max, isNumber, debounce } from 'lodash';
|
import { min, max, isNumber, throttle } from 'lodash';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { DataFrame, FieldType, GrafanaTheme2, PanelData, SelectableValue } from '@grafana/data';
|
import { DataFrame, FieldType, GrafanaTheme2, PanelData, SelectableValue } from '@grafana/data';
|
||||||
@ -123,18 +123,22 @@ export class BreakdownScene extends SceneObjectBase<BreakdownSceneState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.breakdownPanelMaxValue === newMax && this.breakdownPanelMinValue === newMin) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.breakdownPanelMaxValue = newMax;
|
this.breakdownPanelMaxValue = newMax;
|
||||||
this.breakdownPanelMinValue = newMin;
|
this.breakdownPanelMinValue = newMin;
|
||||||
|
|
||||||
this._triggerAxisChangedEvent();
|
this._triggerAxisChangedEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _triggerAxisChangedEvent = debounce(() => {
|
private _triggerAxisChangedEvent = throttle(() => {
|
||||||
const { breakdownPanelMinValue, breakdownPanelMaxValue } = this;
|
const { breakdownPanelMinValue, breakdownPanelMaxValue } = this;
|
||||||
if (breakdownPanelMinValue !== undefined && breakdownPanelMaxValue !== undefined) {
|
if (breakdownPanelMinValue !== undefined && breakdownPanelMaxValue !== undefined) {
|
||||||
this.publishEvent(new BreakdownAxisChangeEvent({ min: breakdownPanelMinValue, max: breakdownPanelMaxValue }));
|
this.publishEvent(new BreakdownAxisChangeEvent({ min: breakdownPanelMinValue, max: breakdownPanelMaxValue }));
|
||||||
}
|
}
|
||||||
}, 0);
|
}, 1000);
|
||||||
|
|
||||||
private clearBreakdownPanelAxisValues() {
|
private clearBreakdownPanelAxisValues() {
|
||||||
this.breakdownPanelMaxValue = undefined;
|
this.breakdownPanelMaxValue = undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user