mirror of
https://github.com/chartjs/Chart.js.git
synced 2024-10-06 04:09:08 +02:00
parent
9224e57d93
commit
9ab50e6313
@ -332,7 +332,7 @@ export default class ArcElement extends Element {
|
||||
|
||||
draw(ctx) {
|
||||
const {options, circumference} = this;
|
||||
const offset = (options.offset || 0) / 2;
|
||||
const offset = (options.offset || 0) / 4;
|
||||
const spacing = (options.spacing || 0) / 2;
|
||||
const circular = options.circular;
|
||||
this.pixelMargin = (options.borderAlign === 'inner') ? 0.33 : 0;
|
||||
@ -344,15 +344,10 @@ export default class ArcElement extends Element {
|
||||
|
||||
ctx.save();
|
||||
|
||||
let radiusOffset = 0;
|
||||
if (offset) {
|
||||
radiusOffset = offset / 2;
|
||||
const halfAngle = (this.startAngle + this.endAngle) / 2;
|
||||
ctx.translate(Math.cos(halfAngle) * radiusOffset, Math.sin(halfAngle) * radiusOffset);
|
||||
if (this.circumference >= PI) {
|
||||
radiusOffset = offset;
|
||||
}
|
||||
}
|
||||
const halfAngle = (this.startAngle + this.endAngle) / 2;
|
||||
ctx.translate(Math.cos(halfAngle) * offset, Math.sin(halfAngle) * offset);
|
||||
const fix = 1 - Math.sin(Math.min(PI, circumference || 0));
|
||||
const radiusOffset = offset * fix;
|
||||
|
||||
ctx.fillStyle = options.backgroundColor;
|
||||
ctx.strokeStyle = options.borderColor;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 30 KiB |
Binary file not shown.
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
BIN
test/fixtures/controller.doughnut/pie-offset.png
vendored
BIN
test/fixtures/controller.doughnut/pie-offset.png
vendored
Binary file not shown.
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 28 KiB |
Loading…
Reference in New Issue
Block a user