billboard.js 3.12.0 → 3.12.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 (45) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +13 -10
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +8 -8
  5. package/dist/billboard.pkgd.js +180 -177
  6. package/dist/billboard.pkgd.min.js +6 -6
  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 +19 -10
  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 +1 -1
  44. package/src/ChartInternal/shape/treemap.ts +19 -10
  45. package/types/types.d.ts +1 -0
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.12.0
8
+ * @version 3.12.1
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - @types/d3-selection ^3.0.0
@@ -46527,173 +46527,6 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
46527
46527
  }
46528
46528
  });
46529
46529
 
46530
- ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/round.js
46531
- /* harmony default export */ function treemap_round(node) {
46532
- node.x0 = Math.round(node.x0);
46533
- node.y0 = Math.round(node.y0);
46534
- node.x1 = Math.round(node.x1);
46535
- node.y1 = Math.round(node.y1);
46536
- }
46537
-
46538
- ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/dice.js
46539
- /* harmony default export */ function dice(parent, x0, y0, x1, y1) {
46540
- var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value;
46541
- while (++i < n) {
46542
- node = nodes[i], node.y0 = y0, node.y1 = y1;
46543
- node.x0 = x0, node.x1 = x0 += node.value * k;
46544
- }
46545
- }
46546
-
46547
- ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/slice.js
46548
- /* harmony default export */ function treemap_slice(parent, x0, y0, x1, y1) {
46549
- var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value;
46550
- while (++i < n) {
46551
- node = nodes[i], node.x0 = x0, node.x1 = x1;
46552
- node.y0 = y0, node.y1 = y0 += node.value * k;
46553
- }
46554
- }
46555
-
46556
- ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/squarify.js
46557
-
46558
-
46559
- var phi = (1 + Math.sqrt(5)) / 2;
46560
- function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
46561
- var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta;
46562
- while (i0 < n) {
46563
- dx = x1 - x0, dy = y1 - y0;
46564
- do
46565
- sumValue = nodes[i1++].value;
46566
- while (!sumValue && i1 < n);
46567
- minValue = maxValue = sumValue;
46568
- alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
46569
- beta = sumValue * sumValue * alpha;
46570
- minRatio = Math.max(maxValue / beta, beta / minValue);
46571
- for (; i1 < n; ++i1) {
46572
- sumValue += nodeValue = nodes[i1].value;
46573
- if (nodeValue < minValue)
46574
- minValue = nodeValue;
46575
- if (nodeValue > maxValue)
46576
- maxValue = nodeValue;
46577
- beta = sumValue * sumValue * alpha;
46578
- newRatio = Math.max(maxValue / beta, beta / minValue);
46579
- if (newRatio > minRatio) {
46580
- sumValue -= nodeValue;
46581
- break;
46582
- }
46583
- minRatio = newRatio;
46584
- }
46585
- rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) });
46586
- if (row.dice)
46587
- dice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
46588
- else
46589
- treemap_slice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
46590
- value -= sumValue, i0 = i1;
46591
- }
46592
- return rows;
46593
- }
46594
- /* harmony default export */ var squarify = ((function custom(ratio) {
46595
- function squarify(parent, x0, y0, x1, y1) {
46596
- squarifyRatio(ratio, parent, x0, y0, x1, y1);
46597
- }
46598
- squarify.ratio = function(x) {
46599
- return custom((x = +x) > 1 ? x : 1);
46600
- };
46601
- return squarify;
46602
- })(phi));
46603
-
46604
- ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/accessors.js
46605
- function optional(f) {
46606
- return f == null ? null : required(f);
46607
- }
46608
- function required(f) {
46609
- if (typeof f !== "function")
46610
- throw new Error();
46611
- return f;
46612
- }
46613
-
46614
- ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/constant.js
46615
- function constantZero() {
46616
- return 0;
46617
- }
46618
- /* harmony default export */ function d3_hierarchy_src_constant(x) {
46619
- return function() {
46620
- return x;
46621
- };
46622
- }
46623
-
46624
- ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/index.js
46625
-
46626
-
46627
-
46628
-
46629
- /* harmony default export */ function treemap() {
46630
- var tile = squarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
46631
- function treemap(root) {
46632
- root.x0 = root.y0 = 0;
46633
- root.x1 = dx;
46634
- root.y1 = dy;
46635
- root.eachBefore(positionNode);
46636
- paddingStack = [0];
46637
- if (round)
46638
- root.eachBefore(treemap_round);
46639
- return root;
46640
- }
46641
- function positionNode(node) {
46642
- var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p;
46643
- if (x1 < x0)
46644
- x0 = x1 = (x0 + x1) / 2;
46645
- if (y1 < y0)
46646
- y0 = y1 = (y0 + y1) / 2;
46647
- node.x0 = x0;
46648
- node.y0 = y0;
46649
- node.x1 = x1;
46650
- node.y1 = y1;
46651
- if (node.children) {
46652
- p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
46653
- x0 += paddingLeft(node) - p;
46654
- y0 += paddingTop(node) - p;
46655
- x1 -= paddingRight(node) - p;
46656
- y1 -= paddingBottom(node) - p;
46657
- if (x1 < x0)
46658
- x0 = x1 = (x0 + x1) / 2;
46659
- if (y1 < y0)
46660
- y0 = y1 = (y0 + y1) / 2;
46661
- tile(node, x0, y0, x1, y1);
46662
- }
46663
- }
46664
- treemap.round = function(x) {
46665
- return arguments.length ? (round = !!x, treemap) : round;
46666
- };
46667
- treemap.size = function(x) {
46668
- return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];
46669
- };
46670
- treemap.tile = function(x) {
46671
- return arguments.length ? (tile = required(x), treemap) : tile;
46672
- };
46673
- treemap.padding = function(x) {
46674
- return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
46675
- };
46676
- treemap.paddingInner = function(x) {
46677
- return arguments.length ? (paddingInner = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingInner;
46678
- };
46679
- treemap.paddingOuter = function(x) {
46680
- return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
46681
- };
46682
- treemap.paddingTop = function(x) {
46683
- return arguments.length ? (paddingTop = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingTop;
46684
- };
46685
- treemap.paddingRight = function(x) {
46686
- return arguments.length ? (paddingRight = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingRight;
46687
- };
46688
- treemap.paddingBottom = function(x) {
46689
- return arguments.length ? (paddingBottom = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingBottom;
46690
- };
46691
- treemap.paddingLeft = function(x) {
46692
- return arguments.length ? (paddingLeft = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingLeft;
46693
- };
46694
- return treemap;
46695
- }
46696
-
46697
46530
  ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/hierarchy/count.js
46698
46531
  function count(node) {
46699
46532
  var sum = 0, children = node.children, i = children && children.length;
@@ -46935,6 +46768,173 @@ Node.prototype = hierarchy.prototype = {
46935
46768
  [Symbol.iterator]: hierarchy_iterator
46936
46769
  };
46937
46770
 
46771
+ ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/round.js
46772
+ /* harmony default export */ function treemap_round(node) {
46773
+ node.x0 = Math.round(node.x0);
46774
+ node.y0 = Math.round(node.y0);
46775
+ node.x1 = Math.round(node.x1);
46776
+ node.y1 = Math.round(node.y1);
46777
+ }
46778
+
46779
+ ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/dice.js
46780
+ /* harmony default export */ function dice(parent, x0, y0, x1, y1) {
46781
+ var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (x1 - x0) / parent.value;
46782
+ while (++i < n) {
46783
+ node = nodes[i], node.y0 = y0, node.y1 = y1;
46784
+ node.x0 = x0, node.x1 = x0 += node.value * k;
46785
+ }
46786
+ }
46787
+
46788
+ ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/slice.js
46789
+ /* harmony default export */ function treemap_slice(parent, x0, y0, x1, y1) {
46790
+ var nodes = parent.children, node, i = -1, n = nodes.length, k = parent.value && (y1 - y0) / parent.value;
46791
+ while (++i < n) {
46792
+ node = nodes[i], node.x0 = x0, node.x1 = x1;
46793
+ node.y0 = y0, node.y1 = y0 += node.value * k;
46794
+ }
46795
+ }
46796
+
46797
+ ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/squarify.js
46798
+
46799
+
46800
+ var phi = (1 + Math.sqrt(5)) / 2;
46801
+ function squarifyRatio(ratio, parent, x0, y0, x1, y1) {
46802
+ var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta;
46803
+ while (i0 < n) {
46804
+ dx = x1 - x0, dy = y1 - y0;
46805
+ do
46806
+ sumValue = nodes[i1++].value;
46807
+ while (!sumValue && i1 < n);
46808
+ minValue = maxValue = sumValue;
46809
+ alpha = Math.max(dy / dx, dx / dy) / (value * ratio);
46810
+ beta = sumValue * sumValue * alpha;
46811
+ minRatio = Math.max(maxValue / beta, beta / minValue);
46812
+ for (; i1 < n; ++i1) {
46813
+ sumValue += nodeValue = nodes[i1].value;
46814
+ if (nodeValue < minValue)
46815
+ minValue = nodeValue;
46816
+ if (nodeValue > maxValue)
46817
+ maxValue = nodeValue;
46818
+ beta = sumValue * sumValue * alpha;
46819
+ newRatio = Math.max(maxValue / beta, beta / minValue);
46820
+ if (newRatio > minRatio) {
46821
+ sumValue -= nodeValue;
46822
+ break;
46823
+ }
46824
+ minRatio = newRatio;
46825
+ }
46826
+ rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) });
46827
+ if (row.dice)
46828
+ dice(row, x0, y0, x1, value ? y0 += dy * sumValue / value : y1);
46829
+ else
46830
+ treemap_slice(row, x0, y0, value ? x0 += dx * sumValue / value : x1, y1);
46831
+ value -= sumValue, i0 = i1;
46832
+ }
46833
+ return rows;
46834
+ }
46835
+ /* harmony default export */ var squarify = ((function custom(ratio) {
46836
+ function squarify(parent, x0, y0, x1, y1) {
46837
+ squarifyRatio(ratio, parent, x0, y0, x1, y1);
46838
+ }
46839
+ squarify.ratio = function(x) {
46840
+ return custom((x = +x) > 1 ? x : 1);
46841
+ };
46842
+ return squarify;
46843
+ })(phi));
46844
+
46845
+ ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/accessors.js
46846
+ function optional(f) {
46847
+ return f == null ? null : required(f);
46848
+ }
46849
+ function required(f) {
46850
+ if (typeof f !== "function")
46851
+ throw new Error();
46852
+ return f;
46853
+ }
46854
+
46855
+ ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/constant.js
46856
+ function constantZero() {
46857
+ return 0;
46858
+ }
46859
+ /* harmony default export */ function d3_hierarchy_src_constant(x) {
46860
+ return function() {
46861
+ return x;
46862
+ };
46863
+ }
46864
+
46865
+ ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/index.js
46866
+
46867
+
46868
+
46869
+
46870
+ /* harmony default export */ function treemap() {
46871
+ var tile = squarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero;
46872
+ function treemap(root) {
46873
+ root.x0 = root.y0 = 0;
46874
+ root.x1 = dx;
46875
+ root.y1 = dy;
46876
+ root.eachBefore(positionNode);
46877
+ paddingStack = [0];
46878
+ if (round)
46879
+ root.eachBefore(treemap_round);
46880
+ return root;
46881
+ }
46882
+ function positionNode(node) {
46883
+ var p = paddingStack[node.depth], x0 = node.x0 + p, y0 = node.y0 + p, x1 = node.x1 - p, y1 = node.y1 - p;
46884
+ if (x1 < x0)
46885
+ x0 = x1 = (x0 + x1) / 2;
46886
+ if (y1 < y0)
46887
+ y0 = y1 = (y0 + y1) / 2;
46888
+ node.x0 = x0;
46889
+ node.y0 = y0;
46890
+ node.x1 = x1;
46891
+ node.y1 = y1;
46892
+ if (node.children) {
46893
+ p = paddingStack[node.depth + 1] = paddingInner(node) / 2;
46894
+ x0 += paddingLeft(node) - p;
46895
+ y0 += paddingTop(node) - p;
46896
+ x1 -= paddingRight(node) - p;
46897
+ y1 -= paddingBottom(node) - p;
46898
+ if (x1 < x0)
46899
+ x0 = x1 = (x0 + x1) / 2;
46900
+ if (y1 < y0)
46901
+ y0 = y1 = (y0 + y1) / 2;
46902
+ tile(node, x0, y0, x1, y1);
46903
+ }
46904
+ }
46905
+ treemap.round = function(x) {
46906
+ return arguments.length ? (round = !!x, treemap) : round;
46907
+ };
46908
+ treemap.size = function(x) {
46909
+ return arguments.length ? (dx = +x[0], dy = +x[1], treemap) : [dx, dy];
46910
+ };
46911
+ treemap.tile = function(x) {
46912
+ return arguments.length ? (tile = required(x), treemap) : tile;
46913
+ };
46914
+ treemap.padding = function(x) {
46915
+ return arguments.length ? treemap.paddingInner(x).paddingOuter(x) : treemap.paddingInner();
46916
+ };
46917
+ treemap.paddingInner = function(x) {
46918
+ return arguments.length ? (paddingInner = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingInner;
46919
+ };
46920
+ treemap.paddingOuter = function(x) {
46921
+ return arguments.length ? treemap.paddingTop(x).paddingRight(x).paddingBottom(x).paddingLeft(x) : treemap.paddingTop();
46922
+ };
46923
+ treemap.paddingTop = function(x) {
46924
+ return arguments.length ? (paddingTop = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingTop;
46925
+ };
46926
+ treemap.paddingRight = function(x) {
46927
+ return arguments.length ? (paddingRight = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingRight;
46928
+ };
46929
+ treemap.paddingBottom = function(x) {
46930
+ return arguments.length ? (paddingBottom = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingBottom;
46931
+ };
46932
+ treemap.paddingLeft = function(x) {
46933
+ return arguments.length ? (paddingLeft = typeof x === "function" ? x : d3_hierarchy_src_constant(+x), treemap) : paddingLeft;
46934
+ };
46935
+ return treemap;
46936
+ }
46937
+
46938
46938
  ;// CONCATENATED MODULE: ./node_modules/d3-hierarchy/src/treemap/binary.js
46939
46939
  /* harmony default export */ function binary(parent, x0, y0, x1, y1) {
46940
46940
  var nodes = parent.children, i, n = nodes.length, sum, sums = new Array(n + 1);
@@ -47032,6 +47032,16 @@ function convertDataToTreemapData(data) {
47032
47032
  };
47033
47033
  });
47034
47034
  }
47035
+ function getHierachyData(data) {
47036
+ const $$ = this;
47037
+ const hierarchyData = hierarchy(data).sum((d) => d.value);
47038
+ const sortFn = $$.getSortCompareFn(true);
47039
+ return [
47040
+ $$.treemap(
47041
+ sortFn ? hierarchyData.sort(sortFn) : hierarchyData
47042
+ )
47043
+ ];
47044
+ }
47035
47045
  /* harmony default export */ var shape_treemap = ({
47036
47046
  initTreemap() {
47037
47047
  const $$ = this;
@@ -47045,13 +47055,6 @@ function convertDataToTreemapData(data) {
47045
47055
  } = $$;
47046
47056
  clip.id = `${datetimeId}-clip`;
47047
47057
  $$.treemap = treemap().tile($$.getTreemapTile());
47048
- $$.treemapFn = (data) => {
47049
- const hierarchyData = hierarchy(data).sum((d) => d.value);
47050
- const sortFn = $$.getSortCompareFn(true);
47051
- return $$.treemap(
47052
- sortFn ? hierarchyData.sort(sortFn) : hierarchyData
47053
- );
47054
- };
47055
47058
  $el.defs.append("clipPath").attr("id", clip.id).append("rect").attr("width", width).attr("height", height);
47056
47059
  $el.treemap = $el.main.select(`.${$COMMON.chart}`).attr("clip-path", `url(#${clip.id})`).append("g").classed($TREEMAP.chartTreemaps, true);
47057
47060
  $$.bindTreemapEvent();
@@ -47138,7 +47141,7 @@ function convertDataToTreemapData(data) {
47138
47141
  updateTargetsForTreemap(targets) {
47139
47142
  const $$ = this;
47140
47143
  const { $el: { treemap } } = $$;
47141
- const treemapData = $$.treemapFn($$.getTreemapData(targets != null ? targets : $$.data.targets));
47144
+ const treemapData = getHierachyData.call($$, $$.getTreemapData(targets != null ? targets : $$.data.targets));
47142
47145
  treemap.data(treemapData);
47143
47146
  },
47144
47147
  /**
@@ -48555,7 +48558,7 @@ const bb = {
48555
48558
  * bb.version; // "1.0.0"
48556
48559
  * @memberof bb
48557
48560
  */
48558
- version: "3.12.0",
48561
+ version: "3.12.1",
48559
48562
  /**
48560
48563
  * Generate chart
48561
48564
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: