mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-06 16:26:52 +01:00
Doughnut: complete radians to degrees conversion (#8321)
This commit is contained in:
@@ -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.
|
||||
|
||||
|
||||
@@ -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`
|
||||
|
||||
@@ -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();
|
||||
|
||||
8
types/index.esm.d.ts
vendored
8
types/index.esm.d.ts
vendored
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user