@grafana/data#PanelEvents TypeScript Examples
The following examples show how to use
@grafana/data#PanelEvents.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: graph.ts From grafana-chinese with Apache License 2.0 | 6 votes |
constructor(private scope: any, private elem: JQuery, private timeSrv: TimeSrv) {
this.ctrl = scope.ctrl;
this.contextMenu = scope.ctrl.contextMenuCtrl;
this.dashboard = this.ctrl.dashboard;
this.panel = this.ctrl.panel;
this.annotations = [];
this.panelWidth = 0;
this.eventManager = new EventManager(this.ctrl);
this.thresholdManager = new ThresholdManager(this.ctrl);
this.timeRegionManager = new TimeRegionManager(this.ctrl, config.theme.type);
// @ts-ignore
this.tooltip = new GraphTooltip(this.elem, this.ctrl.dashboard, this.scope, () => {
return this.sortedSeries;
});
// panel events
this.ctrl.events.on(PanelEvents.panelTeardown, this.onPanelTeardown.bind(this));
this.ctrl.events.on(PanelEvents.render, this.onRender.bind(this));
// global events
appEvents.on(CoreEvents.graphHover, this.onGraphHover.bind(this), scope);
appEvents.on(CoreEvents.graphHoverClear, this.onGraphHoverClear.bind(this), scope);
this.elem.bind('plotselected', this.onPlotSelected.bind(this));
this.elem.bind('plotclick', this.onPlotClick.bind(this));
// get graph legend element
if (this.elem && this.elem.parent) {
this.legendElem = this.elem.parent().find('.graph-legend')[0];
}
}