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
  import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
11
11
  import { pointer, select, namespaces, selectAll } from 'd3-selection';
@@ -1371,6 +1371,20 @@ var main = {
1371
1371
  * }
1372
1372
  */
1373
1373
  resize_auto: true,
1374
+ /**
1375
+ * Set a callback to execute when the chart is clicked.
1376
+ * @name onclick
1377
+ * @memberof Options
1378
+ * @type {Function}
1379
+ * @default undefined
1380
+ * @example
1381
+ * onclick: function(event) {
1382
+ * this; // chart instance itself
1383
+ * event; // native event object
1384
+ * ...
1385
+ * }
1386
+ */
1387
+ onclick: undefined,
1374
1388
  /**
1375
1389
  * Set a callback to execute when mouse/touch enters the chart.
1376
1390
  * @name onover
@@ -1378,8 +1392,9 @@ var main = {
1378
1392
  * @type {Function}
1379
1393
  * @default undefined
1380
1394
  * @example
1381
- * onover: function() {
1395
+ * onover: function(event) {
1382
1396
  * this; // chart instance itself
1397
+ * event; // native event object
1383
1398
  * ...
1384
1399
  * }
1385
1400
  */
@@ -1391,8 +1406,9 @@ var main = {
1391
1406
  * @type {Function}
1392
1407
  * @default undefined
1393
1408
  * @example
1394
- * onout: function() {
1409
+ * onout: function(event) {
1395
1410
  * this; // chart instance itself
1411
+ * event; // native event object
1396
1412
  * ...
1397
1413
  * }
1398
1414
  */
@@ -3003,10 +3019,6 @@ var Cache = /** @class */ (function () {
3003
3019
  return Cache;
3004
3020
  }());
3005
3021
 
3006
- /**
3007
- * Copyright (c) 2017 ~ present NAVER Corp.
3008
- * billboard.js project is licensed under the MIT license
3009
- */
3010
3022
  var setTimeout$1 = win.setTimeout, clearTimeout$1 = win.clearTimeout;
3011
3023
  /**
3012
3024
  * Generate resize queue function
@@ -3040,19 +3052,23 @@ function generateResize() {
3040
3052
  */
3041
3053
  function generateWait() {
3042
3054
  var transitionsToWait = [];
3043
- var f = function (t, callback) {
3055
+ // 'f' is called as selection.call(f, ...);
3056
+ var f = function (selection, callback) {
3044
3057
  var timer;
3045
- // eslint-disable-next-line
3058
+ /**
3059
+ * Check if transition is complete
3060
+ * @private
3061
+ */
3046
3062
  function loop() {
3047
3063
  var _a;
3048
3064
  var done = 0;
3049
- for (var i = 0, t_1; (t_1 = transitionsToWait[i]); i++) {
3050
- if (t_1 === true || ((_a = t_1.empty) === null || _a === void 0 ? void 0 : _a.call(t_1))) {
3065
+ for (var i = 0, t = void 0; (t = transitionsToWait[i]); i++) {
3066
+ if (t === true || ((_a = t.empty) === null || _a === void 0 ? void 0 : _a.call(t))) {
3051
3067
  done++;
3052
3068
  continue;
3053
3069
  }
3054
3070
  try {
3055
- t_1.transition();
3071
+ t.transition();
3056
3072
  }
3057
3073
  catch (e) {
3058
3074
  done++;
@@ -8346,7 +8362,7 @@ var ChartInternal = /** @class */ (function () {
8346
8362
  };
8347
8363
  ChartInternal.prototype.initParams = function () {
8348
8364
  var $$ = this;
8349
- var _a = $$, config = _a.config, format = _a.format, state = _a.state;
8365
+ var config = $$.config, format = $$.format, state = $$.state;
8350
8366
  var isRotated = config.axis_rotated;
8351
8367
  // datetime to be used for uniqueness
8352
8368
  state.datetimeId = "bb-".concat(+new Date() * getRandom());
@@ -8439,8 +8455,11 @@ var ChartInternal = /** @class */ (function () {
8439
8455
  .style("display", "block");
8440
8456
  if (hasInteraction && state.inputType) {
8441
8457
  var isTouch = state.inputType === "touch";
8442
- $el.svg.on(isTouch ? "touchstart" : "mouseenter", function () { return callFn(config.onover, $$.api); })
8443
- .on(isTouch ? "touchend" : "mouseleave", function () { return callFn(config.onout, $$.api); });
8458
+ var onclick_1 = config.onclick, onover = config.onover, onout = config.onout;
8459
+ $el.svg
8460
+ .on("click", (onclick_1 === null || onclick_1 === void 0 ? void 0 : onclick_1.bind($$.api)) || null)
8461
+ .on(isTouch ? "touchstart" : "mouseenter", (onover === null || onover === void 0 ? void 0 : onover.bind($$.api)) || null)
8462
+ .on(isTouch ? "touchend" : "mouseleave", (onout === null || onout === void 0 ? void 0 : onout.bind($$.api)) || null);
8444
8463
  }
8445
8464
  config.svg_classname && $el.svg.attr("class", config.svg_classname);
8446
8465
  // Define defs
@@ -10008,18 +10027,23 @@ extend(Chart.prototype, [
10008
10027
  */
10009
10028
  function setMinMax($$, type, value) {
10010
10029
  var config = $$.config;
10011
- var axisX = "axis_x_".concat(type);
10012
- var axisY = "axis_y_".concat(type);
10013
- var axisY2 = "axis_y2_".concat(type);
10030
+ var helper = function (key, value) {
10031
+ var v = isNumber(value) ? value : (value === false ? undefined : null);
10032
+ if (v !== null) {
10033
+ config["axis_".concat(key, "_").concat(type)] = v;
10034
+ }
10035
+ };
10014
10036
  if (isDefined(value)) {
10015
10037
  if (isObjectType(value)) {
10016
- isValue(value.x) && (config[axisX] = value.x);
10017
- isValue(value.y) && (config[axisY] = value.y);
10018
- isValue(value.y2) && (config[axisY2] = value.y2);
10038
+ Object.keys(value).forEach(function (key) {
10039
+ helper(key, value[key]);
10040
+ });
10019
10041
  }
10020
- else {
10021
- config[axisY] = value;
10022
- config[axisY2] = value;
10042
+ else if (isNumber(value) || value === false) {
10043
+ // shorthand values affects only y and y2.
10044
+ ["y", "y2"].forEach(function (key) {
10045
+ helper(key, value);
10046
+ });
10023
10047
  }
10024
10048
  $$.redraw({
10025
10049
  withUpdateOrgXDomain: true,
@@ -10096,8 +10120,9 @@ var axis$1 = {
10096
10120
  * @instance
10097
10121
  * @memberof Chart
10098
10122
  * @param {object} min If min is given, specified axis' min value will be updated.<br>
10099
- * If no argument is given, the min values set on generating option for each axis will be returned.
10100
- * If not set any min values on generation, it will return `undefined`.
10123
+ * If no argument is given, the min values set on generating option for each axis will be returned.
10124
+ * If not set any min values on generation, it will return `undefined`.<br>
10125
+ * To unset specific axis max, set `false` to each of them.
10101
10126
  * @returns {object|undefined}
10102
10127
  * @example
10103
10128
  * // Update axis' min
@@ -10106,10 +10131,21 @@ var axis$1 = {
10106
10131
  * y: 1000,
10107
10132
  * y2: 100
10108
10133
  * });
10134
+ *
10135
+ * // To unset specific axis min, set false to each of them.
10136
+ * chart.axis.min({
10137
+ * x: false,
10138
+ * y: false,
10139
+ * y2: false
10140
+ * });
10141
+ *
10142
+ * // shorthand (only affects y and y2 axis)
10143
+ * chart.axis.min(-50);
10144
+ * chart.axis.min(false);
10109
10145
  */
10110
10146
  min: function (min) {
10111
10147
  var $$ = this.internal;
10112
- return isValue(min) ?
10148
+ return isValue(min) || min === false ?
10113
10149
  setMinMax($$, "min", min) :
10114
10150
  getMinMax($$, "min");
10115
10151
  },
@@ -10119,8 +10155,9 @@ var axis$1 = {
10119
10155
  * @instance
10120
10156
  * @memberof Chart
10121
10157
  * @param {object} max If max is given, specified axis' max value will be updated.<br>
10122
- * If no argument is given, the max values set on generating option for each axis will be returned.
10123
- * If not set any max values on generation, it will return `undefined`.
10158
+ * If no argument is given, the max values set on generating option for each axis will be returned.
10159
+ * If not set any max values on generation, it will return `undefined`.<br>
10160
+ * To unset specific axis max, set `false` to each of them.
10124
10161
  * @returns {object|undefined}
10125
10162
  * @example
10126
10163
  * // Update axis' label
@@ -10129,10 +10166,21 @@ var axis$1 = {
10129
10166
  * y: 1000,
10130
10167
  * y2: 10000
10131
10168
  * });
10169
+ *
10170
+ * // To unset specific axis max, set false to each of them.
10171
+ * chart.axis.max({
10172
+ * x: false,
10173
+ * y: false,
10174
+ * y2: false
10175
+ * });
10176
+ *
10177
+ * // shorthand (only affects y and y2 axis)
10178
+ * chart.axis.max(10);
10179
+ * chart.axis.max(false);
10132
10180
  */
10133
10181
  max: function (max) {
10134
10182
  var $$ = this.internal;
10135
- return arguments.length ?
10183
+ return isValue(max) || max === false ?
10136
10184
  setMinMax($$, "max", max) :
10137
10185
  getMinMax($$, "max");
10138
10186
  },
@@ -10141,7 +10189,9 @@ var axis$1 = {
10141
10189
  * @function axis․range
10142
10190
  * @instance
10143
10191
  * @memberof Chart
10144
- * @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.
10192
+ * @param {object} range If range is given, specified axis' min and max value will be updated.
10193
+ * If no argument is given, the current min and max values for each axis will be returned.<br>
10194
+ * To unset specific axis max, set `false` to each of them.
10145
10195
  * @returns {object|undefined}
10146
10196
  * @example
10147
10197
  * // Update axis' label
@@ -10157,12 +10207,31 @@ var axis$1 = {
10157
10207
  * y2: 10000
10158
10208
  * },
10159
10209
  * });
10210
+ *
10211
+ * // To unset specific axis max, set false to each of them.
10212
+ * chart.axis.range({
10213
+ * min: {
10214
+ * x: false,
10215
+ * y: false,
10216
+ * y2: false
10217
+ * },
10218
+ * max: {
10219
+ * x: false,
10220
+ * y: false,
10221
+ * y2: false
10222
+ * },
10223
+ * });
10224
+ *
10225
+ * // shorthand (only affects y and y2 axis)
10226
+ * chart.axis.range({ min: -50, max: 1000 });
10227
+ * chart.axis.range({ min: false, max: false });
10160
10228
  */
10161
10229
  range: function (range) {
10162
10230
  var axis = this.axis;
10163
10231
  if (arguments.length) {
10164
- isDefined(range.max) && axis.max(range.max);
10165
- isDefined(range.min) && axis.min(range.min);
10232
+ var min = range.min, max = range.max;
10233
+ isDefined(max) && axis.max(max);
10234
+ isDefined(min) && axis.min(min);
10166
10235
  }
10167
10236
  else {
10168
10237
  return {
@@ -12774,7 +12843,7 @@ var flow = {
12774
12843
  else {
12775
12844
  translateX = $$.axis.isTimeSeries() ?
12776
12845
  x(orgDomain[0]) - x(domain[0]) :
12777
- x(flowStart.x) - x(flowEnd.x);
12846
+ x((flowStart === null || flowStart === void 0 ? void 0 : flowStart.x) || 0) - x(flowEnd.x);
12778
12847
  }
12779
12848
  var scaleX = (diffDomain(orgDomain) / diffDomain(domain));
12780
12849
  return "translate(".concat(translateX, ",0) scale(").concat(scaleX, ",1)");
@@ -20648,7 +20717,7 @@ var zoomModule = function () {
20648
20717
  var defaults = {};
20649
20718
  /**
20650
20719
  * @namespace bb
20651
- * @version 3.4.0-next.1
20720
+ * @version 3.4.0-next.2
20652
20721
  */
20653
20722
  var bb = {
20654
20723
  /**
@@ -20658,7 +20727,7 @@ var bb = {
20658
20727
  * bb.version; // "1.0.0"
20659
20728
  * @memberof bb
20660
20729
  */
20661
- version: "3.4.0-next.1",
20730
+ version: "3.4.0-next.2",
20662
20731
  /**
20663
20732
  * Generate chart
20664
20733
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -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
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -142,7 +142,7 @@ var Plugin = /*#__PURE__*/function () {
142
142
  return Plugin;
143
143
  }();
144
144
 
145
- Plugin.version = "#3.4.0-next.1#";
145
+ Plugin.version = "#3.4.0-next.2#";
146
146
 
147
147
  /**
148
148
  * Bubble compare diagram plugin.<br>
@@ -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
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -317,7 +317,7 @@ var Plugin = /*#__PURE__*/function () {
317
317
  return Plugin;
318
318
  }();
319
319
 
320
- Plugin.version = "#3.4.0-next.1#";
320
+ Plugin.version = "#3.4.0-next.2#";
321
321
 
322
322
  /**
323
323
  * Copyright (c) 2021 ~ present NAVER Corp.
@@ -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
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -517,7 +517,7 @@ var Plugin = /*#__PURE__*/function () {
517
517
  return Plugin;
518
518
  }();
519
519
 
520
- Plugin.version = "#3.4.0-next.1#";
520
+ Plugin.version = "#3.4.0-next.2#";
521
521
 
522
522
  /**
523
523
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -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
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -165,7 +165,7 @@ var Plugin = /*#__PURE__*/function () {
165
165
  return Plugin;
166
166
  }();
167
167
 
168
- Plugin.version = "#3.4.0-next.1#";
168
+ Plugin.version = "#3.4.0-next.2#";
169
169
 
170
170
  /**
171
171
  * Copyright (c) 2021 ~ present NAVER Corp.
@@ -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
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -296,7 +296,7 @@ var Plugin = /*#__PURE__*/function () {
296
296
  return Plugin;
297
297
  }();
298
298
 
299
- Plugin.version = "#3.4.0-next.1#";
299
+ Plugin.version = "#3.4.0-next.2#";
300
300
 
301
301
  /**
302
302
  * Copyright (c) 2017 ~ present NAVER Corp.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.4.0-next.1",
3
+ "version": "3.4.0-next.2",
4
4
  "description": "Re-usable easy interface JavaScript chart library, based on D3 v4+",
5
5
  "homepage": "https://naver.github.io/billboard.js/",
6
6
  "main": "dist/billboard.js",
@@ -95,14 +95,14 @@
95
95
  "d3-zoom": "^3.0.0"
96
96
  },
97
97
  "devDependencies": {
98
- "@babel/core": "^7.17.7",
98
+ "@babel/core": "^7.17.8",
99
99
  "@babel/eslint-parser": "^7.17.0",
100
100
  "@babel/plugin-proposal-class-properties": "^7.16.7",
101
101
  "@babel/plugin-proposal-object-rest-spread": "^7.17.3",
102
102
  "@babel/plugin-transform-runtime": "^7.17.0",
103
103
  "@babel/preset-env": "^7.16.8",
104
104
  "@babel/preset-typescript": "^7.16.7",
105
- "@babel/runtime": "^7.17.7",
105
+ "@babel/runtime": "^7.17.8",
106
106
  "@commitlint/cli": "^15.0.0",
107
107
  "@commitlint/config-conventional": "^16.2.1",
108
108
  "@rollup/plugin-babel": "^5.3.1",
@@ -119,8 +119,8 @@
119
119
  "@types/d3": "^7.1.0",
120
120
  "@types/mocha": "^9.0.0",
121
121
  "@types/sinon": "^10.0.11",
122
- "@typescript-eslint/eslint-plugin": "^5.15.0",
123
- "@typescript-eslint/parser": "^5.15.0",
122
+ "@typescript-eslint/eslint-plugin": "^5.16.0",
123
+ "@typescript-eslint/parser": "^5.16.0",
124
124
  "babel-helper-modules": "^6.0.0",
125
125
  "babel-loader": "^8.2.3",
126
126
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -150,7 +150,7 @@
150
150
  "eslint": "^8.11.0",
151
151
  "eslint-config-naver": "^2.1.0",
152
152
  "eslint-plugin-import": "^2.25.4",
153
- "eslint-plugin-jsdoc": "^38.0.4",
153
+ "eslint-plugin-jsdoc": "^38.0.6",
154
154
  "eslint-webpack-plugin": "^3.1.1",
155
155
  "exports-loader": "^3.1.0",
156
156
  "hammer-simulator": "0.0.1",
@@ -2,7 +2,18 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {isValue, isDefined, isObjectType} from "../../module/util";
5
+ import {isValue, isDefined, isObjectType, isNumber} from "../../module/util";
6
+
7
+ type AxisOption = {
8
+ x?: number | false;
9
+ y?: number | false;
10
+ y2?: number | false;
11
+ } | number | false;
12
+
13
+ type RangeAxisOption = {
14
+ min? : AxisOption;
15
+ max?: AxisOption;
16
+ };
6
17
 
7
18
  /**
8
19
  * Set the min/max value
@@ -11,20 +22,28 @@ import {isValue, isDefined, isObjectType} from "../../module/util";
11
22
  * @param {object} value Value to be set
12
23
  * @private
13
24
  */
14
- function setMinMax($$, type: "min" | "max", value): void {
25
+ function setMinMax($$, type: "min" | "max", value: AxisOption): void {
15
26
  const {config} = $$;
16
- const axisX = `axis_x_${type}`;
17
- const axisY = `axis_y_${type}`;
18
- const axisY2 = `axis_y2_${type}`;
27
+ const helper = (key, value) => {
28
+ const v = isNumber(value) ? value : (
29
+ value === false ? undefined : null
30
+ );
31
+
32
+ if (v !== null) {
33
+ config[`axis_${key}_${type}`] = v;
34
+ }
35
+ };
19
36
 
20
37
  if (isDefined(value)) {
21
38
  if (isObjectType(value)) {
22
- isValue(value.x) && (config[axisX] = value.x);
23
- isValue(value.y) && (config[axisY] = value.y);
24
- isValue(value.y2) && (config[axisY2] = value.y2);
25
- } else {
26
- config[axisY] = value;
27
- config[axisY2] = value;
39
+ Object.keys(value).forEach(key => {
40
+ helper(key, value[key]);
41
+ });
42
+ } else if (isNumber(value) || value === false) {
43
+ // shorthand values affects only y and y2.
44
+ ["y", "y2"].forEach(key => {
45
+ helper(key, value);
46
+ });
28
47
  }
29
48
 
30
49
  $$.redraw({
@@ -111,8 +130,9 @@ const axis = {
111
130
  * @instance
112
131
  * @memberof Chart
113
132
  * @param {object} min If min is given, specified axis' min value will be updated.<br>
114
- * If no argument is given, the min values set on generating option for each axis will be returned.
115
- * If not set any min values on generation, it will return `undefined`.
133
+ * If no argument is given, the min values set on generating option for each axis will be returned.
134
+ * If not set any min values on generation, it will return `undefined`.<br>
135
+ * To unset specific axis max, set `false` to each of them.
116
136
  * @returns {object|undefined}
117
137
  * @example
118
138
  * // Update axis' min
@@ -121,12 +141,23 @@ const axis = {
121
141
  * y: 1000,
122
142
  * y2: 100
123
143
  * });
144
+ *
145
+ * // To unset specific axis min, set false to each of them.
146
+ * chart.axis.min({
147
+ * x: false,
148
+ * y: false,
149
+ * y2: false
150
+ * });
151
+ *
152
+ * // shorthand (only affects y and y2 axis)
153
+ * chart.axis.min(-50);
154
+ * chart.axis.min(false);
124
155
  */
125
- min: function(min?: number): object|void {
156
+ min: function(min?: AxisOption): object|void {
126
157
  const $$ = this.internal;
127
158
 
128
- return isValue(min) ?
129
- setMinMax($$, "min", min) :
159
+ return isValue(min) || min === false ?
160
+ setMinMax($$, "min", min as AxisOption) :
130
161
  getMinMax($$, "min");
131
162
  },
132
163
 
@@ -136,8 +167,9 @@ const axis = {
136
167
  * @instance
137
168
  * @memberof Chart
138
169
  * @param {object} max If max is given, specified axis' max value will be updated.<br>
139
- * If no argument is given, the max values set on generating option for each axis will be returned.
140
- * If not set any max values on generation, it will return `undefined`.
170
+ * If no argument is given, the max values set on generating option for each axis will be returned.
171
+ * If not set any max values on generation, it will return `undefined`.<br>
172
+ * To unset specific axis max, set `false` to each of them.
141
173
  * @returns {object|undefined}
142
174
  * @example
143
175
  * // Update axis' label
@@ -146,12 +178,23 @@ const axis = {
146
178
  * y: 1000,
147
179
  * y2: 10000
148
180
  * });
181
+ *
182
+ * // To unset specific axis max, set false to each of them.
183
+ * chart.axis.max({
184
+ * x: false,
185
+ * y: false,
186
+ * y2: false
187
+ * });
188
+ *
189
+ * // shorthand (only affects y and y2 axis)
190
+ * chart.axis.max(10);
191
+ * chart.axis.max(false);
149
192
  */
150
- max: function(max?: number): object|void {
193
+ max: function(max?: AxisOption): object|void {
151
194
  const $$ = this.internal;
152
195
 
153
- return arguments.length ?
154
- setMinMax($$, "max", max) :
196
+ return isValue(max) || max === false ?
197
+ setMinMax($$, "max", max as AxisOption) :
155
198
  getMinMax($$, "max");
156
199
  },
157
200
 
@@ -160,7 +203,9 @@ const axis = {
160
203
  * @function axis․range
161
204
  * @instance
162
205
  * @memberof Chart
163
- * @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.
206
+ * @param {object} range If range is given, specified axis' min and max value will be updated.
207
+ * If no argument is given, the current min and max values for each axis will be returned.<br>
208
+ * To unset specific axis max, set `false` to each of them.
164
209
  * @returns {object|undefined}
165
210
  * @example
166
211
  * // Update axis' label
@@ -176,13 +221,33 @@ const axis = {
176
221
  * y2: 10000
177
222
  * },
178
223
  * });
224
+ *
225
+ * // To unset specific axis max, set false to each of them.
226
+ * chart.axis.range({
227
+ * min: {
228
+ * x: false,
229
+ * y: false,
230
+ * y2: false
231
+ * },
232
+ * max: {
233
+ * x: false,
234
+ * y: false,
235
+ * y2: false
236
+ * },
237
+ * });
238
+ *
239
+ * // shorthand (only affects y and y2 axis)
240
+ * chart.axis.range({ min: -50, max: 1000 });
241
+ * chart.axis.range({ min: false, max: false });
179
242
  */
180
- range: function(range): object|void {
243
+ range: function(range: RangeAxisOption): object|void {
181
244
  const {axis} = this;
182
245
 
183
246
  if (arguments.length) {
184
- isDefined(range.max) && axis.max(range.max);
185
- isDefined(range.min) && axis.min(range.min);
247
+ const {min, max} = range;
248
+
249
+ isDefined(max) && axis.max(max);
250
+ isDefined(min) && axis.min(min);
186
251
  } else {
187
252
  return {
188
253
  max: axis.max(),
@@ -251,7 +251,7 @@ export default class ChartInternal {
251
251
 
252
252
  initParams(): void {
253
253
  const $$ = <any> this;
254
- const {config, format, state} = <any> $$;
254
+ const {config, format, state} = $$;
255
255
  const isRotated = config.axis_rotated;
256
256
 
257
257
  // datetime to be used for uniqueness
@@ -378,9 +378,12 @@ export default class ChartInternal {
378
378
 
379
379
  if (hasInteraction && state.inputType) {
380
380
  const isTouch = state.inputType === "touch";
381
+ const {onclick, onover, onout} = config;
381
382
 
382
- $el.svg.on(isTouch ? "touchstart" : "mouseenter", () => callFn(config.onover, $$.api))
383
- .on(isTouch ? "touchend" : "mouseleave", () => callFn(config.onout, $$.api));
383
+ $el.svg
384
+ .on("click", onclick?.bind($$.api) || null)
385
+ .on(isTouch ? "touchstart" : "mouseenter", onover?.bind($$.api) || null)
386
+ .on(isTouch ? "touchend" : "mouseleave", onout?.bind($$.api) || null);
384
387
  }
385
388
 
386
389
  config.svg_classname && $el.svg.attr("class", config.svg_classname);
@@ -230,7 +230,7 @@ export default {
230
230
  } else {
231
231
  translateX = $$.axis.isTimeSeries() ?
232
232
  x(orgDomain[0]) - x(domain[0]) :
233
- x(flowStart.x) - x(flowEnd.x);
233
+ x(flowStart?.x || 0) - x(flowEnd.x);
234
234
  }
235
235
 
236
236
  const scaleX = (diffDomain(orgDomain) / diffDomain(domain));