| 2 | import {toRadians, PI, formatNumber, _parseObjectDataRadialScale} from '../helpers/index.js'; |
| 3 | |
| 4 | export default class PolarAreaController extends DatasetController { |
| 5 | |
| 6 | static id = 'polarArea'; |
| 7 | |
| 8 | /** |
| 9 | * @type {any} |
| 10 | */ |
| 11 | static defaults = { |
| 12 | dataElementType: 'arc', |
| 13 | animation: { |
| 14 | animateRotate: true, |
| 15 | animateScale: true |
| 16 | }, |
| 17 | animations: { |
| 18 | numbers: { |
| 19 | type: 'number', |
| 20 | properties: ['x', 'y', 'startAngle', 'endAngle', 'innerRadius', 'outerRadius'] |
| 21 | }, |
| 22 | }, |
| 23 | indexAxis: 'r', |
| 24 | startAngle: 0, |
| 25 | spacing: 0, |
| 26 | spacingMode: 'proportional', |
| 27 | }; |
| 28 | |
| 29 | /** |
| 30 | * @type {any} |
| 31 | */ |
| 32 | static overrides = { |
| 33 | aspectRatio: 1, |
| 34 | |
| 35 | plugins: { |
| 36 | legend: { |
| 37 | labels: { |
| 38 | generateLabels(chart) { |
| 39 | const data = chart.data; |
| 40 | if (data.labels.length && data.datasets.length) { |
| 41 | const {labels: {pointStyle, color}} = chart.legend.options; |
| 42 | |
| 43 | return data.labels.map((label, i) => { |
| 44 | const meta = chart.getDatasetMeta(0); |
| 45 | const style = meta.controller.getStyle(i); |
| 46 | |
| 47 | return { |
| 48 | text: label, |
| 49 | fillStyle: style.backgroundColor, |
| 50 | strokeStyle: style.borderColor, |
| 51 | fontColor: color, |
| 52 | lineWidth: style.borderWidth, |
| 53 | pointStyle: pointStyle, |
| 54 | hidden: !chart.getDataVisibility(i), |
| 55 | |
| 56 | // Extra data used for toggling the correct item |
| 57 | index: i |
| 58 | }; |
| 59 | }); |
| 60 | } |
| 61 | return []; |
nothing calls this directly
no outgoing calls
no test coverage detected