Fix plotSelect for pie-flot

This commit is contained in:
Kalutka Zhenya 2022-08-22 13:46:05 +03:00
parent 02c7bf4a7c
commit 05f4f8e055

View File

@ -159,13 +159,13 @@ export class TbFlot {
autoHighlight: this.tooltipIndividual === true, autoHighlight: this.tooltipIndividual === true,
markings: [] markings: []
}, },
selection : { mode : 'x' },
legend : { legend : {
show: false show: false
} }
}; };
if (this.chartType === 'line' || this.chartType === 'bar' || this.chartType === 'state') { if (this.chartType === 'line' || this.chartType === 'bar' || this.chartType === 'state') {
this.options.selection = { mode : 'x' };
this.options.xaxes = []; this.options.xaxes = [];
this.xaxis = { this.xaxis = {
mode: 'time', mode: 'time',
@ -1210,9 +1210,11 @@ export class TbFlot {
private enableMouseEvents() { private enableMouseEvents() {
this.$element.css('pointer-events', ''); this.$element.css('pointer-events', '');
this.$element.addClass('mouse-events'); this.$element.addClass('mouse-events');
this.options.selection = { mode : 'x' }; if (this.chartType !== 'pie') {
this.options.selection = {mode: 'x'};
this.$element.bind('plotselected', this.flotSelectHandler);
}
this.$element.bind('plothover', this.flotHoverHandler); this.$element.bind('plothover', this.flotHoverHandler);
this.$element.bind('plotselected', this.flotSelectHandler);
this.$element.bind('dblclick', this.dblclickHandler); this.$element.bind('dblclick', this.dblclickHandler);
this.$element.bind('mousedown', this.mousedownHandler); this.$element.bind('mousedown', this.mousedownHandler);
this.$element.bind('mouseup', this.mouseupHandler); this.$element.bind('mouseup', this.mouseupHandler);
@ -1223,9 +1225,11 @@ export class TbFlot {
private disableMouseEvents() { private disableMouseEvents() {
this.$element.css('pointer-events', 'none'); this.$element.css('pointer-events', 'none');
this.$element.removeClass('mouse-events'); this.$element.removeClass('mouse-events');
this.options.selection = { mode : null }; if (this.chartType !== 'pie') {
this.options.selection = {mode: null};
this.$element.unbind('plotselected', this.flotSelectHandler);
}
this.$element.unbind('plothover', this.flotHoverHandler); this.$element.unbind('plothover', this.flotHoverHandler);
this.$element.unbind('plotselected', this.flotSelectHandler);
this.$element.unbind('dblclick', this.dblclickHandler); this.$element.unbind('dblclick', this.dblclickHandler);
this.$element.unbind('mousedown', this.mousedownHandler); this.$element.unbind('mousedown', this.mousedownHandler);
this.$element.unbind('mouseup', this.mouseupHandler); this.$element.unbind('mouseup', this.mouseupHandler);