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,8 +312,10 @@ 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;
if (this.options.series.pie.stroke.width) {
this.scalingPieRadius(); this.scalingPieRadius();
} }
}
if (this.options.series.pie.label.show) { if (this.options.series.pie.label.show) {
this.options.series.pie.label.formatter = (label, series) => { this.options.series.pie.label.formatter = (label, series) => {
@ -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,17 +706,16 @@ export class TbFlot {
this.resizeTimeoutHandle = null; this.resizeTimeoutHandle = null;
} }
if (this.plot && this.plotInited) { if (this.plot && this.plotInited) {
if (this.chartType === 'pie' && this.settings.stroke?.width) {
this.scalingPieRadius();
this.redrawPlot();
} else {
const width = this.$element.width(); const width = this.$element.width();
const height = this.$element.height(); const height = this.$element.height();
// if (this.chartType === 'pie') {
// this.scalingPieRadius();
// }
if (width && height) { if (width && height) {
this.plot.resize(); this.plot.resize();
if (this.chartType !== 'pie') { if (this.chartType !== 'pie') {
this.plot.setupGrid(); this.plot.setupGrid();
} else {
this.scalingPieRadius();
} }
this.plot.draw(); this.plot.draw();
} else { } else {
@ -725,6 +723,7 @@ export class TbFlot {
} }
} }
} }
}
public checkMouseEvents() { public checkMouseEvents() {
const enabled = !this.ctx.isEdit; const enabled = !this.ctx.isEdit;