billboard.js 3.4.0-next.2 → 3.4.0

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 (40) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +47 -18
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +93 -32
  6. package/dist/billboard.pkgd.min.js +2 -2
  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 +9 -5
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +9 -5
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +9 -5
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -5
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +55 -19
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +55 -19
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +55 -19
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +55 -19
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +1 -1
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +1 -1
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +1 -1
  28. package/dist-esm/billboard.js +38 -18
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +7 -4
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  34. package/package.json +8 -8
  35. package/src/ChartInternal/ChartInternal.ts +19 -8
  36. package/src/ChartInternal/shape/arc.ts +1 -1
  37. package/src/ChartInternal/shape/bar.ts +1 -1
  38. package/src/ChartInternal/shape/point.ts +6 -3
  39. package/src/module/generator.ts +7 -1
  40. package/src/module/util.ts +4 -2
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.4.0-next.2
8
+ * @version 3.4.0
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - d3-axis ^3.0.0
@@ -18624,15 +18624,15 @@ var _brighter = 1 / _darker;
18624
18624
 
18625
18625
 
18626
18626
  var reI = "\\s*([+-]?\\d+)\\s*",
18627
- reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",
18628
- reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
18627
+ reN = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",
18628
+ reP = "\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",
18629
18629
  reHex = /^#([0-9a-f]{3,8})$/,
18630
18630
  reRgbInteger = new RegExp("^rgb\\(\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*\\)$"),
18631
- reRgbPercent = new RegExp("^rgb\\(\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*\\)$"),
18632
- reRgbaInteger = new RegExp("^rgba\\(\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),
18633
- reRgbaPercent = new RegExp("^rgba\\(\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),
18634
- reHslPercent = new RegExp("^hsl\\(\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*\\)$"),
18635
- reHslaPercent = new RegExp("^hsla\\(\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),
18631
+ reRgbPercent = new RegExp("^rgb\\(\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*\\)$"),
18632
+ reRgbaInteger = new RegExp("^rgba\\(\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?\\d+)\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),
18633
+ reRgbaPercent = new RegExp("^rgba\\(\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),
18634
+ reHslPercent = new RegExp("^hsl\\(\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*\\)$"),
18635
+ reHslaPercent = new RegExp("^hsla\\(\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*,\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*\\)$"),
18636
18636
  named = {
18637
18637
  aliceblue: 0xf0f8ff,
18638
18638
  antiquewhite: 0xfaebd7,
@@ -18793,6 +18793,7 @@ src_define(Color, color, {
18793
18793
  hex: color_formatHex,
18794
18794
  // Deprecated! Use color.formatHex.
18795
18795
  formatHex: color_formatHex,
18796
+ formatHex8: color_formatHex8,
18796
18797
  formatHsl: color_formatHsl,
18797
18798
  formatRgb: color_formatRgb,
18798
18799
  toString: color_formatRgb
@@ -18802,6 +18803,10 @@ function color_formatHex() {
18802
18803
  return this.rgb().formatHex();
18803
18804
  }
18804
18805
 
18806
+ function color_formatHex8() {
18807
+ return this.rgb().formatHex8();
18808
+ }
18809
+
18805
18810
  function color_formatHsl() {
18806
18811
  return hslConvert(this).formatHsl();
18807
18812
  }
@@ -18864,12 +18869,16 @@ src_define(Rgb, color_rgb, extend(Color, {
18864
18869
  rgb: function () {
18865
18870
  return this;
18866
18871
  },
18872
+ clamp: function clamp() {
18873
+ return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
18874
+ },
18867
18875
  displayable: function displayable() {
18868
18876
  return -.5 <= this.r && this.r < 255.5 && -.5 <= this.g && this.g < 255.5 && -.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1;
18869
18877
  },
18870
18878
  hex: rgb_formatHex,
18871
18879
  // Deprecated! Use color.formatHex.
18872
18880
  formatHex: rgb_formatHex,
18881
+ formatHex8: rgb_formatHex8,
18873
18882
  formatRgb: rgb_formatRgb,
18874
18883
  toString: rgb_formatRgb
18875
18884
  }));
@@ -18878,14 +18887,25 @@ function rgb_formatHex() {
18878
18887
  return "#" + hex(this.r) + hex(this.g) + hex(this.b);
18879
18888
  }
18880
18889
 
18890
+ function rgb_formatHex8() {
18891
+ return "#" + hex(this.r) + hex(this.g) + hex(this.b) + hex((isNaN(this.opacity) ? 1 : this.opacity) * 255);
18892
+ }
18893
+
18881
18894
  function rgb_formatRgb() {
18882
- var a = this.opacity;
18883
- a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
18884
- return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")");
18895
+ var a = clampa(this.opacity);
18896
+ return "" + (a === 1 ? "rgb(" : "rgba(") + clampi(this.r) + ", " + clampi(this.g) + ", " + clampi(this.b) + (a === 1 ? ")" : ", " + a + ")");
18897
+ }
18898
+
18899
+ function clampa(opacity) {
18900
+ return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
18901
+ }
18902
+
18903
+ function clampi(value) {
18904
+ return Math.max(0, Math.min(255, Math.round(value) || 0));
18885
18905
  }
18886
18906
 
18887
18907
  function hex(value) {
18888
- value = Math.max(0, Math.min(255, Math.round(value) || 0));
18908
+ value = clampi(value);
18889
18909
  return (value < 16 ? "0" : "") + value.toString(16);
18890
18910
  }
18891
18911
 
@@ -18947,17 +18967,29 @@ src_define(Hsl, hsl, extend(Color, {
18947
18967
  m1 = 2 * l - m2;
18948
18968
  return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity);
18949
18969
  },
18970
+ clamp: function clamp() {
18971
+ return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
18972
+ },
18950
18973
  displayable: function displayable() {
18951
18974
  return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1;
18952
18975
  },
18953
18976
  formatHsl: function formatHsl() {
18954
- var a = this.opacity;
18955
- a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a));
18956
- return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")");
18977
+ var a = clampa(this.opacity);
18978
+ return "" + (a === 1 ? "hsl(" : "hsla(") + clamph(this.h) + ", " + clampt(this.s) * 100 + "%, " + clampt(this.l) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")");
18957
18979
  }
18958
18980
  }));
18981
+
18982
+ function clamph(value) {
18983
+ value = (value || 0) % 360;
18984
+ return value < 0 ? value + 360 : value;
18985
+ }
18986
+
18987
+ function clampt(value) {
18988
+ return Math.max(0, Math.min(1, value || 0));
18989
+ }
18959
18990
  /* From FvD 13.37, CSS Color Module Level 3 */
18960
18991
 
18992
+
18961
18993
  function hsl2rgb(h, m1, m2) {
18962
18994
  return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255;
18963
18995
  }
@@ -21891,9 +21923,13 @@ function parseDate(date) {
21891
21923
  if (date instanceof Date) {
21892
21924
  parsedDate = date;
21893
21925
  } else if (isString(date)) {
21894
- var config = this.config,
21926
+ var _format$dataTime,
21927
+ config = this.config,
21895
21928
  format = this.format;
21896
- parsedDate = format.dataTime(config.data_xFormat)(date);
21929
+
21930
+ // if fails to parse, try by new Date()
21931
+ // https://github.com/naver/billboard.js/issues/1714
21932
+ parsedDate = (_format$dataTime = format.dataTime(config.data_xFormat)(date)) != null ? _format$dataTime : new Date(date);
21897
21933
  } else if (isNumber(date) && !isNaN(date)) {
21898
21934
  parsedDate = new Date(+date);
21899
21935
  }
@@ -21912,7 +21948,7 @@ function parseDate(date) {
21912
21948
 
21913
21949
 
21914
21950
  function isTabVisible() {
21915
- return !browser_doc.hidden;
21951
+ return (browser_doc == null ? void 0 : browser_doc.hidden) === !1 || (browser_doc == null ? void 0 : browser_doc.visibilityState) === "visible";
21916
21952
  }
21917
21953
  /**
21918
21954
  * Get the current input type
@@ -24434,6 +24470,12 @@ function generateWait() {
24434
24470
  if (t === !0 || t.empty != null && t.empty()) {
24435
24471
  done++;
24436
24472
  continue;
24473
+ } // when tab isn't visible exit loop
24474
+
24475
+
24476
+ if (isTabVisible() === !1) {
24477
+ done = transitionsToWait.length;
24478
+ break;
24437
24479
  }
24438
24480
 
24439
24481
  try {
@@ -34168,27 +34210,40 @@ var ChartInternal = /*#__PURE__*/function () {
34168
34210
  }
34169
34211
 
34170
34212
  helper(_type);
34171
- } // circle
34213
+ } // Point types
34214
+
34172
34215
 
34216
+ var hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
34173
34217
 
34174
- if ($$.hasType("bubble") || $$.hasType("scatter")) {
34218
+ if (hasPointType) {
34175
34219
  $$.updateTargetForCircle == null ? void 0 : $$.updateTargetForCircle();
34176
34220
  } // Fade-in each chart
34177
34221
 
34178
34222
 
34179
- $$.showTargets();
34223
+ $$.filterTargetsToShowAtInit(hasPointType);
34180
34224
  }
34181
34225
  /**
34182
- * Display targeted elements
34226
+ * Display targeted elements at initialization
34227
+ * @param {boolean} hasPointType whether has point type(bubble, scatter) or not
34183
34228
  * @private
34184
34229
  */
34185
34230
  ;
34186
34231
 
34187
- _proto.showTargets = function showTargets() {
34232
+ _proto.filterTargetsToShowAtInit = function filterTargetsToShowAtInit(hasPointType) {
34233
+ if (hasPointType === void 0) {
34234
+ hasPointType = !1;
34235
+ }
34236
+
34188
34237
  var $$ = this,
34189
34238
  svg = $$.$el.svg,
34190
- $T = $$.$T;
34191
- $T(svg.selectAll("." + $COMMON.target).filter(function (d) {
34239
+ $T = $$.$T,
34240
+ selector = "." + $COMMON.target;
34241
+
34242
+ if (hasPointType) {
34243
+ selector += ", ." + $CIRCLE.chartCircles + " > ." + $CIRCLE.circles;
34244
+ }
34245
+
34246
+ $T(svg.selectAll(selector).filter(function (d) {
34192
34247
  return $$.isTargetToShow(d.id);
34193
34248
  })).style("opacity", null);
34194
34249
  };
@@ -34223,8 +34278,9 @@ var ChartInternal = /*#__PURE__*/function () {
34223
34278
 
34224
34279
  _proto.initialOpacity = function initialOpacity(d) {
34225
34280
  var $$ = this,
34226
- withoutFadeIn = $$.state.withoutFadeIn;
34227
- return $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0";
34281
+ withoutFadeIn = $$.state.withoutFadeIn,
34282
+ r = $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0";
34283
+ return r;
34228
34284
  };
34229
34285
 
34230
34286
  _proto.bindResize = function bindResize() {
@@ -42470,7 +42526,7 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
42470
42526
 
42471
42527
  /**
42472
42528
  * Set transform attributes to arc label text
42473
- * @param {Object} d Data object
42529
+ * @param {object} d Data object
42474
42530
  * @returns {string} Translate attribute string
42475
42531
  * @private
42476
42532
  */
@@ -43464,7 +43520,7 @@ function point_y(p) {
43464
43520
 
43465
43521
  /**
43466
43522
  * Determine if given stacking bar data is radius type
43467
- * @param {Object} d Data row
43523
+ * @param {object} d Data row
43468
43524
  * @returns {boolean}
43469
43525
  */
43470
43526
  isStackingRadiusData: function isStackingRadiusData(d) {
@@ -44323,7 +44379,7 @@ var getTransitionName = function () {
44323
44379
  targets = data.targets.filter(function (d) {
44324
44380
  return _this.isScatterType(d) || _this.isBubbleType(d);
44325
44381
  });
44326
- var mainCircle = $el.main.select("." + $CIRCLE.chartCircles).style("pointer-events", "none").selectAll("." + $CIRCLE.circles).data(targets).attr("class", classCircles);
44382
+ var mainCircle = $el.main.select("." + $CIRCLE.chartCircles).style("pointer-events", "none").selectAll("." + $CIRCLE.circles).data(targets);
44327
44383
  mainCircle.exit().remove();
44328
44384
  enterNode = mainCircle.enter();
44329
44385
  } // Circles for each data point on lines
@@ -44334,6 +44390,11 @@ var getTransitionName = function () {
44334
44390
  });
44335
44391
  enterNode.append("g").attr("class", classCircles).style("cursor", function (d) {
44336
44392
  return isFunction(isSelectable) && isSelectable(d) ? "pointer" : null;
44393
+ }).style("opacity", function () {
44394
+ var _this$parentNode;
44395
+
44396
+ // if the parent node is .bb-chart-circles (bubble, scatter), initialize <g bb-circles> with opacity "0"
44397
+ return (_this$parentNode = this.parentNode) != null && _this$parentNode.classList.contains("bb-chart-circles") ? "0" : null;
44337
44398
  }); // Update date for selected circles
44338
44399
 
44339
44400
  selectionEnabled && targets.forEach(function (t) {
@@ -48834,7 +48895,7 @@ var _defaults = {},
48834
48895
  * bb.version; // "1.0.0"
48835
48896
  * @memberof bb
48836
48897
  */
48837
- version: "3.4.0-next.2",
48898
+ version: "3.4.0",
48838
48899
 
48839
48900
  /**
48840
48901
  * Generate chart
@@ -48969,7 +49030,7 @@ var _defaults = {},
48969
49030
  };
48970
49031
  /**
48971
49032
  * @namespace bb
48972
- * @version 3.4.0-next.2
49033
+ * @version 3.4.0
48973
49034
  */
48974
49035
  ;// CONCATENATED MODULE: ./src/index.ts
48975
49036
  /**