billboard.js 3.3.3 → 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 (69) hide show
  1. package/dist/billboard.css +19 -14
  2. package/dist/billboard.js +504 -112
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +550 -126
  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 +34 -18
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +34 -18
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +29 -15
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +29 -15
  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 +80 -32
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +80 -32
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +75 -29
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +75 -29
  22. package/dist/theme/datalab.css +24 -20
  23. package/dist/theme/datalab.min.css +2 -2
  24. package/dist/theme/graph.css +24 -20
  25. package/dist/theme/graph.min.css +2 -2
  26. package/dist/theme/insight.css +24 -20
  27. package/dist/theme/insight.min.css +2 -2
  28. package/dist-esm/billboard.js +446 -99
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -5
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +8 -7
  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 +21 -21
  35. package/src/Chart/api/axis.ts +90 -25
  36. package/src/Chart/api/focus.ts +3 -2
  37. package/src/ChartInternal/Axis/Axis.ts +8 -6
  38. package/src/ChartInternal/ChartInternal.ts +48 -23
  39. package/src/ChartInternal/data/data.ts +1 -1
  40. package/src/ChartInternal/interactions/flow.ts +1 -1
  41. package/src/ChartInternal/internals/color.ts +4 -3
  42. package/src/ChartInternal/internals/format.ts +5 -1
  43. package/src/ChartInternal/internals/redraw.ts +3 -0
  44. package/src/ChartInternal/internals/text.ts +1 -1
  45. package/src/ChartInternal/internals/transform.ts +4 -1
  46. package/src/ChartInternal/internals/type.ts +5 -0
  47. package/src/ChartInternal/shape/arc.ts +41 -17
  48. package/src/ChartInternal/shape/bar.ts +1 -1
  49. package/src/ChartInternal/shape/point.ts +6 -3
  50. package/src/ChartInternal/shape/polar.ts +132 -0
  51. package/src/ChartInternal/shape/radar.ts +4 -4
  52. package/src/config/Options/common/main.ts +19 -2
  53. package/src/config/Options/data/data.ts +3 -0
  54. package/src/config/Options/shape/polar.ts +81 -0
  55. package/src/config/classes.ts +6 -3
  56. package/src/config/const.ts +3 -0
  57. package/src/config/resolver/shape.ts +4 -0
  58. package/src/core.ts +1 -0
  59. package/src/index.esm.ts +1 -0
  60. package/src/module/generator.ts +19 -5
  61. package/src/module/util.ts +22 -9
  62. package/src/scss/billboard.scss +13 -0
  63. package/src/scss/theme/datalab.scss +13 -0
  64. package/src/scss/theme/graph.scss +13 -0
  65. package/src/scss/theme/insight.scss +13 -0
  66. package/types/bb.d.ts +1 -0
  67. package/types/chart.d.ts +8 -8
  68. package/types/options.d.ts +79 -2
  69. 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.3.3
8
+ * @version 3.4.0
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.3.3#";
145
+ Plugin.version = "#3.4.0#";
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.3.3
8
+ * @version 3.4.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -190,9 +190,7 @@ var $GRID = {
190
190
  };
191
191
  var $RADAR = {
192
192
  chartRadar: "bb-chart-radar",
193
- chartRadars: "bb-chart-radars",
194
- level: "bb-level",
195
- levels: "bb-levels"
193
+ chartRadars: "bb-chart-radars"
196
194
  };
197
195
  var $REGION = {
198
196
  region: "bb-region",
@@ -319,7 +317,7 @@ var Plugin = /*#__PURE__*/function () {
319
317
  return Plugin;
320
318
  }();
321
319
 
322
- Plugin.version = "#3.3.3#";
320
+ Plugin.version = "#3.4.0#";
323
321
 
324
322
  /**
325
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.3.3
8
+ * @version 3.4.0
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -196,9 +196,7 @@ var $GRID = {
196
196
  };
197
197
  var $RADAR = {
198
198
  chartRadar: "bb-chart-radar",
199
- chartRadars: "bb-chart-radars",
200
- level: "bb-level",
201
- levels: "bb-levels"
199
+ chartRadars: "bb-chart-radars"
202
200
  };
203
201
  var $REGION = {
204
202
  region: "bb-region",
@@ -377,13 +375,16 @@ var getRange = function (start, end, step) {
377
375
  * @private
378
376
  */
379
377
  function parseDate(date) {
378
+ var _a;
380
379
  var parsedDate;
381
380
  if (date instanceof Date) {
382
381
  parsedDate = date;
383
382
  }
384
383
  else if (isString(date)) {
385
- var _a = this, config = _a.config, format = _a.format;
386
- parsedDate = format.dataTime(config.data_xFormat)(date);
384
+ var _b = this, config = _b.config, format = _b.format;
385
+ // if fails to parse, try by new Date()
386
+ // https://github.com/naver/billboard.js/issues/1714
387
+ parsedDate = (_a = format.dataTime(config.data_xFormat)(date)) !== null && _a !== void 0 ? _a : new Date(date);
387
388
  }
388
389
  else if (isNumber(date) && !isNaN(date)) {
389
390
  parsedDate = new Date(+date);
@@ -519,7 +520,7 @@ var Plugin = /*#__PURE__*/function () {
519
520
  return Plugin;
520
521
  }();
521
522
 
522
- Plugin.version = "#3.3.3#";
523
+ Plugin.version = "#3.4.0#";
523
524
 
524
525
  /**
525
526
  * 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.3.3
8
+ * @version 3.4.0
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.3.3#";
168
+ Plugin.version = "#3.4.0#";
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.3.3
8
+ * @version 3.4.0
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.3.3#";
299
+ Plugin.version = "#3.4.0#";
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.3.3",
3
+ "version": "3.4.0",
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,34 +95,34 @@
95
95
  "d3-zoom": "^3.0.0"
96
96
  },
97
97
  "devDependencies": {
98
- "@babel/core": "^7.17.5",
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.2",
105
+ "@babel/runtime": "^7.17.8",
106
106
  "@commitlint/cli": "^15.0.0",
107
107
  "@commitlint/config-conventional": "^16.2.1",
108
- "@rollup/plugin-babel": "^5.3.0",
108
+ "@rollup/plugin-babel": "^5.3.1",
109
109
  "@rollup/plugin-node-resolve": "^13.1.3",
110
- "@rollup/plugin-replace": "^3.1.0",
111
- "@rollup/plugin-typescript": "^8.3.0",
110
+ "@rollup/plugin-replace": "^4.0.0",
111
+ "@rollup/plugin-typescript": "^8.3.1",
112
112
  "@semantic-release/changelog": "^6.0.1",
113
113
  "@semantic-release/commit-analyzer": "^9.0.2",
114
114
  "@semantic-release/exec": "^6.0.3",
115
115
  "@semantic-release/git": "^10.0.1",
116
- "@semantic-release/npm": "^9.0.0",
116
+ "@semantic-release/npm": "^9.0.1",
117
117
  "@semantic-release/release-notes-generator": "^10.0.3",
118
118
  "@types/chai": "^4.3.0",
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.12.1",
123
- "@typescript-eslint/parser": "^5.12.1",
122
+ "@typescript-eslint/eslint-plugin": "^5.17.0",
123
+ "@typescript-eslint/parser": "^5.17.0",
124
124
  "babel-helper-modules": "^6.0.0",
125
- "babel-loader": "^8.2.3",
125
+ "babel-loader": "^8.2.4",
126
126
  "babel-plugin-add-module-exports": "^1.0.4",
127
127
  "babel-plugin-minify-constant-folding": "^0.5.0",
128
128
  "babel-plugin-minify-dead-code-elimination": "^0.5.1",
@@ -139,18 +139,18 @@
139
139
  "core-js": "^3.21.1",
140
140
  "coveralls": "^3.1.1",
141
141
  "cross-env": "^7.0.3",
142
- "css-loader": "^6.6.0",
142
+ "css-loader": "^6.7.1",
143
143
  "css-minimizer-webpack-plugin": "^3.3.1",
144
- "d3-color": "^3.0.1",
144
+ "d3-color": "^3.1.0",
145
145
  "d3-delaunay": "^6.0.2",
146
146
  "d3-format": "^3.1.0",
147
147
  "d3-polygon": "^3.0.1",
148
148
  "docdash": "^1.2.0",
149
149
  "dtslint": "^4.2.1",
150
- "eslint": "^8.9.0",
150
+ "eslint": "^8.12.0",
151
151
  "eslint-config-naver": "^2.1.0",
152
152
  "eslint-plugin-import": "^2.25.4",
153
- "eslint-plugin-jsdoc": "^37.9.4",
153
+ "eslint-plugin-jsdoc": "^38.1.3",
154
154
  "eslint-webpack-plugin": "^3.1.1",
155
155
  "exports-loader": "^3.1.0",
156
156
  "hammer-simulator": "0.0.1",
@@ -158,9 +158,9 @@
158
158
  "istanbul-instrumenter-loader": "^3.0.1",
159
159
  "istanbul-lib-instrument": "^5.1.0",
160
160
  "jsdoc": "^3.6.10",
161
- "karma": "^6.3.16",
161
+ "karma": "^6.3.17",
162
162
  "karma-chai": "^0.1.0",
163
- "karma-chrome-launcher": "^3.1.0",
163
+ "karma-chrome-launcher": "^3.1.1",
164
164
  "karma-coverage-istanbul-reporter": "^3.0.3",
165
165
  "karma-mocha": "^2.0.1",
166
166
  "karma-mocha-reporter": "^2.2.3",
@@ -169,11 +169,11 @@
169
169
  "karma-sourcemap-loader": "^0.3.8",
170
170
  "karma-webpack": "^5.0.0",
171
171
  "lite-fixture": "^1.0.2",
172
- "mini-css-extract-plugin": "^2.5.2",
173
- "mocha": "^9.2.1",
172
+ "mini-css-extract-plugin": "^2.6.0",
173
+ "mocha": "^9.2.2",
174
174
  "node-sass": "^7.0.1",
175
175
  "regenerator-runtime": "^0.13.7",
176
- "rollup": "^2.67.3",
176
+ "rollup": "^2.70.1",
177
177
  "rollup-plugin-delete": "^2.0.0",
178
178
  "sass-loader": "^12.6.0",
179
179
  "semantic-release": "^19.0.2",
@@ -183,8 +183,8 @@
183
183
  "style-loader": "^3.3.1",
184
184
  "terser-webpack-plugin": "^5.3.1",
185
185
  "tslib": "^2.3.1",
186
- "typescript": "^4.5.4",
187
- "webpack": "^5.69.1",
186
+ "typescript": "^4.6.3",
187
+ "webpack": "^5.70.0",
188
188
  "webpack-bundle-analyzer": "^4.5.0",
189
189
  "webpack-clean": "^1.2.5",
190
190
  "webpack-cli": "^4.9.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(),
@@ -78,7 +78,7 @@ export default {
78
78
 
79
79
  candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, true);
80
80
 
81
- if ($$.hasArcType()) {
81
+ if ($$.hasArcType(null, ["polar"])) {
82
82
  $$.unexpandArc(targetIds);
83
83
 
84
84
  $$.hasType("gauge") &&
@@ -115,7 +115,8 @@ export default {
115
115
  const candidates = $el.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets
116
116
 
117
117
  candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, false);
118
- $$.hasArcType() && $$.unexpandArc(targetIds);
118
+
119
+ $$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
119
120
 
120
121
  if (config.legend_show) {
121
122
  $$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
@@ -894,7 +894,7 @@ class Axis {
894
894
  const prefix = `axis_${key}_`;
895
895
  const axisScale = scale[key];
896
896
 
897
- if (config[`${prefix}show`] && axisScale) {
897
+ if (axisScale) {
898
898
  const tickValues = config[`${prefix}tick_values`];
899
899
  const tickCount = config[`${prefix}tick_count`];
900
900
 
@@ -941,6 +941,7 @@ class Axis {
941
941
  const $$ = this.owner;
942
942
  const {config, state: {clip, current}, $el} = $$;
943
943
 
944
+
944
945
  ["subX", "x", "y", "y2"].forEach(type => {
945
946
  const axis = $el.axis[type];
946
947
 
@@ -966,13 +967,14 @@ class Axis {
966
967
  }
967
968
  }
968
969
 
969
- tickNodes.each(function(d) {
970
- if (tickValues.indexOf(d) % intervalForCulling) {
970
+ tickNodes
971
+ .each(function(d) {
971
972
  const node = (lines ? this.querySelector("text") : this);
972
973
 
973
- node && (node.style.display = "none");
974
- }
975
- });
974
+ if (node) {
975
+ node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
976
+ }
977
+ });
976
978
  } else {
977
979
  tickNodes.style("display", null);
978
980
  }
@@ -12,7 +12,7 @@ import {
12
12
  import {select as d3Select} from "d3-selection";
13
13
  import {d3Selection} from "../../types/types";
14
14
  import {checkModuleImport} from "../module/error";
15
- import {$COMMON, $TEXT} from "../config/classes";
15
+ import {$COMMON, $CIRCLE, $TEXT} from "../config/classes";
16
16
  import Store from "../config/Store/Store";
17
17
  import Options from "../config/Options/Options";
18
18
  import {document, window} from "../module/browser";
@@ -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
@@ -313,6 +313,7 @@ export default class ChartInternal {
313
313
  const {config, scale, state, $el, org} = $$;
314
314
  const {hasAxis} = state;
315
315
  const hasInteraction = config.interaction_enabled;
316
+ const hasPolar = $$.hasType("polar");
316
317
 
317
318
  // for arc type, set axes to not be shown
318
319
  // $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
@@ -337,6 +338,7 @@ export default class ChartInternal {
337
338
  $$.mapToIds($$.data.targets) : config.data_hide
338
339
  );
339
340
  }
341
+
340
342
  if (config.legend_hide) {
341
343
  $$.addHiddenLegendIds(
342
344
  config.legend_hide === true ?
@@ -377,9 +379,12 @@ export default class ChartInternal {
377
379
 
378
380
  if (hasInteraction && state.inputType) {
379
381
  const isTouch = state.inputType === "touch";
382
+ const {onclick, onover, onout} = config;
380
383
 
381
- $el.svg.on(isTouch ? "touchstart" : "mouseenter", () => callFn(config.onover, $$.api))
382
- .on(isTouch ? "touchend" : "mouseleave", () => callFn(config.onout, $$.api));
384
+ $el.svg
385
+ .on("click", onclick?.bind($$.api) || null)
386
+ .on(isTouch ? "touchstart" : "mouseenter", onover?.bind($$.api) || null)
387
+ .on(isTouch ? "touchend" : "mouseleave", onout?.bind($$.api) || null);
383
388
  }
384
389
 
385
390
  config.svg_classname && $el.svg.attr("class", config.svg_classname);
@@ -387,7 +392,7 @@ export default class ChartInternal {
387
392
  // Define defs
388
393
  const hasColorPatterns = (isFunction(config.color_tiles) && $$.patterns);
389
394
 
390
- if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
395
+ if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
391
396
  $el.defs = $el.svg.append("defs");
392
397
 
393
398
  if (hasAxis) {
@@ -396,7 +401,7 @@ export default class ChartInternal {
396
401
  });
397
402
  }
398
403
 
399
- // Append data backgound color filter definition
404
+ // Append data background color filter definition
400
405
  $$.generateDataLabelBackgroundColorFilter();
401
406
 
402
407
  // set color patterns
@@ -512,6 +517,8 @@ export default class ChartInternal {
512
517
  }
513
518
  });
514
519
  } else {
520
+ const hasPolar = $$.hasType("polar");
521
+
515
522
  if (!hasRadar) {
516
523
  types.push("Arc", "Pie");
517
524
  }
@@ -520,6 +527,8 @@ export default class ChartInternal {
520
527
  types.push("Gauge");
521
528
  } else if (hasRadar) {
522
529
  types.push("Radar");
530
+ } else if (hasPolar) {
531
+ types.push("Polar");
523
532
  }
524
533
  }
525
534
 
@@ -600,6 +609,9 @@ export default class ChartInternal {
600
609
  updateTargets(targets): void {
601
610
  const $$ = <any> this;
602
611
  const {hasAxis, hasRadar} = $$.state;
612
+ const helper = type => $$[`updateTargetsFor${type}`](
613
+ targets.filter($$[`is${type}Type`].bind($$))
614
+ );
603
615
 
604
616
  // Text
605
617
  $$.updateTargetsForText(targets);
@@ -609,42 +621,53 @@ export default class ChartInternal {
609
621
  const name = capitalize(v);
610
622
 
611
623
  if ((v === "line" && $$.hasTypeOf(name)) || $$.hasType(v)) {
612
- $$[`updateTargetsFor${name}`](
613
- targets.filter($$[`is${name}Type`].bind($$))
614
- );
624
+ helper(name);
615
625
  }
616
626
  });
617
627
 
618
628
  // Sub Chart
619
629
  $$.updateTargetsForSubchart &&
620
630
  $$.updateTargetsForSubchart(targets);
621
- } else {
622
- // Arc & Radar
623
- $$.hasArcType(targets) && (
624
- hasRadar ?
625
- $$.updateTargetsForRadar(targets.filter($$.isRadarType.bind($$))) :
626
- $$.updateTargetsForArc(targets.filter($$.isArcType.bind($$)))
627
- );
631
+
632
+ // Arc, Polar, Radar
633
+ } else if ($$.hasArcType(targets)) {
634
+ let type = "Arc";
635
+
636
+ if (hasRadar) {
637
+ type = "Radar";
638
+ } else if ($$.hasType("polar")) {
639
+ type = "Polar";
640
+ }
641
+
642
+ helper(type);
628
643
  }
629
644
 
630
- // circle
631
- if ($$.hasType("bubble") || $$.hasType("scatter")) {
645
+ // Point types
646
+ const hasPointType = $$.hasType("bubble") || $$.hasType("scatter");
647
+
648
+ if (hasPointType) {
632
649
  $$.updateTargetForCircle?.();
633
650
  }
634
651
 
635
652
  // Fade-in each chart
636
- $$.showTargets();
653
+ $$.filterTargetsToShowAtInit(hasPointType);
637
654
  }
638
655
 
639
656
  /**
640
- * Display targeted elements
657
+ * Display targeted elements at initialization
658
+ * @param {boolean} hasPointType whether has point type(bubble, scatter) or not
641
659
  * @private
642
660
  */
643
- showTargets(): void {
661
+ filterTargetsToShowAtInit(hasPointType: boolean = false): void {
644
662
  const $$ = <any> this;
645
663
  const {$el: {svg}, $T} = $$;
664
+ let selector = `.${$COMMON.target}`;
646
665
 
647
- $T(svg.selectAll(`.${$COMMON.target}`)
666
+ if (hasPointType) {
667
+ selector += `, .${$CIRCLE.chartCircles} > .${$CIRCLE.circles}`;
668
+ }
669
+
670
+ $T(svg.selectAll(selector)
648
671
  .filter(d => $$.isTargetToShow(d.id))
649
672
  ).style("opacity", null);
650
673
  }
@@ -683,8 +706,10 @@ export default class ChartInternal {
683
706
  const $$ = <any> this;
684
707
  const {withoutFadeIn} = $$.state;
685
708
 
686
- return $$.getBaseValue(d) !== null &&
709
+ const r = $$.getBaseValue(d) !== null &&
687
710
  withoutFadeIn[d.id] ? null : "0";
711
+
712
+ return r;
688
713
  }
689
714
 
690
715
  bindResize(): void {
@@ -271,7 +271,7 @@ export default {
271
271
  * @private
272
272
  * @returns {{min: Array, max: Array}}
273
273
  */
274
- getMinMaxData() {
274
+ getMinMaxData(): {min: IDataRow[], max: IDataRow[]} {
275
275
  const $$ = this;
276
276
  const cacheKey = KEY.dataMinMax;
277
277
  let minMaxData = $$.cache.get(cacheKey);
@@ -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));