updated scaling radius object

This commit is contained in:
kalutkaz 2022-06-09 13:25:19 +03:00
parent 4082d901d0
commit 25f3cf640a

View File

@ -312,7 +312,9 @@ export class TbFlot {
if (this.settings.stroke) { if (this.settings.stroke) {
this.options.series.pie.stroke.color = this.settings.stroke.color || '#fff'; this.options.series.pie.stroke.color = this.settings.stroke.color || '#fff';
this.options.series.pie.stroke.width = this.settings.stroke.width || 0; this.options.series.pie.stroke.width = this.settings.stroke.width || 0;
this.scalingPieRadius(); if (this.options.series.pie.stroke.width) {
this.scalingPieRadius();
}
} }
if (this.options.series.pie.label.show) { if (this.options.series.pie.label.show) {
@ -692,13 +694,10 @@ export class TbFlot {
} }
private scalingPieRadius() { private scalingPieRadius() {
// if (this.options.series.pie.stroke?.color !== '#fff' && this.options.series.pie.stroke?.width !== 0) {
let scalingLine; let scalingLine;
this.ctx.width > this.ctx.height ? scalingLine = this.ctx.height : scalingLine = this.ctx.width; this.ctx.width > this.ctx.height ? scalingLine = this.ctx.height : scalingLine = this.ctx.width;
let changeRadius = this.options.series.pie.stroke.width / scalingLine; let changeRadius = this.options.series.pie.stroke.width / scalingLine;
this.options.series.pie.radius = changeRadius < 1 ? this.settings.radius - changeRadius : 0; this.options.series.pie.radius = changeRadius < 1 ? this.settings.radius - changeRadius : 0;
console.log(this.options.series.pie.radius);
// }
} }
public resize() { public resize() {
@ -707,21 +706,21 @@ export class TbFlot {
this.resizeTimeoutHandle = null; this.resizeTimeoutHandle = null;
} }
if (this.plot && this.plotInited) { if (this.plot && this.plotInited) {
const width = this.$element.width(); if (this.chartType === 'pie' && this.settings.stroke?.width) {
const height = this.$element.height();
// if (this.chartType === 'pie') {
// this.scalingPieRadius();
// }
if (width && height) {
this.plot.resize();
if (this.chartType !== 'pie') {
this.plot.setupGrid();
} else {
this.scalingPieRadius(); this.scalingPieRadius();
} this.redrawPlot();
this.plot.draw();
} else { } else {
this.resizeTimeoutHandle = setTimeout(this.resize.bind(this), 30); const width = this.$element.width();
const height = this.$element.height();
if (width && height) {
this.plot.resize();
if (this.chartType !== 'pie') {
this.plot.setupGrid();
}
this.plot.draw();
} else {
this.resizeTimeoutHandle = setTimeout(this.resize.bind(this), 30);
}
} }
} }
} }