Doughnut: complete radians to degrees conversion (#8321)

This commit is contained in:
Jukka Kurkela
2021-01-16 23:04:48 +02:00
committed by GitHub
parent eb88909e95
commit 3c64bc88e8
4 changed files with 12 additions and 12 deletions

View File

@@ -164,8 +164,8 @@ These are the customisation options specific to Pie & Doughnut charts. These opt
| Name | Type | Default | Description
| ---- | ---- | ------- | -----------
| `cutoutPercentage` | `number` | `50` - for doughnut, `0` - for pie | The percentage of the chart that is cut out of the middle.
| `rotation` | `number` | `-0.5 * Math.PI` | Starting angle to draw arcs from.
| `circumference` | `number` | `2 * Math.PI` | Sweep to allow arcs to cover.
| `rotation` | `number` | 0 | Starting angle to draw arcs from.
| `circumference` | `number` | 360 | Sweep to allow arcs to cover.
| `animation.animateRotate` | `boolean` | `true` | If true, the chart will animate in with a rotation animation. This property is in the `options.animation` object.
| `animation.animateScale` | `boolean` | `false` | If true, will animate scaling the chart from the center outwards.

View File

@@ -72,7 +72,7 @@ A number of changes were made to the configuration options passed to the `Chart`
* Polar area `elements.arc.angle` is now configured in degrees instead of radians.
* Polar area `startAngle` option is now consistent with `Radar`, 0 is at top and value is in degrees. Default is changed from `-½π` to `0`.
* Doughnut `rotation` option is now in degrees and 0 is at top. Default is changed from `-½π` to `0`.
* Doughnut `circumference` option is now in degrees. Default is changed from `2π` to `0`.
* Doughnut `circumference` option is now in degrees. Default is changed from `2π` to `360`.
* `scales.[x/y]Axes` arrays were removed. Scales are now configured directly to `options.scales` object with the object key being the scale Id.
* `scales.[x/y]Axes.barPercentage` was moved to dataset option `barPercentage`
* `scales.[x/y]Axes.barThickness` was moved to dataset option `barThickness`

View File

@@ -143,12 +143,12 @@
});
document.getElementById('changeCircleSize').addEventListener('click', function() {
if (window.myDoughnut.options.circumference === Math.PI) {
window.myDoughnut.options.circumference = 2 * Math.PI;
window.myDoughnut.options.rotation = -Math.PI / 2;
if (window.myDoughnut.options.circumference === 180) {
window.myDoughnut.options.circumference = 360;
window.myDoughnut.options.rotation = -45;
} else {
window.myDoughnut.options.circumference = Math.PI;
window.myDoughnut.options.rotation = -Math.PI;
window.myDoughnut.options.circumference = 180;
window.myDoughnut.options.rotation = -90;
}
window.myDoughnut.update();

View File

@@ -233,13 +233,13 @@ export interface DoughnutControllerDatasetOptions
/**
* Sweep to allow arcs to cover.
* @default 2 * Math.PI
* @default 360
*/
circumference: number;
/**
* Starting angle to draw this dataset from.
* @default -0.5 * Math.PI
* @default 0
*/
rotation: number;
@@ -273,13 +273,13 @@ export interface DoughnutControllerChartOptions {
/**
* Starting angle to draw arcs from.
* @default -0.5 * Math.PI
* @default 0
*/
rotation: number;
/**
* Sweep to allow arcs to cover.
* @default 2 * Math.PI
* @default 360
*/
circumference: number;