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,
markings: []
},
selection : { mode : 'x' },
legend : {
show: false
}
};
if (this.chartType === 'line' || this.chartType === 'bar' || this.chartType === 'state') {
this.options.selection = { mode : 'x' };
this.options.xaxes = [];
this.xaxis = {
mode: 'time',
@ -1210,9 +1210,11 @@ export class TbFlot {
private enableMouseEvents() {
this.$element.css('pointer-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('plotselected', this.flotSelectHandler);
this.$element.bind('dblclick', this.dblclickHandler);
this.$element.bind('mousedown', this.mousedownHandler);
this.$element.bind('mouseup', this.mouseupHandler);
@ -1223,9 +1225,11 @@ export class TbFlot {
private disableMouseEvents() {
this.$element.css('pointer-events', 'none');
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('plotselected', this.flotSelectHandler);
this.$element.unbind('dblclick', this.dblclickHandler);
this.$element.unbind('mousedown', this.mousedownHandler);
this.$element.unbind('mouseup', this.mouseupHandler);