billboard.js 3.10.3 → 3.11.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 (82) hide show
  1. package/README.md +0 -1
  2. package/dist/billboard.css +5 -4
  3. package/dist/billboard.js +598 -220
  4. package/dist/billboard.min.css +2 -2
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +2828 -2456
  7. package/dist/billboard.pkgd.min.js +2 -4
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +31 -15
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +31 -15
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +30 -15
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +30 -15
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2222 -2214
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2252 -2228
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2253 -2229
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2253 -2230
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2259 -2238
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  28. package/dist/theme/dark.css +7 -7
  29. package/dist/theme/dark.min.css +2 -2
  30. package/dist/theme/datalab.css +7 -7
  31. package/dist/theme/datalab.min.css +2 -2
  32. package/dist/theme/graph.css +7 -7
  33. package/dist/theme/graph.min.css +2 -2
  34. package/dist/theme/insight.css +7 -7
  35. package/dist/theme/insight.min.css +2 -2
  36. package/dist/theme/modern.css +7 -7
  37. package/dist/theme/modern.min.css +2 -2
  38. package/dist-esm/billboard.js +517 -180
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -4
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +7 -9
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -4
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -4
  44. package/package.json +42 -46
  45. package/src/Chart/api/zoom.ts +5 -20
  46. package/src/ChartInternal/Axis/Axis.ts +5 -3
  47. package/src/ChartInternal/Axis/AxisRenderer.ts +14 -0
  48. package/src/ChartInternal/ChartInternal.ts +1 -1
  49. package/src/ChartInternal/data/data.ts +12 -5
  50. package/src/ChartInternal/data/load.ts +37 -1
  51. package/src/ChartInternal/interactions/eventrect.ts +11 -4
  52. package/src/ChartInternal/interactions/interaction.ts +2 -1
  53. package/src/ChartInternal/interactions/zoom.ts +28 -0
  54. package/src/ChartInternal/internals/domain.ts +24 -1
  55. package/src/ChartInternal/internals/legend.ts +28 -2
  56. package/src/ChartInternal/internals/scale.ts +3 -3
  57. package/src/ChartInternal/internals/size.axis.ts +8 -3
  58. package/src/ChartInternal/internals/size.ts +14 -1
  59. package/src/ChartInternal/internals/tooltip.ts +12 -6
  60. package/src/ChartInternal/internals/transform.ts +6 -2
  61. package/src/ChartInternal/internals/type.ts +1 -1
  62. package/src/ChartInternal/shape/arc.ts +110 -34
  63. package/src/ChartInternal/shape/gauge.ts +8 -4
  64. package/src/ChartInternal/shape/radar.ts +58 -45
  65. package/src/config/Options/axis/x.ts +27 -1
  66. package/src/config/Options/axis/y2.ts +13 -0
  67. package/src/config/Options/common/legend.ts +17 -0
  68. package/src/config/Options/common/tooltip.ts +1 -0
  69. package/src/config/Options/shape/arc.ts +40 -3
  70. package/src/config/Options/shape/gauge.ts +23 -2
  71. package/src/config/Options/shape/pie.ts +2 -2
  72. package/src/config/classes.ts +1 -0
  73. package/src/module/Cache.ts +1 -0
  74. package/src/module/util.ts +16 -2
  75. package/src/scss/billboard.scss +2 -1
  76. package/src/scss/theme/dark.scss +2 -1
  77. package/src/scss/theme/datalab.scss +2 -1
  78. package/src/scss/theme/graph.scss +2 -1
  79. package/src/scss/theme/insight.scss +2 -1
  80. package/src/scss/theme/modern.scss +2 -1
  81. package/types/options.d.ts +28 -4
  82. package/types/options.shape.d.ts +44 -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.10.3
8
+ * @version 3.11.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -104,7 +104,7 @@ var Plugin = /** @class */ (function () {
104
104
  delete _this[key];
105
105
  });
106
106
  };
107
- Plugin.version = "3.10.3";
107
+ Plugin.version = "3.11.0-next.2";
108
108
  return Plugin;
109
109
  }());
110
110
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.10.3
8
+ * @version 3.11.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -82,6 +82,7 @@ var $COMMON = {
82
82
  var $ARC = {
83
83
  arc: "bb-arc",
84
84
  arcLabelLine: "bb-arc-label-line",
85
+ arcRange: "bb-arc-range",
85
86
  arcs: "bb-arcs",
86
87
  chartArc: "bb-chart-arc",
87
88
  chartArcs: "bb-chart-arcs",
@@ -279,7 +280,7 @@ var Plugin = /** @class */ (function () {
279
280
  delete _this[key];
280
281
  });
281
282
  };
282
- Plugin.version = "3.10.3";
283
+ Plugin.version = "3.11.0-next.2";
283
284
  return Plugin;
284
285
  }());
285
286
  var Plugin$1 = Plugin;
@@ -314,7 +315,6 @@ var Options = /** @class */ (function () {
314
315
  }
315
316
  return Options;
316
317
  }());
317
- var Options$1 = Options;
318
318
 
319
319
  /**
320
320
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -520,7 +520,7 @@ var Sparkline = /** @class */ (function (_super) {
520
520
  __extends(Sparkline, _super);
521
521
  function Sparkline(options) {
522
522
  var _this = _super.call(this, options) || this;
523
- _this.config = new Options$1();
523
+ _this.config = new Options();
524
524
  return _this;
525
525
  }
526
526
  Sparkline.prototype.$beforeInit = function () {
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.10.3
8
+ * @version 3.11.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -88,6 +88,7 @@ var $COMMON = {
88
88
  var $ARC = {
89
89
  arc: "bb-arc",
90
90
  arcLabelLine: "bb-arc-label-line",
91
+ arcRange: "bb-arc-range",
91
92
  arcs: "bb-arcs",
92
93
  chartArc: "bb-chart-arc",
93
94
  chartArcs: "bb-chart-arcs",
@@ -493,7 +494,7 @@ var Plugin = /** @class */ (function () {
493
494
  delete _this[key];
494
495
  });
495
496
  };
496
- Plugin.version = "3.10.3";
497
+ Plugin.version = "3.11.0-next.2";
497
498
  return Plugin;
498
499
  }());
499
500
  var Plugin$1 = Plugin;
@@ -643,7 +644,6 @@ var Options = /** @class */ (function () {
643
644
  }
644
645
  return Options;
645
646
  }());
646
- var Options$1 = Options;
647
647
 
648
648
  /**
649
649
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -890,7 +890,6 @@ var Elements = /** @class */ (function () {
890
890
  };
891
891
  return Elements;
892
892
  }());
893
- var Elements$1 = Elements;
894
893
 
895
894
  /**
896
895
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -976,7 +975,6 @@ var ColorScale = /** @class */ (function () {
976
975
  };
977
976
  return ColorScale;
978
977
  }());
979
- var ColorScale$1 = ColorScale;
980
978
 
981
979
  /**
982
980
  * Stanford diagram plugin
@@ -1067,7 +1065,7 @@ var Stanford = /** @class */ (function (_super) {
1067
1065
  __extends(Stanford, _super);
1068
1066
  function Stanford(options) {
1069
1067
  var _this = _super.call(this, options) || this;
1070
- _this.config = new Options$1();
1068
+ _this.config = new Options();
1071
1069
  return _this;
1072
1070
  }
1073
1071
  Stanford.prototype.$beforeInit = function () {
@@ -1090,8 +1088,8 @@ var Stanford = /** @class */ (function (_super) {
1090
1088
  var $$ = this.$$;
1091
1089
  loadConfig.call(this, this.options);
1092
1090
  $$.color = this.getStanfordPointColor.bind($$);
1093
- this.colorScale = new ColorScale$1(this);
1094
- this.elements = new Elements$1(this);
1091
+ this.colorScale = new ColorScale(this);
1092
+ this.elements = new Elements(this);
1095
1093
  this.convertData();
1096
1094
  this.initStanfordData();
1097
1095
  this.setStanfordTooltip();
@@ -1105,7 +1103,7 @@ var Stanford = /** @class */ (function (_super) {
1105
1103
  (_b = this.elements) === null || _b === void 0 ? void 0 : _b.updateStanfordElements(duration);
1106
1104
  };
1107
1105
  Stanford.prototype.getOptions = function () {
1108
- return new Options$1();
1106
+ return new Options();
1109
1107
  };
1110
1108
  Stanford.prototype.convertData = function () {
1111
1109
  var data = this.$$.data.targets;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.10.3
8
+ * @version 3.11.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -121,7 +121,7 @@ var Plugin = /** @class */ (function () {
121
121
  delete _this[key];
122
122
  });
123
123
  };
124
- Plugin.version = "3.10.3";
124
+ Plugin.version = "3.11.0-next.2";
125
125
  return Plugin;
126
126
  }());
127
127
  var Plugin$1 = Plugin;
@@ -237,7 +237,6 @@ var Options = /** @class */ (function () {
237
237
  }
238
238
  return Options;
239
239
  }());
240
- var Options$1 = Options;
241
240
 
242
241
  /**
243
242
  * Copyright (c) 2021 ~ present NAVER Corp.
@@ -478,7 +477,7 @@ var TableView = /** @class */ (function (_super) {
478
477
  __extends(TableView, _super);
479
478
  function TableView(options) {
480
479
  var _this = _super.call(this, options) || this;
481
- _this.config = new Options$1();
480
+ _this.config = new Options();
482
481
  return _this;
483
482
  }
484
483
  TableView.prototype.$beforeInit = function () {
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.10.3
8
+ * @version 3.11.0-next.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -269,7 +269,7 @@ var Plugin = /** @class */ (function () {
269
269
  delete _this[key];
270
270
  });
271
271
  };
272
- Plugin.version = "3.10.3";
272
+ Plugin.version = "3.11.0-next.2";
273
273
  return Plugin;
274
274
  }());
275
275
  var Plugin$1 = Plugin;
@@ -325,7 +325,6 @@ var Options = /** @class */ (function () {
325
325
  }
326
326
  return Options;
327
327
  }());
328
- var Options$1 = Options;
329
328
 
330
329
  /**
331
330
  * TextOverlap plugin<br>
@@ -374,7 +373,7 @@ var TextOverlap = /** @class */ (function (_super) {
374
373
  __extends(TextOverlap, _super);
375
374
  function TextOverlap(options) {
376
375
  var _this = _super.call(this, options) || this;
377
- _this.config = new Options$1();
376
+ _this.config = new Options();
378
377
  return _this;
379
378
  }
380
379
  TextOverlap.prototype.$init = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.10.3",
3
+ "version": "3.11.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",
@@ -36,8 +36,7 @@
36
36
  "build:plugin": "cross-env NODE_ENV=plugin webpack && cross-env NODE_ENV=plugin MODE=min webpack && cross-env NODE_ENV=plugin MODE=pkgd webpack && cross-env NODE_ENV=plugin MODE=pkgd-min webpack",
37
37
  "build:plugin:types": "node ./config/type.d-plugin.js",
38
38
  "release": "semantic-release",
39
- "lint": "npm run lint:types && eslint src --ext .ts",
40
- "lint:types": "dtslint --onlyTestTsNext types",
39
+ "lint": "eslint src --ext .ts",
41
40
  "loc": "cloc --by-file src",
42
41
  "test": "node --max-old-space-size=3072 ./node_modules/karma/bin/karma start ./karma.conf.cjs",
43
42
  "test:chrome": "cross-env TEST_TYPE=chrome npm test",
@@ -85,8 +84,6 @@
85
84
  "license": "MIT",
86
85
  "readmeFilename": "README.md",
87
86
  "dependencies": {
88
- "@types/d3-selection": "^3.0.9",
89
- "@types/d3-transition": "^3.0.7",
90
87
  "d3-axis": "^3.0.0",
91
88
  "d3-brush": "^3.0.0",
92
89
  "d3-drag": "^3.0.0",
@@ -102,32 +99,32 @@
102
99
  "d3-zoom": "^3.0.0"
103
100
  },
104
101
  "devDependencies": {
105
- "@babel/core": "^7.23.2",
106
- "@babel/eslint-parser": "^7.22.15",
102
+ "@babel/core": "^7.23.9",
103
+ "@babel/eslint-parser": "^7.23.10",
107
104
  "@babel/plugin-proposal-class-properties": "^7.18.6",
108
105
  "@babel/plugin-proposal-object-rest-spread": "^7.20.7",
109
- "@babel/plugin-transform-runtime": "^7.23.2",
110
- "@babel/preset-env": "^7.23.2",
111
- "@babel/preset-typescript": "^7.23.2",
112
- "@babel/runtime": "^7.23.2",
113
- "@commitlint/cli": "18.2.0",
114
- "@commitlint/config-conventional": "^18.1.0",
106
+ "@babel/plugin-transform-runtime": "^7.23.9",
107
+ "@babel/preset-env": "^7.23.9",
108
+ "@babel/preset-typescript": "^7.23.3",
109
+ "@babel/runtime": "^7.23.9",
110
+ "@commitlint/cli": "18.6.0",
111
+ "@commitlint/config-conventional": "^18.6.0",
115
112
  "@rollup/plugin-babel": "^6.0.4",
116
113
  "@rollup/plugin-node-resolve": "^15.2.3",
117
114
  "@rollup/plugin-replace": "^5.0.5",
118
- "@rollup/plugin-typescript": "^11.1.5",
115
+ "@rollup/plugin-typescript": "^11.1.6",
119
116
  "@semantic-release/changelog": "^6.0.3",
120
117
  "@semantic-release/commit-analyzer": "^11.1.0",
121
118
  "@semantic-release/exec": "^6.0.3",
122
119
  "@semantic-release/git": "^10.0.1",
123
- "@semantic-release/npm": "^11.0.1",
120
+ "@semantic-release/npm": "^11.0.2",
124
121
  "@semantic-release/release-notes-generator": "^12.1.0",
125
- "@types/chai": "^4.3.9",
126
- "@types/d3": "^7.4.2",
127
- "@types/mocha": "^10.0.3",
128
- "@types/sinon": "^17.0.0",
129
- "@typescript-eslint/eslint-plugin": "^6.10.0",
130
- "@typescript-eslint/parser": "^6.10.0",
122
+ "@types/chai": "^4.3.11",
123
+ "@types/d3": "^7.4.3",
124
+ "@types/mocha": "^10.0.6",
125
+ "@types/sinon": "^17.0.3",
126
+ "@typescript-eslint/eslint-plugin": "^7.0.1",
127
+ "@typescript-eslint/parser": "^7.0.1",
131
128
  "babel-helper-modules": "^6.0.0",
132
129
  "babel-loader": "^9.1.3",
133
130
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -139,29 +136,28 @@
139
136
  "babel-plugin-transform-inline-consecutive-adds": "^0.4.3",
140
137
  "babel-plugin-transform-merge-sibling-variables": "^6.9.5",
141
138
  "babel-plugin-transform-minify-booleans": "^6.9.4",
142
- "better-docs": "^2.7.2",
139
+ "better-docs": "^2.7.3",
143
140
  "chai": "^4.3.10",
144
141
  "clean-webpack-plugin": "^4.0.0",
145
142
  "cloc": "^2.11.0",
146
- "core-js": "^3.33.2",
143
+ "core-js": "^3.35.1",
147
144
  "coveralls": "^3.1.1",
148
145
  "cross-env": "^7.0.3",
149
- "css-loader": "^6.8.1",
150
- "css-minimizer-webpack-plugin": "^5.0.1",
146
+ "css-loader": "^6.10.0",
147
+ "css-minimizer-webpack-plugin": "^6.0.0",
151
148
  "d3-color": "^3.1.0",
152
149
  "d3-delaunay": "^6.0.4",
153
150
  "d3-format": "^3.1.0",
154
151
  "d3-polygon": "^3.0.1",
155
152
  "docdash": "^2.0.2",
156
- "dtslint": "^4.2.1",
157
- "eslint": "^8.53.0",
153
+ "eslint": "^8.56.0",
158
154
  "eslint-config-naver": "^2.1.0",
159
- "eslint-plugin-import": "^2.29.0",
160
- "eslint-plugin-jsdoc": "^46.8.2",
155
+ "eslint-plugin-import": "^2.29.1",
156
+ "eslint-plugin-jsdoc": "^48.0.6",
161
157
  "eslint-webpack-plugin": "^4.0.1",
162
- "exports-loader": "^4.0.0",
158
+ "exports-loader": "^5.0.0",
163
159
  "hammer-simulator": "0.0.1",
164
- "husky": "^8.0.3",
160
+ "husky": "^9.0.10",
165
161
  "istanbul-instrumenter-loader": "^3.0.1",
166
162
  "istanbul-lib-instrument": "^6.0.1",
167
163
  "jsdoc": "^4.0.2",
@@ -174,33 +170,33 @@
174
170
  "karma-scss-preprocessor": "^4.0.0",
175
171
  "karma-sinon": "^1.0.5",
176
172
  "karma-sourcemap-loader": "^0.4.0",
177
- "karma-webpack": "^5.0.0",
178
- "lint-staged": "^15.0.2",
173
+ "karma-webpack": "^5.0.1",
174
+ "lint-staged": "^15.2.2",
179
175
  "lite-fixture": "^1.0.2",
180
- "mini-css-extract-plugin": "^2.7.6",
181
- "mocha": "^10.2.0",
176
+ "mini-css-extract-plugin": "^2.8.0",
177
+ "mocha": "^10.3.0",
182
178
  "node-sass": "^9.0.0",
183
- "regenerator-runtime": "^0.14.0",
184
- "rollup": "^4.3.0",
179
+ "regenerator-runtime": "^0.14.1",
180
+ "rollup": "^4.10.0",
185
181
  "rollup-plugin-delete": "^2.0.0",
186
- "sass-loader": "^13.3.2",
187
- "semantic-release": "^22.0.7",
182
+ "sass-loader": "^14.1.0",
183
+ "semantic-release": "^23.0.2",
188
184
  "simulant": "^0.2.2",
189
185
  "sinon": "^17.0.1",
190
186
  "string-replace-loader": "^3.1.0",
191
- "style-loader": "^3.3.3",
187
+ "style-loader": "^3.3.4",
192
188
  "taffydb": "^2.7.3",
193
- "terser-webpack-plugin": "^5.3.9",
189
+ "terser-webpack-plugin": "^5.3.10",
194
190
  "tslib": "^2.6.2",
195
- "typescript": "5.2.2",
196
- "webpack": "^5.89.0",
197
- "webpack-bundle-analyzer": "^4.9.1",
191
+ "typescript": "5.3.3",
192
+ "webpack": "^5.90.1",
193
+ "webpack-bundle-analyzer": "^4.10.1",
198
194
  "webpack-clean": "^1.2.5",
199
195
  "webpack-cli": "^5.1.4",
200
196
  "webpack-common-shake": "^2.1.0",
201
- "webpack-dev-server": "^4.15.1",
197
+ "webpack-dev-server": "^5.0.0",
202
198
  "webpack-merge": "^5.10.0",
203
- "webpackbar": "^5.0.2",
199
+ "webpackbar": "^6.0.0",
204
200
  "write-file-webpack-plugin": "^4.5.1"
205
201
  }
206
202
  }
@@ -35,8 +35,7 @@ import type {TDomainRange} from "../../ChartInternal/data/IData";
35
35
  // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
36
36
  const zoom = function<T = TDomainRange>(domainValue?: T): T | undefined {
37
37
  const $$ = this.internal;
38
- const {$el, axis, config, org, scale, state} = $$;
39
- const isRotated = config.axis_rotated;
38
+ const {axis, config, org, scale, state} = $$;
40
39
  const isCategorized = axis.isCategorized();
41
40
  let domain;
42
41
 
@@ -57,9 +56,7 @@ const zoom = function<T = TDomainRange>(domainValue?: T): T | undefined {
57
56
  if (isWithinRange) {
58
57
  state.domain = domain;
59
58
 
60
- if (isCategorized) {
61
- domain = domain.map((v, i) => Number(v) + (i === 0 ? 0 : 1));
62
- }
59
+ domain = $$.getZoomDomainValue(domain);
63
60
 
64
61
  // hide any possible tooltip show before the zoom
65
62
  $$.api.tooltip.hide();
@@ -73,19 +70,7 @@ const zoom = function<T = TDomainRange>(domainValue?: T): T | undefined {
73
70
  // in case of 'config.zoom_rescale=true', use org.xScale
74
71
  const x = isCategorized ? scale.x.orgScale() : (org.xScale || scale.x);
75
72
 
76
- // Get transform from given domain value
77
- // https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951
78
- const translate = [-x(domain[0]), 0];
79
- const transform = d3ZoomIdentity
80
- .scale(x.range()[1] / (
81
- x(domain[1]) - x(domain[0])
82
- ))
83
- .translate(
84
- ...(isRotated ? translate.reverse() : translate) as [number, number]
85
- );
86
-
87
- $el.eventRect
88
- .call($$.zoom.transform, transform);
73
+ $$.updateCurrentZoomTransform(x, domain);
89
74
  }
90
75
 
91
76
  $$.setZoomResetButton();
@@ -229,9 +214,9 @@ export default {
229
214
  */
230
215
  unzoom(): void {
231
216
  const $$ = this.internal;
232
- const {config, $el: {eventRect, zoomResetBtn}, state} = $$;
217
+ const {config, $el: {eventRect, zoomResetBtn}, scale: {zoom}, state} = $$;
233
218
 
234
- if ($$.scale.zoom) {
219
+ if (zoom) {
235
220
  config.subchart_show ?
236
221
  $$.brush.getSelection().call($$.brush.move, null) :
237
222
  $$.zoom.updateTransformScale(d3ZoomIdentity);
@@ -680,7 +680,7 @@ class Axis {
680
680
 
681
681
  getXAxisTickTextY2Overflow(defaultPadding) {
682
682
  const $$ = this.owner;
683
- const {axis, config, state} = $$;
683
+ const {axis, config, state: {current, isLegendRight, legendItemWidth}} = $$;
684
684
  const xAxisTickRotate = $$.getAxisTickRotate("x");
685
685
  const positiveRotation = xAxisTickRotate > 0 && xAxisTickRotate < 90;
686
686
 
@@ -690,10 +690,12 @@ class Axis {
690
690
  !config.axis_x_tick_multiline &&
691
691
  positiveRotation
692
692
  ) {
693
- const widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingByDirection("left");
693
+ const y2AxisWidth = (config.axis_y2_show && current.maxTickSize.y2.width) || 0;
694
+ const legendWidth = (isLegendRight && legendItemWidth) || 0;
695
+ const widthWithoutCurrentPaddingLeft = current.width - $$.getCurrentPaddingByDirection("left");
694
696
  const maxOverflow = this.getXAxisTickMaxOverflow(
695
697
  xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding
696
- );
698
+ ) - y2AxisWidth - legendWidth;
697
699
  const xAxisTickTextY2Overflow = Math.max(0, maxOverflow) +
698
700
  defaultPadding; // for display inconsistencies between browsers
699
701
 
@@ -313,6 +313,11 @@ export default class AxisRenderer {
313
313
  return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
314
314
  };
315
315
 
316
+ const {config: {
317
+ axis_rotated: isRotated,
318
+ axis_x_tick_text_inner: inner
319
+ }} = this.params.owner;
320
+
316
321
  switch (orient) {
317
322
  case "bottom":
318
323
  lineUpdate
@@ -324,6 +329,15 @@ export default class AxisRenderer {
324
329
  .attr("x", 0)
325
330
  .attr("y", yForText(rotate))
326
331
  .style("text-anchor", textAnchorForText(rotate))
332
+ .style("text-anchor", (d, i, {length}) => {
333
+ if (!isRotated && i === 0 && (inner === true || inner.first)) {
334
+ return "start";
335
+ } else if (!isRotated && i === length - 1 && (inner === true || inner.last)) {
336
+ return "end";
337
+ }
338
+
339
+ return textAnchorForText(rotate);
340
+ })
327
341
  .attr("transform", textTransform(rotate));
328
342
  break;
329
343
  case "top":
@@ -420,7 +420,7 @@ export default class ChartInternal {
420
420
  $el.defs = $el.svg.append("defs");
421
421
 
422
422
  if (hasAxis) {
423
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach(v => {
423
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(v => {
424
424
  $$.appendClip($el.defs, state.clip[v]);
425
425
  });
426
426
  }
@@ -9,6 +9,7 @@ import type {IData, IDataPoint, IDataRow} from "./IData";
9
9
  import {
10
10
  findIndex,
11
11
  getUnique,
12
+ getScrollPosition,
12
13
  hasValue,
13
14
  isArray,
14
15
  isboolean,
@@ -625,10 +626,13 @@ export default {
625
626
 
626
627
  if (orderAsc || orderDesc) {
627
628
  const reducer = (p, c) => p + Math.abs(c.value);
629
+ const sum = v => (isNumber(v) ? v : (
630
+ "values" in v ? v.values.reduce(reducer, 0) : v.value)
631
+ );
628
632
 
629
633
  fn = (t1: IData | IDataRow, t2: IData | IDataRow) => {
630
- const t1Sum = "values" in t1 ? t1.values.reduce(reducer, 0) : t1.value;
631
- const t2Sum = "values" in t2 ? t2.values.reduce(reducer, 0) : t2.value;
634
+ const t1Sum = sum(t1);
635
+ const t2Sum = sum(t2);
632
636
 
633
637
  return isReversed ?
634
638
  (orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum) :
@@ -671,7 +675,7 @@ export default {
671
675
  */
672
676
  getDataIndexFromEvent(event): number {
673
677
  const $$ = this;
674
- const {config, state: {hasRadar, inputType, eventReceiver: {coords, rect}}} = $$;
678
+ const {$el, config, state: {hasRadar, inputType, eventReceiver: {coords, rect}}} = $$;
675
679
  let index;
676
680
 
677
681
  if (hasRadar) {
@@ -687,13 +691,16 @@ export default {
687
691
  index = d && Object.keys(d).length === 1 ? d.index : undefined;
688
692
  } else {
689
693
  const isRotated = config.axis_rotated;
694
+ const scrollPos = getScrollPosition($el.chart.node());
690
695
 
691
696
  // get data based on the mouse coords
692
697
  const e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event;
693
698
 
694
699
  index = findIndex(
695
700
  coords,
696
- isRotated ? e.clientY - rect.top : e.clientX - rect.left,
701
+ isRotated ?
702
+ e.clientY + scrollPos.y - rect.top :
703
+ e.clientX + scrollPos.x - rect.left,
697
704
  0,
698
705
  coords.length - 1,
699
706
  isRotated
@@ -961,7 +968,7 @@ export default {
961
968
  // otherwise, based on the rendered angle value
962
969
  } else {
963
970
  const gaugeArcLength = config.gauge_fullCircle ?
964
- $$.getArcLength() : $$.getGaugeStartAngle() * -2;
971
+ $$.getArcLength() : $$.getStartingAngle() * -2;
965
972
  const arcLength = $$.hasType("gauge") ? gaugeArcLength : Math.PI * 2;
966
973
 
967
974
  ratio = (d.endAngle - d.startAngle) / arcLength;
@@ -22,8 +22,13 @@ export function callDone(fn, resizeAfter = false) {
22
22
  export default {
23
23
  load(rawTargets, args): void {
24
24
  const $$ = this;
25
- const {data} = $$;
25
+ const {axis, data, org, scale} = $$;
26
26
  const {append} = args;
27
+ const zoomState = {
28
+ domain: <any> null,
29
+ currentDomain: <any> null,
30
+ x: <any> null
31
+ };
27
32
  let targets = rawTargets;
28
33
 
29
34
  if (targets) {
@@ -60,6 +65,21 @@ export default {
60
65
  // Set targets
61
66
  $$.updateTargets(data.targets);
62
67
 
68
+ if (scale.zoom) {
69
+ zoomState.x = axis.isCategorized() ? scale.x.orgScale() : (org.xScale || scale.x).copy();
70
+ zoomState.domain = $$.getXDomain(data.targets); // get updated xDomain
71
+
72
+ zoomState.x.domain(zoomState.domain);
73
+ zoomState.currentDomain = $$.zoom.getDomain(); // current zoomed domain
74
+
75
+ // reset zoom state when new data loaded is out of range
76
+ if (!$$.withinRange(zoomState.currentDomain, undefined, zoomState.domain)) {
77
+ scale.x.domain(zoomState.domain);
78
+ scale.zoom = null;
79
+ $$.$el.eventRect.property("__zoom", null);
80
+ }
81
+ }
82
+
63
83
  // Redraw with new targets
64
84
  $$.redraw({
65
85
  withUpdateOrgXDomain: true,
@@ -67,6 +87,22 @@ export default {
67
87
  withLegend: true
68
88
  });
69
89
 
90
+ // when load happens on zoom state
91
+ if (scale.zoom) {
92
+ // const x = (axis.isCategorized() ? scale.x.orgScale() : (org.xScale || scale.x)).copy();
93
+
94
+ org.xDomain = zoomState.domain;
95
+ org.xScale = zoomState.x;
96
+
97
+ if (axis.isCategorized()) {
98
+ zoomState.currentDomain = $$.getZoomDomainValue(zoomState.currentDomain);
99
+ org.xDomain = $$.getZoomDomainValue(org.xDomain);
100
+ org.xScale = zoomState.x.domain(org.xDomain);
101
+ }
102
+
103
+ $$.updateCurrentZoomTransform(zoomState.x, zoomState.currentDomain);
104
+ }
105
+
70
106
  // Update current state chart type and elements list after redraw
71
107
  $$.updateTypesElements();
72
108
 
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {$COMMON, $EVENT, $SHAPE} from "../../config/classes";
6
- import {isboolean, getPointer, isFunction} from "../../module/util";
6
+ import {isboolean, getPointer, getScrollPosition, isFunction} from "../../module/util";
7
7
 
8
8
  export default {
9
9
  /**
@@ -194,9 +194,16 @@ export default {
194
194
  const rectElement = eventRect || $el.eventRect;
195
195
 
196
196
  const updateClientRect = (): void => {
197
- eventReceiver && (
198
- eventReceiver.rect = rectElement.node().getBoundingClientRect()
199
- );
197
+ if (eventReceiver) {
198
+ const scrollPos = getScrollPosition($el.chart.node());
199
+
200
+ eventReceiver.rect = rectElement.node()
201
+ .getBoundingClientRect()
202
+ .toJSON();
203
+
204
+ eventReceiver.rect.top += scrollPos.y;
205
+ eventReceiver.rect.left += scrollPos.x;
206
+ }
200
207
  };
201
208
 
202
209
  if (!rendered || resizing || force) {
@@ -207,7 +207,8 @@ export default {
207
207
  screenX: x,
208
208
  screenY: y,
209
209
  clientX: x,
210
- clientY: y
210
+ clientY: y,
211
+ bubbles: hasRadar // radar type needs to bubble up event
211
212
  };
212
213
 
213
214
  emulateEvent[/^(mouse|click)/.test(type) ? "mouse" : "touch"](