billboard.js 3.3.1 → 3.4.0-next.1

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 (64) hide show
  1. package/dist/billboard.css +19 -14
  2. package/dist/billboard.js +397 -74
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +865 -414
  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 +46 -16
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +46 -16
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +41 -13
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +41 -13
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +470 -342
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +515 -357
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +516 -358
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +512 -356
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +513 -357
  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 +356 -72
  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 +3 -5
  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 +30 -30
  35. package/src/Chart/api/chart.ts +1 -1
  36. package/src/Chart/api/focus.ts +3 -2
  37. package/src/Chart/api/subchart.ts +8 -8
  38. package/src/ChartInternal/Axis/Axis.ts +10 -7
  39. package/src/ChartInternal/ChartInternal.ts +25 -14
  40. package/src/ChartInternal/data/data.ts +1 -1
  41. package/src/ChartInternal/internals/color.ts +4 -3
  42. package/src/ChartInternal/internals/format.ts +13 -4
  43. package/src/ChartInternal/internals/redraw.ts +6 -2
  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/polar.ts +132 -0
  49. package/src/ChartInternal/shape/radar.ts +4 -4
  50. package/src/config/Options/common/tooltip.ts +10 -1
  51. package/src/config/Options/data/data.ts +3 -0
  52. package/src/config/Options/shape/polar.ts +81 -0
  53. package/src/config/classes.ts +6 -3
  54. package/src/config/const.ts +3 -0
  55. package/src/config/resolver/shape.ts +4 -0
  56. package/src/core.ts +1 -0
  57. package/src/index.esm.ts +1 -0
  58. package/src/module/util.ts +30 -10
  59. package/src/scss/billboard.scss +13 -0
  60. package/src/scss/theme/datalab.scss +13 -0
  61. package/src/scss/theme/graph.scss +13 -0
  62. package/src/scss/theme/insight.scss +13 -0
  63. package/types/bb.d.ts +1 -0
  64. package/types/options.d.ts +72 -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.1
8
+ * @version 3.4.0-next.1
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.1#";
145
+ Plugin.version = "#3.4.0-next.1#";
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.1
8
+ * @version 3.4.0-next.1
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.1#";
320
+ Plugin.version = "#3.4.0-next.1#";
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.1
8
+ * @version 3.4.0-next.1
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",
@@ -519,7 +517,7 @@ var Plugin = /*#__PURE__*/function () {
519
517
  return Plugin;
520
518
  }();
521
519
 
522
- Plugin.version = "#3.3.1#";
520
+ Plugin.version = "#3.4.0-next.1#";
523
521
 
524
522
  /**
525
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.3.1
8
+ * @version 3.4.0-next.1
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.1#";
168
+ Plugin.version = "#3.4.0-next.1#";
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.1
8
+ * @version 3.4.0-next.1
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.1#";
299
+ Plugin.version = "#3.4.0-next.1#";
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.1",
3
+ "version": "3.4.0-next.1",
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,32 +95,32 @@
95
95
  "d3-zoom": "^3.0.0"
96
96
  },
97
97
  "devDependencies": {
98
- "@babel/core": "^7.16.7",
99
- "@babel/eslint-parser": "^7.16.5",
98
+ "@babel/core": "^7.17.7",
99
+ "@babel/eslint-parser": "^7.17.0",
100
100
  "@babel/plugin-proposal-class-properties": "^7.16.7",
101
- "@babel/plugin-proposal-object-rest-spread": "^7.16.7",
102
- "@babel/plugin-transform-runtime": "^7.16.8",
101
+ "@babel/plugin-proposal-object-rest-spread": "^7.17.3",
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.16.7",
105
+ "@babel/runtime": "^7.17.7",
106
106
  "@commitlint/cli": "^15.0.0",
107
- "@commitlint/config-conventional": "^16.0.0",
108
- "@rollup/plugin-babel": "^5.3.0",
107
+ "@commitlint/config-conventional": "^16.2.1",
108
+ "@rollup/plugin-babel": "^5.3.1",
109
109
  "@rollup/plugin-node-resolve": "^13.1.3",
110
- "@rollup/plugin-replace": "^3.0.1",
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
- "@types/sinon": "^10.0.8",
122
- "@typescript-eslint/eslint-plugin": "^5.10.0",
123
- "@typescript-eslint/parser": "^5.10.0",
121
+ "@types/sinon": "^10.0.11",
122
+ "@typescript-eslint/eslint-plugin": "^5.15.0",
123
+ "@typescript-eslint/parser": "^5.15.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",
@@ -132,14 +132,14 @@
132
132
  "babel-plugin-transform-inline-consecutive-adds": "^0.4.3",
133
133
  "babel-plugin-transform-merge-sibling-variables": "^6.9.4",
134
134
  "babel-plugin-transform-minify-booleans": "^6.9.4",
135
- "better-docs": "^2.3.2",
135
+ "better-docs": "^2.7.2",
136
136
  "chai": "^4.3.4",
137
137
  "clean-webpack-plugin": "^4.0.0",
138
138
  "cloc": "^2.9.0",
139
- "core-js": "^3.20.3",
139
+ "core-js": "^3.21.1",
140
140
  "coveralls": "^3.1.1",
141
141
  "cross-env": "^7.0.3",
142
- "css-loader": "^6.5.1",
142
+ "css-loader": "^6.7.1",
143
143
  "css-minimizer-webpack-plugin": "^3.3.1",
144
144
  "d3-color": "^3.0.1",
145
145
  "d3-delaunay": "^6.0.2",
@@ -147,10 +147,10 @@
147
147
  "d3-polygon": "^3.0.1",
148
148
  "docdash": "^1.2.0",
149
149
  "dtslint": "^4.2.1",
150
- "eslint": "^8.7.0",
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": "^37.6.1",
153
+ "eslint-plugin-jsdoc": "^38.0.4",
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.12",
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,27 +169,27 @@
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.1.4",
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.66.1",
176
+ "rollup": "^2.70.1",
177
177
  "rollup-plugin-delete": "^2.0.0",
178
- "sass-loader": "^12.4.0",
178
+ "sass-loader": "^12.6.0",
179
179
  "semantic-release": "^19.0.2",
180
180
  "simulant": "^0.2.2",
181
- "sinon": "^12.0.1",
181
+ "sinon": "^13.0.1",
182
182
  "string-replace-loader": "^3.1.0",
183
183
  "style-loader": "^3.3.1",
184
- "terser-webpack-plugin": "^5.3.0",
184
+ "terser-webpack-plugin": "^5.3.1",
185
185
  "tslib": "^2.3.1",
186
- "typescript": "^4.5.4",
187
- "webpack": "^5.66.0",
186
+ "typescript": "^4.6.2",
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",
191
191
  "webpack-common-shake": "^2.1.0",
192
- "webpack-dev-server": "^4.7.3",
192
+ "webpack-dev-server": "^4.7.4",
193
193
  "webpack-merge": "^5.8.0",
194
194
  "webpackbar": "^5.0.2",
195
195
  "write-file-webpack-plugin": "^4.5.1"
@@ -31,7 +31,7 @@ export default {
31
31
 
32
32
  state.resizing = true;
33
33
 
34
- this.flush(false, true);
34
+ this.flush(false);
35
35
  $$.resizeFunction();
36
36
  }
37
37
  },
@@ -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($$)));
@@ -48,13 +48,13 @@ export default {
48
48
  $$.updateSizes();
49
49
  $$.updateTargetsForSubchart($$.data.targets);
50
50
 
51
- $target = subchart.main.selectAll(`.${$COMMON.target}`);
51
+ $target = subchart.main?.selectAll(`.${$COMMON.target}`);
52
52
  }
53
53
 
54
- $target.style("opacity", null);
55
- subchart.main.style("display", null);
54
+ $target?.style("opacity", null);
55
+ subchart.main?.style("display", null);
56
56
 
57
- this.flush();
57
+ this.resize();
58
58
  }
59
59
  },
60
60
 
@@ -69,13 +69,13 @@ export default {
69
69
  */
70
70
  hide(): void {
71
71
  const $$ = this.internal;
72
- const {$el: {subchart}, config} = $$;
72
+ const {$el: {subchart: {main}}, config} = $$;
73
73
 
74
- if (config.subchart_show && subchart.main.style("display") !== "none") {
74
+ if (config.subchart_show && main?.style("display") !== "none") {
75
75
  config.subchart_show = false;
76
- subchart.main.style("display", "none");
76
+ main.style("display", "none");
77
77
 
78
- this.flush();
78
+ this.resize();
79
79
  }
80
80
  },
81
81
 
@@ -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,12 +967,14 @@ class Axis {
966
967
  }
967
968
  }
968
969
 
969
- tickNodes.each(function(d) {
970
- if (tickValues.indexOf(d) % intervalForCulling) {
971
- (lines ? this.querySelector("text") : this)
972
- .style.display = "none";
973
- }
974
- });
970
+ tickNodes
971
+ .each(function(d) {
972
+ const node = (lines ? this.querySelector("text") : this);
973
+
974
+ if (node) {
975
+ node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
976
+ }
977
+ });
975
978
  } else {
976
979
  tickNodes.style("display", null);
977
980
  }
@@ -18,7 +18,7 @@ import Options from "../config/Options/Options";
18
18
  import {document, window} from "../module/browser";
19
19
  import Cache from "../module/Cache";
20
20
  import {generateResize} from "../module/generator";
21
- import {capitalize, extend, notEmpty, convertInputType, getOption, isFunction, isObject, isString, callFn, sortValue} from "../module/util";
21
+ import {capitalize, extend, notEmpty, convertInputType, getOption, getRandom, isFunction, isObject, isString, callFn, sortValue} from "../module/util";
22
22
 
23
23
  // data
24
24
  import dataConvert from "./data/convert";
@@ -255,7 +255,7 @@ export default class ChartInternal {
255
255
  const isRotated = config.axis_rotated;
256
256
 
257
257
  // datetime to be used for uniqueness
258
- state.datetimeId = `bb-${+new Date()}`;
258
+ state.datetimeId = `bb-${+new Date() * (getRandom() as number)}`;
259
259
 
260
260
  $$.color = $$.generateColor();
261
261
  $$.levelColor = $$.generateLevelColor();
@@ -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));
@@ -387,7 +388,7 @@ export default class ChartInternal {
387
388
  // Define defs
388
389
  const hasColorPatterns = (isFunction(config.color_tiles) && $$.patterns);
389
390
 
390
- if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
391
+ if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
391
392
  $el.defs = $el.svg.append("defs");
392
393
 
393
394
  if (hasAxis) {
@@ -396,7 +397,7 @@ export default class ChartInternal {
396
397
  });
397
398
  }
398
399
 
399
- // Append data backgound color filter definition
400
+ // Append data background color filter definition
400
401
  $$.generateDataLabelBackgroundColorFilter();
401
402
 
402
403
  // set color patterns
@@ -512,6 +513,8 @@ export default class ChartInternal {
512
513
  }
513
514
  });
514
515
  } else {
516
+ const hasPolar = $$.hasType("polar");
517
+
515
518
  if (!hasRadar) {
516
519
  types.push("Arc", "Pie");
517
520
  }
@@ -520,6 +523,8 @@ export default class ChartInternal {
520
523
  types.push("Gauge");
521
524
  } else if (hasRadar) {
522
525
  types.push("Radar");
526
+ } else if (hasPolar) {
527
+ types.push("Polar");
523
528
  }
524
529
  }
525
530
 
@@ -600,6 +605,9 @@ export default class ChartInternal {
600
605
  updateTargets(targets): void {
601
606
  const $$ = <any> this;
602
607
  const {hasAxis, hasRadar} = $$.state;
608
+ const helper = type => $$[`updateTargetsFor${type}`](
609
+ targets.filter($$[`is${type}Type`].bind($$))
610
+ );
603
611
 
604
612
  // Text
605
613
  $$.updateTargetsForText(targets);
@@ -609,22 +617,25 @@ export default class ChartInternal {
609
617
  const name = capitalize(v);
610
618
 
611
619
  if ((v === "line" && $$.hasTypeOf(name)) || $$.hasType(v)) {
612
- $$[`updateTargetsFor${name}`](
613
- targets.filter($$[`is${name}Type`].bind($$))
614
- );
620
+ helper(name);
615
621
  }
616
622
  });
617
623
 
618
624
  // Sub Chart
619
625
  $$.updateTargetsForSubchart &&
620
626
  $$.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
- );
627
+
628
+ // Arc, Polar, Radar
629
+ } else if ($$.hasArcType(targets)) {
630
+ let type = "Arc";
631
+
632
+ if (hasRadar) {
633
+ type = "Radar";
634
+ } else if ($$.hasType("polar")) {
635
+ type = "Polar";
636
+ }
637
+
638
+ helper(type);
628
639
  }
629
640
 
630
641
  // circle
@@ -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);
@@ -160,12 +160,13 @@ export default {
160
160
 
161
161
  /**
162
162
  * Append data backgound color filter definition
163
+ * @param {string} color Color string
163
164
  * @private
164
165
  */
165
- generateDataLabelBackgroundColorFilter(): void {
166
+ generateDataLabelBackgroundColorFilter(color?: string): void {
166
167
  const $$ = this;
167
168
  const {$el, config, state} = $$;
168
- const backgroundColors = config.data_labels_backgroundColors;
169
+ const backgroundColors = color || config.data_labels_backgroundColors;
169
170
 
170
171
  if (backgroundColors) {
171
172
  let ids: string[] = [];
@@ -177,7 +178,7 @@ export default {
177
178
  }
178
179
 
179
180
  ids.forEach(v => {
180
- const id = `${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(v)}`;
181
+ const id = `${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(v)}${color ? $$.getTargetSelectorSuffix(color) : ""}`;
181
182
 
182
183
  $el.defs.append("filter")
183
184
  .attr("x", "0")
@@ -38,11 +38,16 @@ export default {
38
38
  */
39
39
  getDefaultValueFormat(): Function {
40
40
  const $$ = this;
41
- const hasArc = $$.hasArcType();
41
+ const {defaultArcValueFormat, yFormat, y2Format} = $$;
42
+ const hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
42
43
 
43
- return hasArc && !$$.hasType("gauge") ?
44
- $$.defaultArcValueFormat :
45
- $$.defaultValueFormat;
44
+ return function(v, ratio, id) {
45
+ const format = hasArc ? defaultArcValueFormat : (
46
+ $$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat
47
+ );
48
+
49
+ return format.call($$, v, ratio);
50
+ };
46
51
  },
47
52
 
48
53
  defaultValueFormat(v): number|string {
@@ -53,6 +58,10 @@ export default {
53
58
  return `${(ratio * 100).toFixed(1)}%`;
54
59
  },
55
60
 
61
+ defaultPolarValueFormat(v): string {
62
+ return `${v}`;
63
+ },
64
+
56
65
  dataLabelFormat(targetId: string): Function {
57
66
  const $$ = this;
58
67
  const dataLabels = $$.config.data_labels;
@@ -85,6 +85,9 @@ export default {
85
85
 
86
86
  // radar
87
87
  $el.radar && $$.redrawRadar();
88
+
89
+ // polar
90
+ $el.polar && $$.redrawPolar();
88
91
  }
89
92
 
90
93
  // @TODO: Axis & Radar type
@@ -246,10 +249,11 @@ export default {
246
249
  redrawWithoutRescale() {
247
250
  this.redraw({
248
251
  withY: false,
249
- withLegend: true,
252
+ withDimension: false,
253
+ withLegend: false,
250
254
  withSubchart: false,
251
255
  withEventRect: false,
252
- withTransitionForAxis: false
256
+ withTransitionForAxis: false,
253
257
  });
254
258
  }
255
259
  };
@@ -501,7 +501,7 @@ export default {
501
501
  * @returns {boolean}
502
502
  * @private
503
503
  */
504
- meetsLabelThreshold(ratio: number = 0, type: "bar" | "donut" | "gauge" | "pie"): boolean {
504
+ meetsLabelThreshold(ratio: number = 0, type: "bar" | "donut" | "gauge" | "pie" | "polar"): boolean {
505
505
  const $$ = this;
506
506
  const {config} = $$;
507
507
  const threshold = config[`${type}_label_threshold`] || 0;
@@ -5,7 +5,7 @@
5
5
  import {$ARC, $AXIS} from "../../config/classes";
6
6
  import {asHalfPixel} from "../../module/util";
7
7
 
8
- type TranslateParam = "main" | "context" | "legend" | "x" | "y" | "y2" | "subX" | "arc" | "radar";
8
+ type TranslateParam = "main" | "context" | "legend" | "x" | "y" | "y2" | "subX" | "arc" | "radar" | "polar";
9
9
 
10
10
  export default {
11
11
  getTranslate(target: TranslateParam, index = 0): string {
@@ -44,6 +44,9 @@ export default {
44
44
  } else if (target === "arc") {
45
45
  x = state.arcWidth / 2;
46
46
  y = state.arcHeight / 2;
47
+ } else if (target === "polar") {
48
+ x = state.arcWidth / 2;
49
+ y = state.arcHeight / 2;
47
50
  } else if (target === "radar") {
48
51
  const [width] = $$.getRadarSize();
49
52
 
@@ -187,6 +187,10 @@ export default {
187
187
  return this.isTypeOf(d, "donut");
188
188
  },
189
189
 
190
+ isPolarType(d): boolean {
191
+ return this.isTypeOf(d, "polar");
192
+ },
193
+
190
194
  isRadarType(d): boolean {
191
195
  return this.isTypeOf(d, "radar");
192
196
  },
@@ -195,6 +199,7 @@ export default {
195
199
  return this.isPieType(d) ||
196
200
  this.isDonutType(d) ||
197
201
  this.isGaugeType(d) ||
202
+ this.isPolarType(d) ||
198
203
  this.isRadarType(d);
199
204
  },
200
205