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
@@ -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
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - d3-axis ^3.0.0
@@ -16311,6 +16311,7 @@ __webpack_require__.d(resolver_shape_namespaceObject, {
16311
16311
  "gauge": function() { return resolver_shape_gauge; },
16312
16312
  "line": function() { return resolver_shape_line; },
16313
16313
  "pie": function() { return resolver_shape_pie; },
16314
+ "polar": function() { return resolver_shape_polar; },
16314
16315
  "radar": function() { return resolver_shape_radar; },
16315
16316
  "scatter": function() { return shape_scatter; },
16316
16317
  "spline": function() { return shape_spline; },
@@ -18345,6 +18346,7 @@ var TYPE = {
18345
18346
  GAUGE: "gauge",
18346
18347
  LINE: "line",
18347
18348
  PIE: "pie",
18349
+ POLAR: "polar",
18348
18350
  RADAR: "radar",
18349
18351
  SCATTER: "scatter",
18350
18352
  SPLINE: "spline",
@@ -18368,6 +18370,7 @@ var TYPE_METHOD_NEEDED = {
18368
18370
  GAUGE: "initArc",
18369
18371
  LINE: "initLine",
18370
18372
  PIE: "initArc",
18373
+ POLAR: "initPolar",
18371
18374
  RADAR: "initCircle",
18372
18375
  SCATTER: "initCircle",
18373
18376
  SPLINE: "initLine",
@@ -18381,7 +18384,7 @@ var TYPE_METHOD_NEEDED = {
18381
18384
  var TYPE_BY_CATEGORY = {
18382
18385
  Area: [TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.AREA_STEP],
18383
18386
  AreaRange: [TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE],
18384
- Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.RADAR],
18387
+ Arc: [TYPE.PIE, TYPE.DONUT, TYPE.GAUGE, TYPE.POLAR, TYPE.RADAR],
18385
18388
  Line: [TYPE.LINE, TYPE.SPLINE, TYPE.AREA, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE, TYPE.AREA_LINE_RANGE, TYPE.STEP, TYPE.AREA_STEP],
18386
18389
  Step: [TYPE.STEP, TYPE.AREA_STEP],
18387
18390
  Spline: [TYPE.SPLINE, TYPE.AREA_SPLINE, TYPE.AREA_SPLINE_RANGE]
@@ -21921,26 +21924,36 @@ function isTabVisible() {
21921
21924
 
21922
21925
 
21923
21926
  function convertInputType(mouse, touch) {
21924
- var hasTouch = !1;
21927
+ var DocumentTouch = win.DocumentTouch,
21928
+ matchMedia = win.matchMedia,
21929
+ navigator = win.navigator,
21930
+ hasTouch = !1;
21925
21931
 
21926
21932
  if (touch) {
21927
21933
  // Some Edge desktop return true: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/20417074/
21928
- if (win.navigator && "maxTouchPoints" in win.navigator) {
21929
- hasTouch = win.navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
21934
+ if (navigator && "maxTouchPoints" in navigator) {
21935
+ hasTouch = navigator.maxTouchPoints > 0; // Ref: https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
21930
21936
  // On IE11 with IE9 emulation mode, ('ontouchstart' in window) is returning true
21931
- } else if ("ontouchmove" in win || win.DocumentTouch && browser_doc instanceof win.DocumentTouch) {
21937
+ } else if ("ontouchmove" in win || DocumentTouch && browser_doc instanceof DocumentTouch) {
21932
21938
  hasTouch = !0;
21933
21939
  } else {
21934
21940
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Browser_detection_using_the_user_agent#avoiding_user_agent_detection
21935
- var mQ = win.matchMedia && matchMedia("(pointer:coarse)");
21936
-
21937
- if (mQ && mQ.media === "(pointer:coarse)") {
21938
- hasTouch = !!mQ.matches;
21941
+ if (matchMedia != null && matchMedia("(pointer:coarse)").matches) {
21942
+ hasTouch = !0;
21943
+ } else {
21944
+ // Only as a last resort, fall back to user agent sniffing
21945
+ var UA = navigator.userAgent;
21946
+ hasTouch = /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(UA) || /\b(Android|Windows Phone|iPad|iPod)\b/i.test(UA);
21939
21947
  }
21940
21948
  }
21941
- }
21949
+ } // 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
21950
+ // https://css-tricks.com/interaction-media-features-and-their-potential-for-incorrect-assumptions/#aa-testing-the-capabilities-of-all-inputs
21951
+ // Demo: https://patrickhlauke.github.io/touch/pointer-hover-any-pointer-any-hover/
21942
21952
 
21943
- var hasMouse = mouse && !hasTouch ? "onmouseover" in win : !1;
21953
+
21954
+ var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
21955
+ return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
21956
+ });
21944
21957
  return hasMouse && "mouse" || hasTouch && "touch" || null;
21945
21958
  }
21946
21959
  ;// CONCATENATED MODULE: ./src/module/error.ts
@@ -22121,12 +22134,14 @@ var $GRID = {
22121
22134
  ygridLines: "bb-ygrid-lines",
22122
22135
  ygrids: "bb-ygrids"
22123
22136
  };
22124
- var $RADAR = {
22125
- chartRadar: "bb-chart-radar",
22126
- chartRadars: "bb-chart-radars",
22137
+ var $LEVEL = {
22127
22138
  level: "bb-level",
22128
22139
  levels: "bb-levels"
22129
22140
  };
22141
+ var $RADAR = {
22142
+ chartRadar: "bb-chart-radar",
22143
+ chartRadars: "bb-chart-radars"
22144
+ };
22130
22145
  var $REGION = {
22131
22146
  region: "bb-region",
22132
22147
  regions: "bb-regions"
@@ -22899,6 +22914,7 @@ var Store = /*#__PURE__*/function () {
22899
22914
  * - gauge
22900
22915
  * - line
22901
22916
  * - pie
22917
+ * - polar
22902
22918
  * - radar
22903
22919
  * - scatter
22904
22920
  * - spline
@@ -22927,6 +22943,7 @@ var Store = /*#__PURE__*/function () {
22927
22943
  * gauge,
22928
22944
  * line,
22929
22945
  * pie,
22946
+ * polar,
22930
22947
  * radar,
22931
22948
  * scatter,
22932
22949
  * spline,
@@ -22973,6 +22990,7 @@ var Store = /*#__PURE__*/function () {
22973
22990
  * gauge,
22974
22991
  * line,
22975
22992
  * pie,
22993
+ * polar,
22976
22994
  * radar,
22977
22995
  * scatter,
22978
22996
  * spline,
@@ -27230,14 +27248,15 @@ var colorizePattern = function (pattern, color, id) {
27230
27248
 
27231
27249
  /**
27232
27250
  * Append data backgound color filter definition
27251
+ * @param {string} color Color string
27233
27252
  * @private
27234
27253
  */
27235
- generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter() {
27254
+ generateDataLabelBackgroundColorFilter: function generateDataLabelBackgroundColorFilter(color) {
27236
27255
  var $$ = this,
27237
27256
  $el = $$.$el,
27238
27257
  config = $$.config,
27239
27258
  state = $$.state,
27240
- backgroundColors = config.data_labels_backgroundColors;
27259
+ backgroundColors = color || config.data_labels_backgroundColors;
27241
27260
 
27242
27261
  if (backgroundColors) {
27243
27262
  var ids = [];
@@ -27249,7 +27268,7 @@ var colorizePattern = function (pattern, color, id) {
27249
27268
  }
27250
27269
 
27251
27270
  ids.forEach(function (v) {
27252
- var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v);
27271
+ var id = state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(v) + (color ? $$.getTargetSelectorSuffix(color) : "");
27253
27272
  $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\"/>");
27254
27273
  });
27255
27274
  }
@@ -27739,7 +27758,7 @@ function getFormat($$, typeValue, v) {
27739
27758
  defaultArcValueFormat = $$.defaultArcValueFormat,
27740
27759
  yFormat = $$.yFormat,
27741
27760
  y2Format = $$.y2Format,
27742
- hasArc = $$.hasArcType(null, ["gauge", "radar"]);
27761
+ hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
27743
27762
  return function (v, ratio, id) {
27744
27763
  var format = hasArc ? defaultArcValueFormat : $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat;
27745
27764
  return format.call($$, v, ratio);
@@ -27751,6 +27770,9 @@ function getFormat($$, typeValue, v) {
27751
27770
  defaultArcValueFormat: function defaultArcValueFormat(v, ratio) {
27752
27771
  return (ratio * 100).toFixed(1) + "%";
27753
27772
  },
27773
+ defaultPolarValueFormat: function defaultPolarValueFormat(v) {
27774
+ return "" + v;
27775
+ },
27754
27776
  dataLabelFormat: function dataLabelFormat(targetId) {
27755
27777
  var $$ = this,
27756
27778
  dataLabels = $$.config.data_labels,
@@ -28513,7 +28535,9 @@ function getFormat($$, typeValue, v) {
28513
28535
  // arc
28514
28536
  $el.arcs && $$.redrawArc(duration, durationForExit, wth.Transform); // radar
28515
28537
 
28516
- $el.radar && $$.redrawRadar();
28538
+ $el.radar && $$.redrawRadar(); // polar
28539
+
28540
+ $el.polar && $$.redrawPolar();
28517
28541
  } // @TODO: Axis & Radar type
28518
28542
 
28519
28543
 
@@ -33254,6 +33278,9 @@ function getTextPos(pos, width) {
33254
33278
  } else if (target === "arc") {
33255
33279
  x = state.arcWidth / 2;
33256
33280
  y = state.arcHeight / 2;
33281
+ } else if (target === "polar") {
33282
+ x = state.arcWidth / 2;
33283
+ y = state.arcHeight / 2;
33257
33284
  } else if (target === "radar") {
33258
33285
  var _$$$getRadarSize = $$.getRadarSize(),
33259
33286
  width = _$$$getRadarSize[0];
@@ -33469,11 +33496,14 @@ function getTextPos(pos, width) {
33469
33496
  isDonutType: function isDonutType(d) {
33470
33497
  return this.isTypeOf(d, "donut");
33471
33498
  },
33499
+ isPolarType: function isPolarType(d) {
33500
+ return this.isTypeOf(d, "polar");
33501
+ },
33472
33502
  isRadarType: function isRadarType(d) {
33473
33503
  return this.isTypeOf(d, "radar");
33474
33504
  },
33475
33505
  isArcType: function isArcType(d) {
33476
- return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isRadarType(d);
33506
+ return this.isPieType(d) || this.isDonutType(d) || this.isGaugeType(d) || this.isPolarType(d) || this.isRadarType(d);
33477
33507
  },
33478
33508
  // determine if is 'circle' data point
33479
33509
  isCirclePoint: function isCirclePoint(node) {
@@ -33801,7 +33831,8 @@ var ChartInternal = /*#__PURE__*/function () {
33801
33831
  $el = $$.$el,
33802
33832
  org = $$.org,
33803
33833
  hasAxis = state.hasAxis,
33804
- hasInteraction = config.interaction_enabled;
33834
+ hasInteraction = config.interaction_enabled,
33835
+ hasPolar = $$.hasType("polar");
33805
33836
 
33806
33837
  // for arc type, set axes to not be shown
33807
33838
  // $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
@@ -33871,14 +33902,14 @@ var ChartInternal = /*#__PURE__*/function () {
33871
33902
 
33872
33903
  var hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
33873
33904
 
33874
- if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
33905
+ if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
33875
33906
  $el.defs = $el.svg.append("defs");
33876
33907
 
33877
33908
  if (hasAxis) {
33878
33909
  ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
33879
33910
  $$.appendClip($el.defs, state.clip[v]);
33880
33911
  });
33881
- } // Append data backgound color filter definition
33912
+ } // Append data background color filter definition
33882
33913
 
33883
33914
 
33884
33915
  $$.generateDataLabelBackgroundColorFilter(); // set color patterns
@@ -33981,6 +34012,8 @@ var ChartInternal = /*#__PURE__*/function () {
33981
34012
  }
33982
34013
  });
33983
34014
  } else {
34015
+ var hasPolar = $$.hasType("polar");
34016
+
33984
34017
  if (!hasRadar) {
33985
34018
  types.push("Arc", "Pie");
33986
34019
  }
@@ -33989,6 +34022,8 @@ var ChartInternal = /*#__PURE__*/function () {
33989
34022
  types.push("Gauge");
33990
34023
  } else if (hasRadar) {
33991
34024
  types.push("Radar");
34025
+ } else if (hasPolar) {
34026
+ types.push("Polar");
33992
34027
  }
33993
34028
  }
33994
34029
 
@@ -34080,7 +34115,11 @@ var ChartInternal = /*#__PURE__*/function () {
34080
34115
  var $$ = this,
34081
34116
  _$$$state2 = $$.state,
34082
34117
  hasAxis = _$$$state2.hasAxis,
34083
- hasRadar = _$$$state2.hasRadar;
34118
+ hasRadar = _$$$state2.hasRadar,
34119
+ helper = function (type) {
34120
+ return $$["updateTargetsFor" + type](targets.filter($$["is" + type + "Type"].bind($$)));
34121
+ };
34122
+
34084
34123
  // Text
34085
34124
  $$.updateTargetsForText(targets);
34086
34125
 
@@ -34089,14 +34128,21 @@ var ChartInternal = /*#__PURE__*/function () {
34089
34128
  var name = capitalize(v);
34090
34129
 
34091
34130
  if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
34092
- $$["updateTargetsFor" + name](targets.filter($$["is" + name + "Type"].bind($$)));
34131
+ helper(name);
34093
34132
  }
34094
34133
  }); // Sub Chart
34095
34134
 
34096
- $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets);
34097
- } else {
34098
- // Arc & Radar
34099
- $$.hasArcType(targets) && (hasRadar ? $$.updateTargetsForRadar(targets.filter($$.isRadarType.bind($$))) : $$.updateTargetsForArc(targets.filter($$.isArcType.bind($$))));
34135
+ $$.updateTargetsForSubchart && $$.updateTargetsForSubchart(targets); // Arc, Polar, Radar
34136
+ } else if ($$.hasArcType(targets)) {
34137
+ var _type = "Arc";
34138
+
34139
+ if (hasRadar) {
34140
+ _type = "Radar";
34141
+ } else if ($$.hasType("polar")) {
34142
+ _type = "Polar";
34143
+ }
34144
+
34145
+ helper(_type);
34100
34146
  } // circle
34101
34147
 
34102
34148
 
@@ -34859,7 +34905,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
34859
34905
  candidates = $$.$el.svg.selectAll($$.selectorTargets(targetIds.filter($$.isTargetToShow, $$)));
34860
34906
  candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !0);
34861
34907
 
34862
- if ($$.hasArcType()) {
34908
+ if ($$.hasArcType(null, ["polar"])) {
34863
34909
  $$.unexpandArc(targetIds);
34864
34910
  $$.hasType("gauge") && $$.undoMarkOverlapped($$, "." + $GAUGE.gaugeValue);
34865
34911
  }
@@ -34897,7 +34943,7 @@ function nodeToSvgDataUrl(node, option, orgSize) {
34897
34943
  candidates = $el.svg.selectAll($$.selectorTargets(targetIds));
34898
34944
  // should be for all targets
34899
34945
  candidates.classed($FOCUS.focused, !1).classed($FOCUS.defocused, !1);
34900
- $$.hasArcType() && $$.unexpandArc(targetIds);
34946
+ $$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
34901
34947
 
34902
34948
  if (config.legend_show) {
34903
34949
  $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
@@ -38090,7 +38136,7 @@ var Axis_Axis = /*#__PURE__*/function () {
38090
38136
  var prefix = "axis_" + key + "_",
38091
38137
  axisScale = scale[key];
38092
38138
 
38093
- if (config[prefix + "show"] && axisScale) {
38139
+ if (axisScale) {
38094
38140
  var tickValues = config[prefix + "tick_values"],
38095
38141
  tickCount = config[prefix + "tick_count"];
38096
38142
  axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
@@ -38158,9 +38204,10 @@ var Axis_Axis = /*#__PURE__*/function () {
38158
38204
  }
38159
38205
 
38160
38206
  tickNodes.each(function (d) {
38161
- if (tickValues.indexOf(d) % intervalForCulling) {
38162
- var node = lines ? this.querySelector("text") : this;
38163
- node && (node.style.display = "none");
38207
+ var node = lines ? this.querySelector("text") : this;
38208
+
38209
+ if (node) {
38210
+ node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
38164
38211
  }
38165
38212
  });
38166
38213
  } else {
@@ -42116,9 +42163,9 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42116
42163
  var $$ = this,
42117
42164
  config = $$.config,
42118
42165
  dataType = config.data_type,
42119
- padding = config.pie_padding,
42166
+ padding = config[dataType + "_padding"],
42120
42167
  startingAngle = config[dataType + "_startingAngle"] || 0,
42121
- padAngle = ($$.hasType("pie") && padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
42168
+ padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
42122
42169
  $$.pie = pie().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) {
42123
42170
  return d.values.reduce(function (a, b) {
42124
42171
  return a + b.value;
@@ -42129,7 +42176,8 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42129
42176
  var $$ = this,
42130
42177
  config = $$.config,
42131
42178
  state = $$.state,
42132
- padding = config.pie_padding,
42179
+ dataType = config.data_type,
42180
+ padding = config[dataType + "_padding"],
42133
42181
  w = config.gauge_width || config.donut_width,
42134
42182
  gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
42135
42183
  // determine radius
@@ -42264,6 +42312,7 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42264
42312
  state = $$.state,
42265
42313
  singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length,
42266
42314
  hasMultiArcGauge = $$.hasMultiArcGauge(),
42315
+ hasPolar = $$.hasType("polar"),
42267
42316
  arc = src_arc().innerRadius(function (d) {
42268
42317
  var _$$$getRadius = $$.getRadius(d),
42269
42318
  innerRadius = _$$$getRadius.innerRadius;
@@ -42271,9 +42320,16 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42271
42320
  return hasMultiArcGauge ? state.radius - singleArcWidth * (d.index + 1) : isNumber(innerRadius) ? innerRadius : 0;
42272
42321
  }).outerRadius(function (d) {
42273
42322
  var _$$$getRadius2 = $$.getRadius(d),
42274
- outerRadius = _$$$getRadius2.outerRadius;
42323
+ outerRadius = _$$$getRadius2.outerRadius,
42324
+ radius = outerRadius;
42275
42325
 
42276
- return hasMultiArcGauge ? state.radius - singleArcWidth * d.index : outerRadius;
42326
+ if (hasMultiArcGauge) {
42327
+ radius = state.radius - singleArcWidth * d.index;
42328
+ } else if (hasPolar) {
42329
+ radius = $$.getPolarOuterRadius(d, outerRadius);
42330
+ }
42331
+
42332
+ return radius;
42277
42333
  }),
42278
42334
  newArc = function (d, withoutUpdate) {
42279
42335
  var path = "M 0 0";
@@ -42331,6 +42387,13 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42331
42387
  getArc: function getArc(d, withoutUpdate, force) {
42332
42388
  return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
42333
42389
  },
42390
+
42391
+ /**
42392
+ * Set transform attributes to arc label text
42393
+ * @param {Object} d Data object
42394
+ * @returns {string} Translate attribute string
42395
+ * @private
42396
+ */
42334
42397
  transformForArcLabel: function transformForArcLabel(d) {
42335
42398
  var $$ = this,
42336
42399
  config = $$.config,
@@ -42345,16 +42408,24 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42345
42408
  y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
42346
42409
  translate = "translate(" + x + "," + y + ")";
42347
42410
  } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
42348
- var _$$$getRadius4 = $$.getRadius(d),
42349
- outerRadius = _$$$getRadius4.outerRadius,
42350
- c = this.svgArc.centroid(updated),
42411
+ var _filter$map,
42412
+ _$$$getRadius4 = $$.getRadius(d),
42413
+ outerRadius = _$$$getRadius4.outerRadius;
42414
+
42415
+ if ($$.hasType("polar")) {
42416
+ outerRadius = $$.getPolarOuterRadius(d, outerRadius);
42417
+ }
42418
+
42419
+ var c = this.svgArc.centroid(updated),
42351
42420
  _c$map = c.map(function (v) {
42352
42421
  return isNaN(v) ? 0 : v;
42353
42422
  }),
42354
42423
  x = _c$map[0],
42355
42424
  y = _c$map[1],
42356
42425
  h = Math.sqrt(x * x + y * y),
42357
- ratio = $$.hasType("donut") && config.donut_label_ratio || $$.hasType("pie") && config.pie_label_ratio;
42426
+ ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
42427
+ return config[v + "_label_ratio"];
42428
+ })) == null ? void 0 : _filter$map[0];
42358
42429
 
42359
42430
  if (ratio) {
42360
42431
  ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
@@ -42382,10 +42453,11 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42382
42453
 
42383
42454
  if ($$.shouldShowArcLabel()) {
42384
42455
  selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBacgroundColor.bind($$)).each(function (d) {
42385
- var node = src_select(this),
42456
+ var _filter,
42457
+ node = src_select(this),
42386
42458
  updated = $$.updateAngle(d),
42387
42459
  ratio = $$.getRatio("arc", updated),
42388
- isUnderThreshold = $$.meetsLabelThreshold(ratio, $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge" || $$.hasType("pie") && "pie");
42460
+ isUnderThreshold = $$.meetsLabelThreshold(ratio, (_filter = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _filter[0]);
42389
42461
 
42390
42462
  if (isUnderThreshold) {
42391
42463
  var value = (updated || d).value,
@@ -42473,21 +42545,20 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42473
42545
  shouldShowArcLabel: function shouldShowArcLabel() {
42474
42546
  var $$ = this,
42475
42547
  config = $$.config;
42476
- return ["pie", "donut", "gauge"].some(function (v) {
42548
+ return ["donut", "gauge", "pie", "polar"].some(function (v) {
42477
42549
  return $$.hasType(v) && config[v + "_label_show"];
42478
42550
  });
42479
42551
  },
42480
42552
  getArcLabelFormat: function getArcLabelFormat() {
42481
42553
  var $$ = this,
42482
42554
  config = $$.config,
42483
- format = config.pie_label_format;
42484
-
42485
- if ($$.hasType("gauge")) {
42486
- format = config.gauge_label_format;
42487
- } else if ($$.hasType("donut")) {
42488
- format = config.donut_label_format;
42489
- }
42555
+ format = function (v) {
42556
+ return v;
42557
+ };
42490
42558
 
42559
+ ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
42560
+ format = config[v + "_label_format"];
42561
+ });
42491
42562
  return isFunction(format) ? format.bind($$.api) : format;
42492
42563
  },
42493
42564
  getArcTitle: function getArcTitle() {
@@ -42619,6 +42690,7 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42619
42690
  }); // bind arc events
42620
42691
 
42621
42692
  hasInteraction && $$.bindArcEvent(mainArc);
42693
+ $$.hasType("polar") && $$.redrawPolar();
42622
42694
  $$.hasType("gauge") && $$.redrawBackgroundArcs();
42623
42695
  $$.redrawArcText(duration);
42624
42696
  },
@@ -44599,6 +44671,124 @@ var getTransitionName = function () {
44599
44671
  }
44600
44672
  }
44601
44673
  });
44674
+ ;// CONCATENATED MODULE: ./src/ChartInternal/shape/polar.ts
44675
+ /**
44676
+ * Copyright (c) 2017 ~ present NAVER Corp.
44677
+ * billboard.js project is licensed under the MIT license
44678
+ */
44679
+
44680
+
44681
+
44682
+ /**
44683
+ * Get data max value
44684
+ * @param {object} $$ ChartInternal instance
44685
+ * @returns {number} max value
44686
+ * @private
44687
+ */
44688
+ function getDataMax($$) {
44689
+ var levelMax = $$.config.polar_level_max,
44690
+ dataMax = $$.getMinMaxData().max[0].value;
44691
+
44692
+ // Apply level max only when is greater than the data max value
44693
+ if (levelMax && levelMax > dataMax) {
44694
+ dataMax = levelMax;
44695
+ }
44696
+
44697
+ return dataMax;
44698
+ }
44699
+
44700
+ /* harmony default export */ var polar = ({
44701
+ /**
44702
+ * Initialize polar
44703
+ * @private
44704
+ */
44705
+ initPolar: function initPolar() {
44706
+ var $$ = this,
44707
+ arcs = $$.$el.arcs,
44708
+ config = $$.config,
44709
+ levelTextShow = config.polar_level_text_show,
44710
+ levelTextBgColor = config.polar_level_text_backgroundColor;
44711
+ // append <g> for level
44712
+ arcs.levels = arcs.append("g").attr("class", $LEVEL.levels); // set level text background color
44713
+
44714
+ if (levelTextShow && levelTextBgColor) {
44715
+ $$.generateDataLabelBackgroundColorFilter(levelTextBgColor);
44716
+ }
44717
+ },
44718
+
44719
+ /**
44720
+ * Get polar outer radius according to the data value
44721
+ * @param {object} d Data object
44722
+ * @param {numbet} outerRadius Outer radius
44723
+ * @returns {number} outer radius
44724
+ * @private
44725
+ */
44726
+ getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) {
44727
+ var dataMax = getDataMax(this);
44728
+ return (d == null ? void 0 : d.data.values[0].value) / dataMax * outerRadius;
44729
+ },
44730
+
44731
+ /**
44732
+ * Update polar based on given data array
44733
+ * @param {object} targets Data object
44734
+ * @private
44735
+ */
44736
+ updateTargetsForPolar: function updateTargetsForPolar(targets) {
44737
+ // borrow from Arc
44738
+ this.updateTargetsForArc(targets);
44739
+ },
44740
+
44741
+ /**
44742
+ * Called whenever redraw happens
44743
+ * @private
44744
+ */
44745
+ redrawPolar: function redrawPolar() {
44746
+ var $$ = this,
44747
+ config = $$.config;
44748
+ config.polar_level_show && $$.updatePolarLevel();
44749
+ },
44750
+
44751
+ /**
44752
+ * Update polar level circle
44753
+ * @private
44754
+ */
44755
+ updatePolarLevel: function updatePolarLevel() {
44756
+ var $$ = this,
44757
+ config = $$.config,
44758
+ state = $$.state,
44759
+ levels = $$.$el.arcs.levels,
44760
+ depth = config.polar_level_depth,
44761
+ dataMax = getDataMax($$),
44762
+ levelData = getRange(0, depth),
44763
+ outerRadius = state.radius,
44764
+ levelRatio = levelData.map(function (l) {
44765
+ return outerRadius * ((l + 1) / depth);
44766
+ }),
44767
+ levelTextFormat = (config.polar_level_text_format || function () {}).bind($$.api),
44768
+ level = levels.selectAll("." + $LEVEL.level).data(levelData);
44769
+
44770
+ level.exit().remove();
44771
+ var levelEnter = level.enter().append("g").attr("class", function (d, i) {
44772
+ return $LEVEL.level + " " + $LEVEL.level + "-" + i;
44773
+ }); // cx, cy, translate: Set center as origin (0,0) so that it can share same center with arcs
44774
+
44775
+ levelEnter.append("circle");
44776
+ levelEnter.merge(level).selectAll("circle").style("visibility", config.polar_level_show ? null : "hidden").attr("cx", 0).attr("cy", 0).attr("r", function (d) {
44777
+ return levelRatio[d];
44778
+ });
44779
+
44780
+ if (config.polar_level_text_show) {
44781
+ var levelTextBackgroundColor = config.polar_level_text_backgroundColor,
44782
+ defsId = "#" + state.datetimeId + "-labels-bg" + $$.getTargetSelectorSuffix(levelTextBackgroundColor);
44783
+ levelEnter.append("text").style("text-anchor", "middle");
44784
+ levelEnter.merge(level).selectAll("text").attr("dy", function (d) {
44785
+ return -levelRatio[d] + 5;
44786
+ }).attr("filter", levelTextBackgroundColor ? "url(" + defsId + ")" : null).text(function (d) {
44787
+ return levelTextFormat(dataMax / levelData.length * (d + 1));
44788
+ });
44789
+ }
44790
+ }
44791
+ });
44602
44792
  ;// CONCATENATED MODULE: ./src/ChartInternal/shape/radar.ts
44603
44793
  /**
44604
44794
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -44639,7 +44829,7 @@ var cacheKey = KEY.radarPoints;
44639
44829
  if ($$.hasType("radar")) {
44640
44830
  $el.radar = $el.main.select("." + $COMMON.chart).append("g").attr("class", $RADAR.chartRadars); // level
44641
44831
 
44642
- $el.radar.levels = $el.radar.append("g").attr("class", $RADAR.levels); // axis
44832
+ $el.radar.levels = $el.radar.append("g").attr("class", $LEVEL.levels); // axis
44643
44833
 
44644
44834
  $el.radar.axes = $el.radar.append("g").attr("class", $AXIS.axis); // shapes
44645
44835
 
@@ -44760,11 +44950,11 @@ var cacheKey = KEY.radarPoints;
44760
44950
  });
44761
44951
  return pos.join(" ");
44762
44952
  }),
44763
- level = radarLevels.selectAll("." + $RADAR.level).data(levelData);
44953
+ level = radarLevels.selectAll("." + $LEVEL.level).data(levelData);
44764
44954
 
44765
44955
  level.exit().remove();
44766
44956
  var levelEnter = level.enter().append("g").attr("class", function (d, i) {
44767
- return $RADAR.level + " " + $RADAR.level + "-" + i;
44957
+ return $LEVEL.level + " " + $LEVEL.level + "-" + i;
44768
44958
  });
44769
44959
  levelEnter.append("polygon").style("visibility", config.radar_level_show ? null : "hidden");
44770
44960
 
@@ -45770,6 +45960,91 @@ var cacheKey = KEY.radarPoints;
45770
45960
  pie_padding: 0,
45771
45961
  pie_startingAngle: 0
45772
45962
  });
45963
+ ;// CONCATENATED MODULE: ./src/config/Options/shape/polar.ts
45964
+ /**
45965
+ * Copyright (c) 2017 ~ present NAVER Corp.
45966
+ * billboard.js project is licensed under the MIT license
45967
+ */
45968
+
45969
+ /**
45970
+ * x Axis config options
45971
+ */
45972
+ /* harmony default export */ var shape_polar = ({
45973
+ /**
45974
+ * Set polar options
45975
+ * @name polar
45976
+ * @memberof Options
45977
+ * @type {object}
45978
+ * @property {object} polar Polar object
45979
+ * @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
45980
+ * @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
45981
+ * @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
45982
+ * @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
45983
+ * @property {number} [polar.level.depth=3] Set the level depth.
45984
+ * @property {boolean} [polar.level.show=true] Show or hide level.
45985
+ * @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
45986
+ * @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
45987
+ * @property {boolean} [polar.level.text.show=true] Show or hide level text.
45988
+ * @property {number} [polar.padAngle=0] Set padding between data.
45989
+ * @property {number} [polar.padding=0] Sets the gap between pie arcs.
45990
+ * @property {number} [polar.startingAngle=0] Set starting angle where data draws.
45991
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
45992
+ * @example
45993
+ * polar: {
45994
+ * label: {
45995
+ * show: false,
45996
+ * format: function(value, ratio, id) {
45997
+ * return d3.format("$")(value);
45998
+ *
45999
+ * // to multiline, return with '\n' character
46000
+ * // return value +"%\nLine1\n2Line2";
46001
+ * },
46002
+ *
46003
+ * // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
46004
+ * // if data value is below than 0.1, text label will be hidden.
46005
+ * threshold: 0.1,
46006
+ *
46007
+ * // set ratio callback. Should return ratio value
46008
+ * ratio: function(d, radius, h) {
46009
+ * ...
46010
+ * return ratio;
46011
+ * },
46012
+ * // or set ratio number
46013
+ * ratio: 0.5
46014
+ * },
46015
+ * level: {
46016
+ * depth: 3,
46017
+ * max: 500,
46018
+ * show: true,
46019
+ * text: {
46020
+ * format: function(x) {
46021
+ * return x + "%";
46022
+ * },
46023
+ * show: true,
46024
+ * backgroundColor: "red"
46025
+ * }
46026
+ * },
46027
+ * padAngle: 0.1,
46028
+ * padding: 0,
46029
+ * startingAngle: 1
46030
+ * }
46031
+ */
46032
+ polar_label_show: !0,
46033
+ polar_label_format: undefined,
46034
+ polar_label_threshold: .05,
46035
+ polar_label_ratio: undefined,
46036
+ polar_level_depth: 3,
46037
+ polar_level_max: undefined,
46038
+ polar_level_show: !0,
46039
+ polar_level_text_backgroundColor: "#fff",
46040
+ polar_level_text_format: function polar_level_text_format(x) {
46041
+ return x % 1 === 0 ? x : x.toFixed(2);
46042
+ },
46043
+ polar_level_text_show: !0,
46044
+ polar_padAngle: 0,
46045
+ polar_padding: 0,
46046
+ polar_startingAngle: 0
46047
+ });
45773
46048
  ;// CONCATENATED MODULE: ./src/config/Options/shape/radar.ts
45774
46049
  /**
45775
46050
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -45870,6 +46145,7 @@ var cacheKey = KEY.radarPoints;
45870
46145
 
45871
46146
 
45872
46147
 
46148
+
45873
46149
  // Options
45874
46150
 
45875
46151
 
@@ -45886,6 +46162,7 @@ var cacheKey = KEY.radarPoints;
45886
46162
 
45887
46163
 
45888
46164
 
46165
+
45889
46166
  /**
45890
46167
  * Extend Axis
45891
46168
  * @param {Array} module Module to be extended
@@ -45978,6 +46255,11 @@ var _area = function area() {
45978
46255
  return extendArc(undefined, [shape_pie]), (resolver_shape_pie = function () {
45979
46256
  return TYPE.PIE;
45980
46257
  })();
46258
+ },
46259
+ resolver_shape_polar = function () {
46260
+ return extendArc([polar], [shape_polar]), (resolver_shape_polar = function () {
46261
+ return TYPE.POLAR;
46262
+ })();
45981
46263
  },
45982
46264
  resolver_shape_radar = function () {
45983
46265
  return extendArc([point, radar], [common_point, shape_radar]), (resolver_shape_radar = function () {
@@ -48472,7 +48754,7 @@ var _defaults = {},
48472
48754
  * bb.version; // "1.0.0"
48473
48755
  * @memberof bb
48474
48756
  */
48475
- version: "3.3.3",
48757
+ version: "3.4.0-next.1",
48476
48758
 
48477
48759
  /**
48478
48760
  * Generate chart
@@ -48520,6 +48802,7 @@ var _defaults = {},
48520
48802
  * gauge,
48521
48803
  * line,
48522
48804
  * pie,
48805
+ * polar,
48523
48806
  * radar,
48524
48807
  * scatter,
48525
48808
  * spline,
@@ -48606,7 +48889,7 @@ var _defaults = {},
48606
48889
  };
48607
48890
  /**
48608
48891
  * @namespace bb
48609
- * @version 3.3.3
48892
+ * @version 3.4.0-next.1
48610
48893
  */
48611
48894
  ;// CONCATENATED MODULE: ./src/index.ts
48612
48895
  /**