Merge pull request #6672 from kalutkaz/fix/pieFlotWidget

[3.4] UI: Fix visual bugs in pie flot widget
This commit is contained in:
Igor Kulikov 2022-06-09 16:55:51 +03:00 committed by GitHub
commit 9afdd97363
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 11 deletions

View File

@ -312,6 +312,9 @@ export class TbFlot {
if (this.settings.stroke) {
this.options.series.pie.stroke.color = this.settings.stroke.color || '#fff';
this.options.series.pie.stroke.width = this.settings.stroke.width || 0;
if (this.options.series.pie.stroke.width) {
this.scalingPieRadius();
}
}
if (this.options.series.pie.label.show) {
@ -690,12 +693,23 @@ export class TbFlot {
}
}
private scalingPieRadius() {
let scalingLine;
this.ctx.width > this.ctx.height ? scalingLine = this.ctx.height : scalingLine = this.ctx.width;
let changeRadius = this.options.series.pie.stroke.width / scalingLine;
this.options.series.pie.radius = changeRadius < 1 ? this.settings.radius - changeRadius : 0;
}
public resize() {
if (this.resizeTimeoutHandle) {
clearTimeout(this.resizeTimeoutHandle);
this.resizeTimeoutHandle = null;
}
if (this.plot && this.plotInited) {
if (this.chartType === 'pie' && this.settings.stroke?.width) {
this.scalingPieRadius();
this.redrawPlot();
} else {
const width = this.$element.width();
const height = this.$element.height();
if (width && height) {
@ -709,6 +723,7 @@ export class TbFlot {
}
}
}
}
public checkMouseEvents() {
const enabled = !this.ctx.isEdit;