billboard.js 3.3.3 → 3.4.0

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 (69) hide show
  1. package/dist/billboard.css +19 -14
  2. package/dist/billboard.js +504 -112
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +550 -126
  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 +34 -18
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +34 -18
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +29 -15
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +29 -15
  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 +80 -32
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +80 -32
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +75 -29
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +75 -29
  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 +446 -99
  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 +8 -7
  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 +21 -21
  35. package/src/Chart/api/axis.ts +90 -25
  36. package/src/Chart/api/focus.ts +3 -2
  37. package/src/ChartInternal/Axis/Axis.ts +8 -6
  38. package/src/ChartInternal/ChartInternal.ts +48 -23
  39. package/src/ChartInternal/data/data.ts +1 -1
  40. package/src/ChartInternal/interactions/flow.ts +1 -1
  41. package/src/ChartInternal/internals/color.ts +4 -3
  42. package/src/ChartInternal/internals/format.ts +5 -1
  43. package/src/ChartInternal/internals/redraw.ts +3 -0
  44. package/src/ChartInternal/internals/text.ts +1 -1
  45. package/src/ChartInternal/internals/transform.ts +4 -1
  46. package/src/ChartInternal/internals/type.ts +5 -0
  47. package/src/ChartInternal/shape/arc.ts +41 -17
  48. package/src/ChartInternal/shape/bar.ts +1 -1
  49. package/src/ChartInternal/shape/point.ts +6 -3
  50. package/src/ChartInternal/shape/polar.ts +132 -0
  51. package/src/ChartInternal/shape/radar.ts +4 -4
  52. package/src/config/Options/common/main.ts +19 -2
  53. package/src/config/Options/data/data.ts +3 -0
  54. package/src/config/Options/shape/polar.ts +81 -0
  55. package/src/config/classes.ts +6 -3
  56. package/src/config/const.ts +3 -0
  57. package/src/config/resolver/shape.ts +4 -0
  58. package/src/core.ts +1 -0
  59. package/src/index.esm.ts +1 -0
  60. package/src/module/generator.ts +19 -5
  61. package/src/module/util.ts +22 -9
  62. package/src/scss/billboard.scss +13 -0
  63. package/src/scss/theme/datalab.scss +13 -0
  64. package/src/scss/theme/graph.scss +13 -0
  65. package/src/scss/theme/insight.scss +13 -0
  66. package/types/bb.d.ts +1 -0
  67. package/types/chart.d.ts +8 -8
  68. package/types/options.d.ts +79 -2
  69. package/types/types.d.ts +2 -0
package/dist/billboard.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.3.3
8
+ * @version 3.4.0
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -183,6 +183,7 @@ __webpack_require__.d(resolver_shape_namespaceObject, {
183
183
  "gauge": function() { return resolver_shape_gauge; },
184
184
  "line": function() { return resolver_shape_line; },
185
185
  "pie": function() { return shape_pie; },
186
+ "polar": function() { return resolver_shape_polar; },
186
187
  "radar": function() { return resolver_shape_radar; },
187
188
  "scatter": function() { return shape_scatter; },
188
189
  "spline": function() { return shape_spline; },
@@ -256,6 +257,7 @@ var TYPE = {
256
257
  GAUGE: "gauge",
257
258
  LINE: "line",
258
259
  PIE: "pie",
260
+ POLAR: "polar",
259
261
  RADAR: "radar",
260
262
  SCATTER: "scatter",
261
263
  SPLINE: "spline",
@@ -279,6 +281,7 @@ var TYPE_METHOD_NEEDED = {
279
281
  GAUGE: "initArc",
280
282
  LINE: "initLine",
281
283
  PIE: "initArc",
284
+ POLAR: "initPolar",
282
285
  RADAR: "initCircle",
283
286
  SCATTER: "initCircle",
284
287
  SPLINE: "initLine",
@@ -292,7 +295,7 @@ var TYPE_METHOD_NEEDED = {
292
295
  var TYPE_BY_CATEGORY = {
293
296
  Area: [TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.AREA_STEP],
294
297
  AreaRange: [TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE],
295
- Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.RADAR],
298
+ Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.POLAR, TYPE.RADAR],
296
299
  Line: [TYPE.LINE, TYPE.SPLINE, TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.STEP, TYPE.AREA_STEP],
297
300
  Step: [TYPE.STEP, TYPE.AREA_STEP],
298
301
  Spline: [TYPE.SPLINE, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE]
@@ -1084,9 +1087,13 @@ function parseDate(date) {
1084
1087
  if (date instanceof Date) {
1085
1088
  parsedDate = date;
1086
1089
  } else if (isString(date)) {
1087
- var config = this.config,
1090
+ var _format$dataTime,
1091
+ config = this.config,
1088
1092
  format = this.format;
1089
- parsedDate = format.dataTime(config.data_xFormat)(date);
1093
+
1094
+ // if fails to parse, try by new Date()
1095
+ // https://github.com/naver/billboard.js/issues/1714
1096
+ parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
1090
1097
  } else if (isNumber(date) && !isNaN(date)) {
1091
1098
  parsedDate = new Date(+date);
1092
1099
  }
@@ -1105,7 +1112,7 @@ function parseDate(date) {
1105
1112
 
1106
1113
 
1107
1114
  function isTabVisible() {
1108
- return !browser_doc.hidden;
1115
+ return (browser_doc == null ? void 0 : browser_doc.hidden) === !1 || (browser_doc == null ? void 0 : browser_doc.visibilityState) === "visible";
1109
1116
  }
1110
1117
  /**
1111
1118
  * Get the current input type
@@ -1117,26 +1124,36 @@ function isTabVisible() {
1117
1124
 
1118
1125
 
1119
1126
  function convertInputType(mouse, touch) {
1120
- var hasTouch = !1;
1127
+ var DocumentTouch = win.DocumentTouch,
1128
+ matchMedia = win.matchMedia,
1129
+ navigator = win.navigator,
1130
+ hasTouch = !1;
1121
1131
 
1122
1132
  if (touch) {
1123
1133
  // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
1124
- if (win.navigator && "maxTouchPoints" in win.navigator) {
1125
- hasTouch = win.navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1134
+ if (navigator && "maxTouchPoints" in navigator) {
1135
+ hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1126
1136
  // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
1127
- } else if ("ontouchmove" in win || win.DocumentTouch && browser_doc instanceof win.DocumentTouch) {
1137
+ } else if ("ontouchmove" in win || DocumentTouch && browser_doc instanceof DocumentTouch) {
1128
1138
  hasTouch = !0;
1129
1139
  } else {
1130
1140
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
1131
- var mQ = win.matchMedia && matchMedia("(pointer:coarse)");
1132
-
1133
- if (mQ && mQ.media === "(pointer:coarse)") {
1134
- hasTouch = !!mQ.matches;
1141
+ if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
1142
+ hasTouch = !0;
1143
+ } else {
1144
+ // Only as a last resort, fall back to user agent sniffing
1145
+ var UA = navigator.userAgent;
1146
+ hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
1135
1147
  }
1136
1148
  }
1137
- }
1149
+ } // 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
1150
+ // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
1151
+ // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
1138
1152
 
1139
- var hasMouse = mouse && !hasTouch ? "onmouseover" in win : !1;
1153
+
1154
+ var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1155
+ return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1156
+ });
1140
1157
  return hasMouse && "mouse" || hasTouch && "touch" || null;
1141
1158
  }
1142
1159
  ;// CONCATENATED MODULE: ./src/module/error.ts
@@ -1317,12 +1334,14 @@ var $GRID = {
1317
1334
  ygridLines: "bb-ygrid-lines",
1318
1335
  ygrids: "bb-ygrids"
1319
1336
  };
1320
- var $RADAR = {
1321
- chartRadar: "bb-chart-radar",
1322
- chartRadars: "bb-chart-radars",
1337
+ var $LEVEL = {
1323
1338
  level: "bb-level",
1324
1339
  levels: "bb-levels"
1325
1340
  };
1341
+ var $RADAR = {
1342
+ chartRadar: "bb-chart-radar",
1343
+ chartRadars: "bb-chart-radars"
1344
+ };
1326
1345
  var $REGION = {
1327
1346
  region: "bb-region",
1328
1347
  regions: "bb-regions"
@@ -1791,6 +1810,21 @@ var Store = /*#__PURE__*/function () {
1791
1810
  */
1792
1811
  resize_auto: !0,
1793
1812
 
1813
+ /**
1814
+ * Set a callback to execute when the chart is clicked.
1815
+ * @name onclick
1816
+ * @memberof Options
1817
+ * @type {Function}
1818
+ * @default undefined
1819
+ * @example
1820
+ * onclick: function(event) {
1821
+ * this; // chart instance itself
1822
+ * event; // native event object
1823
+ * ...
1824
+ * }
1825
+ */
1826
+ onclick: undefined,
1827
+
1794
1828
  /**
1795
1829
  * Set a callback to execute when mouse/touch enters the chart.
1796
1830
  * @name onover
@@ -1798,8 +1832,9 @@ var Store = /*#__PURE__*/function () {
1798
1832
  * @type {Function}
1799
1833
  * @default undefined
1800
1834
  * @example
1801
- * onover: function() {
1835
+ * onover: function(event) {
1802
1836
  * this; // chart instance itself
1837
+ * event; // native event object
1803
1838
  * ...
1804
1839
  * }
1805
1840
  */
@@ -1812,8 +1847,9 @@ var Store = /*#__PURE__*/function () {
1812
1847
  * @type {Function}
1813
1848
  * @default undefined
1814
1849
  * @example
1815
- * onout: function() {
1850
+ * onout: function(event) {
1816
1851
  * this; // chart instance itself
1852
+ * event; // native event object
1817
1853
  * ...
1818
1854
  * }
1819
1855
  */
@@ -2095,6 +2131,7 @@ var Store = /*#__PURE__*/function () {
2095
2131
  * - gauge
2096
2132
  * - line
2097
2133
  * - pie
2134
+ * - polar
2098
2135
  * - radar
2099
2136
  * - scatter
2100
2137
  * - spline
@@ -2123,6 +2160,7 @@ var Store = /*#__PURE__*/function () {
2123
2160
  * gauge,
2124
2161
  * line,
2125
2162
  * pie,
2163
+ * polar,
2126
2164
  * radar,
2127
2165
  * scatter,
2128
2166
  * spline,
@@ -2169,6 +2207,7 @@ var Store = /*#__PURE__*/function () {
2169
2207
  * gauge,
2170
2208
  * line,
2171
2209
  * pie,
2210
+ * polar,
2172
2211
  * radar,
2173
2212
  * scatter,
2174
2213
  * spline,
@@ -3573,28 +3612,38 @@ function generateResize() {
3573
3612
 
3574
3613
  return callResizeFn;
3575
3614
  }
3615
+
3576
3616
  /**
3577
3617
  * Generate transition queue function
3578
3618
  * @returns {Function}
3579
3619
  * @private
3580
3620
  */
3581
-
3582
3621
  function generateWait() {
3583
3622
  var transitionsToWait = [],
3584
- f = function (t, callback) {
3585
- var timer; // eslint-disable-next-line
3623
+ f = function (selection, callback) {
3624
+ var timer;
3625
+ /**
3626
+ * Check if transition is complete
3627
+ * @private
3628
+ */
3586
3629
 
3587
3630
  function loop() {
3588
3631
  var done = 0;
3589
3632
 
3590
- for (var i = 0, _t; _t = transitionsToWait[i]; i++) {
3591
- if (_t === !0 || _t.empty != null && _t.empty()) {
3633
+ for (var i = 0, t; t = transitionsToWait[i]; i++) {
3634
+ if (t === !0 || t.empty != null && t.empty()) {
3592
3635
  done++;
3593
3636
  continue;
3637
+ } // when tab isn't visible exit loop
3638
+
3639
+
3640
+ if (isTabVisible() === !1) {
3641
+ done = transitionsToWait.length;
3642
+ break;
3594
3643
  }
3595
3644
 
3596
3645
  try {
3597
- _t.transition();
3646
+ t.transition();
3598
3647
  } catch (e) {
3599
3648
  done++;
3600
3649
  }
@@ -3610,7 +3659,8 @@ function generateWait() {
3610
3659
  }
3611
3660
 
3612
3661
  loop();
3613
- };
3662
+ }; // 'f' is called as selection.call(f, ...);
3663
+
3614
3664
 
3615
3665
  f.add = function (t) {
3616
3666
  isArray(t) ? transitionsToWait = transitionsToWait.concat(t) : transitionsToWait.push(t);
@@ -5619,14 +5669,15 @@ var colorizePattern = function (pattern, color, id) {
5619
5669
 
5620
5670
  /**
5621
5671
  * Append data backgound color filter definition
5672
+ * @param {string} color Color string
5622
5673
  * @private
5623
5674
  */
5624
- generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter() {
5675
+ generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter(color) {
5625
5676
  var $$ = this,
5626
5677
  $el = $$.$el,
5627
5678
  config = $$.config,
5628
5679
  state = $$.state,
5629
- backgroundColors = config.data_labels_backgroundColors;
5680
+ backgroundColors = color || config.data_labels_backgroundColors;
5630
5681
 
5631
5682
  if (backgroundColors) {
5632
5683
  var ids = [];
@@ -5638,7 +5689,7 @@ var colorizePattern = function (pattern, color, id) {
5638
5689
  }
5639
5690
 
5640
5691
  ids.forEach(function (v) {
5641
- var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v);
5692
+ var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : "");
5642
5693
  $el.defs.append("filter").attr("x", "0").attr("y", "0").attr("width", "1").attr("height", "1").attr("id", id).html("<feFlood flood-color=\"" + (v === "" ? backgroundColors : backgroundColors[v]) + "\" /><feComposite in=\"SourceGraphic\"/>");
5643
5694
  });
5644
5695
  }
@@ -6128,7 +6179,7 @@ function getFormat($$, typeValue, v) {
6128
6179
  defaultArcValueFormat = $$.defaultArcValueFormat,
6129
6180
  yFormat = $$.yFormat,
6130
6181
  y2Format = $$.y2Format,
6131
- hasArc = $$.hasArcType(null, ["gauge", "radar"]);
6182
+ hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
6132
6183
  return function (v, ratio, id) {
6133
6184
  var format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat;
6134
6185
  return format.call($$, v, ratio);
@@ -6140,6 +6191,9 @@ function getFormat($$, typeValue, v) {
6140
6191
  defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
6141
6192
  return (ratio * 100).toFixed(1) + "%";
6142
6193
  },
6194
+ defaultPolarValueFormat: function defaultPolarValueFormat(v) {
6195
+ return "" + v;
6196
+ },
6143
6197
  dataLabelFormat: function dataLabelFormat(targetId) {
6144
6198
  var $$ = this,
6145
6199
  dataLabels = $$.config.data_labels,
@@ -6904,7 +6958,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
6904
6958
  // arc
6905
6959
  $el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform); // radar
6906
6960
 
6907
- $el.radar && $$.redrawRadar();
6961
+ $el.radar && $$.redrawRadar(); // polar
6962
+
6963
+ $el.polar && $$.redrawPolar();
6908
6964
  } // @TODO: Axis & Radar type
6909
6965
 
6910
6966
 
@@ -9225,6 +9281,9 @@ function getTextPos(pos, width) {
9225
9281
  } else if (target === "arc") {
9226
9282
  x = state.arcWidth / 2;
9227
9283
  y = state.arcHeight / 2;
9284
+ } else if (target === "polar") {
9285
+ x = state.arcWidth / 2;
9286
+ y = state.arcHeight / 2;
9228
9287
  } else if (target === "radar") {
9229
9288
  var _$$$getRadarSize = $$.getRadarSize(),
9230
9289
  width = _$$$getRadarSize[0];
@@ -9440,11 +9499,14 @@ function getTextPos(pos, width) {
9440
9499
  isDonutType: function isDonutType(d) {
9441
9500
  return this.isTypeOf(d, "donut");
9442
9501
  },
9502
+ isPolarType: function isPolarType(d) {
9503
+ return this.isTypeOf(d, "polar");
9504
+ },
9443
9505
  isRadarType: function isRadarType(d) {
9444
9506
  return this.isTypeOf(d, "radar");
9445
9507
  },
9446
9508
  isArcType: function isArcType(d) {
9447
- return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
9509
+ return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isPolarType(d) || this.isRadarType(d);
9448
9510
  },
9449
9511
  // determine if is 'circle' data point
9450
9512
  isCirclePoint: function isCirclePoint(node) {
@@ -9724,10 +9786,9 @@ var ChartInternal = /*#__PURE__*/function () {
9724
9786
 
9725
9787
  _proto.initParams = function initParams() {
9726
9788
  var $$ = this,
9727
- _ref = $$,
9728
- config = _ref.config,
9729
- format = _ref.format,
9730
- state = _ref.state,
9789
+ config = $$.config,
9790
+ format = $$.format,
9791
+ state = $$.state,
9731
9792
  isRotated = config.axis_rotated;
9732
9793
  // datetime to be used for uniqueness
9733
9794
  state.datetimeId = "bb-" + +new Date() * getRandom();
@@ -9772,7 +9833,8 @@ var ChartInternal = /*#__PURE__*/function () {
9772
9833
  $el = $$.$el,
9773
9834
  org = $$.org,
9774
9835
  hasAxis = state.hasAxis,
9775
- hasInteraction = config.interaction_enabled;
9836
+ hasInteraction = config.interaction_enabled,
9837
+ hasPolar = $$.hasType("polar");
9776
9838
 
9777
9839
  // for arc type, set axes to not be shown
9778
9840
  // $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
@@ -9830,26 +9892,30 @@ var ChartInternal = /*#__PURE__*/function () {
9830
9892
  $el.svg = $el.chart.append("svg").style("overflow", "hidden").style("display", "block");
9831
9893
 
9832
9894
  if (hasInteraction && state.inputType) {
9833
- var isTouch = state.inputType === "touch";
9834
- $el.svg.on(isTouch ? "touchstart" : "mouseenter", function () {
9835
- return callFn(config.onover, $$.api);
9836
- }).on(isTouch ? "touchend" : "mouseleave", function () {
9837
- return callFn(config.onout, $$.api);
9838
- });
9895
+ var _onclick,
9896
+ _onover,
9897
+ _onout,
9898
+ isTouch = state.inputType === "touch",
9899
+ _config = config,
9900
+ onclick = _config.onclick,
9901
+ onover = _config.onover,
9902
+ onout = _config.onout;
9903
+
9904
+ $el.svg.on("click", ((_onclick = onclick) == null ? void 0 : _onclick.bind($$.api)) || null).on(isTouch ? "touchstart" : "mouseenter", ((_onover = onover) == null ? void 0 : _onover.bind($$.api)) || null).on(isTouch ? "touchend" : "mouseleave", ((_onout = onout) == null ? void 0 : _onout.bind($$.api)) || null);
9839
9905
  }
9840
9906
 
9841
9907
  config.svg_classname && $el.svg.attr("class", config.svg_classname); // Define defs
9842
9908
 
9843
9909
  var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
9844
9910
 
9845
- if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
9911
+ if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
9846
9912
  $el.defs = $el.svg.append("defs");
9847
9913
 
9848
9914
  if (hasAxis) {
9849
9915
  ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
9850
9916
  $$.appendClip($el.defs, state.clip[v]);
9851
9917
  });
9852
- } // Append data backgound color filter definition
9918
+ } // Append data background color filter definition
9853
9919
 
9854
9920
 
9855
9921
  $$.generateDataLabelBackgroundColorFilter(); // set color patterns
@@ -9952,6 +10018,8 @@ var ChartInternal = /*#__PURE__*/function () {
9952
10018
  }
9953
10019
  });
9954
10020
  } else {
10021
+ var hasPolar = $$.hasType("polar");
10022
+
9955
10023
  if (!hasRadar) {
9956
10024
  types.push("Arc", "Pie");
9957
10025
  }
@@ -9960,6 +10028,8 @@ var ChartInternal = /*#__PURE__*/function () {
9960
10028
  types.push("Gauge");
9961
10029
  } else if (hasRadar) {
9962
10030
  types.push("Radar");
10031
+ } else if (hasPolar) {
10032
+ types.push("Polar");
9963
10033
  }
9964
10034
  }
9965
10035
 
@@ -10051,7 +10121,11 @@ var ChartInternal = /*#__PURE__*/function () {
10051
10121
  var $$ = this,
10052
10122
  _$$$state2 = $$.state,
10053
10123
  hasAxis = _$$$state2.hasAxis,
10054
- hasRadar = _$$$state2.hasRadar;
10124
+ hasRadar = _$$$state2.hasRadar,
10125
+ helper = function (type) {
10126
+ return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
10127
+ };
10128
+
10055
10129
  // Text
10056
10130
  $$.updateTargetsForText(targets);
10057
10131
 
@@ -10060,35 +10134,55 @@ var ChartInternal = /*#__PURE__*/function () {
10060
10134
  var name = capitalize(v);
10061
10135
 
10062
10136
  if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
10063
- $$["updateTargetsFor" + name](targets.filter($$["is" + name + "Type"].bind($$)));
10137
+ helper(name);
10064
10138
  }
10065
10139
  }); // Sub Chart
10066
10140
 
10067
- $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets);
10068
- } else {
10069
- // Arc & Radar
10070
- $$.hasArcType(targets) && (hasRadar ? $$.updateTargetsForRadar(targets.filter($$.isRadarType.bind($$))) : $$.updateTargetsForArc(targets.filter($$.isArcType.bind($$))));
10071
- } // circle
10141
+ $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets); // Arc, Polar, Radar
10142
+ } else if ($$.hasArcType(targets)) {
10143
+ var _type = "Arc";
10144
+
10145
+ if (hasRadar) {
10146
+ _type = "Radar";
10147
+ } else if ($$.hasType("polar")) {
10148
+ _type = "Polar";
10149
+ }
10072
10150
 
10151
+ helper(_type);
10152
+ } // Point types
10073
10153
 
10074
- if ($$.hasType("bubble") || $$.hasType("scatter")) {
10154
+
10155
+ var hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
10156
+
10157
+ if (hasPointType) {
10075
10158
  $$.updateTargetForCircle == null ? void 0 : $$.updateTargetForCircle();
10076
10159
  } // Fade-in each chart
10077
10160
 
10078
10161
 
10079
- $$.showTargets();
10162
+ $$.filterTargetsToShowAtInit(hasPointType);
10080
10163
  }
10081
10164
  /**
10082
- * Display targeted elements
10165
+ * Display targeted elements at initialization
10166
+ * @param {boolean} hasPointType whether has point type(bubble, scatter) or not
10083
10167
  * @private
10084
10168
  */
10085
10169
  ;
10086
10170
 
10087
- _proto.showTargets = function showTargets() {
10171
+ _proto.filterTargetsToShowAtInit = function filterTargetsToShowAtInit(hasPointType) {
10172
+ if (hasPointType === void 0) {
10173
+ hasPointType = !1;
10174
+ }
10175
+
10088
10176
  var $$ = this,
10089
10177
  svg = $$.$el.svg,
10090
- $T = $$.$T;
10091
- $T(svg.selectAll("." + $COMMON.target).filter(function (d) {
10178
+ $T = $$.$T,
10179
+ selector = "." + $COMMON.target;
10180
+
10181
+ if (hasPointType) {
10182
+ selector += ", ." + $CIRCLE.chartCircles + " > ." + $CIRCLE.circles;
10183
+ }
10184
+
10185
+ $T(svg.selectAll(selector).filter(function (d) {
10092
10186
  return $$.isTargetToShow(d.id);
10093
10187
  })).style("opacity", null);
10094
10188
  };
@@ -10123,8 +10217,9 @@ var ChartInternal = /*#__PURE__*/function () {
10123
10217
 
10124
10218
  _proto.initialOpacity = function initialOpacity(d) {
10125
10219
  var $$ = this,
10126
- withoutFadeIn = $$.state.withoutFadeIn;
10127
- return $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0";
10220
+ withoutFadeIn = $$.state.withoutFadeIn,
10221
+ r = $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0";
10222
+ return r;
10128
10223
  };
10129
10224
 
10130
10225
  _proto.bindResize = function bindResize() {
@@ -10830,7 +10925,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
10830
10925
  candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
10831
10926
  candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !0);
10832
10927
 
10833
- if ($$.hasArcType()) {
10928
+ if ($$.hasArcType(null, ["polar"])) {
10834
10929
  $$.unexpandArc(targetIds);
10835
10930
  $$.hasType("gauge") && $$.undoMarkOverlapped($$, "." + $GAUGE.gaugeValue);
10836
10931
  }
@@ -10868,7 +10963,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
10868
10963
  candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
10869
10964
  // should be for all targets
10870
10965
  candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !1);
10871
- $$.hasArcType() && $$.unexpandArc(targetIds);
10966
+ $$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
10872
10967
 
10873
10968
  if (config.legend_show) {
10874
10969
  $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
@@ -11572,6 +11667,7 @@ extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus, api_
11572
11667
  * billboard.js project is licensed under the MIT license
11573
11668
  */
11574
11669
 
11670
+
11575
11671
  /**
11576
11672
  * Set the min/max value
11577
11673
  * @param {Chart} $$ Chart instance
@@ -11579,20 +11675,26 @@ extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus, api_
11579
11675
  * @param {object} value Value to be set
11580
11676
  * @private
11581
11677
  */
11582
-
11583
11678
  function setMinMax($$, type, value) {
11584
11679
  var config = $$.config,
11585
- axisY = "axis_y_" + type,
11586
- axisY2 = "axis_y2_" + type;
11680
+ helper = function (key, value) {
11681
+ var v = isNumber(value) ? value : value === !1 ? undefined : null;
11682
+
11683
+ if (v !== null) {
11684
+ config["axis_" + key + "_" + type] = v;
11685
+ }
11686
+ };
11587
11687
 
11588
11688
  if (isDefined(value)) {
11589
11689
  if (isObjectType(value)) {
11590
- isValue(value.x) && (config["axis_x_" + type] = value.x);
11591
- isValue(value.y) && (config[axisY] = value.y);
11592
- isValue(value.y2) && (config[axisY2] = value.y2);
11593
- } else {
11594
- config[axisY] = value;
11595
- config[axisY2] = value;
11690
+ Object.keys(value).forEach(function (key) {
11691
+ helper(key, value[key]);
11692
+ });
11693
+ } else if (isNumber(value) || value === !1) {
11694
+ // shorthand values affects only y and y2.
11695
+ ["y", "y2"].forEach(function (key) {
11696
+ helper(key, value);
11697
+ });
11596
11698
  }
11597
11699
 
11598
11700
  $$.redraw({
@@ -11678,8 +11780,9 @@ var axis = {
11678
11780
  * @instance
11679
11781
  * @memberof Chart
11680
11782
  * @param {object} min If min is given, specified axis' min value will be updated.<br>
11681
- * If no argument is given, the min values set on generating option for each axis will be returned.
11682
- * If not set any min values on generation, it will return `undefined`.
11783
+ * If no argument is given, the min values set on generating option for each axis will be returned.
11784
+ * If not set any min values on generation, it will return `undefined`.<br>
11785
+ * To unset specific axis max, set `false` to each of them.
11683
11786
  * @returns {object|undefined}
11684
11787
  * @example
11685
11788
  * // Update axis' min
@@ -11688,10 +11791,21 @@ var axis = {
11688
11791
  * y: 1000,
11689
11792
  * y2: 100
11690
11793
  * });
11794
+ *
11795
+ * // To unset specific axis min, set false to each of them.
11796
+ * chart.axis.min({
11797
+ * x: false,
11798
+ * y: false,
11799
+ * y2: false
11800
+ * });
11801
+ *
11802
+ * // shorthand (only affects y and y2 axis)
11803
+ * chart.axis.min(-50);
11804
+ * chart.axis.min(false);
11691
11805
  */
11692
11806
  min: function min(_min) {
11693
11807
  var $$ = this.internal;
11694
- return isValue(_min) ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
11808
+ return isValue(_min) || _min === !1 ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
11695
11809
  },
11696
11810
 
11697
11811
  /**
@@ -11700,8 +11814,9 @@ var axis = {
11700
11814
  * @instance
11701
11815
  * @memberof Chart
11702
11816
  * @param {object} max If max is given, specified axis' max value will be updated.<br>
11703
- * If no argument is given, the max values set on generating option for each axis will be returned.
11704
- * If not set any max values on generation, it will return `undefined`.
11817
+ * If no argument is given, the max values set on generating option for each axis will be returned.
11818
+ * If not set any max values on generation, it will return `undefined`.<br>
11819
+ * To unset specific axis max, set `false` to each of them.
11705
11820
  * @returns {object|undefined}
11706
11821
  * @example
11707
11822
  * // Update axis' label
@@ -11710,10 +11825,21 @@ var axis = {
11710
11825
  * y: 1000,
11711
11826
  * y2: 10000
11712
11827
  * });
11828
+ *
11829
+ * // To unset specific axis max, set false to each of them.
11830
+ * chart.axis.max({
11831
+ * x: false,
11832
+ * y: false,
11833
+ * y2: false
11834
+ * });
11835
+ *
11836
+ * // shorthand (only affects y and y2 axis)
11837
+ * chart.axis.max(10);
11838
+ * chart.axis.max(false);
11713
11839
  */
11714
11840
  max: function max(_max) {
11715
11841
  var $$ = this.internal;
11716
- return arguments.length ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max");
11842
+ return isValue(_max) || _max === !1 ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max");
11717
11843
  },
11718
11844
 
11719
11845
  /**
@@ -11721,7 +11847,9 @@ var axis = {
11721
11847
  * @function axis․range
11722
11848
  * @instance
11723
11849
  * @memberof Chart
11724
- * @param {object} range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned.
11850
+ * @param {object} range If range is given, specified axis' min and max value will be updated.
11851
+ * If no argument is given, the current min and max values for each axis will be returned.<br>
11852
+ * To unset specific axis max, set `false` to each of them.
11725
11853
  * @returns {object|undefined}
11726
11854
  * @example
11727
11855
  * // Update axis' label
@@ -11737,13 +11865,33 @@ var axis = {
11737
11865
  * y2: 10000
11738
11866
  * },
11739
11867
  * });
11868
+ *
11869
+ * // To unset specific axis max, set false to each of them.
11870
+ * chart.axis.range({
11871
+ * min: {
11872
+ * x: false,
11873
+ * y: false,
11874
+ * y2: false
11875
+ * },
11876
+ * max: {
11877
+ * x: false,
11878
+ * y: false,
11879
+ * y2: false
11880
+ * },
11881
+ * });
11882
+ *
11883
+ * // shorthand (only affects y and y2 axis)
11884
+ * chart.axis.range({ min: -50, max: 1000 });
11885
+ * chart.axis.range({ min: false, max: false });
11740
11886
  */
11741
11887
  range: function range(_range) {
11742
11888
  var axis = this.axis;
11743
11889
 
11744
11890
  if (arguments.length) {
11745
- isDefined(_range.max) && axis.max(_range.max);
11746
- isDefined(_range.min) && axis.min(_range.min);
11891
+ var min = _range.min,
11892
+ max = _range.max;
11893
+ isDefined(max) && axis.max(max);
11894
+ isDefined(min) && axis.min(min);
11747
11895
  } else {
11748
11896
  return {
11749
11897
  max: axis.max(),
@@ -13911,7 +14059,7 @@ var Axis_Axis = /*#__PURE__*/function () {
13911
14059
  var prefix = "axis_" + key + "_",
13912
14060
  axisScale = scale[key];
13913
14061
 
13914
- if (config[prefix + "show"] && axisScale) {
14062
+ if (axisScale) {
13915
14063
  var tickValues = config[prefix + "tick_values"],
13916
14064
  tickCount = config[prefix + "tick_count"];
13917
14065
  axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
@@ -13979,9 +14127,10 @@ var Axis_Axis = /*#__PURE__*/function () {
13979
14127
  }
13980
14128
 
13981
14129
  tickNodes.each(function (d) {
13982
- if (tickValues.indexOf(d) % intervalForCulling) {
13983
- var node = lines ? this.querySelector("text") : this;
13984
- node && (node.style.display = "none");
14130
+ var node = lines ? this.querySelector("text") : this;
14131
+
14132
+ if (node) {
14133
+ node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
13985
14134
  }
13986
14135
  });
13987
14136
  } else {
@@ -14717,7 +14866,9 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
14717
14866
  } else if (orgDataCount === 1 || ((_flowStart = flowStart) == null ? void 0 : _flowStart.x) === ((_flowEnd = flowEnd) == null ? void 0 : _flowEnd.x)) {
14718
14867
  translateX = x(orgDomain[0]) - x(domain[0]);
14719
14868
  } else {
14720
- translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(flowStart.x) - x(flowEnd.x);
14869
+ var _flowStart2;
14870
+
14871
+ translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(((_flowStart2 = flowStart) == null ? void 0 : _flowStart2.x) || 0) - x(flowEnd.x);
14721
14872
  }
14722
14873
 
14723
14874
  var scaleX = diffDomain(orgDomain) / diffDomain(domain);
@@ -17490,9 +17641,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17490
17641
  var $$ = this,
17491
17642
  config = $$.config,
17492
17643
  dataType = config.data_type,
17493
- padding = config.pie_padding,
17644
+ padding = config[dataType + "_padding"],
17494
17645
  startingAngle = config[dataType + "_startingAngle"] || 0,
17495
- padAngle = ($$.hasType("pie") && padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
17646
+ padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
17496
17647
  $$.pie = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.pie)().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) {
17497
17648
  return d.values.reduce(function (a, b) {
17498
17649
  return a + b.value;
@@ -17503,7 +17654,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17503
17654
  var $$ = this,
17504
17655
  config = $$.config,
17505
17656
  state = $$.state,
17506
- padding = config.pie_padding,
17657
+ dataType = config.data_type,
17658
+ padding = config[dataType + "_padding"],
17507
17659
  w = config.gauge_width || config.donut_width,
17508
17660
  gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
17509
17661
  // determine radius
@@ -17638,6 +17790,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17638
17790
  state = $$.state,
17639
17791
  singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
17640
17792
  hasMultiArcGauge = $$.hasMultiArcGauge(),
17793
+ hasPolar = $$.hasType("polar"),
17641
17794
  arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
17642
17795
  var _$$$getRadius = $$.getRadius(d),
17643
17796
  innerRadius = _$$$getRadius.innerRadius;
@@ -17645,9 +17798,16 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17645
17798
  return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
17646
17799
  }).outerRadius(function (d) {
17647
17800
  var _$$$getRadius2 = $$.getRadius(d),
17648
- outerRadius = _$$$getRadius2.outerRadius;
17801
+ outerRadius = _$$$getRadius2.outerRadius,
17802
+ radius = outerRadius;
17803
+
17804
+ if (hasMultiArcGauge) {
17805
+ radius = state.radius - singleArcWidth * d.index;
17806
+ } else if (hasPolar) {
17807
+ radius = $$.getPolarOuterRadius(d, outerRadius);
17808
+ }
17649
17809
 
17650
- return hasMultiArcGauge ? state.radius - singleArcWidth * d.index : outerRadius;
17810
+ return radius;
17651
17811
  }),
17652
17812
  newArc = function (d, withoutUpdate) {
17653
17813
  var path = "M 0 0";
@@ -17705,6 +17865,13 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17705
17865
  getArc: function getArc(d, withoutUpdate, force) {
17706
17866
  return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
17707
17867
  },
17868
+
17869
+ /**
17870
+ * Set transform attributes to arc label text
17871
+ * @param {object} d Data object
17872
+ * @returns {string} Translate attribute string
17873
+ * @private
17874
+ */
17708
17875
  transformForArcLabel: function transformForArcLabel(d) {
17709
17876
  var $$ = this,
17710
17877
  config = $$.config,
@@ -17719,16 +17886,24 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17719
17886
  y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
17720
17887
  translate = "translate(" + x + "," + y + ")";
17721
17888
  } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
17722
- var _$$$getRadius4 = $$.getRadius(d),
17723
- outerRadius = _$$$getRadius4.outerRadius,
17724
- c = this.svgArc.centroid(updated),
17889
+ var _filter$map,
17890
+ _$$$getRadius4 = $$.getRadius(d),
17891
+ outerRadius = _$$$getRadius4.outerRadius;
17892
+
17893
+ if ($$.hasType("polar")) {
17894
+ outerRadius = $$.getPolarOuterRadius(d, outerRadius);
17895
+ }
17896
+
17897
+ var c = this.svgArc.centroid(updated),
17725
17898
  _c$map = c.map(function (v) {
17726
17899
  return isNaN(v) ? 0 : v;
17727
17900
  }),
17728
17901
  x = _c$map[0],
17729
17902
  y = _c$map[1],
17730
17903
  h = Math.sqrt(x * x + y * y),
17731
- ratio = $$.hasType("donut") && config.donut_label_ratio || $$.hasType("pie") && config.pie_label_ratio;
17904
+ ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
17905
+ return config[v + "_label_ratio"];
17906
+ })) == null ? void 0 : _filter$map[0];
17732
17907
 
17733
17908
  if (ratio) {
17734
17909
  ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
@@ -17756,10 +17931,11 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17756
17931
 
17757
17932
  if ($$.shouldShowArcLabel()) {
17758
17933
  selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBacgroundColor.bind($$)).each(function (d) {
17759
- var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
17934
+ var _filter,
17935
+ node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
17760
17936
  updated = $$.updateAngle(d),
17761
17937
  ratio = $$.getRatio("arc", updated),
17762
- isUnderThreshold = $$.meetsLabelThreshold(ratio, $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge" || $$.hasType("pie") && "pie");
17938
+ isUnderThreshold = $$.meetsLabelThreshold(ratio, (_filter = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _filter[0]);
17763
17939
 
17764
17940
  if (isUnderThreshold) {
17765
17941
  var value = (updated || d).value,
@@ -17847,21 +18023,20 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17847
18023
  shouldShowArcLabel: function shouldShowArcLabel() {
17848
18024
  var $$ = this,
17849
18025
  config = $$.config;
17850
- return ["pie", "donut", "gauge"].some(function (v) {
18026
+ return ["donut", "gauge", "pie", "polar"].some(function (v) {
17851
18027
  return $$.hasType(v) && config[v + "_label_show"];
17852
18028
  });
17853
18029
  },
17854
18030
  getArcLabelFormat: function getArcLabelFormat() {
17855
18031
  var $$ = this,
17856
18032
  config = $$.config,
17857
- format = config.pie_label_format;
17858
-
17859
- if ($$.hasType("gauge")) {
17860
- format = config.gauge_label_format;
17861
- } else if ($$.hasType("donut")) {
17862
- format = config.donut_label_format;
17863
- }
18033
+ format = function (v) {
18034
+ return v;
18035
+ };
17864
18036
 
18037
+ ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
18038
+ format = config[v + "_label_format"];
18039
+ });
17865
18040
  return isFunction(format) ? format.bind($$.api) : format;
17866
18041
  },
17867
18042
  getArcTitle: function getArcTitle() {
@@ -17993,6 +18168,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17993
18168
  }); // bind arc events
17994
18169
 
17995
18170
  hasInteraction && $$.bindArcEvent(mainArc);
18171
+ $$.hasType("polar") && $$.redrawPolar();
17996
18172
  $$.hasType("gauge") && $$.redrawBackgroundArcs();
17997
18173
  $$.redrawArcText(duration);
17998
18174
  },
@@ -18513,7 +18689,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18513
18689
 
18514
18690
  /**
18515
18691
  * Determine if given stacking bar data is radius type
18516
- * @param {Object} d Data row
18692
+ * @param {object} d Data row
18517
18693
  * @returns {boolean}
18518
18694
  */
18519
18695
  isStackingRadiusData: function isStackingRadiusData(d) {
@@ -19372,7 +19548,7 @@ var getTransitionName = function () {
19372
19548
  targets = data.targets.filter(function (d) {
19373
19549
  return _this.isScatterType(d) || _this.isBubbleType(d);
19374
19550
  });
19375
- var mainCircle = $el.main.select("." + $CIRCLE.chartCircles).style("pointer-events", "none").selectAll("." + $CIRCLE.circles).data(targets).attr("class", classCircles);
19551
+ var mainCircle = $el.main.select("." + $CIRCLE.chartCircles).style("pointer-events", "none").selectAll("." + $CIRCLE.circles).data(targets);
19376
19552
  mainCircle.exit().remove();
19377
19553
  enterNode = mainCircle.enter();
19378
19554
  } // Circles for each data point on lines
@@ -19383,6 +19559,11 @@ var getTransitionName = function () {
19383
19559
  });
19384
19560
  enterNode.append("g").attr("class", classCircles).style("cursor", function (d) {
19385
19561
  return isFunction(isSelectable) && isSelectable(d) ? "pointer" : null;
19562
+ }).style("opacity", function () {
19563
+ var _this$parentNode;
19564
+
19565
+ // if the parent node is .bb-chart-circles (bubble, scatter), initialize <g bb-circles> with opacity "0"
19566
+ return (_this$parentNode = this.parentNode) != null && _this$parentNode.classList.contains("bb-chart-circles") ? "0" : null;
19386
19567
  }); // Update date for selected circles
19387
19568
 
19388
19569
  selectionEnabled && targets.forEach(function (t) {
@@ -19800,6 +19981,124 @@ var getTransitionName = function () {
19800
19981
  }
19801
19982
  }
19802
19983
  });
19984
+ ;// CONCATENATED MODULE: ./src/ChartInternal/shape/polar.ts
19985
+ /**
19986
+ * Copyright (c) 2017 ~ present NAVER Corp.
19987
+ * billboard.js project is licensed under the MIT license
19988
+ */
19989
+
19990
+
19991
+
19992
+ /**
19993
+ * Get data max value
19994
+ * @param {object} $$ ChartInternal instance
19995
+ * @returns {number} max value
19996
+ * @private
19997
+ */
19998
+ function getDataMax($$) {
19999
+ var levelMax = $$.config.polar_level_max,
20000
+ dataMax = $$.getMinMaxData().max[0].value;
20001
+
20002
+ // Apply level max only when is greater than the data max value
20003
+ if (levelMax && levelMax > dataMax) {
20004
+ dataMax = levelMax;
20005
+ }
20006
+
20007
+ return dataMax;
20008
+ }
20009
+
20010
+ /* harmony default export */ var polar = ({
20011
+ /**
20012
+ * Initialize polar
20013
+ * @private
20014
+ */
20015
+ initPolar: function initPolar() {
20016
+ var $$ = this,
20017
+ arcs = $$.$el.arcs,
20018
+ config = $$.config,
20019
+ levelTextShow = config.polar_level_text_show,
20020
+ levelTextBgColor = config.polar_level_text_backgroundColor;
20021
+ // append <g> for level
20022
+ arcs.levels = arcs.append("g").attr("class", $LEVEL.levels); // set level text background color
20023
+
20024
+ if (levelTextShow && levelTextBgColor) {
20025
+ $$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
20026
+ }
20027
+ },
20028
+
20029
+ /**
20030
+ * Get polar outer radius according to the data value
20031
+ * @param {object} d Data object
20032
+ * @param {numbet} outerRadius Outer radius
20033
+ * @returns {number} outer radius
20034
+ * @private
20035
+ */
20036
+ getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) {
20037
+ var dataMax = getDataMax(this);
20038
+ return (d == null ? void 0 : d.data.values[0].value) / dataMax * outerRadius;
20039
+ },
20040
+
20041
+ /**
20042
+ * Update polar based on given data array
20043
+ * @param {object} targets Data object
20044
+ * @private
20045
+ */
20046
+ updateTargetsForPolar: function updateTargetsForPolar(targets) {
20047
+ // borrow from Arc
20048
+ this.updateTargetsForArc(targets);
20049
+ },
20050
+
20051
+ /**
20052
+ * Called whenever redraw happens
20053
+ * @private
20054
+ */
20055
+ redrawPolar: function redrawPolar() {
20056
+ var $$ = this,
20057
+ config = $$.config;
20058
+ config.polar_level_show && $$.updatePolarLevel();
20059
+ },
20060
+
20061
+ /**
20062
+ * Update polar level circle
20063
+ * @private
20064
+ */
20065
+ updatePolarLevel: function updatePolarLevel() {
20066
+ var $$ = this,
20067
+ config = $$.config,
20068
+ state = $$.state,
20069
+ levels = $$.$el.arcs.levels,
20070
+ depth = config.polar_level_depth,
20071
+ dataMax = getDataMax($$),
20072
+ levelData = getRange(0, depth),
20073
+ outerRadius = state.radius,
20074
+ levelRatio = levelData.map(function (l) {
20075
+ return outerRadius * ((l + 1) / depth);
20076
+ }),
20077
+ levelTextFormat = (config.polar_level_text_format || function () {}).bind($$.api),
20078
+ level = levels.selectAll("." + $LEVEL.level).data(levelData);
20079
+
20080
+ level.exit().remove();
20081
+ var levelEnter = level.enter().append("g").attr("class", function (d, i) {
20082
+ return $LEVEL.level + " " + $LEVEL.level + "-" + i;
20083
+ }); // cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
20084
+
20085
+ levelEnter.append("circle");
20086
+ levelEnter.merge(level).selectAll("circle").style("visibility", config.polar_level_show ? null : "hidden").attr("cx", 0).attr("cy", 0).attr("r", function (d) {
20087
+ return levelRatio[d];
20088
+ });
20089
+
20090
+ if (config.polar_level_text_show) {
20091
+ var levelTextBackgroundColor = config.polar_level_text_backgroundColor,
20092
+ defsId = "#" + state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(levelTextBackgroundColor);
20093
+ levelEnter.append("text").style("text-anchor", "middle");
20094
+ levelEnter.merge(level).selectAll("text").attr("dy", function (d) {
20095
+ return -levelRatio[d] + 5;
20096
+ }).attr("filter", levelTextBackgroundColor ? "url(" + defsId + ")" : null).text(function (d) {
20097
+ return levelTextFormat(dataMax / levelData.length * (d + 1));
20098
+ });
20099
+ }
20100
+ }
20101
+ });
19803
20102
  ;// CONCATENATED MODULE: ./src/ChartInternal/shape/radar.ts
19804
20103
  /**
19805
20104
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -19840,7 +20139,7 @@ var cacheKey = KEY.radarPoints;
19840
20139
  if ($$.hasType("radar")) {
19841
20140
  $el.radar = $el.main.select("." + $COMMON.chart).append("g").attr("class", $RADAR.chartRadars); // level
19842
20141
 
19843
- $el.radar.levels = $el.radar.append("g").attr("class", $RADAR.levels); // axis
20142
+ $el.radar.levels = $el.radar.append("g").attr("class", $LEVEL.levels); // axis
19844
20143
 
19845
20144
  $el.radar.axes = $el.radar.append("g").attr("class", $AXIS.axis); // shapes
19846
20145
 
@@ -19961,11 +20260,11 @@ var cacheKey = KEY.radarPoints;
19961
20260
  });
19962
20261
  return pos.join(" ");
19963
20262
  }),
19964
- level = radarLevels.selectAll("." + $RADAR.level).data(levelData);
20263
+ level = radarLevels.selectAll("." + $LEVEL.level).data(levelData);
19965
20264
 
19966
20265
  level.exit().remove();
19967
20266
  var levelEnter = level.enter().append("g").attr("class", function (d, i) {
19968
- return $RADAR.level + " " + $RADAR.level + "-" + i;
20267
+ return $LEVEL.level + " " + $LEVEL.level + "-" + i;
19969
20268
  });
19970
20269
  levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden");
19971
20270
 
@@ -20971,6 +21270,91 @@ var cacheKey = KEY.radarPoints;
20971
21270
  pie_padding: 0,
20972
21271
  pie_startingAngle: 0
20973
21272
  });
21273
+ ;// CONCATENATED MODULE: ./src/config/Options/shape/polar.ts
21274
+ /**
21275
+ * Copyright (c) 2017 ~ present NAVER Corp.
21276
+ * billboard.js project is licensed under the MIT license
21277
+ */
21278
+
21279
+ /**
21280
+ * x Axis config options
21281
+ */
21282
+ /* harmony default export */ var shape_polar = ({
21283
+ /**
21284
+ * Set polar options
21285
+ * @name polar
21286
+ * @memberof Options
21287
+ * @type {object}
21288
+ * @property {object} polar Polar object
21289
+ * @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
21290
+ * @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
21291
+ * @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
21292
+ * @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
21293
+ * @property {number} [polar.level.depth=3] Set the level depth.
21294
+ * @property {boolean} [polar.level.show=true] Show or hide level.
21295
+ * @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
21296
+ * @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
21297
+ * @property {boolean} [polar.level.text.show=true] Show or hide level text.
21298
+ * @property {number} [polar.padAngle=0] Set padding between data.
21299
+ * @property {number} [polar.padding=0] Sets the gap between pie arcs.
21300
+ * @property {number} [polar.startingAngle=0] Set starting angle where data draws.
21301
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
21302
+ * @example
21303
+ * polar: {
21304
+ * label: {
21305
+ * show: false,
21306
+ * format: function(value, ratio, id) {
21307
+ * return d3.format("$")(value);
21308
+ *
21309
+ * // to multiline, return with '\n' character
21310
+ * // return value +"%\nLine1\n2Line2";
21311
+ * },
21312
+ *
21313
+ * // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
21314
+ * // if data value is below than 0.1, text label will be hidden.
21315
+ * threshold: 0.1,
21316
+ *
21317
+ * // set ratio callback. Should return ratio value
21318
+ * ratio: function(d, radius, h) {
21319
+ * ...
21320
+ * return ratio;
21321
+ * },
21322
+ * // or set ratio number
21323
+ * ratio: 0.5
21324
+ * },
21325
+ * level: {
21326
+ * depth: 3,
21327
+ * max: 500,
21328
+ * show: true,
21329
+ * text: {
21330
+ * format: function(x) {
21331
+ * return x + "%";
21332
+ * },
21333
+ * show: true,
21334
+ * backgroundColor: "red"
21335
+ * }
21336
+ * },
21337
+ * padAngle: 0.1,
21338
+ * padding: 0,
21339
+ * startingAngle: 1
21340
+ * }
21341
+ */
21342
+ polar_label_show: !0,
21343
+ polar_label_format: undefined,
21344
+ polar_label_threshold: .05,
21345
+ polar_label_ratio: undefined,
21346
+ polar_level_depth: 3,
21347
+ polar_level_max: undefined,
21348
+ polar_level_show: !0,
21349
+ polar_level_text_backgroundColor: "#fff",
21350
+ polar_level_text_format: function polar_level_text_format(x) {
21351
+ return x % 1 === 0 ? x : x.toFixed(2);
21352
+ },
21353
+ polar_level_text_show: !0,
21354
+ polar_padAngle: 0,
21355
+ polar_padding: 0,
21356
+ polar_startingAngle: 0
21357
+ });
20974
21358
  ;// CONCATENATED MODULE: ./src/config/Options/shape/radar.ts
20975
21359
  /**
20976
21360
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -21071,6 +21455,7 @@ var cacheKey = KEY.radarPoints;
21071
21455
 
21072
21456
 
21073
21457
 
21458
+
21074
21459
  // Options
21075
21460
 
21076
21461
 
@@ -21087,6 +21472,7 @@ var cacheKey = KEY.radarPoints;
21087
21472
 
21088
21473
 
21089
21474
 
21475
+
21090
21476
  /**
21091
21477
  * Extend Axis
21092
21478
  * @param {Array} module Module to be extended
@@ -21179,6 +21565,11 @@ var _area = function area() {
21179
21565
  return extendArc(undefined, [pie]), (shape_pie = function () {
21180
21566
  return TYPE.PIE;
21181
21567
  })();
21568
+ },
21569
+ resolver_shape_polar = function () {
21570
+ return extendArc([polar], [shape_polar]), (resolver_shape_polar = function () {
21571
+ return TYPE.POLAR;
21572
+ })();
21182
21573
  },
21183
21574
  resolver_shape_radar = function () {
21184
21575
  return extendArc([point, radar], [common_point, shape_radar]), (resolver_shape_radar = function () {
@@ -23046,7 +23437,7 @@ var _defaults = {},
23046
23437
  * bb.version; // "1.0.0"
23047
23438
  * @memberof bb
23048
23439
  */
23049
- version: "3.3.3",
23440
+ version: "3.4.0",
23050
23441
 
23051
23442
  /**
23052
23443
  * Generate chart
@@ -23094,6 +23485,7 @@ var _defaults = {},
23094
23485
  * gauge,
23095
23486
  * line,
23096
23487
  * pie,
23488
+ * polar,
23097
23489
  * radar,
23098
23490
  * scatter,
23099
23491
  * spline,
@@ -23180,7 +23572,7 @@ var _defaults = {},
23180
23572
  };
23181
23573
  /**
23182
23574
  * @namespace bb
23183
- * @version 3.3.3
23575
+ * @version 3.4.0
23184
23576
  */
23185
23577
  ;// CONCATENATED MODULE: ./src/index.ts
23186
23578
  /**