billboard.js 3.6.3 → 3.7.0-next.2

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 (91) hide show
  1. package/dist/billboard.css +6 -1
  2. package/dist/billboard.js +1704 -843
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +3819 -2263
  6. package/dist/billboard.pkgd.min.js +6 -3
  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 +62 -23
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +62 -23
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +48 -14
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +48 -14
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1087 -1031
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1171 -1112
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1222 -1169
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1159 -1105
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1365 -1319
  22. package/dist/theme/datalab.css +6 -1
  23. package/dist/theme/datalab.min.css +2 -2
  24. package/dist/theme/graph.css +6 -1
  25. package/dist/theme/graph.min.css +2 -2
  26. package/dist/theme/insight.css +6 -1
  27. package/dist/theme/insight.min.css +2 -2
  28. package/dist-esm/billboard.js +942 -277
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -5
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +10 -9
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +10 -9
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -5
  34. package/package.json +44 -38
  35. package/src/Chart/api/chart.ts +13 -4
  36. package/src/Chart/api/export.ts +159 -14
  37. package/src/Chart/api/legend.ts +1 -0
  38. package/src/Chart/api/load.ts +1 -0
  39. package/src/Chart/api/tooltip.ts +11 -2
  40. package/src/ChartInternal/Axis/Axis.ts +1 -1
  41. package/src/ChartInternal/ChartInternal.ts +35 -25
  42. package/src/ChartInternal/data/IData.ts +9 -0
  43. package/src/ChartInternal/data/convert.helper.ts +35 -21
  44. package/src/ChartInternal/data/data.ts +26 -5
  45. package/src/ChartInternal/data/load.ts +3 -0
  46. package/src/ChartInternal/interactions/interaction.ts +42 -33
  47. package/src/ChartInternal/internals/class.ts +3 -4
  48. package/src/ChartInternal/internals/clip.ts +13 -10
  49. package/src/ChartInternal/internals/domain.ts +11 -4
  50. package/src/ChartInternal/internals/format.ts +1 -1
  51. package/src/ChartInternal/internals/grid.ts +1 -1
  52. package/src/ChartInternal/internals/legend.ts +3 -2
  53. package/src/ChartInternal/internals/redraw.ts +12 -5
  54. package/src/ChartInternal/internals/scale.ts +7 -2
  55. package/src/ChartInternal/internals/size.ts +41 -26
  56. package/src/ChartInternal/internals/text.ts +60 -32
  57. package/src/ChartInternal/internals/tooltip.ts +12 -8
  58. package/src/ChartInternal/internals/transform.ts +2 -2
  59. package/src/ChartInternal/internals/type.ts +6 -1
  60. package/src/ChartInternal/shape/arc.ts +145 -68
  61. package/src/ChartInternal/shape/area.ts +3 -0
  62. package/src/ChartInternal/shape/bar.ts +4 -1
  63. package/src/ChartInternal/shape/line.ts +12 -15
  64. package/src/ChartInternal/shape/radar.ts +2 -2
  65. package/src/ChartInternal/shape/shape.ts +10 -5
  66. package/src/ChartInternal/shape/treemap.ts +293 -0
  67. package/src/config/Options/common/tooltip.ts +11 -8
  68. package/src/config/Options/data/data.ts +6 -3
  69. package/src/config/Options/shape/arc.ts +47 -0
  70. package/src/config/Options/shape/gauge.ts +2 -2
  71. package/src/config/Options/shape/pie.ts +1 -1
  72. package/src/config/Options/shape/polar.ts +1 -1
  73. package/src/config/Options/shape/radar.ts +1 -1
  74. package/src/config/Options/shape/spline.ts +1 -1
  75. package/src/config/Options/shape/treemap.ts +53 -0
  76. package/src/config/Store/State.ts +1 -0
  77. package/src/config/classes.ts +7 -0
  78. package/src/config/const.ts +4 -2
  79. package/src/config/resolver/shape.ts +22 -5
  80. package/src/index.esm.ts +2 -1
  81. package/src/module/util.ts +1 -1
  82. package/src/scss/billboard.scss +6 -0
  83. package/src/scss/theme/datalab.scss +6 -0
  84. package/src/scss/theme/graph.scss +6 -0
  85. package/src/scss/theme/insight.scss +6 -0
  86. package/types/bb.d.ts +1 -0
  87. package/types/chart.d.ts +7 -0
  88. package/types/index.d.ts +1 -0
  89. package/types/options.d.ts +42 -624
  90. package/types/options.shape.d.ts +664 -0
  91. package/types/types.d.ts +4 -3
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.3
8
+ * @version 3.7.0-next.2
9
9
  */
10
10
  import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
11
11
  import { pointer, select, namespaces, selectAll } from 'd3-selection';
@@ -18,6 +18,7 @@ import { curveBasis, curveBasisClosed, curveBasisOpen, curveBundle, curveCardina
18
18
  import { axisLeft, axisBottom, axisTop, axisRight } from 'd3-axis';
19
19
  import { easeLinear } from 'd3-ease';
20
20
  import { interpolate } from 'd3-interpolate';
21
+ import { treemap as treemap$1, hierarchy, treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, treemapResquarify } from 'd3-hierarchy';
21
22
  import { zoomIdentity, zoomTransform, zoom as zoom$2 } from 'd3-zoom';
22
23
 
23
24
  /**
@@ -62,7 +63,8 @@ var TYPE = {
62
63
  RADAR: "radar",
63
64
  SCATTER: "scatter",
64
65
  SPLINE: "spline",
65
- STEP: "step"
66
+ STEP: "step",
67
+ TREEMAP: "treemap"
66
68
  };
67
69
  /**
68
70
  * Chart type module and its method from ChartInternal class, needed to be initialized.
@@ -85,7 +87,8 @@ var TYPE_METHOD_NEEDED = {
85
87
  RADAR: "initCircle",
86
88
  SCATTER: "initCircle",
87
89
  SPLINE: "initLine",
88
- STEP: "initLine"
90
+ STEP: "initLine",
91
+ TREEMAP: "initTreemap"
89
92
  };
90
93
  /**
91
94
  * chart types by category
@@ -149,9 +152,7 @@ var _assign = function __assign() {
149
152
  _assign = Object.assign || function (t) {
150
153
  for (var s, i = 1, n = arguments.length; i < n; i++) {
151
154
  s = arguments[i];
152
- for (var p in s) {
153
- if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
154
- }
155
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
155
156
  }
156
157
  return t;
157
158
  };
@@ -547,13 +548,14 @@ function addCssRules(style, selector, prop) {
547
548
  function getCssRules(styleSheets) {
548
549
  var rules = [];
549
550
  styleSheets.forEach(function (sheet) {
551
+ var _a;
550
552
  try {
551
553
  if (sheet.cssRules && sheet.cssRules.length) {
552
554
  rules = rules.concat(toArray(sheet.cssRules));
553
555
  }
554
556
  }
555
557
  catch (e) {
556
- console.error("Error while reading rules from ".concat(sheet.href, ": ").concat(e.toString()));
558
+ (_a = win.console) === null || _a === void 0 ? void 0 : _a.warn("Error while reading rules from ".concat(sheet.href, ": ").concat(e.toString()));
557
559
  }
558
560
  });
559
561
  return rules;
@@ -1027,11 +1029,16 @@ var $TOOLTIP = {
1027
1029
  tooltipContainer: "bb-tooltip-container",
1028
1030
  tooltipName: "bb-tooltip-name"
1029
1031
  };
1032
+ var $TREEMAP = {
1033
+ treemap: "bb-treemap",
1034
+ chartTreemap: "bb-chart-treemap",
1035
+ chartTreemaps: "bb-chart-treemaps"
1036
+ };
1030
1037
  var $ZOOM = {
1031
1038
  buttonZoomReset: "bb-zoom-reset",
1032
1039
  zoomBrush: "bb-zoom-brush"
1033
1040
  };
1034
- var CLASS = _assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $ZOOM);
1041
+ var CLASS = _assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign(_assign({}, $COMMON), $ARC), $AREA), $AXIS), $BAR), $CANDLESTICK), $CIRCLE), $COLOR), $DRAG), $GAUGE), $LEGEND), $LINE), $EVENT), $FOCUS), $GRID), $RADAR), $REGION), $SELECT), $SHAPE), $SUBCHART), $TEXT), $TOOLTIP), $TREEMAP), $ZOOM);
1035
1042
 
1036
1043
  /**
1037
1044
  * Elements class.
@@ -1132,6 +1139,7 @@ var State = /** @class */ (function () {
1132
1139
  xAxisHeight: 0,
1133
1140
  hasAxis: false,
1134
1141
  hasRadar: false,
1142
+ hasTreemap: false,
1135
1143
  // for data CSS rule index (used when boost.useCssRule is true)
1136
1144
  cssRule: {},
1137
1145
  current: {
@@ -1755,6 +1763,7 @@ var data$2 = {
1755
1763
  * - scatter
1756
1764
  * - spline
1757
1765
  * - step
1766
+ * - treemap
1758
1767
  * @name data․type
1759
1768
  * @memberof Options
1760
1769
  * @type {string}
@@ -1783,7 +1792,8 @@ var data$2 = {
1783
1792
  * radar,
1784
1793
  * scatter,
1785
1794
  * spline,
1786
- * step
1795
+ * step,
1796
+ * treemap
1787
1797
  * }
1788
1798
  *
1789
1799
  * bb.generate({
@@ -1797,7 +1807,7 @@ var data$2 = {
1797
1807
  /**
1798
1808
  * Set chart type for each data.<br>
1799
1809
  * This setting overwrites data.type setting.
1800
- * - **NOTE:** `radar` type can't be combined with other types.
1810
+ * - **NOTE:** `radar` and `treemap` type can't be combined with other types.
1801
1811
  * @name data․types
1802
1812
  * @memberof Options
1803
1813
  * @type {object}
@@ -1829,7 +1839,8 @@ var data$2 = {
1829
1839
  * radar,
1830
1840
  * scatter,
1831
1841
  * spline,
1832
- * step
1842
+ * step,
1843
+ * treemap
1833
1844
  * }
1834
1845
  *
1835
1846
  * bb.generate({
@@ -2822,17 +2833,20 @@ var tooltip$2 = {
2822
2833
  * Specified function receives x of the data point to show.
2823
2834
  * @property {Function} [tooltip.format.name] Set format for the name of each data in tooltip.<br>
2824
2835
  * Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge.
2825
- * @property {Function} [tooltip.format.value] Set format for the value of each data in tooltip.<br>
2826
- * Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge.
2827
- * If undefined returned, the row of that value will be skipped.
2836
+ * @property {Function} [tooltip.format.value] Set format for the value of each data in tooltip. If undefined returned, the row of that value will be skipped to be called.
2837
+ * - Will pass following arguments to the given function:
2838
+ * - `value {string}`: Value of the data point
2839
+ * - `ratio {number}`: Ratio of the data point in the `pie/donut/gauge` and `area/bar` when contains grouped data. Otherwise is `undefined`.
2840
+ * - `id {string}`: id of the data point
2841
+ * - `index {number}`: Index of the data point
2828
2842
  * @property {Function} [tooltip.position] Set custom position function for the tooltip.<br>
2829
2843
  * This option can be used to modify the tooltip position by returning object that has top and left.
2830
2844
  * - Will pass following arguments to the given function:
2831
- * - `data {Array}`: Current selected data array object.
2832
- * - `width {number}`: Width of tooltip.
2833
- * - `height {number}`: Height of tooltip.
2834
- * - `element {SVGElement}`: Tooltip event bound element
2835
- * - `pos {object}`: Current position of the tooltip.
2845
+ * - `data {Array}`: Current selected data array object.
2846
+ * - `width {number}`: Width of tooltip.
2847
+ * - `height {number}`: Height of tooltip.
2848
+ * - `element {SVGElement}`: Tooltip event bound element
2849
+ * - `pos {object}`: Current position of the tooltip.
2836
2850
  * @property {Function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
2837
2851
  * If tooltip.grouped is true, data includes multiple data points.<br><br>
2838
2852
  * Specified function receives `data` array and `defaultTitleFormat`, `defaultValueFormat` and `color` functions of the data point to show.
@@ -3377,22 +3391,22 @@ function rows(rows) {
3377
3391
  */
3378
3392
  function json(json, keysParam) {
3379
3393
  var newRows = [];
3380
- var findValueInJson = function (object, path) {
3381
- if (object[path] !== undefined) {
3382
- return object[path];
3383
- }
3384
- var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"); // convert indexes to properties (replace [] with .)
3385
- var pathArray = convertedPath.replace(/^\./, "").split("."); // strip a leading dot
3386
- var target = object;
3387
- pathArray.some(function (k) {
3388
- return !(target = target && k in target ?
3389
- target[k] : undefined);
3390
- });
3391
- return target;
3392
- };
3393
3394
  var targetKeys;
3394
3395
  var data;
3395
3396
  if (Array.isArray(json)) {
3397
+ var findValueInJson_1 = function (object, path) {
3398
+ if (object[path] !== undefined) {
3399
+ return object[path];
3400
+ }
3401
+ var convertedPath = path.replace(/\[(\w+)\]/g, ".$1"); // convert indexes to properties (replace [] with .)
3402
+ var pathArray = convertedPath.replace(/^\./, "").split("."); // strip a leading dot
3403
+ var target = object;
3404
+ pathArray.some(function (k) {
3405
+ return !(target = target && k in target ?
3406
+ target[k] : undefined);
3407
+ });
3408
+ return target;
3409
+ };
3396
3410
  if (keysParam.x) {
3397
3411
  targetKeys = keysParam.value.concat(keysParam.x);
3398
3412
  }
@@ -3403,7 +3417,7 @@ function json(json, keysParam) {
3403
3417
  json.forEach(function (o) {
3404
3418
  var newRow = targetKeys.map(function (key) {
3405
3419
  // convert undefined to null because undefined data will be removed in convertDataToTargets()
3406
- var v = findValueInJson(o, key);
3420
+ var v = findValueInJson_1(o, key);
3407
3421
  if (typeof v === "undefined") {
3408
3422
  v = null;
3409
3423
  }
@@ -3415,8 +3429,9 @@ function json(json, keysParam) {
3415
3429
  }
3416
3430
  else {
3417
3431
  Object.keys(json).forEach(function (key) {
3432
+ var _a;
3418
3433
  var tmp = json[key].concat();
3419
- tmp.unshift(key);
3434
+ (_a = tmp.unshift) === null || _a === void 0 ? void 0 : _a.call(tmp, key);
3420
3435
  newRows.push(tmp);
3421
3436
  });
3422
3437
  data = columns(newRows);
@@ -3905,7 +3920,7 @@ var data$1 = {
3905
3920
  var $$ = this;
3906
3921
  var cacheKey = KEY.dataTotalPerIndex;
3907
3922
  var sum = $$.cache.get(cacheKey);
3908
- if ($$.isStackNormalized() && !sum) {
3923
+ if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) {
3909
3924
  sum = [];
3910
3925
  $$.data.targets.forEach(function (row) {
3911
3926
  row.values.forEach(function (v, i) {
@@ -4144,12 +4159,12 @@ var data$1 = {
4144
4159
  },
4145
4160
  /**
4146
4161
  * Get data.order compare function
4147
- * @param {boolean} isArc Is for Arc type sort or not
4162
+ * @param {boolean} isReversed for Arc & Treemap type sort order needs to be reversed
4148
4163
  * @returns {Function} compare function
4149
4164
  * @private
4150
4165
  */
4151
- getSortCompareFn: function (isArc) {
4152
- if (isArc === void 0) { isArc = false; }
4166
+ getSortCompareFn: function (isReversed) {
4167
+ if (isReversed === void 0) { isReversed = false; }
4153
4168
  var $$ = this;
4154
4169
  var config = $$.config;
4155
4170
  var order = config.data_order;
@@ -4161,7 +4176,7 @@ var data$1 = {
4161
4176
  fn = function (t1, t2) {
4162
4177
  var t1Sum = "values" in t1 ? t1.values.reduce(reducer_1, 0) : t1.value;
4163
4178
  var t2Sum = "values" in t2 ? t2.values.reduce(reducer_1, 0) : t2.value;
4164
- return isArc ?
4179
+ return isReversed ?
4165
4180
  (orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum) :
4166
4181
  (orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum);
4167
4182
  };
@@ -4367,6 +4382,22 @@ var data$1 = {
4367
4382
  }
4368
4383
  return value;
4369
4384
  },
4385
+ /**
4386
+ * Set ratio for grouped data
4387
+ * @param {Array} data Data array
4388
+ * @private
4389
+ */
4390
+ setRatioForGroupedData: function (data) {
4391
+ var $$ = this;
4392
+ var config = $$.config;
4393
+ // calculate ratio if grouped data exists
4394
+ if (config.data_groups.length && data.some(function (d) { return $$.isGrouped(d.id); })) {
4395
+ var setter_1 = function (d) { return $$.getRatio("index", d, true); };
4396
+ data.forEach(function (v) {
4397
+ "values" in v ? v.values.forEach(setter_1) : setter_1(v);
4398
+ });
4399
+ }
4400
+ },
4370
4401
  /**
4371
4402
  * Get ratio value
4372
4403
  * @param {string} type Ratio for given type
@@ -4406,7 +4437,7 @@ var data$1 = {
4406
4437
  total = total.map(function (v, i) { return v - hiddenSum_1[i]; });
4407
4438
  }
4408
4439
  }
4409
- d.ratio = isNumber(d.value) && total && total[d.index] > 0 ?
4440
+ d.ratio = isNumber(d.value) && total ?
4410
4441
  d.value / total[d.index] : 0;
4411
4442
  ratio = d.ratio;
4412
4443
  }
@@ -4419,6 +4450,9 @@ var data$1 = {
4419
4450
  // when all data are 0, return 0
4420
4451
  ratio = max === 0 ? 0 : Math.abs(d.value) / max;
4421
4452
  }
4453
+ else if (type === "treemap") {
4454
+ ratio /= $$.getTotalDataSum(true);
4455
+ }
4422
4456
  }
4423
4457
  return asPercent && ratio ? ratio * 100 : ratio;
4424
4458
  },
@@ -4572,6 +4606,8 @@ var dataLoad = {
4572
4606
  // Remove target
4573
4607
  $$.data.targets = $$.data.targets.filter(function (t) { return t.id !== id; });
4574
4608
  });
4609
+ // since treemap uses different data types, it needs to be transformed
4610
+ state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
4575
4611
  // Update current state chart type and elements list after redraw
4576
4612
  $$.updateTypesElements();
4577
4613
  }
@@ -4669,14 +4705,15 @@ var interaction = {
4669
4705
  */
4670
4706
  setOverOut: function (isOver, d) {
4671
4707
  var $$ = this;
4672
- var config = $$.config, hasRadar = $$.state.hasRadar, main = $$.$el.main;
4673
- var isArc = isObject(d);
4708
+ var config = $$.config, _a = $$.state, hasRadar = _a.hasRadar, hasTreemap = _a.hasTreemap, main = $$.$el.main;
4709
+ var isArcTreemap = isObject(d);
4674
4710
  // Call event handler
4675
- if (isArc || d !== -1) {
4711
+ if (isArcTreemap || d !== -1) {
4676
4712
  var callback_1 = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
4677
- config.color_onover && $$.setOverColor(isOver, d, isArc);
4678
- if (isArc && "id") {
4679
- callback_1(d, main.select(".".concat($ARC.arc).concat($$.getTargetSelectorSuffix(d.id))).node());
4713
+ config.color_onover && $$.setOverColor(isOver, d, isArcTreemap);
4714
+ if (isArcTreemap && "id") {
4715
+ var selector = hasTreemap ? $TREEMAP.treemap : $ARC.arc;
4716
+ callback_1(d, main.select(".".concat(selector).concat($$.getTargetSelectorSuffix(d.id))).node());
4680
4717
  }
4681
4718
  else if (!config.tooltip_grouped) {
4682
4719
  var last_1 = $$.cache.get(KEY.setOverOut) || [];
@@ -4764,26 +4801,30 @@ var interaction = {
4764
4801
  * @param {Array} mouse x and y coordinate value
4765
4802
  */
4766
4803
  dispatchEvent: function (type, index, mouse) {
4804
+ var _a;
4767
4805
  var $$ = this;
4768
- var config = $$.config, _a = $$.state, eventReceiver = _a.eventReceiver, hasAxis = _a.hasAxis, hasRadar = _a.hasRadar, _b = $$.$el, eventRect = _b.eventRect, arcs = _b.arcs, radar = _b.radar;
4769
- var isMultipleX = $$.isMultipleX();
4770
- var element = (hasRadar ? radar.axes.select(".".concat($AXIS.axis, "-").concat(index, " text")) : (eventRect || arcs.selectAll(".".concat($COMMON.target, " path")).filter(function (d, i) { return i === index; }))).node();
4771
- var _c = element.getBoundingClientRect(), width = _c.width, left = _c.left, top = _c.top;
4772
- if (hasAxis && !hasRadar && !isMultipleX) {
4773
- var coords = eventReceiver.coords[index];
4774
- width = coords.w;
4775
- left += coords.x;
4776
- top += coords.y;
4777
- }
4778
- var x = left + (mouse ? mouse[0] : 0) + (isMultipleX || config.axis_rotated ? 0 : (width / 2));
4779
- var y = top + (mouse ? mouse[1] : 0);
4780
- var params = {
4781
- screenX: x,
4782
- screenY: y,
4783
- clientX: x,
4784
- clientY: y
4785
- };
4786
- emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](element, type, params);
4806
+ var config = $$.config, _b = $$.state, eventReceiver = _b.eventReceiver, hasAxis = _b.hasAxis, hasRadar = _b.hasRadar, hasTreemap = _b.hasTreemap, _c = $$.$el, eventRect = _c.eventRect, arcs = _c.arcs, radar = _c.radar, treemap = _c.treemap;
4807
+ var element = (_a = ((hasTreemap && eventReceiver.rect) ||
4808
+ (hasRadar && radar.axes.select(".".concat($AXIS.axis, "-").concat(index, " text"))) || (eventRect || (arcs === null || arcs === void 0 ? void 0 : arcs.selectAll(".".concat($COMMON.target, " path")).filter(function (d, i) { return i === index; }))))) === null || _a === void 0 ? void 0 : _a.node();
4809
+ if (element) {
4810
+ var isMultipleX = $$.isMultipleX();
4811
+ var _d = element.getBoundingClientRect(), width = _d.width, left = _d.left, top_1 = _d.top;
4812
+ if (hasAxis && !hasRadar && !isMultipleX) {
4813
+ var coords = eventReceiver.coords[index];
4814
+ width = coords.w;
4815
+ left += coords.x;
4816
+ top_1 += coords.y;
4817
+ }
4818
+ var x = left + (mouse ? mouse[0] : 0) + (isMultipleX || config.axis_rotated ? 0 : (width / 2));
4819
+ var y = top_1 + (mouse ? mouse[1] : 0);
4820
+ var params = {
4821
+ screenX: x,
4822
+ screenY: y,
4823
+ clientX: x,
4824
+ clientY: y
4825
+ };
4826
+ emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](hasTreemap ? treemap.node() : element, type, params);
4827
+ }
4787
4828
  },
4788
4829
  setDragStatus: function (isDragging) {
4789
4830
  this.state.dragging = isDragging;
@@ -4805,7 +4846,7 @@ var interaction = {
4805
4846
  unbindAllEvents: function () {
4806
4847
  var _a;
4807
4848
  var $$ = this;
4808
- var _b = $$.$el, arcs = _b.arcs, eventRect = _b.eventRect, legend = _b.legend, region = _b.region, svg = _b.svg, brush = $$.brush;
4849
+ var _b = $$.$el, arcs = _b.arcs, eventRect = _b.eventRect, legend = _b.legend, region = _b.region, svg = _b.svg, treemap = _b.treemap, brush = $$.brush;
4809
4850
  var list = [
4810
4851
  "wheel",
4811
4852
  "click",
@@ -4825,7 +4866,7 @@ var interaction = {
4825
4866
  "dblclick.zoom"
4826
4867
  ].join(" ");
4827
4868
  // detach all possible event types
4828
- [svg, eventRect, region === null || region === void 0 ? void 0 : region.list, brush === null || brush === void 0 ? void 0 : brush.getSelection(), arcs === null || arcs === void 0 ? void 0 : arcs.selectAll("path"), legend === null || legend === void 0 ? void 0 : legend.selectAll("g")]
4869
+ [svg, eventRect, region === null || region === void 0 ? void 0 : region.list, brush === null || brush === void 0 ? void 0 : brush.getSelection(), arcs === null || arcs === void 0 ? void 0 : arcs.selectAll("path"), legend === null || legend === void 0 ? void 0 : legend.selectAll("g"), treemap]
4829
4870
  .forEach(function (v) { return v === null || v === void 0 ? void 0 : v.on(list, null); });
4830
4871
  (_a = $$.unbindZoomEvent) === null || _a === void 0 ? void 0 : _a.call($$);
4831
4872
  }
@@ -4849,7 +4890,7 @@ var classModule = {
4849
4890
  getClass: function (type, withShape) {
4850
4891
  var _this = this;
4851
4892
  var isPlural = /s$/.test(type);
4852
- var useIdKey = /^(area|arc|line)s?$/.test(type);
4893
+ var useIdKey = /^(area|arc|line|treemap)s?$/.test(type);
4853
4894
  var key = isPlural ? "id" : "index";
4854
4895
  return function (d) {
4855
4896
  var data = d.data || d;
@@ -4904,11 +4945,12 @@ var classModule = {
4904
4945
  var targetStr = targetId || targetId === 0 ? "-".concat(targetId) : "";
4905
4946
  return targetStr.replace(/([\s?!@#$%^&*()_=+,.<>'":;\[\]\/|~`{}\\])/g, "-");
4906
4947
  },
4907
- selectorTarget: function (id, prefix) {
4908
- var pfx = prefix || "";
4948
+ selectorTarget: function (id, prefix, postfix) {
4949
+ if (prefix === void 0) { prefix = ""; }
4950
+ if (postfix === void 0) { postfix = ""; }
4909
4951
  var target = this.getTargetSelectorSuffix(id);
4910
4952
  // select target & circle
4911
- return "".concat(pfx, ".").concat(CLASS.target + target, ", ").concat(pfx, ".").concat(CLASS.circles + target);
4953
+ return "".concat(prefix, ".").concat(CLASS.target + target, " ").concat(postfix, ", ").concat(prefix, ".").concat(CLASS.circles + target, " ").concat(postfix);
4912
4954
  },
4913
4955
  selectorTargets: function (idsValue, prefix) {
4914
4956
  var _this = this;
@@ -5256,10 +5298,8 @@ var domain = {
5256
5298
  return $$.hasType(v, yTargets, true) && config["".concat(type, "_zerobased")];
5257
5299
  });
5258
5300
  // MEMO: avoid inverting domain unexpectedly
5259
- yDomainMin = isValue(yMin) ? yMin :
5260
- (isValue(yMax) ? (yDomainMin < yMax ? yDomainMin : yMax - 10) : yDomainMin);
5261
- yDomainMax = isValue(yMax) ? yMax :
5262
- (isValue(yMin) ? (yMin < yDomainMax ? yDomainMax : yMin + 10) : yDomainMax);
5301
+ yDomainMin = isValue(yMin) ? yMin : (isValue(yMax) ? (yDomainMin <= yMax ? yDomainMin : yMax - 10) : yDomainMin);
5302
+ yDomainMax = isValue(yMax) ? yMax : (isValue(yMin) ? (yMin <= yDomainMax ? yDomainMax : yMin + 10) : yDomainMax);
5263
5303
  if (isNaN(yDomainMin)) { // set minimum to zero when not number
5264
5304
  yDomainMin = 0;
5265
5305
  }
@@ -5506,7 +5546,7 @@ function getFormat($$, typeValue, v) {
5506
5546
  var type = "axis_".concat(typeValue, "_tick_format");
5507
5547
  var format = config[type] ?
5508
5548
  config[type] : $$.defaultValueFormat;
5509
- return format(v);
5549
+ return format.call($$.api, v);
5510
5550
  }
5511
5551
  var format = {
5512
5552
  yFormat: function (v) {
@@ -5610,6 +5650,7 @@ var legend$1 = {
5610
5650
  * @private
5611
5651
  */
5612
5652
  updateLegend: function (targetIds, options, transitions) {
5653
+ var _a;
5613
5654
  var $$ = this;
5614
5655
  var config = $$.config, state = $$.state, scale = $$.scale, $el = $$.$el;
5615
5656
  var optionz = options || {
@@ -5622,12 +5663,11 @@ var legend$1 = {
5622
5663
  if (config.legend_contents_bindto && config.legend_contents_template) {
5623
5664
  $$.updateLegendTemplate();
5624
5665
  }
5625
- else {
5666
+ else if (!state.hasTreemap) {
5626
5667
  $$.updateLegendElement(targetIds || $$.mapToIds($$.data.targets), optionz, transitions);
5627
5668
  }
5628
5669
  // toggle legend state
5629
- $el.legend.selectAll(".".concat($LEGEND.legendItem))
5630
- .classed($LEGEND.legendItemHidden, function (id) {
5670
+ (_a = $el.legend) === null || _a === void 0 ? void 0 : _a.selectAll(".".concat($LEGEND.legendItem)).classed($LEGEND.legendItemHidden, function (id) {
5631
5671
  var hide = !$$.isTargetToShow(id);
5632
5672
  if (hide) {
5633
5673
  this.style.opacity = null;
@@ -6286,7 +6326,7 @@ var redraw = {
6286
6326
  if (options === void 0) { options = {}; }
6287
6327
  var $$ = this;
6288
6328
  var config = $$.config, state = $$.state, $el = $$.$el;
6289
- var main = $el.main;
6329
+ var main = $el.main, treemap = $el.treemap;
6290
6330
  state.redrawing = true;
6291
6331
  var targetsToShow = $$.filterTargetsToShow($$.data.targets);
6292
6332
  var flow = options.flow, initializing = options.initializing;
@@ -6299,7 +6339,7 @@ var redraw = {
6299
6339
  // update legend and transform each g
6300
6340
  if (wth.Legend && config.legend_show) {
6301
6341
  options.withTransition = !!duration;
6302
- $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
6342
+ !treemap && $$.updateLegend($$.mapToIds($$.data.targets), options, transitions);
6303
6343
  }
6304
6344
  else if (wth.Dimension) {
6305
6345
  // need to update dimension (e.g. axis.y.tick.values) because y tick values should change
@@ -6307,7 +6347,7 @@ var redraw = {
6307
6347
  $$.updateDimension(true);
6308
6348
  }
6309
6349
  // update circleY based on updated parameters
6310
- if (!$$.hasArcType() || state.hasRadar) {
6350
+ if (!treemap && (!$$.hasArcType() || state.hasRadar)) {
6311
6351
  $$.updateCircleY && ($$.circleY = $$.updateCircleY());
6312
6352
  }
6313
6353
  // update axis
@@ -6348,9 +6388,11 @@ var redraw = {
6348
6388
  $el.radar && $$.redrawRadar();
6349
6389
  // polar
6350
6390
  $el.polar && $$.redrawPolar();
6391
+ // treemap
6392
+ treemap && $$.updateTreemap(durationForExit);
6351
6393
  }
6352
6394
  // @TODO: Axis & Radar type
6353
- if (!state.resizing && ($$.hasPointType() || state.hasRadar)) {
6395
+ if (!state.resizing && !treemap && ($$.hasPointType() || state.hasRadar)) {
6354
6396
  $$.updateCircle();
6355
6397
  }
6356
6398
  // text
@@ -6419,7 +6461,7 @@ var redraw = {
6419
6461
  },
6420
6462
  getRedrawList: function (shape, flow, flowFn, withTransition) {
6421
6463
  var $$ = this;
6422
- var config = $$.config, _a = $$.state, hasAxis = _a.hasAxis, hasRadar = _a.hasRadar, grid = $$.$el.grid;
6464
+ var config = $$.config, _a = $$.state, hasAxis = _a.hasAxis, hasRadar = _a.hasRadar, hasTreemap = _a.hasTreemap, grid = $$.$el.grid;
6423
6465
  var _b = shape.pos, cx = _b.cx, cy = _b.cy, xForText = _b.xForText, yForText = _b.yForText;
6424
6466
  var list = [];
6425
6467
  if (hasAxis) {
@@ -6445,6 +6487,9 @@ var redraw = {
6445
6487
  if (($$.hasPointType() || hasRadar) && !config.point_focus_only) {
6446
6488
  $$.redrawCircle && list.push($$.redrawCircle(cx, cy, withTransition, flowFn));
6447
6489
  }
6490
+ if (hasTreemap) {
6491
+ list.push($$.redrawTreemap(withTransition));
6492
+ }
6448
6493
  return list;
6449
6494
  },
6450
6495
  updateAndRedraw: function (options) {
@@ -6556,8 +6601,9 @@ var scale = {
6556
6601
  * @private
6557
6602
  */
6558
6603
  getYScaleById: function (id, isSub) {
6604
+ var _a;
6559
6605
  if (isSub === void 0) { isSub = false; }
6560
- var isY2 = this.axis.getId(id) === "y2";
6606
+ var isY2 = ((_a = this.axis) === null || _a === void 0 ? void 0 : _a.getId(id)) === "y2";
6561
6607
  var key = isSub ? (isY2 ? "subY2" : "subY") : (isY2 ? "y2" : "y");
6562
6608
  return this.scale[key];
6563
6609
  },
@@ -6605,7 +6651,7 @@ var scale = {
6605
6651
  var _a, _b;
6606
6652
  if (updateXDomain === void 0) { updateXDomain = true; }
6607
6653
  var $$ = this;
6608
- var axis = $$.axis, config = $$.config, format = $$.format, org = $$.org, scale = $$.scale, _c = $$.state, width = _c.width, height = _c.height, width2 = _c.width2, height2 = _c.height2, hasAxis = _c.hasAxis;
6654
+ var axis = $$.axis, config = $$.config, format = $$.format, org = $$.org, scale = $$.scale, _c = $$.state, current = _c.current, width = _c.width, height = _c.height, width2 = _c.width2, height2 = _c.height2, hasAxis = _c.hasAxis, hasTreemap = _c.hasTreemap;
6609
6655
  if (hasAxis) {
6610
6656
  var isRotated = config.axis_rotated;
6611
6657
  var resettedPadding = $$.getResettedPadding(1);
@@ -6648,6 +6694,11 @@ var scale = {
6648
6694
  axis.setAxis("y2", scale.y2, config.axis_y2_tick_outer, isInit);
6649
6695
  }
6650
6696
  }
6697
+ else if (hasTreemap) {
6698
+ var padding = $$.getCurrentPadding();
6699
+ scale.x = scaleLinear().rangeRound([padding.left, current.width - padding.right]);
6700
+ scale.y = scaleLinear().rangeRound([padding.top, current.height - padding.bottom]);
6701
+ }
6651
6702
  else {
6652
6703
  // update for arc
6653
6704
  (_b = $$.updateArc) === null || _b === void 0 ? void 0 : _b.call($$);
@@ -6702,9 +6753,9 @@ var shape = {
6702
6753
  getDrawShape: function () {
6703
6754
  var $$ = this;
6704
6755
  var isRotated = $$.config.axis_rotated;
6705
- var hasRadar = $$.state.hasRadar;
6756
+ var _a = $$.state, hasRadar = _a.hasRadar, hasTreemap = _a.hasTreemap;
6706
6757
  var shape = { type: {}, indices: {}, pos: {} };
6707
- ["bar", "candlestick", "line", "area"].forEach(function (v) {
6758
+ !hasTreemap && ["bar", "candlestick", "line", "area"].forEach(function (v) {
6708
6759
  var name = capitalize(/^(bubble|scatter)$/.test(v) ? "line" : v);
6709
6760
  if ($$.hasType(v) || $$.hasTypeOf(name) || (v === "line" && ($$.hasType("bubble") || $$.hasType("scatter")))) {
6710
6761
  var indices = $$.getShapeIndices($$["is".concat(name, "Type")]);
@@ -6713,10 +6764,14 @@ var shape = {
6713
6764
  shape.type[v] = drawFn ? drawFn.bind($$)(indices, false) : undefined;
6714
6765
  }
6715
6766
  });
6716
- if (!$$.hasArcType() || hasRadar) {
6767
+ if (!$$.hasArcType() || hasRadar || hasTreemap) {
6768
+ var cx = void 0;
6769
+ var cy = void 0;
6717
6770
  // generate circle x/y functions depending on updated params
6718
- var cx = hasRadar ? $$.radarCircleX : (isRotated ? $$.circleY : $$.circleX);
6719
- var cy = hasRadar ? $$.radarCircleY : (isRotated ? $$.circleX : $$.circleY);
6771
+ if (!hasTreemap) {
6772
+ cx = hasRadar ? $$.radarCircleX : (isRotated ? $$.circleY : $$.circleX);
6773
+ cy = hasRadar ? $$.radarCircleY : (isRotated ? $$.circleX : $$.circleY);
6774
+ }
6720
6775
  shape.pos = {
6721
6776
  xForText: $$.generateXYForText(shape.indices, true),
6722
6777
  yForText: $$.generateXYForText(shape.indices, false),
@@ -7174,7 +7229,7 @@ var size = {
7174
7229
  $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0;
7175
7230
  var padding;
7176
7231
  if (isValue(config.padding_right)) {
7177
- padding = config.padding_right + 1; // 1 is needed not to hide tick line
7232
+ padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line
7178
7233
  }
7179
7234
  else if ($$.axis && config.axis_rotated) {
7180
7235
  padding = defaultPadding + legendWidthOnRight;
@@ -7283,6 +7338,15 @@ var size = {
7283
7338
  .attr("height", brushSize.height);
7284
7339
  }
7285
7340
  },
7341
+ getCurrentPadding: function () {
7342
+ var $$ = this;
7343
+ return {
7344
+ top: $$.getCurrentPaddingTop(),
7345
+ bottom: $$.getCurrentPaddingBottom(),
7346
+ left: $$.getCurrentPaddingLeft(),
7347
+ right: $$.getCurrentPaddingRight()
7348
+ };
7349
+ },
7286
7350
  /**
7287
7351
  * Get resetted padding values when 'padding=false' option is set
7288
7352
  * https://github.com/naver/billboard.js/issues/2367
@@ -7318,32 +7382,33 @@ var size = {
7318
7382
  var $$ = this;
7319
7383
  var config = $$.config, state = $$.state, legend = $$.$el.legend;
7320
7384
  var isRotated = config.axis_rotated;
7321
- var hasArc = $$.hasArcType();
7385
+ var isNonAxis = $$.hasArcType() || state.hasTreemap;
7322
7386
  !isInit && $$.setContainerSize();
7323
7387
  var currLegend = {
7324
7388
  width: legend ? $$.getLegendWidth() : 0,
7325
7389
  height: legend ? $$.getLegendHeight() : 0
7326
7390
  };
7327
- if (!hasArc && config.axis_x_show && config.axis_x_tick_autorotate) {
7391
+ if (!isNonAxis && config.axis_x_show && config.axis_x_tick_autorotate) {
7328
7392
  $$.updateXAxisTickClip();
7329
7393
  }
7330
7394
  var legendHeightForBottom = state.isLegendRight || state.isLegendInset ? 0 : currLegend.height;
7331
- var xAxisHeight = isRotated || hasArc ? 0 : $$.getHorizontalAxisHeight("x");
7395
+ var xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x");
7332
7396
  var subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ?
7333
7397
  xAxisHeight : 30;
7334
- var subchartHeight = config.subchart_show && !hasArc ?
7398
+ var subchartHeight = config.subchart_show && !isNonAxis ?
7335
7399
  (config.subchart_size_height + subchartXAxisHeight) : 0;
7400
+ var padding = $$.getCurrentPadding();
7336
7401
  // for main
7337
- state.margin = !hasArc && isRotated ? {
7338
- top: $$.getHorizontalAxisHeight("y2") + $$.getCurrentPaddingTop(),
7339
- right: hasArc ? 0 : $$.getCurrentPaddingRight(true),
7340
- bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + $$.getCurrentPaddingBottom(),
7341
- left: subchartHeight + (hasArc ? 0 : $$.getCurrentPaddingLeft())
7402
+ state.margin = !isNonAxis && isRotated ? {
7403
+ top: $$.getHorizontalAxisHeight("y2") + padding.top,
7404
+ right: isNonAxis ? 0 : $$.getCurrentPaddingRight(true),
7405
+ bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + padding.bottom,
7406
+ left: subchartHeight + (isNonAxis ? 0 : padding.left)
7342
7407
  } : {
7343
- top: 4 + $$.getCurrentPaddingTop(),
7344
- right: hasArc ? 0 : $$.getCurrentPaddingRight(true),
7345
- bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
7346
- left: hasArc ? 0 : $$.getCurrentPaddingLeft()
7408
+ top: 4 + padding.top,
7409
+ right: isNonAxis ? 0 : $$.getCurrentPaddingRight(true),
7410
+ bottom: xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
7411
+ left: isNonAxis ? 0 : padding.left
7347
7412
  };
7348
7413
  state.margin = $$.getResettedPadding(state.margin);
7349
7414
  // for subchart
@@ -7385,15 +7450,17 @@ var size = {
7385
7450
  state.height2 = 0;
7386
7451
  }
7387
7452
  // for arc
7388
- var hasGauge = $$.hasType("gauge");
7389
- var isLegendRight = config.legend_show && state.isLegendRight;
7390
- state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0);
7391
- state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
7392
- if (hasGauge && !config.gauge_fullCircle) {
7393
- state.arcHeight += state.height - $$.getPaddingBottomForGauge();
7394
- }
7395
- (_b = $$.updateRadius) === null || _b === void 0 ? void 0 : _b.call($$);
7396
- if (state.isLegendRight && hasArc) {
7453
+ if ($$.hasArcType()) {
7454
+ var hasGauge = $$.hasType("gauge");
7455
+ var isLegendRight = config.legend_show && state.isLegendRight;
7456
+ state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0);
7457
+ state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
7458
+ if (hasGauge && !config.gauge_fullCircle) {
7459
+ state.arcHeight += state.height - $$.getPaddingBottomForGauge();
7460
+ }
7461
+ (_b = $$.updateRadius) === null || _b === void 0 ? void 0 : _b.call($$);
7462
+ }
7463
+ if (state.isLegendRight && isNonAxis) {
7397
7464
  state.margin3.left = state.arcWidth / 2 + state.radiusExpanded * 1.1;
7398
7465
  }
7399
7466
  }
@@ -7522,7 +7589,8 @@ var text = {
7522
7589
  initText: function () {
7523
7590
  var $el = this.$el;
7524
7591
  $el.main.select(".".concat($COMMON.chart)).append("g")
7525
- .attr("class", $TEXT.chartTexts);
7592
+ .attr("class", $TEXT.chartTexts)
7593
+ .style("pointer-events", $el.treemap ? "none" : null);
7526
7594
  },
7527
7595
  /**
7528
7596
  * Update chartText
@@ -7534,9 +7602,10 @@ var text = {
7534
7602
  var classChartText = $$.getChartClass("Text");
7535
7603
  var classTexts = $$.getClass("texts", "id");
7536
7604
  var classFocus = $$.classFocus.bind($$);
7537
- var mainTextUpdate = $$.$el.main.select(".".concat($TEXT.chartTexts)).selectAll(".".concat($TEXT.chartText))
7605
+ var mainTextUpdate = $$.$el.main.select(".".concat($TEXT.chartTexts))
7606
+ .selectAll(".".concat($TEXT.chartText))
7538
7607
  .data(targets)
7539
- .attr("class", function (d) { return classChartText(d) + classFocus(d); });
7608
+ .attr("class", function (d) { return "".concat(classChartText(d)).concat(classFocus(d)).trim(); });
7540
7609
  var mainTextEnter = mainTextUpdate.enter().append("g")
7541
7610
  .style("opacity", "0")
7542
7611
  .attr("class", classChartText)
@@ -7552,6 +7621,7 @@ var text = {
7552
7621
  var $$ = this;
7553
7622
  var $el = $$.$el, $T = $$.$T, config = $$.config;
7554
7623
  var classText = $$.getClass("text", "index");
7624
+ var labelsCentered = config.data_labels.centered;
7555
7625
  var text = $el.main.selectAll(".".concat($TEXT.texts))
7556
7626
  .selectAll(".".concat($TEXT.text))
7557
7627
  .data($$.labelishData.bind($$));
@@ -7569,6 +7639,9 @@ var text = {
7569
7639
  var data = $$.getCandlestickData(d);
7570
7640
  isEndAnchor = !(data === null || data === void 0 ? void 0 : data._isUp);
7571
7641
  }
7642
+ else if ($$.isTreemapType(d)) {
7643
+ return labelsCentered ? "middle" : "start";
7644
+ }
7572
7645
  return (config.axis_rotated ? (isEndAnchor ? "end" : "start") : "middle");
7573
7646
  })
7574
7647
  .style("fill", $$.getStylePropValue($$.updateTextColor))
@@ -7585,7 +7658,8 @@ var text = {
7585
7658
  value = data.close;
7586
7659
  }
7587
7660
  }
7588
- value = $$.dataLabelFormat(d.id)(value, d.id, i, texts);
7661
+ value = $$.isTreemapType(d) ? $$.treemapDataLabelFormat(d)(node) :
7662
+ $$.dataLabelFormat(d.id)(value, d.id, i, texts);
7589
7663
  if (isNumber(value)) {
7590
7664
  this.textContent = value;
7591
7665
  }
@@ -7598,7 +7672,8 @@ var text = {
7598
7672
  var $$ = this;
7599
7673
  var config = $$.config;
7600
7674
  var labelColors = config.data_labels_colors;
7601
- var defaultColor = $$.isArcType(d) && !$$.isRadarType(d) ? null : $$.color(d);
7675
+ var defaultColor = ($$.isArcType(d) && !$$.isRadarType(d)) || $$.isTreemapType(d) ?
7676
+ null : $$.color(d);
7602
7677
  var color;
7603
7678
  if (isString(labelColors)) {
7604
7679
  color = labelColors;
@@ -7650,19 +7725,20 @@ var text = {
7650
7725
  */
7651
7726
  redrawText: function (getX, getY, forFlow, withTransition) {
7652
7727
  var $$ = this;
7653
- var $T = $$.$T, axis = $$.axis, config = $$.config;
7728
+ var $T = $$.$T, axis = $$.axis, config = $$.config, hasTreemap = $$.state.hasTreemap;
7654
7729
  var t = getRandom(true);
7655
7730
  var isRotated = config.axis_rotated;
7656
7731
  var angle = config.data_labels.rotate;
7657
7732
  var anchorString = getRotateAnchor(angle);
7658
7733
  var rotateString = angle ? "rotate(".concat(angle, ")") : "";
7734
+ // $$.meetsLabelThreshold(ratio,
7659
7735
  $$.$el.text
7660
7736
  .style("fill", $$.getStylePropValue($$.updateTextColor))
7661
7737
  .attr("filter", $$.updateTextBacgroundColor.bind($$))
7662
7738
  .style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$))
7663
7739
  .each(function (d, i) {
7664
7740
  // do not apply transition for newly added text elements
7665
- var node = $T(this, !!(withTransition && this.getAttribute("x")), t);
7741
+ var node = $T(hasTreemap && this.childElementCount ? this.parentNode : this, !!(withTransition && this.getAttribute("x")), t);
7666
7742
  var isInverted = config["axis_".concat(axis === null || axis === void 0 ? void 0 : axis.getId(d.id), "_inverted")];
7667
7743
  var pos = {
7668
7744
  x: getX.bind(this)(d, i),
@@ -7723,10 +7799,12 @@ var text = {
7723
7799
  */
7724
7800
  generateXYForText: function (indices, forX) {
7725
7801
  var $$ = this;
7802
+ var _a = $$.state, hasRadar = _a.hasRadar, hasTreemap = _a.hasTreemap;
7726
7803
  var types = Object.keys(indices);
7727
7804
  var points = {};
7728
7805
  var getter = forX ? $$.getXForText : $$.getYForText;
7729
- $$.hasType("radar") && types.push("radar");
7806
+ hasRadar && types.push("radar");
7807
+ hasTreemap && types.push("treemap");
7730
7808
  types.forEach(function (v) {
7731
7809
  points[v] = $$["generateGet".concat(capitalize(v), "Points")](indices[v], false);
7732
7810
  });
@@ -7734,7 +7812,8 @@ var text = {
7734
7812
  var type = ($$.isAreaType(d) && "area") ||
7735
7813
  ($$.isBarType(d) && "bar") ||
7736
7814
  ($$.isCandlestickType(d) && "candlestick") ||
7737
- ($$.isRadarType(d) && "radar") || "line";
7815
+ ($$.isRadarType(d) && "radar") ||
7816
+ ($$.isTreemapType(d) && "treemap") || "line";
7738
7817
  return getter.call($$, points[type](d, i), d, this);
7739
7818
  };
7740
7819
  },
@@ -7743,27 +7822,37 @@ var text = {
7743
7822
  * @param {object} d Data object
7744
7823
  * @param {Array} points Data points position
7745
7824
  * @param {HTMLElement} textElement Data label text element
7825
+ * @param {string} type 'x' or 'y'
7746
7826
  * @returns {number} Position value
7747
7827
  * @private
7748
7828
  */
7749
- getCenteredTextPos: function (d, points, textElement) {
7829
+ getCenteredTextPos: function (d, points, textElement, type) {
7750
7830
  var $$ = this;
7751
7831
  var config = $$.config;
7752
7832
  var isRotated = config.axis_rotated;
7753
- if (config.data_labels.centered && $$.isBarType(d)) {
7833
+ var isBarType = $$.isBarType(d);
7834
+ var isTreemapType = $$.isTreemapType(d);
7835
+ if (config.data_labels.centered && (isBarType || isTreemapType)) {
7754
7836
  var rect = getBoundingRect(textElement);
7755
- var isPositive = d.value >= 0;
7756
- if (isRotated) {
7757
- var w = (isPositive ?
7758
- points[1][1] - points[0][1] :
7759
- points[0][1] - points[1][1]) / 2 + (rect.width / 2);
7760
- return isPositive ? -w - 3 : w + 2;
7837
+ if (isBarType) {
7838
+ var isPositive = d.value >= 0;
7839
+ if (isRotated) {
7840
+ var w = (isPositive ?
7841
+ points[1][1] - points[0][1] :
7842
+ points[0][1] - points[1][1]) / 2 + (rect.width / 2);
7843
+ return isPositive ? -w - 3 : w + 2;
7844
+ }
7845
+ else {
7846
+ var h = (isPositive ?
7847
+ points[0][1] - points[1][1] :
7848
+ points[1][1] - points[0][1]) / 2 + (rect.height / 2);
7849
+ return isPositive ? h : -h - 2;
7850
+ }
7761
7851
  }
7762
- else {
7763
- var h = (isPositive ?
7764
- points[0][1] - points[1][1] :
7765
- points[1][1] - points[0][1]) / 2 + (rect.height / 2);
7766
- return isPositive ? h : -h - 2;
7852
+ else if (isTreemapType) {
7853
+ return type === "x" ?
7854
+ (points[1][0] - points[0][0]) / 2 :
7855
+ (points[1][1] - points[0][1]) / 2 + (rect.height / 2);
7767
7856
  }
7768
7857
  }
7769
7858
  return 0;
@@ -7792,6 +7881,7 @@ var text = {
7792
7881
  var $$ = this;
7793
7882
  var config = $$.config, state = $$.state;
7794
7883
  var isRotated = config.axis_rotated;
7884
+ var isTreemapType = $$.isTreemapType(d);
7795
7885
  var xPos = points[0][0];
7796
7886
  if ($$.isCandlestickType(d)) {
7797
7887
  if (isRotated) {
@@ -7802,6 +7892,9 @@ var text = {
7802
7892
  xPos += (points[1][0] - xPos) / 2;
7803
7893
  }
7804
7894
  }
7895
+ else if (isTreemapType) {
7896
+ xPos += config.data_labels.centered ? 0 : 5;
7897
+ }
7805
7898
  else {
7806
7899
  if (isRotated) {
7807
7900
  var padding = $$.isBarType(d) ? 4 : 6;
@@ -7821,8 +7914,8 @@ var text = {
7821
7914
  xPos = 4;
7822
7915
  }
7823
7916
  }
7824
- if (isRotated) {
7825
- xPos += $$.getCenteredTextPos(d, points, textElement);
7917
+ if (isRotated || isTreemapType) {
7918
+ xPos += $$.getCenteredTextPos(d, points, textElement, "x");
7826
7919
  }
7827
7920
  return xPos + $$.getTextPos(d.id, "x");
7828
7921
  },
@@ -7840,6 +7933,7 @@ var text = {
7840
7933
  var isRotated = config.axis_rotated;
7841
7934
  var isInverted = config["axis_".concat(axis === null || axis === void 0 ? void 0 : axis.getId(d.id), "_inverted")];
7842
7935
  var isBarType = $$.isBarType(d);
7936
+ var isTreemapType = $$.isTreemapType(d);
7843
7937
  var r = config.point_r;
7844
7938
  var rect = getBoundingRect(textElement);
7845
7939
  var value = d.value;
@@ -7860,6 +7954,9 @@ var text = {
7860
7954
  }
7861
7955
  }
7862
7956
  }
7957
+ else if (isTreemapType) {
7958
+ yPos = points[0][1] + (config.data_labels.centered ? 0 : rect.height + 5);
7959
+ }
7863
7960
  else {
7864
7961
  if (isRotated) {
7865
7962
  yPos = (points[0][0] + points[2][0] + rect.height * 0.6) / 2;
@@ -7897,8 +7994,8 @@ var text = {
7897
7994
  yPos = state.height - 4;
7898
7995
  }
7899
7996
  }
7900
- if (!isRotated) {
7901
- yPos += $$.getCenteredTextPos(d, points, textElement);
7997
+ if (!isRotated || isTreemapType) {
7998
+ yPos += $$.getCenteredTextPos(d, points, textElement, "y");
7902
7999
  }
7903
8000
  return yPos + $$.getTextPos(d.id, "y");
7904
8001
  },
@@ -8144,14 +8241,14 @@ var tooltip$1 = {
8144
8241
  */
8145
8242
  getTooltipContent: function (d, defaultTitleFormat, defaultValueFormat, color) {
8146
8243
  var $$ = this;
8147
- var api = $$.api, config = $$.config, state = $$.state;
8244
+ var api = $$.api, config = $$.config, state = $$.state, $el = $$.$el;
8148
8245
  var _a = ["title", "name", "value"].map(function (v) {
8149
8246
  var fn = config["tooltip_format_".concat(v)];
8150
8247
  return isFunction(fn) ? fn.bind(api) : fn;
8151
8248
  }), titleFormat = _a[0], nameFormat = _a[1], valueFormat = _a[2];
8152
8249
  titleFormat = titleFormat || defaultTitleFormat;
8153
8250
  nameFormat = nameFormat || (function (name) { return name; });
8154
- valueFormat = valueFormat || ($$.isStackNormalized() ? function (v, ratio) { return "".concat((ratio * 100).toFixed(2), "%"); } : defaultValueFormat);
8251
+ valueFormat = valueFormat || (state.hasTreemap || $$.isStackNormalized() ? function (v, ratio) { return "".concat((ratio * 100).toFixed(2), "%"); } : defaultValueFormat);
8155
8252
  var order = config.tooltip_order;
8156
8253
  var getRowValue = function (row) { return ($$.axis && $$.isBubbleZType(row) ? $$.getBubbleZData(row.value, "z") : $$.getBaseValue(row)); };
8157
8254
  var getBgColor = $$.levelColor ? function (row) { return $$.levelColor(row.value); } : function (row) { return color(row); };
@@ -8204,8 +8301,9 @@ var tooltip$1 = {
8204
8301
  TITLE: isValue(title) ? (tplStr ? title : "<tr><th colspan=\"2\">".concat(title, "</th></tr>")) : ""
8205
8302
  });
8206
8303
  }
8207
- if (!row.ratio && $$.$el.arcs) {
8208
- row.ratio = $$.getRatio("arc", $$.$el.arcs.select("path.".concat($ARC.arc, "-").concat(row.id)).data()[0]);
8304
+ if (!row.ratio && $el.arcs) {
8305
+ param = ["arc", $$.$el.arcs.select("path.".concat($ARC.arc, "-").concat(row.id)).data()[0]];
8306
+ row.ratio = $$.getRatio.apply($$, param);
8209
8307
  }
8210
8308
  param = [row.ratio, row.id, row.index, d];
8211
8309
  value = sanitise(valueFormat.apply(void 0, __spreadArray([getRowValue(row)], param, false)));
@@ -8273,6 +8371,7 @@ var tooltip$1 = {
8273
8371
  var config = $$.config, scale = $$.scale, state = $$.state;
8274
8372
  var width = state.width, height = state.height, current = state.current, isLegendRight = state.isLegendRight, inputType = state.inputType, event = state.event;
8275
8373
  var hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle;
8374
+ var hasTreemap = state.hasTreemap;
8276
8375
  var svgLeft = $$.getSvgLeft(true);
8277
8376
  var chartRight = svgLeft + current.width - $$.getCurrentPaddingRight();
8278
8377
  var chartLeft = $$.getCurrentPaddingLeft(true);
@@ -8286,7 +8385,7 @@ var tooltip$1 = {
8286
8385
  x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
8287
8386
  }
8288
8387
  }
8289
- else {
8388
+ else if (!hasTreemap) {
8290
8389
  var dataScale = scale.x(dataToShow[0].x);
8291
8390
  if (config.axis_rotated) {
8292
8391
  y = dataScale + size;
@@ -8295,15 +8394,16 @@ var tooltip$1 = {
8295
8394
  }
8296
8395
  else {
8297
8396
  y -= 5;
8298
- x = svgLeft + chartLeft + size + ($$.scale.zoom ? x : dataScale);
8397
+ x = svgLeft + chartLeft + size + (scale.zoom ? x : dataScale);
8299
8398
  }
8300
8399
  }
8301
8400
  // when tooltip left + tWidth > chart's width
8302
8401
  if ((x + tWidth + 15) > chartRight) {
8303
- x -= tWidth + chartLeft;
8402
+ x -= tWidth + (hasTreemap ? 0 : chartLeft);
8304
8403
  }
8305
8404
  if (y + tHeight > current.height) {
8306
- y -= hasGauge ? tHeight * 3 : tHeight + 30;
8405
+ var gap = hasTreemap ? 0 : 30;
8406
+ y -= hasGauge ? tHeight * 3 : tHeight + gap;
8307
8407
  }
8308
8408
  var pos = { top: y, left: x };
8309
8409
  // make sure to not be positioned out of viewport
@@ -8527,8 +8627,8 @@ var transform = {
8527
8627
  },
8528
8628
  transformAll: function (withTransition, transitions) {
8529
8629
  var $$ = this;
8530
- var config = $$.config, hasAxis = $$.state.hasAxis, $el = $$.$el;
8531
- $$.transformMain(withTransition, transitions);
8630
+ var config = $$.config, _a = $$.state, hasAxis = _a.hasAxis, hasTreemap = _a.hasTreemap, $el = $$.$el;
8631
+ !hasTreemap && $$.transformMain(withTransition, transitions);
8532
8632
  hasAxis && config.subchart_show &&
8533
8633
  $$.transformContext(withTransition, transitions);
8534
8634
  $el.legend && $$.transformLegend(withTransition);
@@ -8688,6 +8788,9 @@ var typeInternals = {
8688
8788
  isScatterType: function (d) {
8689
8789
  return this.isTypeOf(d, "scatter");
8690
8790
  },
8791
+ isTreemapType: function (d) {
8792
+ return this.isTypeOf(d, "treemap");
8793
+ },
8691
8794
  isPieType: function (d) {
8692
8795
  return this.isTypeOf(d, "pie");
8693
8796
  },
@@ -8742,7 +8845,8 @@ var typeInternals = {
8742
8845
  this.isScatterType(d) ||
8743
8846
  this.isBubbleType(d) ||
8744
8847
  this.isCandlestickType(d) ||
8745
- this.isRadarType(d) ? d.values.filter(function (v) { return isNumber(v.value) || Boolean(v.value); }) : [];
8848
+ this.isRadarType(d) ||
8849
+ this.isTreemapType(d) ? d.values.filter(function (v) { return isNumber(v.value) || Boolean(v.value); }) : [];
8746
8850
  },
8747
8851
  barLineBubbleData: function (d) {
8748
8852
  return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ?
@@ -8870,8 +8974,9 @@ var ChartInternal = /** @class */ (function () {
8870
8974
  var config = $$.config, state = $$.state, $el = $$.$el;
8871
8975
  var useCssRule = config.boost_useCssRule;
8872
8976
  checkModuleImport($$);
8873
- state.hasAxis = !$$.hasArcType();
8874
8977
  state.hasRadar = !state.hasAxis && $$.hasType("radar");
8978
+ state.hasTreemap = !state.hasAxis && $$.hasType("treemap");
8979
+ state.hasAxis = !$$.hasArcType() && !state.hasTreemap;
8875
8980
  // datetime to be used for uniqueness
8876
8981
  state.datetimeId = "bb-".concat(+new Date() * getRandom());
8877
8982
  if (useCssRule) {
@@ -8954,8 +9059,8 @@ var ChartInternal = /** @class */ (function () {
8954
9059
  if ($$.hasPointType()) {
8955
9060
  $$.point = $$.generatePoint();
8956
9061
  }
9062
+ $$.initClip();
8957
9063
  if (state.hasAxis) {
8958
- $$.initClip();
8959
9064
  format.extraLineClasses = $$.generateExtraLineClass();
8960
9065
  format.dataTime = config.data_xLocaltime ? timeParse : utcParse;
8961
9066
  format.axisTime = config.axis_x_localtime ? timeFormat : utcFormat;
@@ -8988,7 +9093,7 @@ var ChartInternal = /** @class */ (function () {
8988
9093
  var _a, _b;
8989
9094
  var $$ = this;
8990
9095
  var config = $$.config, scale = $$.scale, state = $$.state, $el = $$.$el, org = $$.org;
8991
- var hasAxis = state.hasAxis;
9096
+ var hasAxis = state.hasAxis, hasTreemap = state.hasTreemap;
8992
9097
  var hasInteraction = config.interaction_enabled;
8993
9098
  var hasPolar = $$.hasType("polar");
8994
9099
  // for arc type, set axes to not be shown
@@ -9016,21 +9121,23 @@ var ChartInternal = /** @class */ (function () {
9016
9121
  $$.updateSizes();
9017
9122
  $$.updateScales(true);
9018
9123
  // retrieve scale after the 'updateScales()' is called
9019
- var x = scale.x, y = scale.y, y2 = scale.y2, subX = scale.subX, subY = scale.subY, subY2 = scale.subY2;
9020
- // Set domains for each scale
9021
- if (x) {
9022
- x.domain(sortValue($$.getXDomain($$.data.targets)));
9023
- subX.domain(x.domain());
9024
- // Save original x domain for zoom update
9025
- org.xDomain = x.domain();
9026
- }
9027
- if (y) {
9028
- y.domain($$.getYDomain($$.data.targets, "y"));
9029
- subY.domain(y.domain());
9030
- }
9031
- if (y2) {
9032
- y2.domain($$.getYDomain($$.data.targets, "y2"));
9033
- subY2 && subY2.domain(y2.domain());
9124
+ if (hasAxis) {
9125
+ var x = scale.x, y = scale.y, y2 = scale.y2, subX = scale.subX, subY = scale.subY, subY2 = scale.subY2;
9126
+ // Set domains for each scale
9127
+ if (x) {
9128
+ x.domain(sortValue($$.getXDomain($$.data.targets)));
9129
+ subX.domain(x.domain());
9130
+ // Save original x domain for zoom update
9131
+ org.xDomain = x.domain();
9132
+ }
9133
+ if (y) {
9134
+ y.domain($$.getYDomain($$.data.targets, "y"));
9135
+ subY.domain(y.domain());
9136
+ }
9137
+ if (y2) {
9138
+ y2.domain($$.getYDomain($$.data.targets, "y2"));
9139
+ subY2 && subY2.domain(y2.domain());
9140
+ }
9034
9141
  }
9035
9142
  // -- Basic Elements --
9036
9143
  $el.svg = $el.chart.append("svg")
@@ -9047,7 +9154,8 @@ var ChartInternal = /** @class */ (function () {
9047
9154
  config.svg_classname && $el.svg.attr("class", config.svg_classname);
9048
9155
  // Define defs
9049
9156
  var hasColorPatterns = (isFunction(config.color_tiles) && $$.patterns);
9050
- if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
9157
+ if (hasAxis || hasColorPatterns || hasPolar || hasTreemap ||
9158
+ config.data_labels_backgroundColors) {
9051
9159
  $el.defs = $el.svg.append("defs");
9052
9160
  if (hasAxis) {
9053
9161
  ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
@@ -9067,13 +9175,13 @@ var ChartInternal = /** @class */ (function () {
9067
9175
  // Define regions
9068
9176
  var main = $el.svg.append("g")
9069
9177
  .classed($COMMON.main, true)
9070
- .attr("transform", $$.getTranslate("main"));
9178
+ .attr("transform", hasTreemap ? null : $$.getTranslate("main"));
9071
9179
  $el.main = main;
9072
9180
  // initialize subchart when subchart show option is set
9073
9181
  config.subchart_show && $$.initSubchart();
9074
9182
  config.tooltip_show && $$.initTooltip();
9075
9183
  config.title_text && $$.initTitle();
9076
- config.legend_show && $$.initLegend();
9184
+ !hasTreemap && config.legend_show && $$.initLegend();
9077
9185
  // -- Main Region --
9078
9186
  // text when empty
9079
9187
  if (config.data_empty_label_text) {
@@ -9133,7 +9241,7 @@ var ChartInternal = /** @class */ (function () {
9133
9241
  */
9134
9242
  ChartInternal.prototype.initChartElements = function () {
9135
9243
  var $$ = this;
9136
- var _a = $$.state, hasAxis = _a.hasAxis, hasRadar = _a.hasRadar;
9244
+ var _a = $$.state, hasAxis = _a.hasAxis, hasRadar = _a.hasRadar, hasTreemap = _a.hasTreemap;
9137
9245
  var types = [];
9138
9246
  if (hasAxis) {
9139
9247
  ["bar", "bubble", "candlestick", "line"].forEach(function (v) {
@@ -9143,6 +9251,9 @@ var ChartInternal = /** @class */ (function () {
9143
9251
  }
9144
9252
  });
9145
9253
  }
9254
+ else if (hasTreemap) {
9255
+ types.push("Treemap");
9256
+ }
9146
9257
  else {
9147
9258
  var hasPolar = $$.hasType("polar");
9148
9259
  if (!hasRadar) {
@@ -9219,7 +9330,7 @@ var ChartInternal = /** @class */ (function () {
9219
9330
  ChartInternal.prototype.updateTargets = function (targets) {
9220
9331
  var _a;
9221
9332
  var $$ = this;
9222
- var _b = $$.state, hasAxis = _b.hasAxis, hasRadar = _b.hasRadar;
9333
+ var _b = $$.state, hasAxis = _b.hasAxis, hasRadar = _b.hasRadar, hasTreemap = _b.hasTreemap;
9223
9334
  var helper = function (type) { return $$["updateTargetsFor".concat(type)](targets.filter($$["is".concat(type, "Type")].bind($$))); };
9224
9335
  // Text
9225
9336
  $$.updateTargetsForText(targets);
@@ -9244,6 +9355,10 @@ var ChartInternal = /** @class */ (function () {
9244
9355
  type = "Polar";
9245
9356
  }
9246
9357
  helper(type);
9358
+ // Arc, Polar, Radar
9359
+ }
9360
+ else if (hasTreemap) {
9361
+ helper("Treemap");
9247
9362
  }
9248
9363
  // Point types
9249
9364
  var hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
@@ -9540,8 +9655,9 @@ var apiChart = {
9540
9655
  },
9541
9656
  /**
9542
9657
  * Get or set config option value.
9543
- * - **NOTE:** for without parameter occasion
9544
- * - will return all specified generation options object only. (will exclude any other options not specified at the initialization)
9658
+ * - **NOTE**
9659
+ * - The option key name must be specified as the last level.
9660
+ * - when no argument is given, will return all specified generation options object only. (will exclude any other options not specified at the initialization)
9545
9661
  * @function config
9546
9662
  * @instance
9547
9663
  * @memberof Chart
@@ -9555,12 +9671,20 @@ var apiChart = {
9555
9671
  * // Getter
9556
9672
  * chart.config("gauge.max");
9557
9673
  *
9674
+ * // Getter specified with top level key name will not work.
9675
+ * // The option key name must be specified as the last level.
9676
+ * // chart.config("gauge"); // will not work
9677
+ *
9558
9678
  * // without any arguments, it returns generation config object
9559
9679
  * chart.config(); // {data: { ... }, axis: { ... }, ...}
9560
9680
  *
9561
9681
  * // Setter
9562
9682
  * chart.config("gauge.max", 100);
9563
9683
  *
9684
+ * // Setter specified with top level key name will not work.
9685
+ * // The option key name must be specified as the last level.
9686
+ * // chart.config("gauge", {min: 10, max: 20}); // will not work
9687
+ *
9564
9688
  * // Setter & redraw with the new option
9565
9689
  * chart.config("gauge.max", 100, true);
9566
9690
  */
@@ -9579,7 +9703,7 @@ var apiChart = {
9579
9703
  res = config[key];
9580
9704
  }
9581
9705
  }
9582
- else {
9706
+ else if (arguments.length === 0 || isEmpty(name)) {
9583
9707
  res = state.orgConfig;
9584
9708
  }
9585
9709
  return res;
@@ -9789,8 +9913,11 @@ var apiData = { data: data };
9789
9913
  * @private
9790
9914
  * @see https://developer.mozilla.org/ko/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
9791
9915
  */
9792
- var b64EncodeUnicode = function (str) { return btoa(encodeURIComponent(str)
9793
- .replace(/%([0-9A-F]{2})/g, function (match, p) { return String.fromCharCode(Number("0x".concat(p))); })); };
9916
+ var b64EncodeUnicode = function (str) {
9917
+ var _a;
9918
+ return (_a = win.btoa) === null || _a === void 0 ? void 0 : _a.call(win, encodeURIComponent(str)
9919
+ .replace(/%([0-9A-F]{2})/g, function (match, p) { return String.fromCharCode(Number("0x".concat(p))); }));
9920
+ };
9794
9921
  /**
9795
9922
  * Convert svg node to data url
9796
9923
  * @param {HTMLElement} node target node
@@ -9807,6 +9934,15 @@ function nodeToSvgDataUrl(node, option, orgSize) {
9807
9934
  .filter(function (r) { return r.cssText; })
9808
9935
  .map(function (r) { return r.cssText; });
9809
9936
  clone.setAttribute("xmlns", namespaces.xhtml);
9937
+ // remove padding & margin
9938
+ clone.style.margin = "0";
9939
+ clone.style.padding = "0";
9940
+ // remove text nodes
9941
+ if (option.preserveFontStyle) {
9942
+ clone.querySelectorAll("text").forEach(function (t) {
9943
+ t.innerHTML = "";
9944
+ });
9945
+ }
9810
9946
  var nodeXml = serializer.serializeToString(clone);
9811
9947
  // escape css for XML
9812
9948
  var style = doc.createElement("style");
@@ -9818,12 +9954,113 @@ function nodeToSvgDataUrl(node, option, orgSize) {
9818
9954
  .replace("/\n/g", "%0A");
9819
9955
  return "data:image/svg+xml;base64,".concat(b64EncodeUnicode(dataStr));
9820
9956
  }
9957
+ /**
9958
+ * Get coordinate of the element
9959
+ * @param {SVGElement} elem Target element
9960
+ * @param {object} svgOffset SVG offset
9961
+ * @returns {object}
9962
+ * @private
9963
+ */
9964
+ function getCoords(elem, svgOffset) {
9965
+ var top = svgOffset.top, left = svgOffset.left;
9966
+ var _a = elem.getBBox(), x = _a.x, y = _a.y;
9967
+ var _b = elem.getScreenCTM(), a = _b.a, b = _b.b, c = _b.c, d = _b.d, e = _b.e, f = _b.f;
9968
+ var _c = elem.getBoundingClientRect(), width = _c.width, height = _c.height;
9969
+ return {
9970
+ x: (a * x) + (c * y) + e - left,
9971
+ y: (b * x) + (d * y) + f - top + (height - Math.round(height / 4)),
9972
+ width: width,
9973
+ height: height
9974
+ };
9975
+ }
9976
+ /**
9977
+ * Get text glyph
9978
+ * @param {SVGTextElement} svg Target svg node
9979
+ * @returns {Array}
9980
+ * @private
9981
+ */
9982
+ function getGlyph(svg) {
9983
+ var _a = svg.getBoundingClientRect(), left = _a.left, top = _a.top;
9984
+ var filterFn = function (t) { return t.textContent || t.childElementCount; };
9985
+ var glyph = [];
9986
+ toArray(svg.querySelectorAll("text"))
9987
+ .filter(filterFn)
9988
+ .forEach(function (t) {
9989
+ var getStyleFn = function (ts) {
9990
+ var _a;
9991
+ var _b = win.getComputedStyle(ts), fill = _b.fill, fontFamily = _b.fontFamily, fontSize = _b.fontSize, textAnchor = _b.textAnchor, transform = _b.transform;
9992
+ var _c = getCoords(ts, { left: left, top: top }), x = _c.x, y = _c.y, width = _c.width, height = _c.height;
9993
+ return _a = {},
9994
+ _a[ts.textContent] = {
9995
+ x: x,
9996
+ y: y,
9997
+ width: width,
9998
+ height: height,
9999
+ fill: fill,
10000
+ fontFamily: fontFamily,
10001
+ fontSize: fontSize,
10002
+ textAnchor: textAnchor,
10003
+ transform: transform
10004
+ },
10005
+ _a;
10006
+ };
10007
+ if (t.childElementCount > 1) {
10008
+ var text = [];
10009
+ toArray(t.querySelectorAll("tspan"))
10010
+ .filter(filterFn)
10011
+ .forEach(function (ts) {
10012
+ glyph.push(getStyleFn(ts));
10013
+ });
10014
+ return text;
10015
+ }
10016
+ else {
10017
+ glyph.push(getStyleFn(t));
10018
+ }
10019
+ });
10020
+ return glyph;
10021
+ }
10022
+ /**
10023
+ * Render text glyph
10024
+ * - NOTE: Called when the 'preserveFontStyle' option is true
10025
+ * @param {CanvasRenderingContext2D} ctx Canvas context
10026
+ * @param {Array} glyph Text glyph array
10027
+ * @private
10028
+ */
10029
+ function renderText(ctx, glyph) {
10030
+ glyph.forEach(function (g) {
10031
+ Object.keys(g).forEach(function (key) {
10032
+ var _a = g[key], x = _a.x, y = _a.y, width = _a.width, height = _a.height, fill = _a.fill, fontFamily = _a.fontFamily, fontSize = _a.fontSize, transform = _a.transform;
10033
+ ctx.save();
10034
+ ctx.font = "".concat(fontSize, " ").concat(fontFamily);
10035
+ ctx.fillStyle = fill;
10036
+ if (transform === "none") {
10037
+ ctx.fillText(key, x, y);
10038
+ }
10039
+ else {
10040
+ var args = transform
10041
+ .replace(/(matrix|\(|\))/g, "")
10042
+ .split(",");
10043
+ if (args.splice(4).every(function (v) { return +v === 0; })) {
10044
+ args.push(x + width - (width / 4));
10045
+ args.push(y - height + (height / 3));
10046
+ }
10047
+ else {
10048
+ args.push(x);
10049
+ args.push(y);
10050
+ }
10051
+ ctx.transform.apply(ctx, args);
10052
+ ctx.fillText(key, 0, 0);
10053
+ }
10054
+ ctx.restore();
10055
+ });
10056
+ });
10057
+ }
9821
10058
  var apiExport = {
9822
10059
  /**
9823
10060
  * Export chart as an image.
9824
10061
  * - **NOTE:**
9825
10062
  * - IE11 and below not work properly due to the lack of the feature(<a href="https://msdn.microsoft.com/en-us/library/hh834675(v=vs.85).aspx">foreignObject</a>) support
9826
- * - The basic CSS file(ex. billboard.css) should be at same domain as API call context to get correct styled export image.
10063
+ * - Every style applied to the chart & the basic CSS file(ex. billboard.css) should be at same domain as API call context to get correct styled export image.
9827
10064
  * @function export
9828
10065
  * @instance
9829
10066
  * @memberof Chart
@@ -9832,6 +10069,12 @@ var apiExport = {
9832
10069
  * @param {number} [option.width={currentWidth}] width
9833
10070
  * @param {number} [option.height={currentHeigth}] height
9834
10071
  * @param {boolean} [option.preserveAspectRatio=true] Preserve aspect ratio on given size
10072
+ * @param {boolean} [option.preserveFontStyle=false] Preserve font style(font-family).<br>
10073
+ * **NOTE:**
10074
+ * - This option is useful when outlink web font style's `font-family` are applied to chart's text element.
10075
+ * - Text element's position(especially "transformed") can't be preserved correctly according the page's layout condition.
10076
+ * - If need to preserve accurate text position, embed the web font data within to the page and set `preserveFontStyle=false`.
10077
+ * - Checkout the embed example: <a href="https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html">https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html</a>
9835
10078
  * @param {Function} [callback] The callback to be invoked when export is ready.
9836
10079
  * @returns {string} dataURI
9837
10080
  * @example
@@ -9855,6 +10098,7 @@ var apiExport = {
9855
10098
  * width: 800,
9856
10099
  * height: 600,
9857
10100
  * preserveAspectRatio: false,
10101
+ * preserveFontStyle: false,
9858
10102
  * mimeType: "image/png"
9859
10103
  * },
9860
10104
  * dataUrl => { ... }
@@ -9863,15 +10107,17 @@ var apiExport = {
9863
10107
  "export": function (option, callback) {
9864
10108
  var _this = this;
9865
10109
  var $$ = this.internal;
9866
- var state = $$.state, chart = $$.$el.chart;
9867
- var _a = state.current, width = _a.width, height = _a.height;
10110
+ var state = $$.state, _a = $$.$el, chart = _a.chart, svg = _a.svg;
10111
+ var _b = state.current, width = _b.width, height = _b.height;
9868
10112
  var opt = mergeObj({
9869
10113
  width: width,
9870
10114
  height: height,
9871
10115
  preserveAspectRatio: true,
10116
+ preserveFontStyle: false,
9872
10117
  mimeType: "image/png"
9873
10118
  }, option);
9874
10119
  var svgDataUrl = nodeToSvgDataUrl(chart.node(), opt, { width: width, height: height });
10120
+ var glyph = opt.preserveFontStyle ? getGlyph(svg.node()) : [];
9875
10121
  if (callback && isFunction(callback)) {
9876
10122
  var img_1 = new Image();
9877
10123
  img_1.crossOrigin = "Anonymous";
@@ -9881,6 +10127,11 @@ var apiExport = {
9881
10127
  canvas.width = opt.width || width;
9882
10128
  canvas.height = opt.height || height;
9883
10129
  ctx.drawImage(img_1, 0, 0);
10130
+ if (glyph.length) {
10131
+ renderText(ctx, glyph);
10132
+ // release glyph array
10133
+ glyph.length = 0;
10134
+ }
9884
10135
  callback.bind(_this)(canvas.toDataURL(opt.mimeType));
9885
10136
  };
9886
10137
  img_1.src = svgDataUrl;
@@ -10008,6 +10259,7 @@ var apiFocus = {
10008
10259
  var legend = {
10009
10260
  /**
10010
10261
  * Show legend for each target.
10262
+ * - **NOTE:** Legend APIs aren't supported for `treemap` type.
10011
10263
  * @function legend․show
10012
10264
  * @instance
10013
10265
  * @memberof Chart
@@ -10224,6 +10476,7 @@ var apiLoad = {
10224
10476
  });
10225
10477
  }
10226
10478
  else {
10479
+ $$.api.tooltip.hide();
10227
10480
  $$.loadFromArgs(args);
10228
10481
  }
10229
10482
  },
@@ -10439,6 +10692,13 @@ var tooltip = {
10439
10692
  * x: new Date("2018-01-02 00:00")
10440
10693
  * });
10441
10694
  *
10695
+ * // treemap type can be shown by using "id" only.
10696
+ * chart.tooltip.show({
10697
+ * data: {
10698
+ * id: "data1" // data id
10699
+ * }
10700
+ * });
10701
+ *
10442
10702
  * // when data.xs is used
10443
10703
  * chart.tooltip.show({
10444
10704
  * data: {
@@ -10459,7 +10719,7 @@ var tooltip = {
10459
10719
  */
10460
10720
  show: function (args) {
10461
10721
  var $$ = this.internal;
10462
- var config = $$.config, inputType = $$.state.inputType;
10722
+ var $el = $$.$el, config = $$.config, _a = $$.state, eventReceiver = _a.eventReceiver, hasTreemap = _a.hasTreemap, inputType = _a.inputType;
10463
10723
  var index;
10464
10724
  var mouse;
10465
10725
  // determine mouse position on the chart
@@ -10470,7 +10730,10 @@ var tooltip = {
10470
10730
  if (args.data) {
10471
10731
  var data = args.data;
10472
10732
  var y = $$.getYScaleById(data.id)(data.value);
10473
- if ($$.isMultipleX()) {
10733
+ if (hasTreemap && data.id) {
10734
+ eventReceiver.rect = $el.main.select("".concat($$.selectorTarget(data.id, undefined, "rect")));
10735
+ }
10736
+ else if ($$.isMultipleX()) {
10474
10737
  // if multiple xs, target point will be determined by mouse
10475
10738
  mouse = [$$.scale.x(data.x), y];
10476
10739
  }
@@ -12516,7 +12779,7 @@ var Axis = /** @class */ (function () {
12516
12779
  var config = $$.config, current = $$.state.current, _a = $$.$el, svg = _a.svg, chart = _a.chart;
12517
12780
  var currentTickMax = current.maxTickWidths[id];
12518
12781
  var maxWidth = 0;
12519
- if (withoutRecompute || !config["axis_".concat(id, "_show")] || $$.filterTargetsToShow().length === 0) {
12782
+ if (withoutRecompute || !config["axis_".concat(id, "_show")] || (currentTickMax.size > 0 && $$.filterTargetsToShow().length === 0)) {
12520
12783
  return currentTickMax.size;
12521
12784
  }
12522
12785
  if (svg) {
@@ -13513,17 +13776,19 @@ var flow = {
13513
13776
  var clip = {
13514
13777
  initClip: function () {
13515
13778
  var $$ = this;
13516
- var clip = $$.state.clip;
13779
+ var _a = $$.state, clip = _a.clip, hasAxis = _a.hasAxis;
13517
13780
  // MEMO: clipId needs to be unique because it conflicts when multiple charts exist
13518
13781
  clip.id = "".concat($$.state.datetimeId, "-clip");
13519
- clip.idXAxis = "".concat(clip.id, "-xaxis");
13520
- clip.idYAxis = "".concat(clip.id, "-yaxis");
13521
- clip.idGrid = "".concat(clip.id, "-grid");
13522
- // Define 'clip-path' attribute values
13523
- clip.path = $$.getClipPath(clip.id);
13524
- clip.pathXAxis = $$.getClipPath(clip.idXAxis);
13525
- clip.pathYAxis = $$.getClipPath(clip.idYAxis);
13526
- clip.pathGrid = $$.getClipPath(clip.idGrid);
13782
+ if (hasAxis) {
13783
+ clip.idXAxis = "".concat(clip.id, "-xaxis");
13784
+ clip.idYAxis = "".concat(clip.id, "-yaxis");
13785
+ clip.idGrid = "".concat(clip.id, "-grid");
13786
+ // Define 'clip-path' attribute values
13787
+ clip.path = $$.getClipPath(clip.id);
13788
+ clip.pathXAxis = $$.getClipPath(clip.idXAxis);
13789
+ clip.pathYAxis = $$.getClipPath(clip.idYAxis);
13790
+ clip.pathGrid = $$.getClipPath(clip.idGrid);
13791
+ }
13527
13792
  },
13528
13793
  getClipPath: function (id) {
13529
13794
  var $$ = this;
@@ -13780,7 +14045,7 @@ var grid = {
13780
14045
  xgridLine.append("line")
13781
14046
  .style("opacity", "0");
13782
14047
  xgridLine.append("text")
13783
- .attr("transform", isRotated ? "" : "rotate(-90)")
14048
+ .attr("transform", isRotated ? null : "rotate(-90)")
13784
14049
  .attr("dy", -5)
13785
14050
  .style("opacity", "0");
13786
14051
  xLines = xgridLine.merge(xLines);
@@ -16132,6 +16397,99 @@ var options = [
16132
16397
  * Copyright (c) 2017 ~ present NAVER Corp.
16133
16398
  * billboard.js project is licensed under the MIT license
16134
16399
  */
16400
+ /**
16401
+ * Get radius functions
16402
+ * @param {number} expandRate Expand rate number.
16403
+ * - If 0, means for "normal" radius.
16404
+ * - If > 0, means for "expanded" radius.
16405
+ * @returns {object} radius functions
16406
+ * @private
16407
+ */
16408
+ function getRadiusFn(expandRate) {
16409
+ if (expandRate === void 0) { expandRate = 0; }
16410
+ var $$ = this;
16411
+ var config = $$.config, state = $$.state;
16412
+ var hasMultiArcGauge = $$.hasMultiArcGauge();
16413
+ var singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length;
16414
+ var expandWidth = expandRate ? (Math.min(state.radiusExpanded * expandRate - state.radius, singleArcWidth * 0.8 - (1 - expandRate) * 100)) : 0;
16415
+ return {
16416
+ /**
16417
+ * Getter of arc innerRadius value
16418
+ * @param {IArcData} d Data object
16419
+ * @returns {number} innerRadius value
16420
+ * @private
16421
+ */
16422
+ inner: function (d) {
16423
+ var innerRadius = $$.getRadius(d).innerRadius;
16424
+ return hasMultiArcGauge ?
16425
+ state.radius - singleArcWidth * (d.index + 1) :
16426
+ isNumber(innerRadius) ? innerRadius : 0;
16427
+ },
16428
+ /**
16429
+ * Getter of arc outerRadius value
16430
+ * @param {IArcData} d Data object
16431
+ * @returns {number} outerRadius value
16432
+ * @private
16433
+ */
16434
+ outer: function (d) {
16435
+ var outerRadius = $$.getRadius(d).outerRadius;
16436
+ var radius;
16437
+ if (hasMultiArcGauge) {
16438
+ radius = state.radius - singleArcWidth * d.index + expandWidth;
16439
+ }
16440
+ else if ($$.hasType("polar") && !expandRate) {
16441
+ radius = $$.getPolarOuterRadius(d, outerRadius);
16442
+ }
16443
+ else {
16444
+ radius = outerRadius;
16445
+ if (expandRate) {
16446
+ var radiusExpanded = state.radiusExpanded;
16447
+ if (state.radius !== outerRadius) {
16448
+ radiusExpanded -= Math.abs(state.radius - outerRadius);
16449
+ }
16450
+ radius = radiusExpanded * expandRate;
16451
+ }
16452
+ }
16453
+ return radius;
16454
+ },
16455
+ /**
16456
+ * Getter of arc cornerRadius value
16457
+ * @param {IArcData} d Data object
16458
+ * @param {number} outerRadius outer radius value
16459
+ * @returns {number} cornerRadius value
16460
+ * @private
16461
+ */
16462
+ corner: function (d, outerRadius) {
16463
+ var _a = config.arc_cornerRadius_ratio, ratio = _a === void 0 ? 0 : _a, _b = config.arc_cornerRadius, cornerRadius = _b === void 0 ? 0 : _b;
16464
+ var id = d.data.id, value = d.value;
16465
+ var corner = 0;
16466
+ if (ratio) {
16467
+ corner = ratio * outerRadius;
16468
+ }
16469
+ else {
16470
+ corner = isNumber(cornerRadius) ?
16471
+ cornerRadius : cornerRadius.call($$.api, id, value, outerRadius);
16472
+ }
16473
+ return corner;
16474
+ }
16475
+ };
16476
+ }
16477
+ /**
16478
+ * Get attrTween function to get interpolated value on transition
16479
+ * @param {Function} fn Arc function to execute
16480
+ * @returns {Function} attrTween function
16481
+ * @private
16482
+ */
16483
+ function getAttrTweenFn(fn) {
16484
+ return function (d) {
16485
+ var interpolate$1 = interpolate(this._current, d);
16486
+ this._current = d;
16487
+ return function (t) {
16488
+ var interpolated = interpolate$1(t);
16489
+ return fn(interpolated);
16490
+ };
16491
+ };
16492
+ }
16135
16493
  var shapeArc = {
16136
16494
  initPie: function () {
16137
16495
  var $$ = this;
@@ -16274,37 +16632,17 @@ var shapeArc = {
16274
16632
  },
16275
16633
  getSvgArc: function () {
16276
16634
  var $$ = this;
16277
- var state = $$.state;
16278
- var singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length;
16279
- var hasMultiArcGauge = $$.hasMultiArcGauge();
16280
- var hasPolar = $$.hasType("polar");
16635
+ var _a = getRadiusFn.call($$), inner = _a.inner, outer = _a.outer, corner = _a.corner;
16281
16636
  var arc$1 = arc()
16282
- .innerRadius(function (d) {
16283
- var innerRadius = $$.getRadius(d).innerRadius;
16284
- return hasMultiArcGauge ?
16285
- state.radius - singleArcWidth * (d.index + 1) :
16286
- isNumber(innerRadius) ? innerRadius : 0;
16287
- })
16288
- .outerRadius(function (d) {
16289
- var outerRadius = $$.getRadius(d).outerRadius;
16290
- var radius = outerRadius;
16291
- if (hasMultiArcGauge) {
16292
- radius = state.radius - singleArcWidth * d.index;
16293
- }
16294
- else if (hasPolar) {
16295
- radius = $$.getPolarOuterRadius(d, outerRadius);
16296
- }
16297
- return radius;
16298
- });
16637
+ .innerRadius(inner)
16638
+ .outerRadius(outer);
16299
16639
  var newArc = function (d, withoutUpdate) {
16640
+ var _a;
16300
16641
  var path = "M 0 0";
16301
16642
  if (d.value || d.data) {
16302
- var updated = !withoutUpdate && $$.updateAngle(d);
16303
- if (withoutUpdate) {
16304
- path = arc$1(d);
16305
- }
16306
- else if (updated) {
16307
- path = arc$1(updated);
16643
+ var data = withoutUpdate ? d : (_a = $$.updateAngle(d)) !== null && _a !== void 0 ? _a : null;
16644
+ if (data) {
16645
+ path = arc$1.cornerRadius(corner(data, outer(data)))(data);
16308
16646
  }
16309
16647
  }
16310
16648
  return path;
@@ -16313,34 +16651,27 @@ var shapeArc = {
16313
16651
  newArc.centroid = arc$1.centroid;
16314
16652
  return newArc;
16315
16653
  },
16654
+ /**
16655
+ * Get expanded arc path function
16656
+ * @param {number} rate Expand rate
16657
+ * @returns {Function} Expanded arc path getter function
16658
+ * @private
16659
+ */
16316
16660
  getSvgArcExpanded: function (rate) {
16661
+ if (rate === void 0) { rate = 1; }
16317
16662
  var $$ = this;
16318
- var state = $$.state;
16319
- var newRate = rate || 1;
16320
- var singleArcWidth = state.gaugeArcWidth / $$.filterTargetsToShow($$.data.targets).length;
16321
- var hasMultiArcGauge = $$.hasMultiArcGauge();
16322
- var expandWidth = Math.min(state.radiusExpanded * newRate - state.radius, singleArcWidth * 0.8 - (1 - newRate) * 100);
16663
+ var _a = getRadiusFn.call($$, rate), inner = _a.inner, outer = _a.outer, corner = _a.corner;
16323
16664
  var arc$1 = arc()
16324
- .innerRadius(function (d) { return (hasMultiArcGauge ?
16325
- state.radius - singleArcWidth * (d.index + 1) : $$.getRadius(d).innerRadius); })
16326
- .outerRadius(function (d) {
16327
- var radius;
16328
- if (hasMultiArcGauge) {
16329
- radius = state.radius - singleArcWidth * d.index + expandWidth;
16330
- }
16331
- else {
16332
- var outerRadius = $$.getRadius(d).outerRadius;
16333
- var radiusExpanded = state.radiusExpanded;
16334
- if (state.radius !== outerRadius) {
16335
- radiusExpanded -= Math.abs(state.radius - outerRadius);
16336
- }
16337
- radius = radiusExpanded * newRate;
16338
- }
16339
- return radius;
16340
- });
16665
+ .innerRadius(inner)
16666
+ .outerRadius(outer);
16341
16667
  return function (d) {
16342
16668
  var updated = $$.updateAngle(d);
16343
- return updated ? arc$1(updated) : "M 0 0";
16669
+ var outerR = outer(updated);
16670
+ var cornerR = 0;
16671
+ if (updated) {
16672
+ cornerR = corner(updated, outerR);
16673
+ }
16674
+ return updated ? arc$1.cornerRadius(cornerR)(updated) : "M 0 0";
16344
16675
  };
16345
16676
  },
16346
16677
  getArc: function (d, withoutUpdate, force) {
@@ -16389,7 +16720,7 @@ var shapeArc = {
16389
16720
  },
16390
16721
  convertToArcData: function (d) {
16391
16722
  return this.addName({
16392
- id: d.data ? d.data.id : d.id,
16723
+ id: "data" in d ? d.data.id : d.id,
16393
16724
  value: d.value,
16394
16725
  ratio: this.getRatio("arc", d),
16395
16726
  index: d.index
@@ -16444,10 +16775,10 @@ var shapeArc = {
16444
16775
  select(this).selectAll("path")
16445
16776
  .transition()
16446
16777
  .duration(expandDuration)
16447
- .attr("d", $$.svgArcExpanded)
16778
+ .attrTween("d", getAttrTweenFn($$.svgArcExpanded.bind($$)))
16448
16779
  .transition()
16449
16780
  .duration(expandDuration * 2)
16450
- .attr("d", svgArcExpandedSub);
16781
+ .attrTween("d", getAttrTweenFn(svgArcExpandedSub.bind($$)));
16451
16782
  });
16452
16783
  },
16453
16784
  unexpandArc: function (targetIds) {
@@ -16461,7 +16792,7 @@ var shapeArc = {
16461
16792
  .selectAll("path")
16462
16793
  .transition()
16463
16794
  .duration(function (d) { return $$.getExpandConfig(d.data.id, "duration"); })
16464
- .attr("d", $$.svgArc);
16795
+ .attrTween("d", getAttrTweenFn($$.svgArc.bind($$)));
16465
16796
  svg.selectAll("".concat($ARC.arc))
16466
16797
  .style("opacity", null);
16467
16798
  },
@@ -16886,6 +17217,8 @@ var shapeArea = {
16886
17217
  })
16887
17218
  .merge(area);
16888
17219
  area.style("opacity", state.orgAreaOpacity);
17220
+ // calculate ratio if grouped data exists
17221
+ $$.setRatioForGroupedData($root.area.data());
16889
17222
  },
16890
17223
  /**
16891
17224
  * Redraw function
@@ -17014,7 +17347,7 @@ var shapeBar = {
17014
17347
  if (!$el.bar) {
17015
17348
  $$.initBar();
17016
17349
  }
17017
- var mainBarUpdate = $$.$el.main.select(".".concat($BAR.chartBars))
17350
+ var mainBarUpdate = $el.main.select(".".concat($BAR.chartBars))
17018
17351
  .selectAll(".".concat($BAR.chartBar))
17019
17352
  .data(
17020
17353
  // remove
@@ -17055,6 +17388,8 @@ var shapeBar = {
17055
17388
  .style("fill", $$.updateBarColor.bind($$))
17056
17389
  .merge(bar)
17057
17390
  .style("opacity", initialOpacity);
17391
+ // calculate ratio if grouped data exists
17392
+ $$.setRatioForGroupedData($root.bar.data());
17058
17393
  },
17059
17394
  /**
17060
17395
  * Update bar color
@@ -17757,22 +18092,12 @@ var shapeLine = {
17757
18092
  var config = $$.config;
17758
18093
  var isRotated = config.axis_rotated;
17759
18094
  var isTimeSeries = $$.axis.isTimeSeries();
17760
- var xOffset = $$.axis.isCategorized() ? 0.5 : 0;
17761
18095
  var regions = [];
17762
18096
  var dasharray = "2 2"; // default value
17763
18097
  var xp;
17764
18098
  var yp;
17765
18099
  var diff;
17766
18100
  var diffx2;
17767
- // check weather data is within region
17768
- var isWithinRegions = function (withinX, withinRegions) {
17769
- for (var i = 0, reg = void 0; (reg = withinRegions[i]); i++) {
17770
- if (reg.start < withinX && withinX <= reg.end) {
17771
- return reg.style;
17772
- }
17773
- }
17774
- return false;
17775
- };
17776
18101
  // Check start/end of regions
17777
18102
  if (isDefined(_regions)) {
17778
18103
  var getValue = function (v, def) { return (isUndefined(v) ? def : (isTimeSeries ? parseDate.call($$, v) : v)); };
@@ -17809,7 +18134,7 @@ var shapeLine = {
17809
18134
  for (var i = 0, data = void 0; (data = d[i]); i++) {
17810
18135
  var prevData = d[i - 1];
17811
18136
  var hasPrevData = prevData && isValue(prevData.value);
17812
- var style = isWithinRegions(data.x, regions);
18137
+ var style = $$.isWithinRegions(data.x, regions);
17813
18138
  // https://github.com/naver/billboard.js/issues/1172
17814
18139
  if (!isValue(data.value)) {
17815
18140
  continue;
@@ -17826,7 +18151,7 @@ var shapeLine = {
17826
18151
  style = dasharray.split(" ");
17827
18152
  }
17828
18153
  // Draw with region // TODO: Fix for horizotal charts
17829
- xp = getScale(axisType.x, prevData.x + xOffset, data.x + xOffset);
18154
+ xp = getScale(axisType.x, prevData.x, data.x);
17830
18155
  yp = getScale(axisType.y, prevData.value, data.value);
17831
18156
  var dx = x(data.x) - x(prevData.x);
17832
18157
  var dy = y(data.value) - y(prevData.value);
@@ -17844,6 +18169,14 @@ var shapeLine = {
17844
18169
  }
17845
18170
  return path;
17846
18171
  },
18172
+ isWithinRegions: function (withinX, withinRegions) {
18173
+ for (var i = 0, reg = void 0; (reg = withinRegions[i]); i++) {
18174
+ if (reg.start < withinX && withinX <= reg.end) {
18175
+ return reg.style;
18176
+ }
18177
+ }
18178
+ return false;
18179
+ },
17847
18180
  isWithinStep: function (that, y) {
17848
18181
  return Math.abs(y - getPointer(this.state.event, that)[1]) < 30;
17849
18182
  },
@@ -18659,9 +18992,9 @@ var shapeRadar = {
18659
18992
  return "translate(".concat(posX, " ").concat(posY, ")");
18660
18993
  });
18661
18994
  }
18662
- $$.bindEvent();
18995
+ $$.bindRadarEvent();
18663
18996
  },
18664
- bindEvent: function () {
18997
+ bindRadarEvent: function () {
18665
18998
  var $$ = this;
18666
18999
  var config = $$.config, state = $$.state, _a = $$.$el, radar = _a.radar, svg = _a.svg;
18667
19000
  var focusOnly = config.point_focus_only;
@@ -18749,6 +19082,236 @@ var shapeRadar = {
18749
19082
  }
18750
19083
  };
18751
19084
 
19085
+ /**
19086
+ * Copyright (c) 2017 ~ present NAVER Corp.
19087
+ * billboard.js project is licensed under the MIT license
19088
+ */
19089
+ /**
19090
+ * Get treemap elements' position
19091
+ * @param {d3Selection} group Root selection
19092
+ * @param {object} root Root data
19093
+ * @private
19094
+ */
19095
+ function position(group, root) {
19096
+ var $$ = this;
19097
+ var _a = $$.scale, x = _a.x, y = _a.y, width = $$.state.width;
19098
+ group.selectAll("g")
19099
+ .attr("transform", function (d) { return ("translate(".concat(d === root ? "0,0" : "".concat(x(d.x0), ",").concat(y(d.y0)), ")")); })
19100
+ .select("rect")
19101
+ .attr("width", function (d) { return (d === root ? width : x(d.x1) - x(d.x0)); })
19102
+ .attr("height", function (d) { return (d === root ? 0 : y(d.y1) - y(d.y0)); });
19103
+ }
19104
+ /**
19105
+ * Convert data for treemap hierarchy
19106
+ * @param {object} data Data object
19107
+ * @returns {Array} Array of data for treemap hierarchy
19108
+ * @private
19109
+ */
19110
+ function convertDataToTreemapData(data) {
19111
+ var $$ = this;
19112
+ return data.map(function (d) {
19113
+ var id = d.id, values = d.values;
19114
+ var value = values[0].value;
19115
+ return {
19116
+ name: id,
19117
+ id: id,
19118
+ value: value,
19119
+ ratio: $$.getRatio("treemap", values[0])
19120
+ };
19121
+ });
19122
+ }
19123
+ var shapeTreemap = {
19124
+ initTreemap: function () {
19125
+ var $$ = this;
19126
+ var $el = $$.$el, _a = $$.state, _b = _a.current, width = _b.width, height = _b.height, clip = _a.clip;
19127
+ var clipId = clip.id;
19128
+ $$.treemap = treemap$1()
19129
+ .tile($$.getTreemapTile());
19130
+ $$.treemapFn = function (data) {
19131
+ var hierarchyData = hierarchy(data).sum(function (d) { return d.value; });
19132
+ var sortFn = $$.getSortCompareFn(true);
19133
+ return $$.treemap(sortFn ? hierarchyData.sort(sortFn) : hierarchyData);
19134
+ };
19135
+ $el.defs
19136
+ .append("clipPath")
19137
+ .attr("id", clipId)
19138
+ .append("rect")
19139
+ .attr("width", width)
19140
+ .attr("height", height);
19141
+ $el.treemap = $el.main.select(".".concat($COMMON.chart))
19142
+ .attr("clip-path", "url(#".concat(clipId, ")"))
19143
+ .append("g")
19144
+ .classed($TREEMAP.chartTreemaps, true);
19145
+ $$.bindTreemapEvent();
19146
+ },
19147
+ /**
19148
+ * Bind events
19149
+ * @private
19150
+ */
19151
+ bindTreemapEvent: function () {
19152
+ var $$ = this;
19153
+ var $el = $$.$el, config = $$.config, state = $$.state;
19154
+ var getTarget = function (event) {
19155
+ var _a;
19156
+ var target = event.isTrusted ? event.target : (_a = state.eventReceiver.rect) === null || _a === void 0 ? void 0 : _a.node();
19157
+ var data;
19158
+ if (/^rect$/i.test(target.tagName)) {
19159
+ state.event = event;
19160
+ data = select(target).datum();
19161
+ }
19162
+ return data === null || data === void 0 ? void 0 : data.data;
19163
+ };
19164
+ if (config.interaction_enabled) {
19165
+ var isTouch = state.inputType === "touch";
19166
+ $el.treemap
19167
+ .on(isTouch ? "touchstart" : "mousemove", function (event) {
19168
+ var data = getTarget(event);
19169
+ if (data) {
19170
+ $$.showTooltip([data], event.currentTarget);
19171
+ event.type === "mouseover" && $$.setOverOut(true, data);
19172
+ }
19173
+ })
19174
+ .on(isTouch ? "touchend" : "mouseout", function (event) {
19175
+ var data = getTarget(event);
19176
+ $$.hideTooltip();
19177
+ $$.setOverOut(false, data);
19178
+ });
19179
+ }
19180
+ },
19181
+ /**
19182
+ * Get tiling function
19183
+ * @returns {Function}
19184
+ * @private
19185
+ */
19186
+ getTreemapTile: function () {
19187
+ var _a, _b;
19188
+ var $$ = this;
19189
+ var config = $$.config, _c = $$.state.current, width = _c.width, height = _c.height;
19190
+ var tile = (_b = {
19191
+ "binary": treemapBinary,
19192
+ "dice": treemapDice,
19193
+ "slice": treemapSlice,
19194
+ "sliceDice": treemapSliceDice,
19195
+ "squarify": treemapSquarify,
19196
+ "resquarify": treemapResquarify
19197
+ }[(_a = config.treemap_tile) !== null && _a !== void 0 ? _a : "binary"]) !== null && _b !== void 0 ? _b : treemapBinary;
19198
+ return function (node, x0, y0, x1, y1) {
19199
+ tile(node, 0, 0, width, height);
19200
+ for (var _i = 0, _a = node.children; _i < _a.length; _i++) {
19201
+ var child = _a[_i];
19202
+ child.x0 = x0 + child.x0 / width * (x1 - x0);
19203
+ child.x1 = x0 + child.x1 / width * (x1 - x0);
19204
+ child.y0 = y0 + child.y0 / height * (y1 - y0);
19205
+ child.y1 = y0 + child.y1 / height * (y1 - y0);
19206
+ }
19207
+ };
19208
+ },
19209
+ /**
19210
+ * Get treemap hierarchy data
19211
+ * @param {Array} targets Data targets
19212
+ * @returns {object}
19213
+ * @private
19214
+ */
19215
+ getTreemapData: function (targets) {
19216
+ var $$ = this;
19217
+ return {
19218
+ name: "root",
19219
+ children: convertDataToTreemapData.bind($$)($$.filterTargetsToShow(targets.filter($$.isTreemapType, $$)))
19220
+ };
19221
+ },
19222
+ /**
19223
+ * Update treemap data
19224
+ * @param {Array} targets Data targets
19225
+ * @private
19226
+ */
19227
+ updateTargetsForTreemap: function (targets) {
19228
+ var $$ = this;
19229
+ var treemap = $$.$el.treemap;
19230
+ var treemapData = $$.treemapFn($$.getTreemapData(targets !== null && targets !== void 0 ? targets : $$.data.targets));
19231
+ // using $el.treemap reference can alter data, so select treemap <g> again
19232
+ treemap.data(treemapData);
19233
+ },
19234
+ /**
19235
+ * Render treemap
19236
+ * @param {number} durationForExit Duration for exit transition
19237
+ * @private
19238
+ */
19239
+ updateTreemap: function (durationForExit) {
19240
+ var $$ = this;
19241
+ var $el = $$.$el, $T = $$.$T;
19242
+ var data = $el.treemap.datum();
19243
+ var classChartTreemap = $$.getChartClass("Treemap");
19244
+ var treemap = $el.treemap
19245
+ .selectAll("g")
19246
+ .data(data.children);
19247
+ $T(treemap.exit(), durationForExit)
19248
+ .style("opacity", "0")
19249
+ .remove();
19250
+ treemap.enter()
19251
+ .append("g")
19252
+ .append("rect");
19253
+ $el.treemap.selectAll("g")
19254
+ .attr("class", classChartTreemap)
19255
+ .select("rect")
19256
+ .attr("fill", function (d) { return $$.color(d.data.name); });
19257
+ },
19258
+ /**
19259
+ * Generate treemap coordinate points data
19260
+ * @returns {Array} Array of coordinate points
19261
+ * @private
19262
+ */
19263
+ generateGetTreemapPoints: function () {
19264
+ var $$ = this;
19265
+ var $el = $$.$el, _a = $$.scale, x = _a.x, y = _a.y;
19266
+ var points = {};
19267
+ $el.treemap.selectAll("g").each(function (d) {
19268
+ points[d.data.name] = [
19269
+ [x(d.x0), y(d.y0)],
19270
+ [x(d.x1), y(d.y1)]
19271
+ ];
19272
+ });
19273
+ return function (d) { return points[d.id]; };
19274
+ },
19275
+ /**
19276
+ * Redraw treemap
19277
+ * @param {boolean} withTransition With or without transition
19278
+ * @returns {Array} Selections
19279
+ * @private
19280
+ */
19281
+ redrawTreemap: function (withTransition) {
19282
+ var $$ = this;
19283
+ var $el = $$.$el, _a = $$.state.current, width = _a.width, height = _a.height;
19284
+ // update defs
19285
+ $el.defs.select("rect")
19286
+ .attr("width", width)
19287
+ .attr("height", height);
19288
+ return [
19289
+ $$.$T($el.treemap, withTransition, getRandom())
19290
+ .call(position.bind($$), $el.treemap.datum())
19291
+ ];
19292
+ },
19293
+ /**
19294
+ * Get treemap data label format function
19295
+ * @param {object} d Data object
19296
+ * @returns {Function}
19297
+ * @private
19298
+ */
19299
+ treemapDataLabelFormat: function (d) {
19300
+ var $$ = this;
19301
+ var config = $$.config;
19302
+ var id = d.id, value = d.value;
19303
+ var format = config.treemap_label_format;
19304
+ var ratio = $$.getRatio("treemap", d);
19305
+ var percentValue = (ratio * 100).toFixed(2);
19306
+ var meetLabelThreshold = config.treemap_label_show && $$.meetsLabelThreshold(ratio, "treemap") ? null : "0";
19307
+ return function (node) {
19308
+ node.style("opacity", meetLabelThreshold);
19309
+ return isFunction(format) ? format.bind($$.api)(value, ratio, id) :
19310
+ "".concat(id, "\n").concat(percentValue, "%");
19311
+ };
19312
+ }
19313
+ };
19314
+
18752
19315
  /**
18753
19316
  * Copyright (c) 2017 ~ present NAVER Corp.
18754
19317
  * billboard.js project is licensed under the MIT license
@@ -19243,7 +19806,7 @@ var optScatter = {
19243
19806
  * billboard.js project is licensed under the MIT license
19244
19807
  */
19245
19808
  /**
19246
- * x Axis config options
19809
+ * spline config options
19247
19810
  */
19248
19811
  var optSpline = {
19249
19812
  /**
@@ -19284,6 +19847,52 @@ var optSpline = {
19284
19847
  spline_interpolation_type: "cardinal"
19285
19848
  };
19286
19849
 
19850
+ /**
19851
+ * Copyright (c) 2017 ~ present NAVER Corp.
19852
+ * billboard.js project is licensed under the MIT license
19853
+ */
19854
+ /**
19855
+ * arc config options
19856
+ */
19857
+ var optArc = {
19858
+ /**
19859
+ * Set arc options
19860
+ * @name arc
19861
+ * @memberof Options
19862
+ * @type {object}
19863
+ * @property {object} arc Arc object
19864
+ * @property {number|Function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
19865
+ * - **NOTE:**
19866
+ * - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
19867
+ * @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
19868
+ * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
19869
+ * @see [Demo: Gauge corner radius](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeCornerRadius)
19870
+ * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
19871
+ * @example
19872
+ * arc: {
19873
+ * cornerRadius: 12,
19874
+ *
19875
+ * // can customize corner radius for each data with function callback
19876
+ * //
19877
+ * // The function will receive:
19878
+ * // - id {string}: Data id
19879
+ * // - value {number}: Data value
19880
+ * // - outerRadius {number}: Outer radius value
19881
+ * cornerRadius: function(id, value, outerRadius) {
19882
+ * return (id === "data1" && value > 10) ?
19883
+ * 50 : outerRadius * 1.2;
19884
+ * },
19885
+ *
19886
+ * // set ratio relative of outer radius
19887
+ * cornerRadius: {
19888
+ * ratio: 0.5
19889
+ * }
19890
+ * }
19891
+ */
19892
+ arc_cornerRadius: 0,
19893
+ arc_cornerRadius_ratio: 0
19894
+ };
19895
+
19287
19896
  /**
19288
19897
  * Copyright (c) 2017 ~ present NAVER Corp.
19289
19898
  * billboard.js project is licensed under the MIT license
@@ -19407,7 +20016,7 @@ var optGauge = {
19407
20016
  * - `startingAngle < -1 * Math.PI` defaults to `Math.PI`
19408
20017
  * - `startingAngle > Math.PI` defaults to `Math.PI`
19409
20018
  * @property {number} [gauge.arcLength=100] Set the length of the arc to be drawn in percent from -100 to 100.<br>
19410
- * Negative value will draw the arc **counterclockwise**.
20019
+ * Negative value will draw the arc **counterclockwise**. Need to be used in conjunction with `gauge.fullCircle=true`.
19411
20020
  *
19412
20021
  * **Limitations:**
19413
20022
  * - -100 <= arcLength (in percent) <= 100
@@ -19420,7 +20029,7 @@ var optGauge = {
19420
20029
  * **Available Values:**
19421
20030
  * - single
19422
20031
  * - multi
19423
- * @property {string} [gauge.arcs.minWidth=5] Set minimal width of gauge arcs until the innerRadius disappears.
20032
+ * @property {number} [gauge.arcs.minWidth=5] Set minimal width of gauge arcs until the innerRadius disappears.
19424
20033
  * @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
19425
20034
  * @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
19426
20035
  * @example
@@ -19494,7 +20103,7 @@ var optGauge = {
19494
20103
  * billboard.js project is licensed under the MIT license
19495
20104
  */
19496
20105
  /**
19497
- * x Axis config options
20106
+ * pie config options
19498
20107
  */
19499
20108
  var optPie = {
19500
20109
  /**
@@ -19594,7 +20203,7 @@ var optPie = {
19594
20203
  * billboard.js project is licensed under the MIT license
19595
20204
  */
19596
20205
  /**
19597
- * x Axis config options
20206
+ * polar config options
19598
20207
  */
19599
20208
  var optPolar = {
19600
20209
  /**
@@ -19676,7 +20285,7 @@ var optPolar = {
19676
20285
  * billboard.js project is licensed under the MIT license
19677
20286
  */
19678
20287
  /**
19679
- * x Axis config options
20288
+ * radar config options
19680
20289
  */
19681
20290
  var optRadar = {
19682
20291
  /**
@@ -19747,6 +20356,60 @@ var optRadar = {
19747
20356
  radar_direction_clockwise: false
19748
20357
  };
19749
20358
 
20359
+ /**
20360
+ * Copyright (c) 2017 ~ present NAVER Corp.
20361
+ * billboard.js project is licensed under the MIT license
20362
+ */
20363
+ /**
20364
+ * treemap config options
20365
+ */
20366
+ var optTreemap = {
20367
+ /**
20368
+ * Set treemap options
20369
+ * @name treemap
20370
+ * @memberof Options
20371
+ * @type {object}
20372
+ * @property {object} treemap Treemap object
20373
+ * @property {string} [treemap.tile="binary"] Treemap tile type
20374
+ * - **Available tile type values:**
20375
+ * - binary ([d3.treemapBinary](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapBinary))
20376
+ * - dice ([d3.treemapDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapDice))
20377
+ * - slice ([d3.treemapSlice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSlice))
20378
+ * - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
20379
+ * - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
20380
+ * - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
20381
+ * @property {Function} [treemap.label.format] Set formatter for the label text.
20382
+ * @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
20383
+ * @property {number} [treemap.label.show=true] Show or hide label text.
20384
+ * @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
20385
+ * @example
20386
+ * treemap: {
20387
+ * // "binary", "dice", "slice", "sliceDice", "squrify", "resquarify"
20388
+ * tile: "dice",
20389
+ *
20390
+ * label: {
20391
+ * // show or hide label text
20392
+ * show: false,
20393
+ *
20394
+ * // set label text formatter
20395
+ * format: function(value, ratio, id) {
20396
+ * return d3.format("$")(value);
20397
+ *
20398
+ * // to multiline, return with '\n' character
20399
+ * // return value +"%\nLine1\n2Line2";
20400
+ * },
20401
+ *
20402
+ * // set ratio number
20403
+ * ratio: 0.05
20404
+ * }
20405
+ * }
20406
+ */
20407
+ treemap_tile: "binary",
20408
+ treemap_label_format: undefined,
20409
+ treemap_label_threshold: 0.05,
20410
+ treemap_label_show: true
20411
+ };
20412
+
19750
20413
  /**
19751
20414
  * Copyright (c) 2017 ~ present NAVER Corp.
19752
20415
  * billboard.js project is licensed under the MIT license
@@ -19793,16 +20456,18 @@ var line = function () { return (extendLine(), (line = function () { return TYPE
19793
20456
  var spline = function () { return (extendLine(undefined, [optSpline]), (spline = function () { return TYPE.SPLINE; })()); };
19794
20457
  var step = function () { return (extendLine(), (step = function () { return TYPE.STEP; })()); };
19795
20458
  // Arc types
19796
- var donut = function () { return (extendArc(undefined, [optDonut]), (donut = function () { return TYPE.DONUT; })()); };
19797
- var gauge = function () { return (extendArc([shapeGauge], [optGauge]), (gauge = function () { return TYPE.GAUGE; })()); };
19798
- var pie = function () { return (extendArc(undefined, [optPie]), (pie = function () { return TYPE.PIE; })()); };
19799
- var polar = function () { return (extendArc([shapePolar], [optPolar]), (polar = function () { return TYPE.POLAR; })()); };
20459
+ var donut = function () { return (extendArc(undefined, [optArc, optDonut]), (donut = function () { return TYPE.DONUT; })()); };
20460
+ var gauge = function () { return (extendArc([shapeGauge], [optArc, optGauge]), (gauge = function () { return TYPE.GAUGE; })()); };
20461
+ var pie = function () { return (extendArc(undefined, [optArc, optPie]), (pie = function () { return TYPE.PIE; })()); };
20462
+ var polar = function () { return (extendArc([shapePolar], [optArc, optPolar]), (polar = function () { return TYPE.POLAR; })()); };
19800
20463
  var radar = function () { return (extendArc([shapePoint, shapeRadar], [optPoint, optRadar]), (radar = function () { return TYPE.RADAR; })()); };
19801
20464
  // Axis based types
19802
20465
  var bar = function () { return (extendAxis([shapeBar], optBar), (bar = function () { return TYPE.BAR; })()); };
19803
20466
  var bubble = function () { return (extendAxis([shapePoint, shapeBubble], [optBubble, optPoint]), (bubble = function () { return TYPE.BUBBLE; })()); };
19804
20467
  var candlestick = function () { return (extendAxis([shapeCandlestick], [optCandlestick]), (candlestick = function () { return TYPE.CANDLESTICK; })()); };
19805
20468
  var scatter = function () { return (extendAxis([shapePoint], [optPoint, optScatter]), (scatter = function () { return TYPE.SCATTER; })()); };
20469
+ // Non Axis based types
20470
+ var treemap = function () { return (extendAxis([shapeTreemap], [optTreemap]), (treemap = function () { return TYPE.TREEMAP; })()); };
19806
20471
 
19807
20472
  /**
19808
20473
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -21441,7 +22106,7 @@ var zoomModule = function () {
21441
22106
  var defaults = {};
21442
22107
  /**
21443
22108
  * @namespace bb
21444
- * @version 3.6.3
22109
+ * @version 3.7.0-next.2
21445
22110
  */
21446
22111
  var bb = {
21447
22112
  /**
@@ -21451,7 +22116,7 @@ var bb = {
21451
22116
  * bb.version; // "1.0.0"
21452
22117
  * @memberof bb
21453
22118
  */
21454
- version: "3.6.3",
22119
+ version: "3.7.0-next.2",
21455
22120
  /**
21456
22121
  * Generate chart
21457
22122
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -21580,4 +22245,4 @@ var bb = {
21580
22245
  plugin: {}
21581
22246
  };
21582
22247
 
21583
- export { area, areaLineRange, areaSpline, areaSplineRange, areaStep, bar, bb, bubble, candlestick, bb as default, donut, gauge, line, pie, polar, radar, scatter, selectionModule as selection, spline, step, subchartModule as subchart, zoomModule as zoom };
22248
+ export { area, areaLineRange, areaSpline, areaSplineRange, areaStep, bar, bb, bubble, candlestick, bb as default, donut, gauge, line, pie, polar, radar, scatter, selectionModule as selection, spline, step, subchartModule as subchart, treemap, zoomModule as zoom };