billboard.js 3.14.0-next.1 → 3.14.0-next.3

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 (51) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +63 -15
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +9 -9
  5. package/dist/billboard.pkgd.js +63 -15
  6. package/dist/billboard.pkgd.min.js +13 -13
  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 +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  27. package/dist/theme/dark.css +1 -1
  28. package/dist/theme/dark.min.css +1 -1
  29. package/dist/theme/datalab.css +1 -1
  30. package/dist/theme/datalab.min.css +1 -1
  31. package/dist/theme/graph.css +1 -1
  32. package/dist/theme/graph.min.css +1 -1
  33. package/dist/theme/insight.css +1 -1
  34. package/dist/theme/insight.min.css +1 -1
  35. package/dist/theme/modern.css +1 -1
  36. package/dist/theme/modern.min.css +1 -1
  37. package/dist-esm/billboard.js +61 -18
  38. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  39. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  42. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  43. package/package.json +12 -12
  44. package/src/ChartInternal/Axis/AxisRendererHelper.ts +5 -3
  45. package/src/ChartInternal/data/IData.ts +4 -0
  46. package/src/ChartInternal/interactions/eventrect.ts +4 -3
  47. package/src/ChartInternal/interactions/zoom.ts +11 -3
  48. package/src/ChartInternal/internals/legend.ts +12 -3
  49. package/src/ChartInternal/shape/bar.ts +49 -16
  50. package/src/config/Options/common/legend.ts +6 -3
  51. package/types/options.d.ts +3 -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.14.0-next.1
8
+ * @version 3.14.0-next.3
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.0-next.1
8
+ * @version 3.14.0-next.3
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -615,9 +615,12 @@ const $ZOOM = {
615
615
  * }
616
616
  *
617
617
  * // when set below callback, will disable corresponding default interactions
618
- * onclick: function(id) { ... },
619
- * onover: function(id) { ... },
620
- * onout: function(id) { ... },
618
+ * onclick: function(id, visible) {
619
+ * // toggle based on the data visibility
620
+ * this[visible ? "hide" : "show"](id);
621
+ * },
622
+ * onover: function(id, visible) { ... },
623
+ * onout: function(id, visible) { ... },
621
624
  *
622
625
  * // set tile's size
623
626
  * tile: {
@@ -5855,7 +5858,12 @@ function getFormattedText(id, formatted = true) {
5855
5858
  item.on(
5856
5859
  interaction.dblclick ? "dblclick" : "click",
5857
5860
  interaction || isFunction(config.legend_item_onclick) ? function(event, id) {
5858
- if (!callFn(config.legend_item_onclick, api, id)) {
5861
+ if (!callFn(
5862
+ config.legend_item_onclick,
5863
+ api,
5864
+ id,
5865
+ !state.hiddenTargetIds.includes(id)
5866
+ )) {
5859
5867
  const { altKey, target, type } = event;
5860
5868
  if (type === "dblclick" || altKey) {
5861
5869
  if (state.hiddenTargetIds.length && target.parentNode.getAttribute("class").indexOf(
@@ -5875,7 +5883,12 @@ function getFormattedText(id, formatted = true) {
5875
5883
  } : null
5876
5884
  );
5877
5885
  !isTouch && item.on("mouseout", interaction || isFunction(config.legend_item_onout) ? function(event, id) {
5878
- if (!callFn(config.legend_item_onout, api, id)) {
5886
+ if (!callFn(
5887
+ config.legend_item_onout,
5888
+ api,
5889
+ id,
5890
+ !state.hiddenTargetIds.includes(id)
5891
+ )) {
5879
5892
  (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, false);
5880
5893
  if (hasGauge) {
5881
5894
  $$.undoMarkOverlapped($$, `.${$GAUGE.gaugeValue}`);
@@ -5883,7 +5896,12 @@ function getFormattedText(id, formatted = true) {
5883
5896
  $$.api.revert();
5884
5897
  }
5885
5898
  } : null).on("mouseover", interaction || isFunction(config.legend_item_onover) ? function(event, id) {
5886
- if (!callFn(config.legend_item_onover, api, id)) {
5899
+ if (!callFn(
5900
+ config.legend_item_onover,
5901
+ api,
5902
+ id,
5903
+ !state.hiddenTargetIds.includes(id)
5904
+ )) {
5887
5905
  (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, true);
5888
5906
  if (hasGauge) {
5889
5907
  $$.markOverlapped(id, $$, `.${$GAUGE.gaugeValue}`);
@@ -11108,7 +11126,7 @@ extend(zoom, {
11108
11126
  const $$ = this;
11109
11127
  $$.scale.zoom = null;
11110
11128
  $$.generateZoom();
11111
- $$.initZoomBehaviour();
11129
+ $$.config.zoom_type === "drag" && $$.initZoomBehaviour();
11112
11130
  },
11113
11131
  /**
11114
11132
  * Bind zoom event
@@ -11149,6 +11167,9 @@ extend(zoom, {
11149
11167
  const isRotated = config.axis_rotated;
11150
11168
  (_a = org.xScale) == null ? void 0 : _a.range(scale.x.range());
11151
11169
  const newScale = transform[isRotated ? "rescaleY" : "rescaleX"](org.xScale || scale.x);
11170
+ if (newScale.domain().some((v) => /(Invalid Date|NaN)/.test(v.toString()))) {
11171
+ return;
11172
+ }
11152
11173
  const domain = $$.trimXDomain(newScale.domain());
11153
11174
  const rescale = config.zoom_rescale;
11154
11175
  newScale.domain(domain, org.xDomain);
@@ -12761,7 +12782,10 @@ class AxisRendererHelper {
12761
12782
  const { config } = this;
12762
12783
  const fn = id === "x" ? (value) => `translate(${value + config.tickOffset},0)` : (value) => `translate(0,${value})`;
12763
12784
  return (selection, scale) => {
12764
- selection.attr("transform", (d) => isValue(d) ? fn(Math.ceil(scale(d))) : null);
12785
+ selection.attr("transform", (d) => {
12786
+ const x = scale(d);
12787
+ return isValue(d) ? fn(Math.ceil(x)) : null;
12788
+ });
12765
12789
  };
12766
12790
  }
12767
12791
  scaleExtent(domain) {
@@ -14437,13 +14461,14 @@ class Axis_Axis {
14437
14461
  clickHandlerForMultipleXS(ctx) {
14438
14462
  const $$ = ctx;
14439
14463
  const { config, state } = $$;
14464
+ const pointSensitivity = config.point_sensitivity;
14440
14465
  const targetsToShow = $$.filterTargetsToShow($$.data.targets);
14441
14466
  if ($$.hasArcType(targetsToShow)) {
14442
14467
  return;
14443
14468
  }
14444
14469
  const mouse = getPointer(state.event, this);
14445
14470
  const closest = $$.findClosestFromTargets(targetsToShow, mouse);
14446
- const sensitivity = config.point_sensitivity === "radius" ? closest.r : config.point_sensitivity;
14471
+ const sensitivity = pointSensitivity === "radius" ? closest == null ? void 0 : closest.r : isFunction(pointSensitivity) ? closest && pointSensitivity(closest) : pointSensitivity;
14447
14472
  if (!closest) {
14448
14473
  return;
14449
14474
  }
@@ -18378,7 +18403,7 @@ function getAttrTweenFn(fn) {
18378
18403
  const $$ = this;
18379
18404
  const { bar } = isSub ? $$.$el.subchart : $$.$el;
18380
18405
  return [
18381
- $$.$T(bar, withTransition, getRandom()).attr("d", (d) => (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d)).style("fill", $$.updateBarColor.bind($$)).style("opacity", null)
18406
+ $$.$T(bar, withTransition, getRandom()).attr("d", (d) => (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d)).style("fill", $$.updateBarColor.bind($$)).style("clip-path", (d) => d.clipPath).style("opacity", null)
18382
18407
  ];
18383
18408
  },
18384
18409
  /**
@@ -18417,19 +18442,42 @@ function getAttrTweenFn(fn) {
18417
18442
  const isInverted = config[`axis_${$$.axis.getId(d.id)}_inverted`];
18418
18443
  const isNegative = !isInverted && isUnderZero || isInverted && !isUnderZero;
18419
18444
  const pathRadius = ["", ""];
18420
- let radius = 0;
18421
18445
  const isGrouped = $$.isGrouped(d.id);
18422
18446
  const isRadiusData = getRadius && isGrouped ? $$.isStackingRadiusData(d) : false;
18447
+ const init = [
18448
+ points[0][indexX],
18449
+ points[0][indexY]
18450
+ ];
18451
+ let radius = 0;
18452
+ d.clipPath = null;
18423
18453
  if (getRadius) {
18424
18454
  const index = isRotated ? indexY : indexX;
18425
18455
  const barW = points[2][index] - points[0][index];
18426
18456
  radius = !isGrouped || isRadiusData ? getRadius(barW) : 0;
18427
- const arc = `a${radius},${radius} ${isNegative ? `1 0 0` : `0 0 1`} `;
18457
+ const arc = `a${radius} ${radius} ${isNegative ? `1 0 0` : `0 0 1`} `;
18428
18458
  pathRadius[+!isRotated] = `${arc}${radius},${radius}`;
18429
18459
  pathRadius[+isRotated] = `${arc}${[-radius, radius][isRotated ? "sort" : "reverse"]()}`;
18430
18460
  isNegative && pathRadius.reverse();
18431
18461
  }
18432
- const path = isRotated ? `H${points[1][indexX] + (isNegative ? radius : -radius)} ${pathRadius[0]}V${points[2][indexY] - radius} ${pathRadius[1]}H${points[3][indexX]}` : `V${points[1][indexY] + (isNegative ? -radius : radius)} ${pathRadius[0]}H${points[2][indexX] - radius} ${pathRadius[1]}V${points[3][indexY]}`;
18462
+ const pos = isRotated ? points[1][indexX] + (isNegative ? radius : -radius) : points[1][indexY] + (isNegative ? -radius : radius);
18463
+ if (radius) {
18464
+ let clipPath = "";
18465
+ if (isRotated) {
18466
+ if (isNegative && init[0] < pos) {
18467
+ clipPath = `0 ${pos - init[0]}px 0 0`;
18468
+ } else if (!isNegative && init[0] > pos) {
18469
+ clipPath = `0 0 0 ${init[0] - pos}px`;
18470
+ }
18471
+ } else {
18472
+ if (isNegative && init[1] > pos) {
18473
+ clipPath = `${init[1] - pos}px 0 0 0`;
18474
+ } else if (!isNegative && init[1] < pos) {
18475
+ clipPath = `0 0 ${pos - init[1]}px 0`;
18476
+ }
18477
+ }
18478
+ d.clipPath = `inset(${clipPath})`;
18479
+ }
18480
+ const path = isRotated ? `H${pos} ${pathRadius[0]}V${points[2][indexY] - radius} ${pathRadius[1]}H${points[3][indexX]}` : `V${pos} ${pathRadius[0]}H${points[2][indexX] - radius} ${pathRadius[1]}V${points[3][indexY]}`;
18433
18481
  return `M${points[0][indexX]},${points[0][indexY]}${path}z`;
18434
18482
  };
18435
18483
  },
@@ -21789,7 +21837,7 @@ const bb = {
21789
21837
  * bb.version; // "1.0.0"
21790
21838
  * @memberof bb
21791
21839
  */
21792
- version: "3.14.0-next.1",
21840
+ version: "3.14.0-next.3",
21793
21841
  /**
21794
21842
  * Generate chart
21795
21843
  * - **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.0-next.1
8
+ * @version 3.14.0-next.3
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}