]> git.ipfire.org Git - thirdparty/Chart.js.git/commitdiff
Doughnut: complete radians to degrees conversion (#8321)
authorJukka Kurkela <jukka.kurkela@gmail.com>
Sat, 16 Jan 2021 21:04:48 +0000 (23:04 +0200)
committerGitHub <noreply@github.com>
Sat, 16 Jan 2021 21:04:48 +0000 (16:04 -0500)
docs/docs/charts/doughnut.mdx
docs/docs/getting-started/v3-migration.md
samples/charts/doughnut.html
types/index.esm.d.ts

index e5758478fd791de82342a79ef80ff93025c8aa32..a9b929eb43560001e4beb5020a062998ff2f2c30 100644 (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.
 
index 1877fd60faa349e221ad8b5e3c5944f0e557024a..0e2e86e7ecf7d2f55f3b49567d6812e97aa00769 100644 (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`
index 4373c99c5ed0c899b8d8f66049c3b42fbfe24afa..358213bc4b013808e9cdf66d8d3d9f5c999a7753 100644 (file)
                });
 
                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();
index 28f48da1713f7e1e5cdad5f3d210bcb6d4fb8b1b..a018fa5ef24e1fb2d623490e06c4f735c12d2777 100644 (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;