billboard.js 3.4.0-next.1 → 3.4.0-next.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 (42) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +121 -41
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +121 -41
  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 +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.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2 -2
  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 +105 -36
  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 +2 -2
  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 +6 -6
  35. package/src/Chart/api/axis.ts +90 -25
  36. package/src/ChartInternal/ChartInternal.ts +6 -3
  37. package/src/ChartInternal/interactions/flow.ts +1 -1
  38. package/src/config/Options/common/main.ts +19 -2
  39. package/src/module/generator.ts +12 -4
  40. package/types/chart.d.ts +8 -8
  41. package/types/options.d.ts +7 -2
  42. package/types/types.d.ts +2 -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.4.0-next.1
8
+ * @version 3.4.0-next.2
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
@@ -22610,6 +22610,21 @@ var Store = /*#__PURE__*/function () {
22610
22610
  */
22611
22611
  resize_auto: !0,
22612
22612
 
22613
+ /**
22614
+ * Set a callback to execute when the chart is clicked.
22615
+ * @name onclick
22616
+ * @memberof Options
22617
+ * @type {Function}
22618
+ * @default undefined
22619
+ * @example
22620
+ * onclick: function(event) {
22621
+ * this; // chart instance itself
22622
+ * event; // native event object
22623
+ * ...
22624
+ * }
22625
+ */
22626
+ onclick: undefined,
22627
+
22613
22628
  /**
22614
22629
  * Set a callback to execute when mouse/touch enters the chart.
22615
22630
  * @name onover
@@ -22617,8 +22632,9 @@ var Store = /*#__PURE__*/function () {
22617
22632
  * @type {Function}
22618
22633
  * @default undefined
22619
22634
  * @example
22620
- * onover: function() {
22635
+ * onover: function(event) {
22621
22636
  * this; // chart instance itself
22637
+ * event; // native event object
22622
22638
  * ...
22623
22639
  * }
22624
22640
  */
@@ -22631,8 +22647,9 @@ var Store = /*#__PURE__*/function () {
22631
22647
  * @type {Function}
22632
22648
  * @default undefined
22633
22649
  * @example
22634
- * onout: function() {
22650
+ * onout: function(event) {
22635
22651
  * this; // chart instance itself
22652
+ * event; // native event object
22636
22653
  * ...
22637
22654
  * }
22638
22655
  */
@@ -24395,28 +24412,32 @@ function generateResize() {
24395
24412
 
24396
24413
  return callResizeFn;
24397
24414
  }
24415
+
24398
24416
  /**
24399
24417
  * Generate transition queue function
24400
24418
  * @returns {Function}
24401
24419
  * @private
24402
24420
  */
24403
-
24404
24421
  function generateWait() {
24405
24422
  var transitionsToWait = [],
24406
- f = function (t, callback) {
24407
- var timer; // eslint-disable-next-line
24423
+ f = function (selection, callback) {
24424
+ var timer;
24425
+ /**
24426
+ * Check if transition is complete
24427
+ * @private
24428
+ */
24408
24429
 
24409
24430
  function loop() {
24410
24431
  var done = 0;
24411
24432
 
24412
- for (var i = 0, _t; _t = transitionsToWait[i]; i++) {
24413
- if (_t === !0 || _t.empty != null && _t.empty()) {
24433
+ for (var i = 0, t; t = transitionsToWait[i]; i++) {
24434
+ if (t === !0 || t.empty != null && t.empty()) {
24414
24435
  done++;
24415
24436
  continue;
24416
24437
  }
24417
24438
 
24418
24439
  try {
24419
- _t.transition();
24440
+ t.transition();
24420
24441
  } catch (e) {
24421
24442
  done++;
24422
24443
  }
@@ -24432,7 +24453,8 @@ function generateWait() {
24432
24453
  }
24433
24454
 
24434
24455
  loop();
24435
- };
24456
+ }; // 'f' is called as selection.call(f, ...);
24457
+
24436
24458
 
24437
24459
  f.add = function (t) {
24438
24460
  isArray(t) ? transitionsToWait = transitionsToWait.concat(t) : transitionsToWait.push(t);
@@ -33783,10 +33805,9 @@ var ChartInternal = /*#__PURE__*/function () {
33783
33805
 
33784
33806
  _proto.initParams = function initParams() {
33785
33807
  var $$ = this,
33786
- _ref = $$,
33787
- config = _ref.config,
33788
- format = _ref.format,
33789
- state = _ref.state,
33808
+ config = $$.config,
33809
+ format = $$.format,
33810
+ state = $$.state,
33790
33811
  isRotated = config.axis_rotated;
33791
33812
  // datetime to be used for uniqueness
33792
33813
  state.datetimeId = "bb-" + +new Date() * getRandom();
@@ -33890,12 +33911,16 @@ var ChartInternal = /*#__PURE__*/function () {
33890
33911
  $el.svg = $el.chart.append("svg").style("overflow", "hidden").style("display", "block");
33891
33912
 
33892
33913
  if (hasInteraction && state.inputType) {
33893
- var isTouch = state.inputType === "touch";
33894
- $el.svg.on(isTouch ? "touchstart" : "mouseenter", function () {
33895
- return callFn(config.onover, $$.api);
33896
- }).on(isTouch ? "touchend" : "mouseleave", function () {
33897
- return callFn(config.onout, $$.api);
33898
- });
33914
+ var _onclick,
33915
+ _onover,
33916
+ _onout,
33917
+ isTouch = state.inputType === "touch",
33918
+ _config = config,
33919
+ onclick = _config.onclick,
33920
+ onover = _config.onover,
33921
+ onout = _config.onout;
33922
+
33923
+ $el.svg.on("click", ((_onclick = onclick) == null ? void 0 : _onclick.bind($$.api)) || null).on(isTouch ? "touchstart" : "mouseenter", ((_onover = onover) == null ? void 0 : _onover.bind($$.api)) || null).on(isTouch ? "touchend" : "mouseleave", ((_onout = onout) == null ? void 0 : _onout.bind($$.api)) || null);
33899
33924
  }
33900
33925
 
33901
33926
  config.svg_classname && $el.svg.attr("class", config.svg_classname); // Define defs
@@ -35647,6 +35672,7 @@ util_extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus,
35647
35672
  * billboard.js project is licensed under the MIT license
35648
35673
  */
35649
35674
 
35675
+
35650
35676
  /**
35651
35677
  * Set the min/max value
35652
35678
  * @param {Chart} $$ Chart instance
@@ -35654,20 +35680,26 @@ util_extend(Chart.prototype, [chart, api_color, api_data, api_export, api_focus,
35654
35680
  * @param {object} value Value to be set
35655
35681
  * @private
35656
35682
  */
35657
-
35658
35683
  function setMinMax($$, type, value) {
35659
35684
  var config = $$.config,
35660
- axisY = "axis_y_" + type,
35661
- axisY2 = "axis_y2_" + type;
35685
+ helper = function (key, value) {
35686
+ var v = isNumber(value) ? value : value === !1 ? undefined : null;
35687
+
35688
+ if (v !== null) {
35689
+ config["axis_" + key + "_" + type] = v;
35690
+ }
35691
+ };
35662
35692
 
35663
35693
  if (isDefined(value)) {
35664
35694
  if (isObjectType(value)) {
35665
- isValue(value.x) && (config["axis_x_" + type] = value.x);
35666
- isValue(value.y) && (config[axisY] = value.y);
35667
- isValue(value.y2) && (config[axisY2] = value.y2);
35668
- } else {
35669
- config[axisY] = value;
35670
- config[axisY2] = value;
35695
+ Object.keys(value).forEach(function (key) {
35696
+ helper(key, value[key]);
35697
+ });
35698
+ } else if (isNumber(value) || value === !1) {
35699
+ // shorthand values affects only y and y2.
35700
+ ["y", "y2"].forEach(function (key) {
35701
+ helper(key, value);
35702
+ });
35671
35703
  }
35672
35704
 
35673
35705
  $$.redraw({
@@ -35753,8 +35785,9 @@ var axis = {
35753
35785
  * @instance
35754
35786
  * @memberof Chart
35755
35787
  * @param {object} min If min is given, specified axis' min value will be updated.<br>
35756
- * If no argument is given, the min values set on generating option for each axis will be returned.
35757
- * If not set any min values on generation, it will return `undefined`.
35788
+ * If no argument is given, the min values set on generating option for each axis will be returned.
35789
+ * If not set any min values on generation, it will return `undefined`.<br>
35790
+ * To unset specific axis max, set `false` to each of them.
35758
35791
  * @returns {object|undefined}
35759
35792
  * @example
35760
35793
  * // Update axis' min
@@ -35763,10 +35796,21 @@ var axis = {
35763
35796
  * y: 1000,
35764
35797
  * y2: 100
35765
35798
  * });
35799
+ *
35800
+ * // To unset specific axis min, set false to each of them.
35801
+ * chart.axis.min({
35802
+ * x: false,
35803
+ * y: false,
35804
+ * y2: false
35805
+ * });
35806
+ *
35807
+ * // shorthand (only affects y and y2 axis)
35808
+ * chart.axis.min(-50);
35809
+ * chart.axis.min(false);
35766
35810
  */
35767
35811
  min: function min(_min) {
35768
35812
  var $$ = this.internal;
35769
- return isValue(_min) ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
35813
+ return isValue(_min) || _min === !1 ? setMinMax($$, "min", _min) : axis_getMinMax($$, "min");
35770
35814
  },
35771
35815
 
35772
35816
  /**
@@ -35775,8 +35819,9 @@ var axis = {
35775
35819
  * @instance
35776
35820
  * @memberof Chart
35777
35821
  * @param {object} max If max is given, specified axis' max value will be updated.<br>
35778
- * If no argument is given, the max values set on generating option for each axis will be returned.
35779
- * If not set any max values on generation, it will return `undefined`.
35822
+ * If no argument is given, the max values set on generating option for each axis will be returned.
35823
+ * If not set any max values on generation, it will return `undefined`.<br>
35824
+ * To unset specific axis max, set `false` to each of them.
35780
35825
  * @returns {object|undefined}
35781
35826
  * @example
35782
35827
  * // Update axis' label
@@ -35785,10 +35830,21 @@ var axis = {
35785
35830
  * y: 1000,
35786
35831
  * y2: 10000
35787
35832
  * });
35833
+ *
35834
+ * // To unset specific axis max, set false to each of them.
35835
+ * chart.axis.max({
35836
+ * x: false,
35837
+ * y: false,
35838
+ * y2: false
35839
+ * });
35840
+ *
35841
+ * // shorthand (only affects y and y2 axis)
35842
+ * chart.axis.max(10);
35843
+ * chart.axis.max(false);
35788
35844
  */
35789
35845
  max: function max(_max) {
35790
35846
  var $$ = this.internal;
35791
- return arguments.length ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max");
35847
+ return isValue(_max) || _max === !1 ? setMinMax($$, "max", _max) : axis_getMinMax($$, "max");
35792
35848
  },
35793
35849
 
35794
35850
  /**
@@ -35796,7 +35852,9 @@ var axis = {
35796
35852
  * @function axis․range
35797
35853
  * @instance
35798
35854
  * @memberof Chart
35799
- * @param {object} range If range is given, specified axis' min and max value will be updated. If no argument is given, the current min and max values for each axis will be returned.
35855
+ * @param {object} range If range is given, specified axis' min and max value will be updated.
35856
+ * If no argument is given, the current min and max values for each axis will be returned.<br>
35857
+ * To unset specific axis max, set `false` to each of them.
35800
35858
  * @returns {object|undefined}
35801
35859
  * @example
35802
35860
  * // Update axis' label
@@ -35812,13 +35870,33 @@ var axis = {
35812
35870
  * y2: 10000
35813
35871
  * },
35814
35872
  * });
35873
+ *
35874
+ * // To unset specific axis max, set false to each of them.
35875
+ * chart.axis.range({
35876
+ * min: {
35877
+ * x: false,
35878
+ * y: false,
35879
+ * y2: false
35880
+ * },
35881
+ * max: {
35882
+ * x: false,
35883
+ * y: false,
35884
+ * y2: false
35885
+ * },
35886
+ * });
35887
+ *
35888
+ * // shorthand (only affects y and y2 axis)
35889
+ * chart.axis.range({ min: -50, max: 1000 });
35890
+ * chart.axis.range({ min: false, max: false });
35815
35891
  */
35816
35892
  range: function range(_range) {
35817
35893
  var axis = this.axis;
35818
35894
 
35819
35895
  if (arguments.length) {
35820
- isDefined(_range.max) && axis.max(_range.max);
35821
- isDefined(_range.min) && axis.min(_range.min);
35896
+ var min = _range.min,
35897
+ max = _range.max;
35898
+ isDefined(max) && axis.max(max);
35899
+ isDefined(min) && axis.min(min);
35822
35900
  } else {
35823
35901
  return {
35824
35902
  max: axis.max(),
@@ -38945,7 +39023,9 @@ var src_linear_linear = function (t) {
38945
39023
  } else if (orgDataCount === 1 || ((_flowStart = flowStart) == null ? void 0 : _flowStart.x) === ((_flowEnd = flowEnd) == null ? void 0 : _flowEnd.x)) {
38946
39024
  translateX = x(orgDomain[0]) - x(domain[0]);
38947
39025
  } else {
38948
- translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(flowStart.x) - x(flowEnd.x);
39026
+ var _flowStart2;
39027
+
39028
+ translateX = $$.axis.isTimeSeries() ? x(orgDomain[0]) - x(domain[0]) : x(((_flowStart2 = flowStart) == null ? void 0 : _flowStart2.x) || 0) - x(flowEnd.x);
38949
39029
  }
38950
39030
 
38951
39031
  var scaleX = diffDomain(orgDomain) / diffDomain(domain);
@@ -48754,7 +48834,7 @@ var _defaults = {},
48754
48834
  * bb.version; // "1.0.0"
48755
48835
  * @memberof bb
48756
48836
  */
48757
- version: "3.4.0-next.1",
48837
+ version: "3.4.0-next.2",
48758
48838
 
48759
48839
  /**
48760
48840
  * Generate chart
@@ -48889,7 +48969,7 @@ var _defaults = {},
48889
48969
  };
48890
48970
  /**
48891
48971
  * @namespace bb
48892
- * @version 3.4.0-next.1
48972
+ * @version 3.4.0-next.2
48893
48973
  */
48894
48974
  ;// CONCATENATED MODULE: ./src/index.ts
48895
48975
  /**