diff --git a/frontend/src/app/models/ChartSelectionManager.ts b/frontend/src/app/models/ChartSelectionManager.ts index 504d9673f..2bd34d692 100644 --- a/frontend/src/app/models/ChartSelectionManager.ts +++ b/frontend/src/app/models/ChartSelectionManager.ts @@ -27,6 +27,9 @@ export class ChartSelectionManager { private _selectedItems: Array = []; private _multipleSelect: boolean = false; private _clickCallbacks: Function[] = []; + private windowKeyEventHandlerRef: (this: Window, ev: KeyboardEvent) => any = this.windowKeyEventHandler.bind(this) + private zRenderMouseEventHandlerRef: (this: Window, ev: KeyboardEvent) => any = this.zRenderMouseEventHandler.bind(this) + constructor(events?: ChartMouseEvent[]) { this._clickCallbacks = @@ -46,24 +49,24 @@ export class ChartSelectionManager { } public attachWindowListeners(window: Window) { - window?.addEventListener('keydown', this.windowKeyEventHandler.bind(this)); - window?.addEventListener('keyup', this.windowKeyEventHandler.bind(this)); + window?.addEventListener('keydown', this.windowKeyEventHandlerRef); + window?.addEventListener('keyup', this.windowKeyEventHandlerRef); } public removeWindowListeners(window: Window) { window?.removeEventListener( 'keydown', - this.windowKeyEventHandler.bind(this), + this.windowKeyEventHandlerRef, ); - window?.removeEventListener('keyup', this.windowKeyEventHandler.bind(this)); + window?.removeEventListener('keyup', this.windowKeyEventHandlerRef); } public attachZRenderListeners(chart: EChartsType) { - chart?.getZr().on('click', this.zRenderMouseEventHandler.bind(this)); + chart?.getZr().on('click', this.zRenderMouseEventHandlerRef); } public removeZRenderListeners(chart: EChartsType) { - chart?.getZr().off('click', this.zRenderMouseEventHandler.bind(this)); + chart?.getZr().off('click', this.zRenderMouseEventHandlerRef); } public attachEChartsListeners(chart: EChartsType) { diff --git a/frontend/src/app/pages/DashBoardPage/utils/widget.ts b/frontend/src/app/pages/DashBoardPage/utils/widget.ts index 4a46330ba..5539487f4 100644 --- a/frontend/src/app/pages/DashBoardPage/utils/widget.ts +++ b/frontend/src/app/pages/DashBoardPage/utils/widget.ts @@ -591,7 +591,7 @@ export const getWidgetMap = ( ) { content.config.controllerDate.startTime.exactValue = _value?.[0]; - content.config.controllerDate.endTime.exactValue = _value?.[0]; + content.config.controllerDate.endTime.exactValue = _value?.[1] ?? _value?.[0]; } break; @@ -600,7 +600,7 @@ export const getWidgetMap = ( ...(content.config.controllerDate as any), startTime: { relativeOrExact: TimeFilterValueCategory.Exact, - exactValue: formatTime(_value as any, TIME_FORMATTER), + exactValue: formatTime(_value?.[0] as any, TIME_FORMATTER), }, }; break;