billboard.js 3.14.2 → 3.15.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +4 -2
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +138 -95
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +10 -10
  6. package/dist/billboard.pkgd.js +1350 -1007
  7. package/dist/billboard.pkgd.min.js +17 -17
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +3 -3
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -9
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1204 -914
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -5
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1205 -915
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -7
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +1206 -916
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1207 -917
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +8 -8
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1215 -918
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +6 -6
  28. package/dist/theme/dark.css +1 -1
  29. package/dist/theme/dark.min.css +1 -1
  30. package/dist/theme/datalab.css +1 -1
  31. package/dist/theme/datalab.min.css +1 -1
  32. package/dist/theme/graph.css +1 -1
  33. package/dist/theme/graph.min.css +1 -1
  34. package/dist/theme/insight.css +1 -1
  35. package/dist/theme/insight.min.css +1 -1
  36. package/dist/theme/modern.css +1 -1
  37. package/dist/theme/modern.min.css +1 -1
  38. package/dist-esm/billboard.js +164 -117
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -77
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -77
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -77
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -66
  44. package/package.json +35 -35
  45. package/src/Chart/api/chart.ts +2 -0
  46. package/src/Chart/api/regions.ts +2 -2
  47. package/src/ChartInternal/Axis/Axis.ts +68 -60
  48. package/src/ChartInternal/ChartInternal.ts +9 -4
  49. package/src/ChartInternal/data/data.ts +1 -1
  50. package/src/ChartInternal/interactions/interaction.ts +2 -2
  51. package/src/ChartInternal/internals/region.ts +44 -46
  52. package/src/config/Options/axis/y2.ts +13 -0
  53. package/src/config/Options/common/main.ts +30 -11
  54. package/src/config/Options/shape/gauge.ts +3 -2
  55. package/types/options.d.ts +2 -1
  56. package/types/options.shape.d.ts +3 -2
  57. package/types/types.d.ts +0 -14
package/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
  [![Latest Version][badge-latest]][link-version] [![Next version][badge-next]][link-version] [![bb][badge-@billboard.js/react]][link-@billboard.js/react]<br>
7
7
  [![semantic-release][badge-semantic-release]][link-semantic-release] ![React][badge-react]
8
8
 
9
- ![CI Status][badge-ci-status] [![Coverage Status][badge-coverage]][link-coverage] [![Known Vulnerabilities][badge-snyk]][link-snyk]
10
- [![download][badge-download]][link-download] [![jsDelivr][badge-jsDelivr]][link-jsDelivr] [![gzip size][badge-gzip-size]][link-gzip-size]
9
+ [![download][badge-download]][link-download] [![download][badge-download-weekly]][link-download] [![jsDelivr][badge-jsDelivr]][link-jsDelivr] [![jsDelivr][badge-jsDelivr-weekly]][link-jsDelivr]<br>
10
+ ![CI Status][badge-ci-status] [![Coverage Status][badge-coverage]][link-coverage] [![Known Vulnerabilities][badge-snyk]][link-snyk] [![gzip size][badge-gzip-size]][link-gzip-size]
11
11
 
12
12
  billboard.js is a re-usable, easy interface JavaScript chart library, based on [D3.js](https://d3js.org/).
13
13
  > The name "billboard" comes from the famous `billboard chart` which everybody knows.<br>
@@ -288,7 +288,9 @@ THE SOFTWARE.
288
288
 
289
289
  <!-- badges -->
290
290
  [badge-download]: https://img.shields.io/npm/dm/billboard.js.svg?style=flat
291
+ [badge-download-weekly]: https://img.shields.io/npm/dw/billboard.js
291
292
  [badge-jsDelivr]: https://data.jsdelivr.com/v1/package/npm/billboard.js/badge?style=rounded
293
+ [badge-jsDelivr-weekly]: https://img.shields.io/jsdelivr/npm/hw/billboard.js
292
294
  [badge-ci-status]: https://github.com/naver/billboard.js/workflows/CI/badge.svg
293
295
  [badge-coverage]: https://coveralls.io/repos/github/naver/billboard.js/badge.svg?branch=master&v1
294
296
  [badge-snyk]: https://snyk.io/test/github/naver/billboard.js/badge.svg?targetFile=package.json
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.14.2
8
+ * @version 3.15.0-next.1
9
9
  */
10
10
  /*-- Chart --*/
11
11
  .bb svg {
package/dist/billboard.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.14.2
8
+ * @version 3.15.0-next.1
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -827,6 +827,7 @@ const $ZOOM = {
827
827
  * - **NOTE:** Available options
828
828
  * - true: Enables automatic resize.
829
829
  * - false: Disables automatic resize.
830
+ * - "parent": Enables automatic resize when the parent node is resized.
830
831
  * - "viewBox": Enables automatic resize, and size will be fixed based on the viewbox.
831
832
  * @property {boolean|number} [resize.timer=true] Set resize timer option.
832
833
  * - **NOTE:** Available options
@@ -834,11 +835,15 @@ const $ZOOM = {
834
835
  * - true: `setTimeout()`
835
836
  * - false: `requestIdleCallback()`
836
837
  * - Given number(delay in ms) value, resize function will be triggered using `setTimeout()` with given delay.
837
- * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeViewBox)
838
+ * @see [Demo: resize "parent"](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeParent)
839
+ * @see [Demo: resize "viewBox"](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeViewBox)
838
840
  * @example
839
841
  * resize: {
840
842
  * auto: false,
841
843
  *
844
+ * // set resize based on parent node width value
845
+ * auto: "parent",
846
+ *
842
847
  * // set resize based on viewBox value
843
848
  * auto: "viewBox",
844
849
  *
@@ -1047,17 +1052,31 @@ const $ZOOM = {
1047
1052
  render: {},
1048
1053
  /**
1049
1054
  * Show rectangles inside the chart.<br><br>
1050
- * This option accepts array including object that has axis, start, end and class.
1051
- * The keys start, end and class are optional.
1052
- * axis must be x, y or y2. start and end should be the value where regions start and end.
1053
- * If not specified, the edge values will be used.
1054
- * If timeseries x axis, date string, Date object and unixtime integer can be used.
1055
- * If class is set, the region element will have it as class.
1055
+ * - **NOTE:**<br>
1056
+ * - axis must be x, y or y2. start and end should be the value where regions start and end.
1057
+ * - If not specified, the edge values will be used.
1058
+ * - If timeseries x axis, date string, Date object and unixtime integer can be used.
1059
+ * - If category x axis, category name can be used for start and end.
1060
+ * - If class is set, the region element will have it as class.
1061
+ *
1062
+ * This option accept array of object with below values:
1063
+ * - `axis {string}`: 'x', 'y', or 'y2'
1064
+ * - `[start] {number|Date|string}`: Start position of the region. If not set, the start will be the edge of the chart.
1065
+ * - `[end] {number|Date|string}`: End position of the region. If not set, the end will be the edge of the chart.
1066
+ * - `[class] {string}`: Class value to apply to the region.
1067
+ * - `[label] {object}` Lable text option.
1068
+ * - `text {string}`: Text value.
1069
+ * - `x {number}`: x Position.
1070
+ * - `y {number}`: y Position.
1071
+ * - `color {string}`: Color string.
1072
+ * - `rotated (boolean)`: Whether rotate label or not.
1056
1073
  * @name regions
1057
1074
  * @memberof Options
1058
1075
  * @type {Array}
1059
1076
  * @default []
1060
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Region.RegionLabel)
1077
+ * @see [Demo: Regions](https://naver.github.io/billboard.js/demo/#Region.Region)
1078
+ * @see [Demo: Regions Timeseries](https://naver.github.io/billboard.js/demo/#Region.RegionWithTimeseries)
1079
+ * @see [Demo: Regions Label](https://naver.github.io/billboard.js/demo/#Region.RegionLabel)
1061
1080
  * @example
1062
1081
  * regions: [
1063
1082
  * {
@@ -4172,7 +4191,7 @@ function getDataKeyForJson(keysParam, config) {
4172
4191
  if (hasViewBox($el.svg)) {
4173
4192
  const pos = [point, 0];
4174
4193
  isRotated && pos.reverse();
4175
- point = getTransformCTM($el.svg.node(), ...pos)[isRotated ? "y" : "x"];
4194
+ point = getTransformCTM($el.eventRect.node(), ...pos)[isRotated ? "y" : "x"];
4176
4195
  } else {
4177
4196
  point -= isRotated ? rect.top : rect.left;
4178
4197
  }
@@ -4701,7 +4720,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
4701
4720
  * @param {Array} mouse x and y coordinate value
4702
4721
  */
4703
4722
  dispatchEvent(type, index, mouse) {
4704
- var _a, _b;
4723
+ var _a, _b, _c;
4705
4724
  const $$ = this;
4706
4725
  const {
4707
4726
  config,
@@ -4714,7 +4733,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
4714
4733
  },
4715
4734
  $el: { eventRect, funnel, radar, svg, treemap }
4716
4735
  } = $$;
4717
- let element = (_b = (hasFunnel || hasTreemap) && eventReceiver.rect || hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) == null ? void 0 : _a.call($$, index)))) == null ? void 0 : _b.node();
4736
+ let element = (_c = (_b = (hasFunnel || hasTreemap) && eventReceiver.rect || hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) == null ? void 0 : _a.call($$, index)))) == null ? void 0 : _b.node) == null ? void 0 : _c.call(_b);
4718
4737
  if (element) {
4719
4738
  const isMultipleX = $$.isMultipleX();
4720
4739
  const isRotated = config.axis_rotated;
@@ -4734,7 +4753,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
4734
4753
  let x = left + (mouse ? mouse[0] : 0) + (isMultipleX || isRotated ? 0 : width / 2);
4735
4754
  let y = top + (mouse ? mouse[1] : 0) + (isRotated ? 4 : 0);
4736
4755
  if (hasViewBox(svg)) {
4737
- const ctm = getTransformCTM($$.$el.svg.node(), x, y, false);
4756
+ const ctm = getTransformCTM($$.$el.eventRect.node(), x, y, false);
4738
4757
  x = ctm.x;
4739
4758
  y = ctm.y;
4740
4759
  }
@@ -8935,7 +8954,7 @@ class ChartInternal {
8935
8954
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
8936
8955
  $el.defs = $el.svg.append("defs");
8937
8956
  if (hasAxis) {
8938
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
8957
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
8939
8958
  $$.appendClip($el.defs, state.clip[v]);
8940
8959
  });
8941
8960
  }
@@ -9176,11 +9195,11 @@ class ChartInternal {
9176
9195
  }
9177
9196
  bindResize() {
9178
9197
  const $$ = this;
9179
- const { config, state } = $$;
9198
+ const { $el, config, state } = $$;
9180
9199
  const resizeFunction = generateResize(config.resize_timer);
9181
9200
  const list = [];
9182
9201
  list.push(() => callFn(config.onresize, $$.api));
9183
- if (config.resize_auto === true) {
9202
+ if (/^(true|parent)$/.test(config.resize_auto)) {
9184
9203
  list.push(() => {
9185
9204
  state.resizing = true;
9186
9205
  if (config.legend_show) {
@@ -9196,7 +9215,11 @@ class ChartInternal {
9196
9215
  });
9197
9216
  list.forEach((v) => resizeFunction.add(v));
9198
9217
  $$.resizeFunction = resizeFunction;
9199
- win.addEventListener("resize", $$.resizeFunction = resizeFunction);
9218
+ if (config.resize_auto === "parent") {
9219
+ ($$.resizeFunction.resizeObserver = new ResizeObserver($$.resizeFunction.bind($$))).observe($el.chart.node().parentNode);
9220
+ } else {
9221
+ win.addEventListener("resize", $$.resizeFunction);
9222
+ }
9200
9223
  }
9201
9224
  /**
9202
9225
  * Call plugin hook
@@ -9351,6 +9374,7 @@ function loadConfig(config) {
9351
9374
  * chart.destroy();
9352
9375
  */
9353
9376
  destroy() {
9377
+ var _a;
9354
9378
  const $$ = this.internal;
9355
9379
  const { $el: { chart, style, svg } } = $$;
9356
9380
  if (notEmpty($$)) {
@@ -9359,6 +9383,7 @@ function loadConfig(config) {
9359
9383
  $$.unbindAllEvents();
9360
9384
  svg.select("*").interrupt();
9361
9385
  $$.resizeFunction.clear();
9386
+ (_a = $$.resizeFunction.resizeObserver) == null ? void 0 : _a.disconnect();
9362
9387
  win.removeEventListener("resize", $$.resizeFunction);
9363
9388
  chart.classed("bb", false).style("position", null).selectChildren().remove();
9364
9389
  style && style.parentNode.removeChild(style);
@@ -12592,7 +12617,7 @@ extend(regions, {
12592
12617
  * @function regions․add
12593
12618
  * @instance
12594
12619
  * @memberof Chart
12595
- * @param {Array|object} regions New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
12620
+ * @param {Array|object} regions New region will be added. The format of this argument is the same as [regions](./Options.html#.regions) and it's possible to give an Object if only one region will be added.
12596
12621
  * @returns {Array} regions
12597
12622
  * @example
12598
12623
  * // Add a new region
@@ -13330,12 +13355,10 @@ class Axis_Axis {
13330
13355
  init() {
13331
13356
  const $$ = this.owner;
13332
13357
  const { config, $el: { main, axis }, state: { clip } } = $$;
13333
- const isRotated = config.axis_rotated;
13334
13358
  const target = ["x", "y"];
13335
13359
  config.axis_y2_show && target.push("y2");
13336
13360
  target.forEach((v) => {
13337
13361
  const classAxis = this.getAxisClassName(v);
13338
- const classLabel = $AXIS[`axis${v.toUpperCase()}Label`];
13339
13362
  axis[v] = main.append("g").attr("class", classAxis).attr("clip-path", () => {
13340
13363
  let res = null;
13341
13364
  if (v === "x") {
@@ -13345,10 +13368,8 @@ class Axis_Axis {
13345
13368
  }
13346
13369
  return res;
13347
13370
  }).attr("transform", $$.getTranslate(v)).style("visibility", config[`axis_${v}_show`] ? null : "hidden");
13348
- axis[v].append("text").attr("class", classLabel).attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated]).style("text-anchor", () => this.textAnchorForAxisLabel(v));
13349
13371
  this.generateAxes(v);
13350
13372
  });
13351
- config.axis_tooltip && this.setAxisTooltip();
13352
13373
  }
13353
13374
  /**
13354
13375
  * Set axis orient according option value
@@ -13624,17 +13645,6 @@ class Axis_Axis {
13624
13645
  }
13625
13646
  return x;
13626
13647
  }
13627
- dxForAxisLabel(id) {
13628
- const $$ = this.owner;
13629
- const position = this.getAxisLabelPosition(id);
13630
- let dx = position.isBottom ? "0.5em" : "0";
13631
- if (this.isHorizontal($$, id !== "x")) {
13632
- dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
13633
- } else if (position.isTop) {
13634
- dx = "-0.5em";
13635
- }
13636
- return dx;
13637
- }
13638
13648
  textAnchorForAxisLabel(id) {
13639
13649
  const $$ = this.owner;
13640
13650
  const position = this.getAxisLabelPosition(id);
@@ -13646,6 +13656,17 @@ class Axis_Axis {
13646
13656
  }
13647
13657
  return anchor;
13648
13658
  }
13659
+ dxForAxisLabel(id) {
13660
+ const $$ = this.owner;
13661
+ const position = this.getAxisLabelPosition(id);
13662
+ let dx = position.isBottom ? "0.5em" : "0";
13663
+ if (this.isHorizontal($$, id !== "x")) {
13664
+ dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
13665
+ } else if (position.isTop) {
13666
+ dx = "-0.5em";
13667
+ }
13668
+ return dx;
13669
+ }
13649
13670
  dyForAxisLabel(id) {
13650
13671
  const $$ = this.owner;
13651
13672
  const { config } = $$;
@@ -13812,17 +13833,26 @@ class Axis_Axis {
13812
13833
  }
13813
13834
  return maxOverflow + tickOffset;
13814
13835
  }
13836
+ /**
13837
+ * Update axis label text
13838
+ * @param {boolean} withTransition Weather update with transition
13839
+ * @private
13840
+ */
13815
13841
  updateLabels(withTransition) {
13816
13842
  const $$ = this.owner;
13817
- const { $el: { main }, $T } = $$;
13818
- const labels = {
13819
- x: main.select(`.${$AXIS.axisX} .${$AXIS.axisXLabel}`),
13820
- y: main.select(`.${$AXIS.axisY} .${$AXIS.axisYLabel}`),
13821
- y2: main.select(`.${$AXIS.axisY2} .${$AXIS.axisY2Label}`)
13822
- };
13823
- Object.keys(labels).filter((id) => !labels[id].empty()).forEach((v) => {
13824
- const node = labels[v];
13825
- $T(node, withTransition).attr("x", () => this.xForAxisLabel(v)).attr("dx", () => this.dxForAxisLabel(v)).attr("dy", () => this.dyForAxisLabel(v)).text(() => this.getLabelText(v));
13843
+ const { config, $el: { main }, $T } = $$;
13844
+ const isRotated = config.axis_rotated;
13845
+ ["x", "y", "y2"].forEach((id) => {
13846
+ const text = this.getLabelText(id);
13847
+ const selector = `axis${capitalize(id)}`;
13848
+ const classLabel = $AXIS[`${selector}Label`];
13849
+ if (text) {
13850
+ let axisLabel = main.select(`text.${classLabel}`);
13851
+ if (axisLabel.empty()) {
13852
+ axisLabel = main.select(`g.${$AXIS[selector]}`).insert("text", ":first-child").attr("class", classLabel).attr("transform", ["rotate(-90)", null][id === "x" ? +!isRotated : +isRotated]).style("text-anchor", () => this.textAnchorForAxisLabel(id));
13853
+ }
13854
+ $T(axisLabel, withTransition).attr("x", () => this.xForAxisLabel(id)).attr("dx", () => this.dxForAxisLabel(id)).attr("dy", () => this.dyForAxisLabel(id)).text(text);
13855
+ }
13826
13856
  });
13827
13857
  }
13828
13858
  /**
@@ -13883,7 +13913,7 @@ class Axis_Axis {
13883
13913
  }
13884
13914
  redraw(transitions, isHidden, isInit) {
13885
13915
  const $$ = this.owner;
13886
- const { config, $el } = $$;
13916
+ const { config, state, $el } = $$;
13887
13917
  const opacity = isHidden ? "0" : null;
13888
13918
  ["x", "y", "y2", "subX"].forEach((id) => {
13889
13919
  const axis = this[id];
@@ -13897,6 +13927,7 @@ class Axis_Axis {
13897
13927
  }
13898
13928
  });
13899
13929
  this.updateAxes();
13930
+ !state.rendered && config.axis_tooltip && this.setAxisTooltip();
13900
13931
  }
13901
13932
  /**
13902
13933
  * Redraw axis
@@ -14025,15 +14056,17 @@ class Axis_Axis {
14025
14056
  );
14026
14057
  ["x", "y", "y2"].forEach((v) => {
14027
14058
  var _a2, _b, _c;
14028
- axisTooltip[v] = (_a2 = axis[v]) == null ? void 0 : _a2.append("text").classed($AXIS[`axis${v.toUpperCase()}Tooltip`], true).attr("filter", $$.updateTextBGColor({ id: v }, bgColor));
14029
- if (isRotated) {
14030
- const pos = v === "x" ? "x" : "y";
14031
- const val = v === "y" ? "1.15em" : v === "x" ? "-0.3em" : "-0.4em";
14032
- (_b = axisTooltip[v]) == null ? void 0 : _b.attr(pos, val).attr(`d${v === "x" ? "y" : "x"}`, v === "x" ? "0.4em" : "-1.3em").style("text-anchor", v === "x" ? "end" : null);
14033
- } else {
14034
- const pos = v === "x" ? "y" : "x";
14035
- const val = v === "x" ? "1.15em" : `${v === "y" ? "-" : ""}0.4em`;
14036
- (_c = axisTooltip[v]) == null ? void 0 : _c.attr(pos, val).attr(`d${v === "x" ? "x" : "y"}`, v === "x" ? "-1em" : "0.3em").style("text-anchor", v === "y" ? "end" : null);
14059
+ if (isString(bgColor) || bgColor[v]) {
14060
+ axisTooltip[v] = (_a2 = axis[v]) == null ? void 0 : _a2.append("text").classed($AXIS[`axis${v.toUpperCase()}Tooltip`], true).attr("filter", $$.updateTextBGColor({ id: v }, bgColor));
14061
+ if (isRotated) {
14062
+ const pos = v === "x" ? "x" : "y";
14063
+ const val = v === "y" ? "1.15em" : v === "x" ? "-0.3em" : "-0.4em";
14064
+ (_b = axisTooltip[v]) == null ? void 0 : _b.attr(pos, val).attr(`d${v === "x" ? "y" : "x"}`, v === "x" ? "0.4em" : "-1.3em").style("text-anchor", v === "x" ? "end" : null);
14065
+ } else {
14066
+ const pos = v === "x" ? "y" : "x";
14067
+ const val = v === "x" ? "1.15em" : `${v === "y" ? "-" : ""}0.4em`;
14068
+ (_c = axisTooltip[v]) == null ? void 0 : _c.attr(pos, val).attr(`d${v === "x" ? "x" : "y"}`, v === "x" ? "-1em" : "0.3em").style("text-anchor", v === "y" ? "end" : null);
14069
+ }
14037
14070
  }
14038
14071
  });
14039
14072
  }
@@ -15195,62 +15228,59 @@ function smoothLines(el, type) {
15195
15228
  label.style("opacity", null)
15196
15229
  ];
15197
15230
  },
15198
- getRegionXY(type, d) {
15199
- const $$ = this;
15200
- const { config, scale } = $$;
15201
- const isRotated = config.axis_rotated;
15202
- const isX = type === "x";
15203
- let key = "start";
15204
- let currScale;
15205
- let pos = 0;
15206
- if (d.axis === "y" || d.axis === "y2") {
15207
- if (!isX) {
15208
- key = "end";
15209
- }
15210
- if ((isX ? isRotated : !isRotated) && key in d) {
15211
- currScale = scale[d.axis];
15212
- pos = currScale(d[key]);
15213
- }
15214
- } else if ((isX ? !isRotated : isRotated) && key in d) {
15215
- currScale = scale.zoom || scale.x;
15216
- pos = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
15217
- }
15218
- return pos;
15219
- },
15220
15231
  regionX(d) {
15221
- return this.getRegionXY("x", d);
15232
+ return this.getRegionSize("x", d);
15222
15233
  },
15223
15234
  regionY(d) {
15224
- return this.getRegionXY("y", d);
15235
+ return this.getRegionSize("y", d);
15236
+ },
15237
+ regionWidth(d) {
15238
+ return this.getRegionSize("width", d);
15239
+ },
15240
+ regionHeight(d) {
15241
+ return this.getRegionSize("height", d);
15225
15242
  },
15243
+ /**
15244
+ * Get Region size according start/end position
15245
+ * @param {string} type Type string
15246
+ * @param {ojbect} d Data object
15247
+ * @returns {number}
15248
+ * @private
15249
+ */
15226
15250
  getRegionSize(type, d) {
15227
15251
  const $$ = this;
15228
15252
  const { config, scale, state } = $$;
15229
15253
  const isRotated = config.axis_rotated;
15230
- const isWidth = type === "width";
15231
- const start = $$[isWidth ? "regionX" : "regionY"](d);
15254
+ const isAxisType = /(x|y|y2)/.test(type);
15255
+ const isType = isAxisType ? type === "x" : type === "width";
15256
+ const start = !isAxisType && $$[isType ? "regionX" : "regionY"](d);
15257
+ let key = isAxisType ? "start" : "end";
15258
+ let pos = isAxisType ? 0 : state[type];
15232
15259
  let currScale;
15233
- let key = "end";
15234
- let end = state[type];
15235
15260
  if (d.axis === "y" || d.axis === "y2") {
15236
- if (!isWidth) {
15261
+ if (!isAxisType && !isType) {
15237
15262
  key = "start";
15263
+ } else if (isAxisType && !isType) {
15264
+ key = "end";
15238
15265
  }
15239
- if ((isWidth ? isRotated : !isRotated) && key in d) {
15266
+ if ((isType ? isRotated : !isRotated) && key in d) {
15240
15267
  currScale = scale[d.axis];
15241
- end = currScale(d[key]);
15242
15268
  }
15243
- } else if ((isWidth ? !isRotated : isRotated) && key in d) {
15269
+ } else if ((isType ? !isRotated : isRotated) && key in d) {
15244
15270
  currScale = scale.zoom || scale.x;
15245
- end = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
15246
15271
  }
15247
- return end < start ? 0 : end - start;
15248
- },
15249
- regionWidth(d) {
15250
- return this.getRegionSize("width", d);
15251
- },
15252
- regionHeight(d) {
15253
- return this.getRegionSize("height", d);
15272
+ if (currScale) {
15273
+ let offset = 0;
15274
+ pos = d[key];
15275
+ if ($$.axis.isTimeSeries(d.axis)) {
15276
+ pos = parseDate.call($$, pos);
15277
+ } else if (/(x|width)/.test(type) && $$.axis.isCategorized() && isNaN(pos)) {
15278
+ pos = config.axis_x_categories.indexOf(pos);
15279
+ offset = $$.axis.x.tickOffset() * (key === "start" ? -1 : 1);
15280
+ }
15281
+ pos = currScale(pos) + offset;
15282
+ }
15283
+ return isAxisType ? pos : pos < start ? 0 : pos - start;
15254
15284
  },
15255
15285
  isRegionOnX(d) {
15256
15286
  return !d.axis || d.axis === "x";
@@ -16570,6 +16600,18 @@ function smoothLines(el, type) {
16570
16600
 
16571
16601
  ;// ./src/config/Options/axis/y2.ts
16572
16602
  /* harmony default export */ var y2 = ({
16603
+ /**
16604
+ * Set clip-path attribute for y2 axis element
16605
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
16606
+ * @name axis․y2․clipPath
16607
+ * @memberof Options
16608
+ * @type {boolean}
16609
+ * @default true
16610
+ * @example
16611
+ * // don't set 'clip-path' attribute
16612
+ * clipPath: false
16613
+ */
16614
+ axis_y2_clipPath: true,
16573
16615
  /**
16574
16616
  * Show or hide y2 axis.
16575
16617
  * - **NOTE**:
@@ -21358,8 +21400,9 @@ ${percentValue}%`;
21358
21400
  * @property {number} [gauge.expand.rate=0.98] Set expand rate.
21359
21401
  * @property {number} [gauge.expand.duration=50] Set the expand transition time in milliseconds.
21360
21402
  * @property {boolean} [gauge.enforceMinMax=false] Enforce to given min/max value.
21361
- * - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
21362
- * - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
21403
+ * - **Note:** Only works for single data series.
21404
+ * - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
21405
+ * - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
21363
21406
  * @property {number} [gauge.min=0] Set min value of the gauge.
21364
21407
  * @property {number} [gauge.max=100] Set max value of the gauge.
21365
21408
  * @property {number} [gauge.startingAngle=-1 * Math.PI / 2] Set starting angle where data draws.
@@ -21862,7 +21905,7 @@ const bb = {
21862
21905
  * bb.version; // "1.0.0"
21863
21906
  * @memberof bb
21864
21907
  */
21865
- version: "3.14.2",
21908
+ version: "3.15.0-next.1",
21866
21909
  /**
21867
21910
  * Generate chart
21868
21911
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -5,5 +5,5 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.14.2
8
+ * @version 3.15.0-next.1
9
9
  */.bb svg{font:10px sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0)}.bb path,.bb line{fill:none;stroke:#000}.bb text,.bb .bb-button{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid-focus,.bb-ygrid{shape-rendering:crispEdges}.bb-chart-arcs .bb-needle,.bb-chart-arc .bb-gauge-value{fill:#000}.bb-chart-arc path{stroke:#fff}.bb-chart-arc rect{stroke:#fff;stroke-width:1}.bb-chart-arc text{fill:#fff;font-size:13px}.bb-chart-funnels path{stroke-width:0}.bb-chart-funnels+.bb-chart-texts text{font-size:13px;fill:#fff}.bb-axis{shape-rendering:crispEdges}.bb-axis .bb-axis-x-tooltip,.bb-axis .bb-axis-y-tooltip,.bb-axis .bb-axis-y2-tooltip{font-size:1em;fill:#fff;white-space:nowrap}.bb-grid{pointer-events:none}.bb-grid line{stroke:#aaa}.bb-grid text{fill:#aaa}.bb-xgrid,.bb-ygrid{stroke-dasharray:3 3}.bb-text.bb-empty{fill:gray;font-size:2em}.bb-line{stroke-width:1px}.bb-circle._expanded_{stroke-width:1px;stroke:#fff}.bb-selected-circle{fill:#fff;stroke-width:2px}.bb-bar{stroke-width:0}.bb-bar._expanded_{fill-opacity:.75}.bb-candlestick{stroke-width:1px}.bb-candlestick._expanded_{fill-opacity:.75}.bb-target.bb-focused,.bb-circles.bb-focused{opacity:1}.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step,.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step{stroke-width:2px}.bb-target.bb-defocused,.bb-circles.bb-defocused{opacity:.3!important}.bb-target.bb-defocused .text-overlapping,.bb-circles.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-region rect{fill-opacity:.1}.bb-zoom-brush,.bb-brush .extent{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}.bb-title{font:14px sans-serif}.bb-chart-treemaps rect{stroke:#fff;stroke-width:1px}.bb-tooltip-container{z-index:10;user-select:none}.bb-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;opacity:.9;box-shadow:7px 7px 12px -9px #777;white-space:nowrap}.bb-tooltip tr{border:1px solid #CCC}.bb-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#fff}.bb-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;width:10px;height:10px;margin-right:6px}.bb-tooltip.value{text-align:right}.bb-area{stroke-width:0;opacity:.2}.bb-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}text.bb-chart-arcs-gauge-title{dominant-baseline:middle;font-size:2.7em}.bb-chart-arcs .bb-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.bb-chart-arcs .bb-chart-arcs-gauge-unit{fill:#000;font-size:16px}.bb-chart-arcs .bb-chart-arcs-gauge-max,.bb-chart-arcs .bb-chart-arcs-gauge-min{fill:#777}.bb-chart-arcs .bb-levels circle{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-arcs .bb-levels text{fill:#848282}.bb-chart-radars .bb-levels polygon{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-levels text{fill:#848282}.bb-chart-radars .bb-axis line{stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-axis text{font-size:1.15em;cursor:default}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;top:10px;right:10px}.bb-button .bb-zoom-reset{font-size:11px;border:solid 1px #ccc;background-color:#fff;padding:5px;border-radius:5px;cursor:pointer}