billboard.js 3.3.3 → 3.4.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/billboard.css +19 -14
  2. package/dist/billboard.js +343 -60
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +343 -60
  6. package/dist/billboard.pkgd.min.js +2 -2
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +27 -15
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +27 -15
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +22 -12
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +22 -12
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +27 -15
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +27 -15
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +22 -12
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +22 -12
  22. package/dist/theme/datalab.css +24 -20
  23. package/dist/theme/datalab.min.css +2 -2
  24. package/dist/theme/graph.css +24 -20
  25. package/dist/theme/graph.min.css +2 -2
  26. package/dist/theme/insight.css +24 -20
  27. package/dist/theme/insight.min.css +2 -2
  28. package/dist-esm/billboard.js +310 -52
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -5
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -5
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  34. package/package.json +19 -19
  35. package/src/Chart/api/focus.ts +3 -2
  36. package/src/ChartInternal/Axis/Axis.ts +8 -6
  37. package/src/ChartInternal/ChartInternal.ts +23 -12
  38. package/src/ChartInternal/data/data.ts +1 -1
  39. package/src/ChartInternal/internals/color.ts +4 -3
  40. package/src/ChartInternal/internals/format.ts +5 -1
  41. package/src/ChartInternal/internals/redraw.ts +3 -0
  42. package/src/ChartInternal/internals/text.ts +1 -1
  43. package/src/ChartInternal/internals/transform.ts +4 -1
  44. package/src/ChartInternal/internals/type.ts +5 -0
  45. package/src/ChartInternal/shape/arc.ts +41 -17
  46. package/src/ChartInternal/shape/polar.ts +132 -0
  47. package/src/ChartInternal/shape/radar.ts +4 -4
  48. package/src/config/Options/data/data.ts +3 -0
  49. package/src/config/Options/shape/polar.ts +81 -0
  50. package/src/config/classes.ts +6 -3
  51. package/src/config/const.ts +3 -0
  52. package/src/config/resolver/shape.ts +4 -0
  53. package/src/core.ts +1 -0
  54. package/src/index.esm.ts +1 -0
  55. package/src/module/util.ts +18 -7
  56. package/src/scss/billboard.scss +13 -0
  57. package/src/scss/theme/datalab.scss +13 -0
  58. package/src/scss/theme/graph.scss +13 -0
  59. package/src/scss/theme/insight.scss +13 -0
  60. package/types/bb.d.ts +1 -0
  61. package/types/options.d.ts +72 -0
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ */
5
+ import {$LEVEL} from "../../config/classes";
6
+ import {getRange} from "../../module/util";
7
+ import {IArcData, IData} from "../data/IData";
8
+
9
+ /**
10
+ * Get data max value
11
+ * @param {object} $$ ChartInternal instance
12
+ * @returns {number} max value
13
+ * @private
14
+ */
15
+ function getDataMax($$): number {
16
+ const levelMax = $$.config.polar_level_max;
17
+ let dataMax = $$.getMinMaxData().max[0].value;
18
+
19
+ // Apply level max only when is greater than the data max value
20
+ if (levelMax && levelMax > dataMax) {
21
+ dataMax = levelMax;
22
+ }
23
+
24
+ return dataMax;
25
+ }
26
+
27
+ export default {
28
+ /**
29
+ * Initialize polar
30
+ * @private
31
+ */
32
+ initPolar(): void {
33
+ const $$ = this;
34
+ const {$el: {arcs}, config} = $$;
35
+ const levelTextShow: boolean = config.polar_level_text_show;
36
+ const levelTextBgColor: string = config.polar_level_text_backgroundColor;
37
+
38
+ // append <g> for level
39
+ arcs.levels = arcs.append("g")
40
+ .attr("class", $LEVEL.levels);
41
+
42
+ // set level text background color
43
+ if (levelTextShow && levelTextBgColor) {
44
+ $$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
45
+ }
46
+ },
47
+
48
+ /**
49
+ * Get polar outer radius according to the data value
50
+ * @param {object} d Data object
51
+ * @param {numbet} outerRadius Outer radius
52
+ * @returns {number} outer radius
53
+ * @private
54
+ */
55
+ getPolarOuterRadius(d: IArcData, outerRadius: number): number {
56
+ const dataMax = getDataMax(this);
57
+
58
+ return (d?.data.values[0].value / dataMax) * outerRadius;
59
+ },
60
+
61
+ /**
62
+ * Update polar based on given data array
63
+ * @param {object} targets Data object
64
+ * @private
65
+ */
66
+ updateTargetsForPolar(targets: IData[]): void {
67
+ // borrow from Arc
68
+ this.updateTargetsForArc(targets);
69
+ },
70
+
71
+ /**
72
+ * Called whenever redraw happens
73
+ * @private
74
+ */
75
+ redrawPolar(): void {
76
+ const $$ = this;
77
+ const {config} = $$;
78
+
79
+ config.polar_level_show && $$.updatePolarLevel();
80
+ },
81
+
82
+ /**
83
+ * Update polar level circle
84
+ * @private
85
+ */
86
+ updatePolarLevel(): void {
87
+ const $$ = this;
88
+ const {config, state, $el: {arcs: {levels}}} = $$;
89
+
90
+ const depth: number = config.polar_level_depth;
91
+ const dataMax = getDataMax($$);
92
+ const levelData = getRange(0, depth);
93
+ const outerRadius = state.radius;
94
+ const levelRatio = levelData.map(l => outerRadius * ((l + 1) / depth));
95
+ const levelTextFormat = (config.polar_level_text_format || function() {}).bind($$.api);
96
+
97
+ const level = levels
98
+ .selectAll(`.${$LEVEL.level}`)
99
+ .data(levelData);
100
+
101
+ level.exit().remove();
102
+
103
+ const levelEnter = level.enter().append("g")
104
+ .attr("class", (d, i) => `${$LEVEL.level} ${$LEVEL.level}-${i}`);
105
+
106
+ // cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
107
+ levelEnter.append("circle");
108
+
109
+ levelEnter
110
+ .merge(level)
111
+ .selectAll("circle")
112
+ .style("visibility", config.polar_level_show ? null : "hidden")
113
+ .attr("cx", 0)
114
+ .attr("cy", 0)
115
+ .attr("r", d => levelRatio[d]);
116
+
117
+ if (config.polar_level_text_show) {
118
+ const levelTextBackgroundColor = config.polar_level_text_backgroundColor;
119
+ const defsId = `#${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(levelTextBackgroundColor)}`;
120
+
121
+ levelEnter.append("text")
122
+ .style("text-anchor", "middle");
123
+
124
+ levelEnter
125
+ .merge(level)
126
+ .selectAll("text")
127
+ .attr("dy", d => -levelRatio[d] + 5)
128
+ .attr("filter", levelTextBackgroundColor ? `url(${defsId})` : null)
129
+ .text(d => levelTextFormat(dataMax / levelData.length * (d + 1)));
130
+ }
131
+ }
132
+ };
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {KEY} from "../../module/Cache";
7
- import {$AXIS, $COMMON, $RADAR, $SHAPE, $TEXT} from "../../config/classes";
7
+ import {$AXIS, $COMMON, $LEVEL, $RADAR, $SHAPE, $TEXT} from "../../config/classes";
8
8
  import {getMinMax, getRange, isDefined, isEmpty, isNumber, isUndefined, setTextValue, toArray} from "../../module/util";
9
9
 
10
10
  /**
@@ -40,7 +40,7 @@ export default {
40
40
 
41
41
  // level
42
42
  $el.radar.levels = $el.radar.append("g")
43
- .attr("class", $RADAR.levels);
43
+ .attr("class", $LEVEL.levels);
44
44
 
45
45
  // axis
46
46
  $el.radar.axes = $el.radar.append("g")
@@ -176,13 +176,13 @@ export default {
176
176
  });
177
177
 
178
178
  const level = radarLevels
179
- .selectAll(`.${$RADAR.level}`)
179
+ .selectAll(`.${$LEVEL.level}`)
180
180
  .data(levelData);
181
181
 
182
182
  level.exit().remove();
183
183
 
184
184
  const levelEnter = level.enter().append("g")
185
- .attr("class", (d, i) => `${$RADAR.level} ${$RADAR.level}-${i}`);
185
+ .attr("class", (d, i) => `${$LEVEL.level} ${$LEVEL.level}-${i}`);
186
186
 
187
187
  levelEnter.append("polygon")
188
188
  .style("visibility", config.radar_level_show ? null : "hidden");
@@ -93,6 +93,7 @@ export default {
93
93
  * - gauge
94
94
  * - line
95
95
  * - pie
96
+ * - polar
96
97
  * - radar
97
98
  * - scatter
98
99
  * - spline
@@ -121,6 +122,7 @@ export default {
121
122
  * gauge,
122
123
  * line,
123
124
  * pie,
125
+ * polar,
124
126
  * radar,
125
127
  * scatter,
126
128
  * spline,
@@ -167,6 +169,7 @@ export default {
167
169
  * gauge,
168
170
  * line,
169
171
  * pie,
172
+ * polar,
170
173
  * radar,
171
174
  * scatter,
172
175
  * spline,
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ */
5
+ /**
6
+ * x Axis config options
7
+ */
8
+ export default {
9
+ /**
10
+ * Set polar options
11
+ * @name polar
12
+ * @memberof Options
13
+ * @type {object}
14
+ * @property {object} polar Polar object
15
+ * @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
16
+ * @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
17
+ * @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
18
+ * @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
19
+ * @property {number} [polar.level.depth=3] Set the level depth.
20
+ * @property {boolean} [polar.level.show=true] Show or hide level.
21
+ * @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
22
+ * @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
23
+ * @property {boolean} [polar.level.text.show=true] Show or hide level text.
24
+ * @property {number} [polar.padAngle=0] Set padding between data.
25
+ * @property {number} [polar.padding=0] Sets the gap between pie arcs.
26
+ * @property {number} [polar.startingAngle=0] Set starting angle where data draws.
27
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
28
+ * @example
29
+ * polar: {
30
+ * label: {
31
+ * show: false,
32
+ * format: function(value, ratio, id) {
33
+ * return d3.format("$")(value);
34
+ *
35
+ * // to multiline, return with '\n' character
36
+ * // return value +"%\nLine1\n2Line2";
37
+ * },
38
+ *
39
+ * // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
40
+ * // if data value is below than 0.1, text label will be hidden.
41
+ * threshold: 0.1,
42
+ *
43
+ * // set ratio callback. Should return ratio value
44
+ * ratio: function(d, radius, h) {
45
+ * ...
46
+ * return ratio;
47
+ * },
48
+ * // or set ratio number
49
+ * ratio: 0.5
50
+ * },
51
+ * level: {
52
+ * depth: 3,
53
+ * max: 500,
54
+ * show: true,
55
+ * text: {
56
+ * format: function(x) {
57
+ * return x + "%";
58
+ * },
59
+ * show: true,
60
+ * backgroundColor: "red"
61
+ * }
62
+ * },
63
+ * padAngle: 0.1,
64
+ * padding: 0,
65
+ * startingAngle: 1
66
+ * }
67
+ */
68
+ polar_label_show: true,
69
+ polar_label_format: <(() => number|string)|undefined> undefined,
70
+ polar_label_threshold: 0.05,
71
+ polar_label_ratio: <(() => number)|undefined> undefined,
72
+ polar_level_depth: 3,
73
+ polar_level_max: <number|undefined> undefined,
74
+ polar_level_show: true,
75
+ polar_level_text_backgroundColor: "#fff",
76
+ polar_level_text_format: (x: number) => (x % 1 === 0 ? x : x.toFixed(2)),
77
+ polar_level_text_show: true,
78
+ polar_padAngle: 0,
79
+ polar_padding: 0,
80
+ polar_startingAngle: 0
81
+ };
@@ -126,13 +126,16 @@ export const $GRID = {
126
126
  ygrids: "bb-ygrids"
127
127
  };
128
128
 
129
- export const $RADAR = {
130
- chartRadar: "bb-chart-radar",
131
- chartRadars: "bb-chart-radars",
129
+ export const $LEVEL = {
132
130
  level: "bb-level",
133
131
  levels: "bb-levels"
134
132
  };
135
133
 
134
+ export const $RADAR = {
135
+ chartRadar: "bb-chart-radar",
136
+ chartRadars: "bb-chart-radars"
137
+ };
138
+
136
139
  export const $REGION = {
137
140
  region: "bb-region",
138
141
  regions: "bb-regions"
@@ -19,6 +19,7 @@ export const TYPE = {
19
19
  GAUGE: "gauge",
20
20
  LINE: "line",
21
21
  PIE: "pie",
22
+ POLAR: "polar",
22
23
  RADAR: "radar",
23
24
  SCATTER: "scatter",
24
25
  SPLINE: "spline",
@@ -42,6 +43,7 @@ export const TYPE_METHOD_NEEDED = {
42
43
  GAUGE: "initArc",
43
44
  LINE: "initLine",
44
45
  PIE: "initArc",
46
+ POLAR: "initPolar",
45
47
  RADAR: "initCircle",
46
48
  SCATTER: "initCircle",
47
49
  SPLINE: "initLine",
@@ -68,6 +70,7 @@ export const TYPE_BY_CATEGORY = {
68
70
  TYPE.PIE,
69
71
  TYPE.DONUT,
70
72
  TYPE.GAUGE,
73
+ TYPE.POLAR,
71
74
  TYPE.RADAR
72
75
  ],
73
76
  Line: [
@@ -24,6 +24,7 @@ import shapeGauge from "../../ChartInternal/shape/gauge";
24
24
  import shapeBubble from "../../ChartInternal/shape/bubble";
25
25
  import shapeLine from "../../ChartInternal/shape/line";
26
26
  import shapePoint from "../../ChartInternal/shape/point";
27
+ import shapePolar from "../../ChartInternal/shape/polar";
27
28
  import shapeRadar from "../../ChartInternal/shape/radar";
28
29
 
29
30
  // Options
@@ -40,6 +41,7 @@ import optSpline from "../Options/shape/spline";
40
41
  import optDonut from "../Options/shape/donut";
41
42
  import optGauge from "../Options/shape/gauge";
42
43
  import optPie from "../Options/shape/pie";
44
+ import optPolar from "../Options/shape/polar";
43
45
  import optRadar from "../Options/shape/radar";
44
46
 
45
47
  export {
@@ -55,6 +57,7 @@ export {
55
57
  gauge,
56
58
  line,
57
59
  pie,
60
+ polar,
58
61
  radar,
59
62
  scatter,
60
63
  spline,
@@ -121,6 +124,7 @@ let step = (): string => (extendLine(), (step = () => TYPE.STEP)());
121
124
  let donut = (): string => (extendArc(undefined, [optDonut]), (donut = () => TYPE.DONUT)());
122
125
  let gauge = (): string => (extendArc([shapeGauge], [optGauge]), (gauge = () => TYPE.GAUGE)());
123
126
  let pie = (): string => (extendArc(undefined, [optPie]), (pie = () => TYPE.PIE)());
127
+ let polar = (): string => (extendArc([shapePolar], [optPolar]), (polar = () => TYPE.POLAR)());
124
128
  let radar = (): string => (
125
129
  extendArc([shapePoint, shapeRadar], [optPoint, optRadar]), (radar = () => TYPE.RADAR)()
126
130
  );
package/src/core.ts CHANGED
@@ -70,6 +70,7 @@ const bb = {
70
70
  * gauge,
71
71
  * line,
72
72
  * pie,
73
+ * polar,
73
74
  * radar,
74
75
  * scatter,
75
76
  * spline,
package/src/index.esm.ts CHANGED
@@ -16,6 +16,7 @@ export {
16
16
  gauge,
17
17
  line,
18
18
  pie,
19
+ polar,
19
20
  radar,
20
21
  scatter,
21
22
  spline,
@@ -732,28 +732,39 @@ function isTabVisible(): boolean {
732
732
  * @private
733
733
  */
734
734
  function convertInputType(mouse: boolean, touch: boolean): "mouse" | "touch" | null {
735
+ const {DocumentTouch, matchMedia, navigator} = window;
735
736
  let hasTouch = false;
736
737
 
737
738
  if (touch) {
738
739
  // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
739
- if (window.navigator && "maxTouchPoints" in window.navigator) {
740
- hasTouch = window.navigator.maxTouchPoints > 0;
740
+ if (navigator && "maxTouchPoints" in navigator) {
741
+ hasTouch = navigator.maxTouchPoints > 0;
741
742
 
742
743
  // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
743
744
  // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
744
- } else if ("ontouchmove" in window || (window.DocumentTouch && document instanceof window.DocumentTouch)) {
745
+ } else if ("ontouchmove" in window || (DocumentTouch && document instanceof DocumentTouch)) {
745
746
  hasTouch = true;
746
747
  } else {
747
748
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
748
- const mQ = window.matchMedia && matchMedia("(pointer:coarse)");
749
+ if (matchMedia?.("(pointer:coarse)").matches) {
750
+ hasTouch = true;
751
+ } else {
752
+ // Only as a last resort, fall back to user agent sniffing
753
+ const UA = navigator.userAgent;
749
754
 
750
- if (mQ && mQ.media === "(pointer:coarse)") {
751
- hasTouch = !!mQ.matches;
755
+ hasTouch = (
756
+ /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) ||
757
+ /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA)
758
+ );
752
759
  }
753
760
  }
754
761
  }
755
762
 
756
- const hasMouse = mouse && !hasTouch ? ("onmouseover" in window) : false;
763
+ // Check if agent has mouse using any-hover, touch devices (e.g iPad) with external mouse will return true as long as mouse is connected
764
+ // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
765
+ // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
766
+ const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"]
767
+ .some(v => matchMedia?.(`(${v})`).matches);
757
768
 
758
769
  return (hasMouse && "mouse") || (hasTouch && "touch") || null;
759
770
  }
@@ -250,6 +250,19 @@ text.bb-chart-arcs-gauge-title {
250
250
  .bb-chart-arcs-gauge-min {
251
251
  fill: #777;
252
252
  }
253
+
254
+ /*-- Polar --*/
255
+ .bb-levels {
256
+ circle {
257
+ fill: none;
258
+ stroke: #848282;
259
+ stroke-width: .5px;
260
+ }
261
+
262
+ text {
263
+ fill: #848282;
264
+ }
265
+ }
253
266
  }
254
267
 
255
268
  /*-- Radar --*/
@@ -314,6 +314,19 @@ text.bb-chart-arcs-gauge-title {
314
314
  fill: #eaeaea;
315
315
  stroke-width: 0;
316
316
  }
317
+
318
+ /*-- Polar --*/
319
+ .bb-levels {
320
+ circle {
321
+ fill: none;
322
+ stroke: #848282;
323
+ stroke-width: .5px;
324
+ }
325
+
326
+ text {
327
+ fill: #848282;
328
+ }
329
+ }
317
330
  }
318
331
 
319
332
  .bb-chart-arc {
@@ -332,6 +332,19 @@ text.bb-chart-arcs-gauge-title {
332
332
  fill: #eaeaea;
333
333
  stroke-width: 0;
334
334
  }
335
+
336
+ /*-- Polar --*/
337
+ .bb-levels {
338
+ circle {
339
+ fill: none;
340
+ stroke: #848282;
341
+ stroke-width: .5px;
342
+ }
343
+
344
+ text {
345
+ fill: #848282;
346
+ }
347
+ }
335
348
  }
336
349
 
337
350
  .bb-chart-arc {
@@ -312,6 +312,19 @@ text.bb-chart-arcs-gauge-title {
312
312
  fill: #eaeaea;
313
313
  stroke-width: 0;
314
314
  }
315
+
316
+ /*-- Polar --*/
317
+ .bb-levels {
318
+ circle {
319
+ fill: none;
320
+ stroke: #848282;
321
+ stroke-width: .5px;
322
+ }
323
+
324
+ text {
325
+ fill: #848282;
326
+ }
327
+ }
315
328
  }
316
329
 
317
330
  .bb-chart-arc {
package/types/bb.d.ts CHANGED
@@ -45,6 +45,7 @@ export function donut(): "donut";
45
45
  export function gauge(): "gauge";
46
46
  export function line(): "line";
47
47
  export function pie(): "pie";
48
+ export function polar(): "polar";
48
49
  export function radar(): "radar";
49
50
  export function scatter(): "scatter";
50
51
  export function spline(): "spline";
@@ -461,6 +461,78 @@ export interface ChartOptions {
461
461
  }
462
462
  };
463
463
 
464
+ polar?: {
465
+ label?: {
466
+ /**
467
+ * Show or hide label on each polar piece.
468
+ */
469
+ show?: boolean;
470
+
471
+ /**
472
+ * Set threshold ratio to show/hide labels.
473
+ */
474
+ threshold?: number;
475
+
476
+ /**
477
+ * Set formatter for the label on each polar piece.
478
+ */
479
+ format?(this: Chart, value: number, ratio: number, id: string): string;
480
+
481
+ /**
482
+ * Set ratio of labels position.
483
+ */
484
+ ratio?: ((this: Chart, d: DataItem, radius: number, h: number) => void) | number
485
+ };
486
+ level?: {
487
+ /**
488
+ * Set the level depth.
489
+ */
490
+ depth?: number;
491
+
492
+ /**
493
+ * Set level max value.
494
+ */
495
+ max?: number;
496
+
497
+ /**
498
+ * Show or hide level.
499
+ */
500
+ show?: boolean;
501
+
502
+ text?: {
503
+ /**
504
+ * Set label text's background color.
505
+ */
506
+ backgroundColor?: string;
507
+
508
+ /**
509
+ * Set format function for the level value.
510
+ */
511
+ format?: (this: Chart, x: string) => string;
512
+
513
+ /**
514
+ * Show or hide level text.
515
+ */
516
+ show?: boolean;
517
+ }
518
+ };
519
+
520
+ /**
521
+ * Set padding between data.
522
+ */
523
+ padAngle?: number;
524
+
525
+ /**
526
+ * Sets the gap between pie arcs.
527
+ */
528
+ padding?: number;
529
+
530
+ /**
531
+ * Set starting angle where data draws.
532
+ */
533
+ startAngle?: number;
534
+ };
535
+
464
536
  pie?: {
465
537
  label?: {
466
538
  /**