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
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-next.1
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]
@@ -1117,26 +1120,36 @@ function isTabVisible() {
1117
1120
 
1118
1121
 
1119
1122
  function convertInputType(mouse, touch) {
1120
- var hasTouch = !1;
1123
+ var DocumentTouch = win.DocumentTouch,
1124
+ matchMedia = win.matchMedia,
1125
+ navigator = win.navigator,
1126
+ hasTouch = !1;
1121
1127
 
1122
1128
  if (touch) {
1123
1129
  // 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
1130
+ if (navigator && "maxTouchPoints" in navigator) {
1131
+ hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
1126
1132
  // 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) {
1133
+ } else if ("ontouchmove" in win || DocumentTouch && browser_doc instanceof DocumentTouch) {
1128
1134
  hasTouch = !0;
1129
1135
  } else {
1130
1136
  // 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;
1137
+ if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
1138
+ hasTouch = !0;
1139
+ } else {
1140
+ // Only as a last resort, fall back to user agent sniffing
1141
+ var UA = navigator.userAgent;
1142
+ hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
1135
1143
  }
1136
1144
  }
1137
- }
1145
+ } // 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
1146
+ // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
1147
+ // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
1138
1148
 
1139
- var hasMouse = mouse && !hasTouch ? "onmouseover" in win : !1;
1149
+
1150
+ var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1151
+ return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1152
+ });
1140
1153
  return hasMouse && "mouse" || hasTouch && "touch" || null;
1141
1154
  }
1142
1155
  ;// CONCATENATED MODULE: ./src/module/error.ts
@@ -1317,12 +1330,14 @@ var $GRID = {
1317
1330
  ygridLines: "bb-ygrid-lines",
1318
1331
  ygrids: "bb-ygrids"
1319
1332
  };
1320
- var $RADAR = {
1321
- chartRadar: "bb-chart-radar",
1322
- chartRadars: "bb-chart-radars",
1333
+ var $LEVEL = {
1323
1334
  level: "bb-level",
1324
1335
  levels: "bb-levels"
1325
1336
  };
1337
+ var $RADAR = {
1338
+ chartRadar: "bb-chart-radar",
1339
+ chartRadars: "bb-chart-radars"
1340
+ };
1326
1341
  var $REGION = {
1327
1342
  region: "bb-region",
1328
1343
  regions: "bb-regions"
@@ -2095,6 +2110,7 @@ var Store = /*#__PURE__*/function () {
2095
2110
  * - gauge
2096
2111
  * - line
2097
2112
  * - pie
2113
+ * - polar
2098
2114
  * - radar
2099
2115
  * - scatter
2100
2116
  * - spline
@@ -2123,6 +2139,7 @@ var Store = /*#__PURE__*/function () {
2123
2139
  * gauge,
2124
2140
  * line,
2125
2141
  * pie,
2142
+ * polar,
2126
2143
  * radar,
2127
2144
  * scatter,
2128
2145
  * spline,
@@ -2169,6 +2186,7 @@ var Store = /*#__PURE__*/function () {
2169
2186
  * gauge,
2170
2187
  * line,
2171
2188
  * pie,
2189
+ * polar,
2172
2190
  * radar,
2173
2191
  * scatter,
2174
2192
  * spline,
@@ -5619,14 +5637,15 @@ var colorizePattern = function (pattern, color, id) {
5619
5637
 
5620
5638
  /**
5621
5639
  * Append data backgound color filter definition
5640
+ * @param {string} color Color string
5622
5641
  * @private
5623
5642
  */
5624
- generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter() {
5643
+ generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter(color) {
5625
5644
  var $$ = this,
5626
5645
  $el = $$.$el,
5627
5646
  config = $$.config,
5628
5647
  state = $$.state,
5629
- backgroundColors = config.data_labels_backgroundColors;
5648
+ backgroundColors = color || config.data_labels_backgroundColors;
5630
5649
 
5631
5650
  if (backgroundColors) {
5632
5651
  var ids = [];
@@ -5638,7 +5657,7 @@ var colorizePattern = function (pattern, color, id) {
5638
5657
  }
5639
5658
 
5640
5659
  ids.forEach(function (v) {
5641
- var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v);
5660
+ var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : "");
5642
5661
  $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
5662
  });
5644
5663
  }
@@ -6128,7 +6147,7 @@ function getFormat($$, typeValue, v) {
6128
6147
  defaultArcValueFormat = $$.defaultArcValueFormat,
6129
6148
  yFormat = $$.yFormat,
6130
6149
  y2Format = $$.y2Format,
6131
- hasArc = $$.hasArcType(null, ["gauge", "radar"]);
6150
+ hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
6132
6151
  return function (v, ratio, id) {
6133
6152
  var format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat;
6134
6153
  return format.call($$, v, ratio);
@@ -6140,6 +6159,9 @@ function getFormat($$, typeValue, v) {
6140
6159
  defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
6141
6160
  return (ratio * 100).toFixed(1) + "%";
6142
6161
  },
6162
+ defaultPolarValueFormat: function defaultPolarValueFormat(v) {
6163
+ return "" + v;
6164
+ },
6143
6165
  dataLabelFormat: function dataLabelFormat(targetId) {
6144
6166
  var $$ = this,
6145
6167
  dataLabels = $$.config.data_labels,
@@ -6904,7 +6926,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
6904
6926
  // arc
6905
6927
  $el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform); // radar
6906
6928
 
6907
- $el.radar && $$.redrawRadar();
6929
+ $el.radar && $$.redrawRadar(); // polar
6930
+
6931
+ $el.polar && $$.redrawPolar();
6908
6932
  } // @TODO: Axis & Radar type
6909
6933
 
6910
6934
 
@@ -9225,6 +9249,9 @@ function getTextPos(pos, width) {
9225
9249
  } else if (target === "arc") {
9226
9250
  x = state.arcWidth / 2;
9227
9251
  y = state.arcHeight / 2;
9252
+ } else if (target === "polar") {
9253
+ x = state.arcWidth / 2;
9254
+ y = state.arcHeight / 2;
9228
9255
  } else if (target === "radar") {
9229
9256
  var _$$$getRadarSize = $$.getRadarSize(),
9230
9257
  width = _$$$getRadarSize[0];
@@ -9440,11 +9467,14 @@ function getTextPos(pos, width) {
9440
9467
  isDonutType: function isDonutType(d) {
9441
9468
  return this.isTypeOf(d, "donut");
9442
9469
  },
9470
+ isPolarType: function isPolarType(d) {
9471
+ return this.isTypeOf(d, "polar");
9472
+ },
9443
9473
  isRadarType: function isRadarType(d) {
9444
9474
  return this.isTypeOf(d, "radar");
9445
9475
  },
9446
9476
  isArcType: function isArcType(d) {
9447
- return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
9477
+ return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isPolarType(d) || this.isRadarType(d);
9448
9478
  },
9449
9479
  // determine if is 'circle' data point
9450
9480
  isCirclePoint: function isCirclePoint(node) {
@@ -9772,7 +9802,8 @@ var ChartInternal = /*#__PURE__*/function () {
9772
9802
  $el = $$.$el,
9773
9803
  org = $$.org,
9774
9804
  hasAxis = state.hasAxis,
9775
- hasInteraction = config.interaction_enabled;
9805
+ hasInteraction = config.interaction_enabled,
9806
+ hasPolar = $$.hasType("polar");
9776
9807
 
9777
9808
  // for arc type, set axes to not be shown
9778
9809
  // $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
@@ -9842,14 +9873,14 @@ var ChartInternal = /*#__PURE__*/function () {
9842
9873
 
9843
9874
  var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
9844
9875
 
9845
- if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
9876
+ if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
9846
9877
  $el.defs = $el.svg.append("defs");
9847
9878
 
9848
9879
  if (hasAxis) {
9849
9880
  ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
9850
9881
  $$.appendClip($el.defs, state.clip[v]);
9851
9882
  });
9852
- } // Append data backgound color filter definition
9883
+ } // Append data background color filter definition
9853
9884
 
9854
9885
 
9855
9886
  $$.generateDataLabelBackgroundColorFilter(); // set color patterns
@@ -9952,6 +9983,8 @@ var ChartInternal = /*#__PURE__*/function () {
9952
9983
  }
9953
9984
  });
9954
9985
  } else {
9986
+ var hasPolar = $$.hasType("polar");
9987
+
9955
9988
  if (!hasRadar) {
9956
9989
  types.push("Arc", "Pie");
9957
9990
  }
@@ -9960,6 +9993,8 @@ var ChartInternal = /*#__PURE__*/function () {
9960
9993
  types.push("Gauge");
9961
9994
  } else if (hasRadar) {
9962
9995
  types.push("Radar");
9996
+ } else if (hasPolar) {
9997
+ types.push("Polar");
9963
9998
  }
9964
9999
  }
9965
10000
 
@@ -10051,7 +10086,11 @@ var ChartInternal = /*#__PURE__*/function () {
10051
10086
  var $$ = this,
10052
10087
  _$$$state2 = $$.state,
10053
10088
  hasAxis = _$$$state2.hasAxis,
10054
- hasRadar = _$$$state2.hasRadar;
10089
+ hasRadar = _$$$state2.hasRadar,
10090
+ helper = function (type) {
10091
+ return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
10092
+ };
10093
+
10055
10094
  // Text
10056
10095
  $$.updateTargetsForText(targets);
10057
10096
 
@@ -10060,14 +10099,21 @@ var ChartInternal = /*#__PURE__*/function () {
10060
10099
  var name = capitalize(v);
10061
10100
 
10062
10101
  if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
10063
- $$["updateTargetsFor" + name](targets.filter($$["is" + name + "Type"].bind($$)));
10102
+ helper(name);
10064
10103
  }
10065
10104
  }); // Sub Chart
10066
10105
 
10067
- $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets);
10068
- } else {
10069
- // Arc & Radar
10070
- $$.hasArcType(targets) && (hasRadar ? $$.updateTargetsForRadar(targets.filter($$.isRadarType.bind($$))) : $$.updateTargetsForArc(targets.filter($$.isArcType.bind($$))));
10106
+ $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets); // Arc, Polar, Radar
10107
+ } else if ($$.hasArcType(targets)) {
10108
+ var _type = "Arc";
10109
+
10110
+ if (hasRadar) {
10111
+ _type = "Radar";
10112
+ } else if ($$.hasType("polar")) {
10113
+ _type = "Polar";
10114
+ }
10115
+
10116
+ helper(_type);
10071
10117
  } // circle
10072
10118
 
10073
10119
 
@@ -10830,7 +10876,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
10830
10876
  candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
10831
10877
  candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !0);
10832
10878
 
10833
- if ($$.hasArcType()) {
10879
+ if ($$.hasArcType(null, ["polar"])) {
10834
10880
  $$.unexpandArc(targetIds);
10835
10881
  $$.hasType("gauge") && $$.undoMarkOverlapped($$, "." + $GAUGE.gaugeValue);
10836
10882
  }
@@ -10868,7 +10914,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
10868
10914
  candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
10869
10915
  // should be for all targets
10870
10916
  candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !1);
10871
- $$.hasArcType() && $$.unexpandArc(targetIds);
10917
+ $$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
10872
10918
 
10873
10919
  if (config.legend_show) {
10874
10920
  $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
@@ -13911,7 +13957,7 @@ var Axis_Axis = /*#__PURE__*/function () {
13911
13957
  var prefix = "axis_" + key + "_",
13912
13958
  axisScale = scale[key];
13913
13959
 
13914
- if (config[prefix + "show"] && axisScale) {
13960
+ if (axisScale) {
13915
13961
  var tickValues = config[prefix + "tick_values"],
13916
13962
  tickCount = config[prefix + "tick_count"];
13917
13963
  axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
@@ -13979,9 +14025,10 @@ var Axis_Axis = /*#__PURE__*/function () {
13979
14025
  }
13980
14026
 
13981
14027
  tickNodes.each(function (d) {
13982
- if (tickValues.indexOf(d) % intervalForCulling) {
13983
- var node = lines ? this.querySelector("text") : this;
13984
- node && (node.style.display = "none");
14028
+ var node = lines ? this.querySelector("text") : this;
14029
+
14030
+ if (node) {
14031
+ node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
13985
14032
  }
13986
14033
  });
13987
14034
  } else {
@@ -17490,9 +17537,9 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17490
17537
  var $$ = this,
17491
17538
  config = $$.config,
17492
17539
  dataType = config.data_type,
17493
- padding = config.pie_padding,
17540
+ padding = config[dataType + "_padding"],
17494
17541
  startingAngle = config[dataType + "_startingAngle"] || 0,
17495
- padAngle = ($$.hasType("pie") && padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
17542
+ padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
17496
17543
  $$.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
17544
  return d.values.reduce(function (a, b) {
17498
17545
  return a + b.value;
@@ -17503,7 +17550,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17503
17550
  var $$ = this,
17504
17551
  config = $$.config,
17505
17552
  state = $$.state,
17506
- padding = config.pie_padding,
17553
+ dataType = config.data_type,
17554
+ padding = config[dataType + "_padding"],
17507
17555
  w = config.gauge_width || config.donut_width,
17508
17556
  gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
17509
17557
  // determine radius
@@ -17638,6 +17686,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17638
17686
  state = $$.state,
17639
17687
  singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
17640
17688
  hasMultiArcGauge = $$.hasMultiArcGauge(),
17689
+ hasPolar = $$.hasType("polar"),
17641
17690
  arc = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.arc)().innerRadius(function (d) {
17642
17691
  var _$$$getRadius = $$.getRadius(d),
17643
17692
  innerRadius = _$$$getRadius.innerRadius;
@@ -17645,9 +17694,16 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17645
17694
  return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
17646
17695
  }).outerRadius(function (d) {
17647
17696
  var _$$$getRadius2 = $$.getRadius(d),
17648
- outerRadius = _$$$getRadius2.outerRadius;
17697
+ outerRadius = _$$$getRadius2.outerRadius,
17698
+ radius = outerRadius;
17649
17699
 
17650
- return hasMultiArcGauge ? state.radius - singleArcWidth * d.index : outerRadius;
17700
+ if (hasMultiArcGauge) {
17701
+ radius = state.radius - singleArcWidth * d.index;
17702
+ } else if (hasPolar) {
17703
+ radius = $$.getPolarOuterRadius(d, outerRadius);
17704
+ }
17705
+
17706
+ return radius;
17651
17707
  }),
17652
17708
  newArc = function (d, withoutUpdate) {
17653
17709
  var path = "M 0 0";
@@ -17705,6 +17761,13 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17705
17761
  getArc: function getArc(d, withoutUpdate, force) {
17706
17762
  return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
17707
17763
  },
17764
+
17765
+ /**
17766
+ * Set transform attributes to arc label text
17767
+ * @param {Object} d Data object
17768
+ * @returns {string} Translate attribute string
17769
+ * @private
17770
+ */
17708
17771
  transformForArcLabel: function transformForArcLabel(d) {
17709
17772
  var $$ = this,
17710
17773
  config = $$.config,
@@ -17719,16 +17782,24 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17719
17782
  y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
17720
17783
  translate = "translate(" + x + "," + y + ")";
17721
17784
  } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
17722
- var _$$$getRadius4 = $$.getRadius(d),
17723
- outerRadius = _$$$getRadius4.outerRadius,
17724
- c = this.svgArc.centroid(updated),
17785
+ var _filter$map,
17786
+ _$$$getRadius4 = $$.getRadius(d),
17787
+ outerRadius = _$$$getRadius4.outerRadius;
17788
+
17789
+ if ($$.hasType("polar")) {
17790
+ outerRadius = $$.getPolarOuterRadius(d, outerRadius);
17791
+ }
17792
+
17793
+ var c = this.svgArc.centroid(updated),
17725
17794
  _c$map = c.map(function (v) {
17726
17795
  return isNaN(v) ? 0 : v;
17727
17796
  }),
17728
17797
  x = _c$map[0],
17729
17798
  y = _c$map[1],
17730
17799
  h = Math.sqrt(x * x + y * y),
17731
- ratio = $$.hasType("donut") && config.donut_label_ratio || $$.hasType("pie") && config.pie_label_ratio;
17800
+ ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
17801
+ return config[v + "_label_ratio"];
17802
+ })) == null ? void 0 : _filter$map[0];
17732
17803
 
17733
17804
  if (ratio) {
17734
17805
  ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
@@ -17756,10 +17827,11 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17756
17827
 
17757
17828
  if ($$.shouldShowArcLabel()) {
17758
17829
  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),
17830
+ var _filter,
17831
+ node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
17760
17832
  updated = $$.updateAngle(d),
17761
17833
  ratio = $$.getRatio("arc", updated),
17762
- isUnderThreshold = $$.meetsLabelThreshold(ratio, $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge" || $$.hasType("pie") && "pie");
17834
+ isUnderThreshold = $$.meetsLabelThreshold(ratio, (_filter = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _filter[0]);
17763
17835
 
17764
17836
  if (isUnderThreshold) {
17765
17837
  var value = (updated || d).value,
@@ -17847,21 +17919,20 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17847
17919
  shouldShowArcLabel: function shouldShowArcLabel() {
17848
17920
  var $$ = this,
17849
17921
  config = $$.config;
17850
- return ["pie", "donut", "gauge"].some(function (v) {
17922
+ return ["donut", "gauge", "pie", "polar"].some(function (v) {
17851
17923
  return $$.hasType(v) && config[v + "_label_show"];
17852
17924
  });
17853
17925
  },
17854
17926
  getArcLabelFormat: function getArcLabelFormat() {
17855
17927
  var $$ = this,
17856
17928
  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
- }
17929
+ format = function (v) {
17930
+ return v;
17931
+ };
17864
17932
 
17933
+ ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
17934
+ format = config[v + "_label_format"];
17935
+ });
17865
17936
  return isFunction(format) ? format.bind($$.api) : format;
17866
17937
  },
17867
17938
  getArcTitle: function getArcTitle() {
@@ -17993,6 +18064,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17993
18064
  }); // bind arc events
17994
18065
 
17995
18066
  hasInteraction && $$.bindArcEvent(mainArc);
18067
+ $$.hasType("polar") && $$.redrawPolar();
17996
18068
  $$.hasType("gauge") && $$.redrawBackgroundArcs();
17997
18069
  $$.redrawArcText(duration);
17998
18070
  },
@@ -19800,6 +19872,124 @@ var getTransitionName = function () {
19800
19872
  }
19801
19873
  }
19802
19874
  });
19875
+ ;// CONCATENATED MODULE: ./src/ChartInternal/shape/polar.ts
19876
+ /**
19877
+ * Copyright (c) 2017 ~ present NAVER Corp.
19878
+ * billboard.js project is licensed under the MIT license
19879
+ */
19880
+
19881
+
19882
+
19883
+ /**
19884
+ * Get data max value
19885
+ * @param {object} $$ ChartInternal instance
19886
+ * @returns {number} max value
19887
+ * @private
19888
+ */
19889
+ function getDataMax($$) {
19890
+ var levelMax = $$.config.polar_level_max,
19891
+ dataMax = $$.getMinMaxData().max[0].value;
19892
+
19893
+ // Apply level max only when is greater than the data max value
19894
+ if (levelMax && levelMax > dataMax) {
19895
+ dataMax = levelMax;
19896
+ }
19897
+
19898
+ return dataMax;
19899
+ }
19900
+
19901
+ /* harmony default export */ var polar = ({
19902
+ /**
19903
+ * Initialize polar
19904
+ * @private
19905
+ */
19906
+ initPolar: function initPolar() {
19907
+ var $$ = this,
19908
+ arcs = $$.$el.arcs,
19909
+ config = $$.config,
19910
+ levelTextShow = config.polar_level_text_show,
19911
+ levelTextBgColor = config.polar_level_text_backgroundColor;
19912
+ // append <g> for level
19913
+ arcs.levels = arcs.append("g").attr("class", $LEVEL.levels); // set level text background color
19914
+
19915
+ if (levelTextShow && levelTextBgColor) {
19916
+ $$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
19917
+ }
19918
+ },
19919
+
19920
+ /**
19921
+ * Get polar outer radius according to the data value
19922
+ * @param {object} d Data object
19923
+ * @param {numbet} outerRadius Outer radius
19924
+ * @returns {number} outer radius
19925
+ * @private
19926
+ */
19927
+ getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) {
19928
+ var dataMax = getDataMax(this);
19929
+ return (d == null ? void 0 : d.data.values[0].value) / dataMax * outerRadius;
19930
+ },
19931
+
19932
+ /**
19933
+ * Update polar based on given data array
19934
+ * @param {object} targets Data object
19935
+ * @private
19936
+ */
19937
+ updateTargetsForPolar: function updateTargetsForPolar(targets) {
19938
+ // borrow from Arc
19939
+ this.updateTargetsForArc(targets);
19940
+ },
19941
+
19942
+ /**
19943
+ * Called whenever redraw happens
19944
+ * @private
19945
+ */
19946
+ redrawPolar: function redrawPolar() {
19947
+ var $$ = this,
19948
+ config = $$.config;
19949
+ config.polar_level_show && $$.updatePolarLevel();
19950
+ },
19951
+
19952
+ /**
19953
+ * Update polar level circle
19954
+ * @private
19955
+ */
19956
+ updatePolarLevel: function updatePolarLevel() {
19957
+ var $$ = this,
19958
+ config = $$.config,
19959
+ state = $$.state,
19960
+ levels = $$.$el.arcs.levels,
19961
+ depth = config.polar_level_depth,
19962
+ dataMax = getDataMax($$),
19963
+ levelData = getRange(0, depth),
19964
+ outerRadius = state.radius,
19965
+ levelRatio = levelData.map(function (l) {
19966
+ return outerRadius * ((l + 1) / depth);
19967
+ }),
19968
+ levelTextFormat = (config.polar_level_text_format || function () {}).bind($$.api),
19969
+ level = levels.selectAll("." + $LEVEL.level).data(levelData);
19970
+
19971
+ level.exit().remove();
19972
+ var levelEnter = level.enter().append("g").attr("class", function (d, i) {
19973
+ return $LEVEL.level + " " + $LEVEL.level + "-" + i;
19974
+ }); // cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
19975
+
19976
+ levelEnter.append("circle");
19977
+ levelEnter.merge(level).selectAll("circle").style("visibility", config.polar_level_show ? null : "hidden").attr("cx", 0).attr("cy", 0).attr("r", function (d) {
19978
+ return levelRatio[d];
19979
+ });
19980
+
19981
+ if (config.polar_level_text_show) {
19982
+ var levelTextBackgroundColor = config.polar_level_text_backgroundColor,
19983
+ defsId = "#" + state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(levelTextBackgroundColor);
19984
+ levelEnter.append("text").style("text-anchor", "middle");
19985
+ levelEnter.merge(level).selectAll("text").attr("dy", function (d) {
19986
+ return -levelRatio[d] + 5;
19987
+ }).attr("filter", levelTextBackgroundColor ? "url(" + defsId + ")" : null).text(function (d) {
19988
+ return levelTextFormat(dataMax / levelData.length * (d + 1));
19989
+ });
19990
+ }
19991
+ }
19992
+ });
19803
19993
  ;// CONCATENATED MODULE: ./src/ChartInternal/shape/radar.ts
19804
19994
  /**
19805
19995
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -19840,7 +20030,7 @@ var cacheKey = KEY.radarPoints;
19840
20030
  if ($$.hasType("radar")) {
19841
20031
  $el.radar = $el.main.select("." + $COMMON.chart).append("g").attr("class", $RADAR.chartRadars); // level
19842
20032
 
19843
- $el.radar.levels = $el.radar.append("g").attr("class", $RADAR.levels); // axis
20033
+ $el.radar.levels = $el.radar.append("g").attr("class", $LEVEL.levels); // axis
19844
20034
 
19845
20035
  $el.radar.axes = $el.radar.append("g").attr("class", $AXIS.axis); // shapes
19846
20036
 
@@ -19961,11 +20151,11 @@ var cacheKey = KEY.radarPoints;
19961
20151
  });
19962
20152
  return pos.join(" ");
19963
20153
  }),
19964
- level = radarLevels.selectAll("." + $RADAR.level).data(levelData);
20154
+ level = radarLevels.selectAll("." + $LEVEL.level).data(levelData);
19965
20155
 
19966
20156
  level.exit().remove();
19967
20157
  var levelEnter = level.enter().append("g").attr("class", function (d, i) {
19968
- return $RADAR.level + " " + $RADAR.level + "-" + i;
20158
+ return $LEVEL.level + " " + $LEVEL.level + "-" + i;
19969
20159
  });
19970
20160
  levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden");
19971
20161
 
@@ -20971,6 +21161,91 @@ var cacheKey = KEY.radarPoints;
20971
21161
  pie_padding: 0,
20972
21162
  pie_startingAngle: 0
20973
21163
  });
21164
+ ;// CONCATENATED MODULE: ./src/config/Options/shape/polar.ts
21165
+ /**
21166
+ * Copyright (c) 2017 ~ present NAVER Corp.
21167
+ * billboard.js project is licensed under the MIT license
21168
+ */
21169
+
21170
+ /**
21171
+ * x Axis config options
21172
+ */
21173
+ /* harmony default export */ var shape_polar = ({
21174
+ /**
21175
+ * Set polar options
21176
+ * @name polar
21177
+ * @memberof Options
21178
+ * @type {object}
21179
+ * @property {object} polar Polar object
21180
+ * @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
21181
+ * @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
21182
+ * @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
21183
+ * @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
21184
+ * @property {number} [polar.level.depth=3] Set the level depth.
21185
+ * @property {boolean} [polar.level.show=true] Show or hide level.
21186
+ * @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
21187
+ * @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
21188
+ * @property {boolean} [polar.level.text.show=true] Show or hide level text.
21189
+ * @property {number} [polar.padAngle=0] Set padding between data.
21190
+ * @property {number} [polar.padding=0] Sets the gap between pie arcs.
21191
+ * @property {number} [polar.startingAngle=0] Set starting angle where data draws.
21192
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
21193
+ * @example
21194
+ * polar: {
21195
+ * label: {
21196
+ * show: false,
21197
+ * format: function(value, ratio, id) {
21198
+ * return d3.format("$")(value);
21199
+ *
21200
+ * // to multiline, return with '\n' character
21201
+ * // return value +"%\nLine1\n2Line2";
21202
+ * },
21203
+ *
21204
+ * // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
21205
+ * // if data value is below than 0.1, text label will be hidden.
21206
+ * threshold: 0.1,
21207
+ *
21208
+ * // set ratio callback. Should return ratio value
21209
+ * ratio: function(d, radius, h) {
21210
+ * ...
21211
+ * return ratio;
21212
+ * },
21213
+ * // or set ratio number
21214
+ * ratio: 0.5
21215
+ * },
21216
+ * level: {
21217
+ * depth: 3,
21218
+ * max: 500,
21219
+ * show: true,
21220
+ * text: {
21221
+ * format: function(x) {
21222
+ * return x + "%";
21223
+ * },
21224
+ * show: true,
21225
+ * backgroundColor: "red"
21226
+ * }
21227
+ * },
21228
+ * padAngle: 0.1,
21229
+ * padding: 0,
21230
+ * startingAngle: 1
21231
+ * }
21232
+ */
21233
+ polar_label_show: !0,
21234
+ polar_label_format: undefined,
21235
+ polar_label_threshold: .05,
21236
+ polar_label_ratio: undefined,
21237
+ polar_level_depth: 3,
21238
+ polar_level_max: undefined,
21239
+ polar_level_show: !0,
21240
+ polar_level_text_backgroundColor: "#fff",
21241
+ polar_level_text_format: function polar_level_text_format(x) {
21242
+ return x % 1 === 0 ? x : x.toFixed(2);
21243
+ },
21244
+ polar_level_text_show: !0,
21245
+ polar_padAngle: 0,
21246
+ polar_padding: 0,
21247
+ polar_startingAngle: 0
21248
+ });
20974
21249
  ;// CONCATENATED MODULE: ./src/config/Options/shape/radar.ts
20975
21250
  /**
20976
21251
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -21071,6 +21346,7 @@ var cacheKey = KEY.radarPoints;
21071
21346
 
21072
21347
 
21073
21348
 
21349
+
21074
21350
  // Options
21075
21351
 
21076
21352
 
@@ -21087,6 +21363,7 @@ var cacheKey = KEY.radarPoints;
21087
21363
 
21088
21364
 
21089
21365
 
21366
+
21090
21367
  /**
21091
21368
  * Extend Axis
21092
21369
  * @param {Array} module Module to be extended
@@ -21179,6 +21456,11 @@ var _area = function area() {
21179
21456
  return extendArc(undefined, [pie]), (shape_pie = function () {
21180
21457
  return TYPE.PIE;
21181
21458
  })();
21459
+ },
21460
+ resolver_shape_polar = function () {
21461
+ return extendArc([polar], [shape_polar]), (resolver_shape_polar = function () {
21462
+ return TYPE.POLAR;
21463
+ })();
21182
21464
  },
21183
21465
  resolver_shape_radar = function () {
21184
21466
  return extendArc([point, radar], [common_point, shape_radar]), (resolver_shape_radar = function () {
@@ -23046,7 +23328,7 @@ var _defaults = {},
23046
23328
  * bb.version; // "1.0.0"
23047
23329
  * @memberof bb
23048
23330
  */
23049
- version: "3.3.3",
23331
+ version: "3.4.0-next.1",
23050
23332
 
23051
23333
  /**
23052
23334
  * Generate chart
@@ -23094,6 +23376,7 @@ var _defaults = {},
23094
23376
  * gauge,
23095
23377
  * line,
23096
23378
  * pie,
23379
+ * polar,
23097
23380
  * radar,
23098
23381
  * scatter,
23099
23382
  * spline,
@@ -23180,7 +23463,7 @@ var _defaults = {},
23180
23463
  };
23181
23464
  /**
23182
23465
  * @namespace bb
23183
- * @version 3.3.3
23466
+ * @version 3.4.0-next.1
23184
23467
  */
23185
23468
  ;// CONCATENATED MODULE: ./src/index.ts
23186
23469
  /**