From: Evert Timberg Date: Mon, 12 Oct 2020 14:56:03 +0000 (-0400) Subject: Polar Area `elements.arc.angle` option now returns degrees (#7871) X-Git-Tag: v3.0.0-beta.4~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdd742d75201d916c595bc32e10b899507e44fde;p=thirdparty%2FChart.js.git Polar Area `elements.arc.angle` option now returns degrees (#7871) * Polar Area `elements.arc.angle` option now returns degrees * Update wording of migration docs --- diff --git a/docs/docs/getting-started/v3-migration.md b/docs/docs/getting-started/v3-migration.md index 473da19dd..77c17695a 100644 --- a/docs/docs/getting-started/v3-migration.md +++ b/docs/docs/getting-started/v3-migration.md @@ -66,6 +66,7 @@ A number of changes were made to the configuration options passed to the `Chart` * `hover.animationDuration` is now configured in `animation.active.duration` * `responsiveAnimationDuration` is now configured in `animation.resize.duration` +* 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`. diff --git a/src/controllers/controller.polarArea.js b/src/controllers/controller.polarArea.js index 9c69b79fa..d2718b7ab 100644 --- a/src/controllers/controller.polarArea.js +++ b/src/controllers/controller.polarArea.js @@ -1,5 +1,5 @@ import DatasetController from '../core/core.datasetController'; -import {resolve, toRadians, PI, TAU} from '../helpers/index'; +import {resolve, toRadians, PI} from '../helpers/index'; function getStartAngleRadians(deg) { // radialLinear scale draws angleLines using startAngle. 0 is expected to be at top. @@ -121,10 +121,10 @@ export default class PolarAreaController extends DatasetController { // Scriptable options const context = me.getContext(index, mode === 'active'); - return resolve([ + return toRadians(resolve([ me.chart.options.elements.arc.angle, - TAU / count - ], context, index); + 360 / count + ], context, index)); } } diff --git a/test/fixtures/controller.polarArea/angle-array.json b/test/fixtures/controller.polarArea/angle-array.json index f8fce27b5..073e5708c 100644 --- a/test/fixtures/controller.polarArea/angle-array.json +++ b/test/fixtures/controller.polarArea/angle-array.json @@ -19,7 +19,7 @@ "elements": { "arc": { "angle": [ - 1.0566, 1.7566, 1.0566, 2.1566, 0.2566 + 60.5387, 100.6457, 60.5387, 123.5641, 14.7021 ] } }, diff --git a/test/fixtures/controller.polarArea/border-align-center.json b/test/fixtures/controller.polarArea/border-align-center.json index 234712001..45b49f3db 100644 --- a/test/fixtures/controller.polarArea/border-align-center.json +++ b/test/fixtures/controller.polarArea/border-align-center.json @@ -26,7 +26,7 @@ "elements": { "arc": { "angle": [ - 0.0378, 0.1892, 0.3786, 1.8925, 3.7849 + 2.1658, 10.8404, 21.6922, 108.4323, 216.8588 ] } }, diff --git a/test/fixtures/controller.polarArea/border-align-inner.json b/test/fixtures/controller.polarArea/border-align-inner.json index fa165484d..c6edc39d3 100644 --- a/test/fixtures/controller.polarArea/border-align-inner.json +++ b/test/fixtures/controller.polarArea/border-align-inner.json @@ -27,7 +27,7 @@ "elements": { "arc": { "angle": [ - 0.0378, 0.1892, 0.3786, 1.8925, 3.7849 + 2.1658, 10.8404, 21.6922, 108.4323, 216.8588 ] } },