billboard.js 3.12.1 → 3.12.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 (45) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +45 -24
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +9 -9
  5. package/dist/billboard.pkgd.js +45 -24
  6. package/dist/billboard.pkgd.min.js +16 -16
  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 +54 -27
  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 +7 -7
  44. package/src/ChartInternal/data/load.ts +3 -0
  45. package/src/ChartInternal/shape/funnel.ts +49 -25
@@ -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.1
8
+ * @version 3.12.2
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
@@ -27708,6 +27708,7 @@ function callDone(fn, resizeAfter = false) {
27708
27708
  $$.data.targets = $$.data.targets.filter((t) => t.id !== id);
27709
27709
  hasLegendDefsPoint && ((_a2 = $el.defs) == null ? void 0 : _a2.select(`#${$$.getDefsPointId(suffixId)}`).remove());
27710
27710
  });
27711
+ state.hasFunnel && $$.updateFunnel($$.data.targets);
27711
27712
  state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
27712
27713
  $$.updateTypesElements();
27713
27714
  }
@@ -45205,13 +45206,16 @@ function getSize(checkNeck = false) {
45205
45206
  height: height - (config.legend_show ? $$.getLegendHeight() + 10 : 0) - (padding.top + padding.bottom)
45206
45207
  }, padding);
45207
45208
  if (checkNeck) {
45208
- const { width: neckWidth } = getNecklSize.call($$, {
45209
+ const { width: neckWidth, height: neckHeight } = getNecklSize.call($$, {
45209
45210
  width: size.width,
45210
45211
  height: size.height
45211
45212
  });
45212
45213
  if (size.width < neckWidth) {
45213
45214
  size.width = neckWidth;
45214
45215
  }
45216
+ if (size.height < neckHeight) {
45217
+ size.height = neckHeight;
45218
+ }
45215
45219
  }
45216
45220
  return size;
45217
45221
  }
@@ -45234,49 +45238,55 @@ function getNecklSize(current) {
45234
45238
  }
45235
45239
  function getCoord(d) {
45236
45240
  const $$ = this;
45237
- const { top, width } = getSize.call($$, true);
45241
+ const { top, left, width } = getSize.call($$, true);
45238
45242
  const coords = [];
45239
45243
  d.forEach((d2, i) => {
45240
45244
  const { ratio } = d2;
45241
45245
  const y = i > 0 ? coords[i - 1][2][1] : top;
45242
45246
  coords.push(d2.coords = [
45243
- [0, y],
45247
+ [left, y],
45244
45248
  // M
45245
- [width, y],
45249
+ [left + width, y],
45246
45250
  // 1
45247
- [width, i > 0 ? ratio + y : ratio + top],
45251
+ [left + width, i > 0 ? ratio + y : ratio + top],
45248
45252
  // 2
45249
- [0, i > 0 ? ratio + y : ratio + top],
45253
+ [left, i > 0 ? ratio + y : ratio + top],
45250
45254
  // 3
45251
- [0, y]
45255
+ [left, y]
45252
45256
  // 4
45253
45257
  ]);
45254
45258
  });
45255
45259
  return coords;
45256
45260
  }
45257
- function getNeckPath() {
45261
+ function getClipPath(forBackground = false) {
45258
45262
  const $$ = this;
45259
45263
  const { width, height, top, left } = getSize.call($$, true);
45260
45264
  const neck = getNecklSize.call($$, { width, height });
45261
- const rightX = (width + neck.width) / 2;
45262
45265
  const leftX = (width - neck.width) / 2;
45266
+ const rightX = (width + neck.width) / 2;
45263
45267
  const bodyHeigth = height - neck.height;
45264
45268
  const coords = [
45265
- [0 + left, 0 + top],
45269
+ [0, 0],
45266
45270
  // M
45267
- [width + left, 0 + top],
45271
+ [width, 0],
45268
45272
  // 1
45269
45273
  [rightX, bodyHeigth],
45270
45274
  // 2
45271
- [rightX, height + top],
45275
+ [rightX, height],
45272
45276
  // 3
45273
- [leftX, height + top],
45277
+ [leftX, height],
45274
45278
  // 4
45275
45279
  [leftX, bodyHeigth],
45276
45280
  // 5
45277
- [0 + left, 0 + top]
45281
+ [0, 0]
45278
45282
  // 6
45279
45283
  ];
45284
+ if (forBackground) {
45285
+ coords.forEach((d) => {
45286
+ d[0] += left;
45287
+ d[1] += top;
45288
+ });
45289
+ }
45280
45290
  return `M${coords.join("L")}z`;
45281
45291
  }
45282
45292
  function getFunnelData(d) {
@@ -45364,23 +45374,35 @@ function updateRatio(data) {
45364
45374
  mainFunnelEnter.append("path");
45365
45375
  funnel.path = mainFunnelEnter.merge(mainFunnelUpdate).attr("class", (d) => classChartFunnel(d)).select("path").attr("class", classFunnel).style("opacity", "0").style("fill", $$.color);
45366
45376
  },
45377
+ /**
45378
+ * Update funnel path selection
45379
+ * @param {object} targets Updated target data
45380
+ * @private
45381
+ */
45382
+ updateFunnel(targets) {
45383
+ const $$ = this;
45384
+ const { $el: { funnel } } = $$;
45385
+ const targetIds = targets.map(({ id }) => id);
45386
+ funnel.path = funnel.path.filter((d) => targetIds.indexOf(d.id) >= 0);
45387
+ },
45367
45388
  /**
45368
45389
  * Generate treemap coordinate points data
45369
45390
  * @returns {Array} Array of coordinate points
45370
45391
  * @private
45371
45392
  */
45372
45393
  generateGetFunnelPoints() {
45373
- var _a;
45374
45394
  const $$ = this;
45375
45395
  const { $el: { funnel } } = $$;
45376
45396
  const targets = $$.filterTargetsToShow(funnel.path);
45397
+ const { top, left, right } = getSize.call($$);
45398
+ const center = (left - right) / 2;
45377
45399
  const points = {};
45378
- let accumulatedHeight = (_a = getSize.call($$).top) != null ? _a : 0;
45400
+ let accumulatedHeight = top != null ? top : 0;
45379
45401
  targets.each((d, i) => {
45380
- var _a2;
45402
+ var _a;
45381
45403
  points[d.id] = [
45382
- [0, accumulatedHeight],
45383
- [0, accumulatedHeight += ((_a2 = targets == null ? void 0 : targets[i]) != null ? _a2 : d).ratio]
45404
+ [center, accumulatedHeight],
45405
+ [center, accumulatedHeight += ((_a = targets == null ? void 0 : targets[i]) != null ? _a : d).ratio]
45384
45406
  ];
45385
45407
  });
45386
45408
  return (d) => points[d.id];
@@ -45394,9 +45416,8 @@ function updateRatio(data) {
45394
45416
  const { $T, $el: { funnel } } = $$;
45395
45417
  const targets = $$.filterTargetsToShow(funnel.path);
45396
45418
  const coords = getCoord.call($$, updateRatio.call($$, targets.data()));
45397
- const neckPath = getNeckPath.bind($$)();
45398
- funnel.attr("clip-path", `path('${neckPath}')`);
45399
- funnel.background.attr("d", neckPath);
45419
+ funnel.attr("clip-path", `path('${getClipPath.bind($$)()}')`);
45420
+ funnel.background.attr("d", getClipPath.call($$, true));
45400
45421
  $T(targets).attr("d", (d, i) => `M${coords[i].join("L")}z`).style("opacity", "1");
45401
45422
  funnel.selectAll("g").style("opacity", null);
45402
45423
  }
@@ -48558,7 +48579,7 @@ const bb = {
48558
48579
  * bb.version; // "1.0.0"
48559
48580
  * @memberof bb
48560
48581
  */
48561
- version: "3.12.1",
48582
+ version: "3.12.2",
48562
48583
  /**
48563
48584
  * Generate chart
48564
48585
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: