billboard.js 3.2.0-next.5 → 3.2.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 (57) hide show
  1. package/dist/billboard.css +8 -8
  2. package/dist/billboard.js +109 -68
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +3794 -2736
  6. package/dist/billboard.pkgd.min.js +3 -3
  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 +9 -5
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +9 -5
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +9 -5
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -5
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +3433 -2617
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +3451 -2631
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +3485 -2655
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +3453 -2633
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +3450 -2630
  22. package/dist/theme/datalab.css +6 -4
  23. package/dist/theme/datalab.min.css +2 -2
  24. package/dist/theme/graph.css +6 -4
  25. package/dist/theme/graph.min.css +2 -2
  26. package/dist/theme/insight.css +6 -4
  27. package/dist/theme/insight.min.css +2 -2
  28. package/dist-esm/billboard.js +446 -420
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +6 -6
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +15 -15
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +6 -6
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -4
  34. package/package.json +52 -53
  35. package/src/Chart/api/load.ts +7 -0
  36. package/src/Chart/api/zoom.ts +9 -6
  37. package/src/ChartInternal/Axis/Axis.ts +2 -2
  38. package/src/ChartInternal/ChartInternal.ts +1 -1
  39. package/src/ChartInternal/data/data.ts +1 -1
  40. package/src/ChartInternal/interactions/eventrect.ts +21 -3
  41. package/src/ChartInternal/interactions/zoom.ts +1 -1
  42. package/src/ChartInternal/internals/domain.ts +27 -29
  43. package/src/ChartInternal/internals/legend.ts +2 -1
  44. package/src/ChartInternal/internals/redraw.ts +2 -2
  45. package/src/ChartInternal/internals/text.ts +2 -2
  46. package/src/ChartInternal/shape/arc.ts +2 -6
  47. package/src/ChartInternal/shape/bar.ts +10 -2
  48. package/src/config/Options/data/data.ts +3 -3
  49. package/src/config/Options/shape/line.ts +6 -1
  50. package/src/module/util.ts +3 -5
  51. package/src/scss/billboard.scss +3 -13
  52. package/src/scss/theme/datalab.scss +3 -7
  53. package/src/scss/theme/graph.scss +3 -2
  54. package/src/scss/theme/insight.scss +3 -2
  55. package/types/chart.d.ts +2 -2
  56. package/types/options.d.ts +3 -3
  57. package/types/types.d.ts +5 -2
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.2.0-next.5
8
+ * @version 3.2.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -144,7 +144,7 @@ var Plugin = /*#__PURE__*/function () {
144
144
  return Plugin;
145
145
  }();
146
146
 
147
- Plugin.version = "#3.2.0-next.5#";
147
+ Plugin.version = "#3.2.2#";
148
148
 
149
149
  /**
150
150
  * 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.2.0-next.5
8
+ * @version 3.2.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -268,7 +268,7 @@ var Plugin = /*#__PURE__*/function () {
268
268
  return Plugin;
269
269
  }();
270
270
 
271
- Plugin.version = "#3.2.0-next.5#";
271
+ Plugin.version = "#3.2.2#";
272
272
 
273
273
  /**
274
274
  * Copyright (c) 2021 ~ present NAVER Corp.
@@ -520,7 +520,7 @@ var Sparkline = /** @class */ (function (_super) {
520
520
  msg = "Contains non supported chart types.";
521
521
  }
522
522
  if (msg) {
523
- throw new Error("[Sparkline plugin] " + msg);
523
+ throw new Error("[Sparkline plugin] ".concat(msg));
524
524
  }
525
525
  };
526
526
  Sparkline.prototype.overrideInternals = function () {
@@ -587,7 +587,7 @@ var Sparkline = /** @class */ (function (_super) {
587
587
  var _this = this;
588
588
  if (bind === void 0) { bind = true; }
589
589
  if (this.$$.config.interaction_enabled) {
590
- var method_1 = (bind ? "add" : "remove") + "EventListener";
590
+ var method_1 = "".concat(bind ? "add" : "remove", "EventListener");
591
591
  this.element
592
592
  .forEach(function (el) {
593
593
  var svg = el.querySelector("svg");
@@ -639,11 +639,11 @@ var Sparkline = /** @class */ (function (_super) {
639
639
  }
640
640
  data.map(function (v) { return v.id; })
641
641
  .forEach(function (id, i) {
642
- var selector = "." + CLASS.target + "-" + id;
642
+ var selector = ".".concat(CLASS.target, "-").concat(id);
643
643
  var shape = $el.main.selectAll(selector);
644
644
  var svg = el[i].querySelector("svg");
645
645
  if (!svg) {
646
- el[i].innerHTML = svgWrapper + "</svg>";
646
+ el[i].innerHTML = "".concat(svgWrapper, "</svg>");
647
647
  svg = el[i].querySelector("svg");
648
648
  svg.__id = id;
649
649
  }
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.2.0-next.5
8
+ * @version 3.2.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -336,7 +336,7 @@ function parseDate(date) {
336
336
  }
337
337
  if (!parsedDate || isNaN(+parsedDate)) {
338
338
  console && console.error &&
339
- console.error("Failed to parse x '" + date + "' to Date object");
339
+ console.error("Failed to parse x '".concat(date, "' to Date object"));
340
340
  }
341
341
  return parsedDate;
342
342
  }
@@ -467,7 +467,7 @@ var Plugin = /*#__PURE__*/function () {
467
467
  return Plugin;
468
468
  }();
469
469
 
470
- Plugin.version = "#3.2.0-next.5#";
470
+ Plugin.version = "#3.2.2#";
471
471
 
472
472
  /**
473
473
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -749,9 +749,9 @@ var Elements = /** @class */ (function () {
749
749
  var xvCustom = this.xvCustom.bind($$);
750
750
  var yvCustom = this.yvCustom.bind($$);
751
751
  // Stanford-Lines
752
- var stanfordLine = main.select("." + CLASS.stanfordLines)
752
+ var stanfordLine = main.select(".".concat(CLASS.stanfordLines))
753
753
  .style("shape-rendering", "geometricprecision")
754
- .selectAll("." + CLASS.stanfordLine)
754
+ .selectAll(".".concat(CLASS.stanfordLine))
755
755
  .data(this.owner.config.lines);
756
756
  // exit
757
757
  stanfordLine.exit().transition()
@@ -764,7 +764,7 @@ var Elements = /** @class */ (function () {
764
764
  .style("opacity", "0");
765
765
  stanfordLineEnter
766
766
  .merge(stanfordLine)
767
- .attr("class", function (d) { return CLASS.stanfordLine + (d["class"] ? " " + d["class"] : ""); })
767
+ .attr("class", function (d) { return CLASS.stanfordLine + (d["class"] ? " ".concat(d["class"]) : ""); })
768
768
  .select("line")
769
769
  .transition()
770
770
  .duration(duration)
@@ -783,8 +783,8 @@ var Elements = /** @class */ (function () {
783
783
  var yvCustom = this.yvCustom.bind($$);
784
784
  var countPointsInRegion = this.owner.countEpochsInRegion.bind($$);
785
785
  // Stanford-Regions
786
- var stanfordRegion = main.select("." + CLASS.stanfordRegions)
787
- .selectAll("." + CLASS.stanfordRegion)
786
+ var stanfordRegion = main.select(".".concat(CLASS.stanfordRegions))
787
+ .selectAll(".".concat(CLASS.stanfordRegion))
788
788
  .data(this.owner.config.regions);
789
789
  // exit
790
790
  stanfordRegion.exit().transition()
@@ -801,7 +801,7 @@ var Elements = /** @class */ (function () {
801
801
  stanfordRegion = stanfordRegionEnter.merge(stanfordRegion);
802
802
  // update
803
803
  stanfordRegion
804
- .attr("class", function (d) { return CLASS.stanfordRegion + (d["class"] ? " " + d["class"] : ""); })
804
+ .attr("class", function (d) { return CLASS.stanfordRegion + (d["class"] ? " ".concat(d["class"]) : ""); })
805
805
  .select("polygon")
806
806
  .transition()
807
807
  .duration(duration)
@@ -885,7 +885,7 @@ var ColorScale = /** @class */ (function () {
885
885
  .attr("height", height)
886
886
  .attr("class", CLASS.colorScale);
887
887
  this.colorScale.append("g")
888
- .attr("transform", "translate(0, " + config.padding_top + ")")
888
+ .attr("transform", "translate(0, ".concat(config.padding_top, ")"))
889
889
  .selectAll("bars")
890
890
  .data(points)
891
891
  .enter()
@@ -916,7 +916,7 @@ var ColorScale = /** @class */ (function () {
916
916
  // Draw Axis
917
917
  var axis = this.colorScale.append("g")
918
918
  .attr("class", "legend axis")
919
- .attr("transform", "translate(" + barWidth + ",0)")
919
+ .attr("transform", "translate(".concat(barWidth, ",0)"))
920
920
  .call(legendAxis);
921
921
  if (scaleFormat === "pow10") {
922
922
  axis.selectAll(".tick text")
@@ -927,7 +927,7 @@ var ColorScale = /** @class */ (function () {
927
927
  .attr("dy", "-.7em") // https://bl.ocks.org/mbostock/6738229
928
928
  .text(function (d) { return Math.round(Math.log(d) / Math.LN10); });
929
929
  }
930
- this.colorScale.attr("transform", "translate(" + ($$.state.current.width - this.xForColorScale()) + ", 0)");
930
+ this.colorScale.attr("transform", "translate(".concat($$.state.current.width - this.xForColorScale(), ", 0)"));
931
931
  };
932
932
  ColorScale.prototype.xForColorScale = function () {
933
933
  return this.owner.config.padding_right +
@@ -1118,11 +1118,11 @@ var Stanford = /** @class */ (function (_super) {
1118
1118
  var config = this.$$.config;
1119
1119
  if (isEmpty(config.tooltip_contents)) {
1120
1120
  config.tooltip_contents = function (d, defaultTitleFormat, defaultValueFormat, color) {
1121
- var html = "<table class=\"" + CLASS$1.tooltip + "\"><tbody>";
1121
+ var html = "<table class=\"".concat(CLASS$1.tooltip, "\"><tbody>");
1122
1122
  d.forEach(function (v) {
1123
- html += "<tr>\n\t\t\t\t\t\t\t<th>" + defaultTitleFormat(config.data_x) + "</th>\n\t\t\t\t\t\t\t<th class=\"value\">" + defaultValueFormat(v.x) + "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>" + defaultTitleFormat(v.id) + "</th>\n\t\t\t\t\t\t\t<th class=\"value\">" + defaultValueFormat(v.value) + "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"" + CLASS$1.tooltipName + "-" + v.id + "\">\n\t\t\t\t\t\t\t<td class=\"name\"><span style=\"background-color:" + color(v) + "\"></span>" + defaultTitleFormat("Epochs") + "</td>\n\t\t\t\t\t\t\t<td class=\"value\">" + defaultValueFormat(v.epochs) + "</td>\n\t\t\t\t\t\t</tr>";
1123
+ html += "<tr>\n\t\t\t\t\t\t\t<th>".concat(defaultTitleFormat(config.data_x), "</th>\n\t\t\t\t\t\t\t<th class=\"value\">").concat(defaultValueFormat(v.x), "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>").concat(defaultTitleFormat(v.id), "</th>\n\t\t\t\t\t\t\t<th class=\"value\">").concat(defaultValueFormat(v.value), "</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class=\"").concat(CLASS$1.tooltipName, "-").concat(v.id, "\">\n\t\t\t\t\t\t\t<td class=\"name\"><span style=\"background-color:").concat(color(v), "\"></span>").concat(defaultTitleFormat("Epochs"), "</td>\n\t\t\t\t\t\t\t<td class=\"value\">").concat(defaultValueFormat(v.epochs), "</td>\n\t\t\t\t\t\t</tr>");
1124
1124
  });
1125
- return html + "</tbody></table>";
1125
+ return "".concat(html, "</tbody></table>");
1126
1126
  };
1127
1127
  }
1128
1128
  };
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.2.0-next.5
8
+ * @version 3.2.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -170,7 +170,7 @@ var Plugin = /*#__PURE__*/function () {
170
170
  return Plugin;
171
171
  }();
172
172
 
173
- Plugin.version = "#3.2.0-next.5#";
173
+ Plugin.version = "#3.2.2#";
174
174
 
175
175
  /**
176
176
  * Copyright (c) 2021 ~ present NAVER Corp.
@@ -410,7 +410,7 @@ function mergeObj(target) {
410
410
  function tplProcess(tpl, data) {
411
411
  var res = tpl;
412
412
  for (var x in data) {
413
- res = res.replace(new RegExp("{=" + x + "}", "g"), data[x]);
413
+ res = res.replace(new RegExp("{=".concat(x, "}"), "g"), data[x]);
414
414
  }
415
415
  return res;
416
416
  }
@@ -506,7 +506,7 @@ var TableView = /** @class */ (function (_super) {
506
506
  TableView.prototype.$init = function () {
507
507
  var _a;
508
508
  var _b = this.config, className = _b["class"], selector = _b.selector, style = _b.style;
509
- var element = document.querySelector(selector || "." + (className || defaultStyle["class"]));
509
+ var element = document.querySelector(selector || ".".concat(className || defaultStyle["class"]));
510
510
  if (!element) {
511
511
  var chart = this.$$.$el.chart.node();
512
512
  element = document.createElement("table");
@@ -552,11 +552,11 @@ var TableView = /** @class */ (function (_super) {
552
552
  });
553
553
  });
554
554
  rows.forEach(function (v) {
555
- tbody += "<tr>" + v.map(function (d, i) { return tplProcess(i ? tpl.tbody : tpl.tbodyHeader, {
555
+ tbody += "<tr>".concat(v.map(function (d, i) { return tplProcess(i ? tpl.tbody : tpl.tbodyHeader, {
556
556
  value: i === 0 ?
557
557
  config.categoryFormat.bind(_this)(d) :
558
558
  (isNumber(d) ? d.toLocaleString() : "")
559
- }); }).join("") + "</tr>";
559
+ }); }).join(""), "</tr>");
560
560
  });
561
561
  var rx = /<[^>]+><\/[^>]+>/g;
562
562
  var r = tplProcess(tpl.body, _assign(_assign({}, config), { title: config.title || $$.config.title_text || "", thead: thead, tbody: tbody })).replace(rx, "");
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.2.0-next.5
8
+ * @version 3.2.2
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -300,7 +300,7 @@ var Plugin = /*#__PURE__*/function () {
300
300
  return Plugin;
301
301
  }();
302
302
 
303
- Plugin.version = "#3.2.0-next.5#";
303
+ Plugin.version = "#3.2.2#";
304
304
 
305
305
  /**
306
306
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -453,8 +453,8 @@ var TextOverlap = /** @class */ (function (_super) {
453
453
  "middle" : (angle === 0 ? "start" : "end");
454
454
  this.style.display = polygonArea$1 < area ? "none" : "";
455
455
  this.setAttribute("text-anchor", txtAnchor);
456
- this.setAttribute("dy", "0." + (angle === 1 ? 71 : 35) + "em");
457
- this.setAttribute("transform", "translate(" + xTranslate + ", " + yTranslate + ")");
456
+ this.setAttribute("dy", "0.".concat(angle === 1 ? 71 : 35, "em"));
457
+ this.setAttribute("transform", "translate(".concat(xTranslate, ", ").concat(yTranslate, ")"));
458
458
  }
459
459
  i++;
460
460
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.2.0-next.5",
3
+ "version": "3.2.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",
@@ -31,7 +31,6 @@
31
31
  "build:production:analyzer": "cross-env ANALYZER=true npm run build:production",
32
32
  "build:packaged:analyzer": "cross-env ANALYZER=true npm run build:packaged",
33
33
  "build:plugin": "cross-env NODE_ENV=plugin webpack && cross-env NODE_ENV=plugin MODE=min webpack && cross-env NODE_ENV=plugin MODE=pkgd webpack",
34
- "_build:plugin": "cross-env NODE_ENV=plugin MODE=pkgd webpack",
35
34
  "release": "semantic-release",
36
35
  "lint": "npm run lint:types && eslint src --ext .ts",
37
36
  "lint:types": "dtslint --onlyTestTsNext types",
@@ -87,7 +86,7 @@
87
86
  "d3-dsv": "^3.0.1",
88
87
  "d3-ease": "^3.0.1",
89
88
  "d3-interpolate": "^3.0.1",
90
- "d3-scale": "^4.0.0",
89
+ "d3-scale": "^4.0.2",
91
90
  "d3-selection": "^3.0.0",
92
91
  "d3-shape": "^3.0.1",
93
92
  "d3-time-format": "^4.0.0",
@@ -95,34 +94,34 @@
95
94
  "d3-zoom": "^3.0.0"
96
95
  },
97
96
  "devDependencies": {
98
- "@babel/core": "^7.15.5",
99
- "@babel/eslint-parser": "^7.15.4",
100
- "@babel/plugin-proposal-class-properties": "^7.14.5",
101
- "@babel/plugin-proposal-object-rest-spread": "^7.15.6",
102
- "@babel/plugin-transform-runtime": "^7.15.0",
103
- "@babel/preset-env": "^7.15.6",
104
- "@babel/preset-typescript": "^7.15.0",
105
- "@babel/runtime": "^7.15.4",
106
- "@commitlint/cli": "^13.1.0",
107
- "@commitlint/config-conventional": "^13.1.0",
97
+ "@babel/core": "^7.16.0",
98
+ "@babel/eslint-parser": "^7.16.3",
99
+ "@babel/plugin-proposal-class-properties": "^7.16.0",
100
+ "@babel/plugin-proposal-object-rest-spread": "^7.16.0",
101
+ "@babel/plugin-transform-runtime": "^7.16.4",
102
+ "@babel/preset-env": "^7.16.4",
103
+ "@babel/preset-typescript": "^7.16.0",
104
+ "@babel/runtime": "^7.16.3",
105
+ "@commitlint/cli": "^15.0.0",
106
+ "@commitlint/config-conventional": "^15.0.0",
108
107
  "@rollup/plugin-babel": "^5.3.0",
109
- "@rollup/plugin-node-resolve": "^13.0.4",
108
+ "@rollup/plugin-node-resolve": "^13.0.6",
110
109
  "@rollup/plugin-replace": "^3.0.0",
111
- "@rollup/plugin-typescript": "^8.2.5",
112
- "@semantic-release/changelog": "^5.0.1",
113
- "@semantic-release/commit-analyzer": "^8.0.1",
114
- "@semantic-release/exec": "^5.0.0",
115
- "@semantic-release/git": "^9.0.1",
116
- "@semantic-release/npm": "^7.1.3",
117
- "@semantic-release/release-notes-generator": "^9.0.3",
118
- "@types/chai": "^4.2.21",
119
- "@types/d3": "^7.0.0",
110
+ "@rollup/plugin-typescript": "^8.3.0",
111
+ "@semantic-release/changelog": "^6.0.1",
112
+ "@semantic-release/commit-analyzer": "^9.0.1",
113
+ "@semantic-release/exec": "^6.0.2",
114
+ "@semantic-release/git": "^10.0.1",
115
+ "@semantic-release/npm": "^8.0.3",
116
+ "@semantic-release/release-notes-generator": "^10.0.2",
117
+ "@types/chai": "^4.2.22",
118
+ "@types/d3": "^7.1.0",
120
119
  "@types/mocha": "^9.0.0",
121
- "@types/sinon": "^10.0.2",
122
- "@typescript-eslint/eslint-plugin": "^4.31.1",
123
- "@typescript-eslint/parser": "^4.31.1",
120
+ "@types/sinon": "^10.0.6",
121
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
122
+ "@typescript-eslint/parser": "^5.4.0",
124
123
  "babel-helper-modules": "^6.0.0",
125
- "babel-loader": "^8.2.2",
124
+ "babel-loader": "^8.2.3",
126
125
  "babel-plugin-add-module-exports": "^1.0.4",
127
126
  "babel-plugin-minify-constant-folding": "^0.5.0",
128
127
  "babel-plugin-minify-dead-code-elimination": "^0.5.1",
@@ -136,29 +135,29 @@
136
135
  "chai": "^4.3.4",
137
136
  "clean-webpack-plugin": "^4.0.0",
138
137
  "cloc": "^2.8.0",
139
- "core-js": "^3.17.3",
138
+ "core-js": "^3.19.1",
140
139
  "coveralls": "^3.1.1",
141
140
  "cross-env": "^7.0.3",
142
- "css-loader": "^6.2.0",
143
- "css-minimizer-webpack-plugin": "^3.0.2",
141
+ "css-loader": "^6.5.1",
142
+ "css-minimizer-webpack-plugin": "^3.1.4",
144
143
  "d3-color": "^3.0.1",
145
144
  "d3-delaunay": "^6.0.2",
146
145
  "d3-format": "^3.0.1",
147
146
  "d3-polygon": "^3.0.1",
148
147
  "docdash": "^1.2.0",
149
- "dtslint": "^4.1.6",
150
- "eslint": "^7.32.0",
148
+ "dtslint": "^4.2.1",
149
+ "eslint": "^8.2.0",
151
150
  "eslint-config-naver": "^2.1.0",
152
- "eslint-plugin-import": "^2.24.2",
153
- "eslint-plugin-jsdoc": "^36.1.0",
154
- "eslint-webpack-plugin": "^3.0.1",
155
- "exports-loader": "^3.0.0",
151
+ "eslint-plugin-import": "^2.25.3",
152
+ "eslint-plugin-jsdoc": "^37.0.3",
153
+ "eslint-webpack-plugin": "^3.1.1",
154
+ "exports-loader": "^3.1.0",
156
155
  "hammer-simulator": "0.0.1",
157
- "husky": "^7.0.2",
156
+ "husky": "^7.0.4",
158
157
  "istanbul-instrumenter-loader": "^3.0.1",
159
- "istanbul-lib-instrument": "^5.0.2",
158
+ "istanbul-lib-instrument": "^5.1.0",
160
159
  "jsdoc": "^3.6.7",
161
- "karma": "^6.3.4",
160
+ "karma": "^6.3.9",
162
161
  "karma-chai": "^0.1.0",
163
162
  "karma-chrome-launcher": "^3.1.0",
164
163
  "karma-coverage-istanbul-reporter": "^3.0.3",
@@ -169,29 +168,29 @@
169
168
  "karma-sourcemap-loader": "^0.3.8",
170
169
  "karma-webpack": "^5.0.0",
171
170
  "lite-fixture": "^1.0.2",
172
- "mini-css-extract-plugin": "^2.3.0",
173
- "mocha": "^9.1.1",
171
+ "mini-css-extract-plugin": "^2.4.5",
172
+ "mocha": "^9.1.3",
174
173
  "node-sass": "^6.0.1",
175
174
  "regenerator-runtime": "^0.13.7",
176
- "rollup": "^2.56.3",
175
+ "rollup": "^2.60.0",
177
176
  "rollup-plugin-delete": "^2.0.0",
178
- "sass-loader": "^12.1.0",
179
- "semantic-release": "^17.4.7",
177
+ "sass-loader": "^12.3.0",
178
+ "semantic-release": "^18.0.0",
180
179
  "simulant": "^0.2.2",
181
- "sinon": "^11.1.2",
180
+ "sinon": "^12.0.1",
182
181
  "string-replace-loader": "^3.0.3",
183
- "style-loader": "^3.2.1",
184
- "terser-webpack-plugin": "^5.2.4",
182
+ "style-loader": "^3.3.1",
183
+ "terser-webpack-plugin": "^5.2.5",
185
184
  "tslib": "^2.3.1",
186
- "typescript": "^4.4.3",
187
- "webpack": "^5.52.1",
188
- "webpack-bundle-analyzer": "^4.4.2",
185
+ "typescript": "^4.5.2",
186
+ "webpack": "^5.64.1",
187
+ "webpack-bundle-analyzer": "^4.5.0",
189
188
  "webpack-clean": "^1.2.5",
190
- "webpack-cli": "^4.8.0",
189
+ "webpack-cli": "^4.9.1",
191
190
  "webpack-common-shake": "^2.1.0",
192
- "webpack-dev-server": "^4.2.1",
191
+ "webpack-dev-server": "^4.5.0",
193
192
  "webpack-merge": "^5.8.0",
194
- "webpackbar": "^5.0.0-3",
193
+ "webpackbar": "^5.0.2",
195
194
  "write-file-webpack-plugin": "^4.5.1"
196
195
  }
197
196
  }
@@ -127,6 +127,13 @@ export default {
127
127
  * value: ["upload", "download"]
128
128
  * }
129
129
  * });
130
+ * @example
131
+ * chart.load({
132
+ * json: {
133
+ * data1:[30, 20, 50, 40, 60, 50],
134
+ * data2:[200, 130, 90, 240, 130, 220],
135
+ * }
136
+ * });
130
137
  */
131
138
  load(args): void {
132
139
  const $$ = this.internal;
@@ -35,22 +35,25 @@ function withinRange(domain: (number|Date)[], current, range: number[]): boolean
35
35
  * // Zoom to specified domain range
36
36
  * chart.zoom([10, 20]);
37
37
  *
38
+ * // For timeseries, the domain value can be string, but the format should match with the 'data.xFormat' option.
39
+ * chart.zoom(["2021-02-03", "2021-02-08"]);
40
+ *
38
41
  * // Get the current zoomed domain range
39
42
  * chart.zoom();
40
43
  */
41
- const zoom = function(domainValue?: (number|Date)[]): (number|Date)[]|undefined {
44
+ const zoom = function(domainValue?: (Date|number|string)[]): (Date|number)[]|undefined {
42
45
  const $$ = this.internal;
43
- const {$el, config, org, scale} = $$;
46
+ const {$el, axis, config, org, scale} = $$;
44
47
  const isRotated = config.axis_rotated;
45
- const isCategorized = $$.axis.isCategorized();
48
+ const isCategorized = axis.isCategorized();
46
49
  let domain = domainValue;
47
50
 
48
51
  if (config.zoom_enabled && domain) {
49
- if ($$.axis.isTimeSeries()) {
52
+ if (axis.isTimeSeries()) {
50
53
  domain = domain.map(x => parseDate.bind($$)(x));
51
54
  }
52
55
 
53
- if (withinRange(domain, $$.getZoomDomain(true), $$.getZoomDomain())) {
56
+ if (withinRange(domain as (number|Date)[], $$.getZoomDomain(true), $$.getZoomDomain())) {
54
57
  if (isCategorized) {
55
58
  domain = domain.map((v, i) => Number(v) + (i === 0 ? 0 : 1));
56
59
  }
@@ -89,7 +92,7 @@ const zoom = function(domainValue?: (number|Date)[]): (number|Date)[]|undefined
89
92
  scale.zoom.domain() : scale.x.orgDomain();
90
93
  }
91
94
 
92
- return domain;
95
+ return domain as (Date|number)[];
93
96
  };
94
97
 
95
98
  extend(zoom, {
@@ -631,8 +631,8 @@ class Axis {
631
631
  const dummy = chart.append("svg")
632
632
  .style("visibility", "hidden")
633
633
  .style("position", "fixed")
634
- .style("top", "0px")
635
- .style("left", "0px");
634
+ .style("top", "0")
635
+ .style("left", "0");
636
636
 
637
637
  axis.create(dummy);
638
638
 
@@ -79,7 +79,7 @@ export default class ChartInternal {
79
79
  subY: null,
80
80
  subY2: null,
81
81
  zoom: null
82
- }
82
+ };
83
83
 
84
84
  // original values
85
85
  public org = {
@@ -412,7 +412,7 @@ export default {
412
412
  return target;
413
413
  },
414
414
 
415
- mapToIds(targets) {
415
+ mapToIds(targets): string[] {
416
416
  return targets.map(d => d.id);
417
417
  },
418
418
 
@@ -406,15 +406,33 @@ export default {
406
406
 
407
407
  state.event = event;
408
408
 
409
+ if (!d) {
410
+ return;
411
+ }
412
+
413
+ let {index} = d;
414
+ const stepType = config.line_step_type;
415
+
416
+ // tooltip position match for step-before & step-after
417
+ if (config.line_step_tooltipMatch && $$.hasType("step") && /^step\-(before|after)$/.test(stepType)) {
418
+ const scale = $$.scale.zoom || $$.scale.x;
419
+ const xs = $$.axis.xs[index];
420
+ const inverted = scale.invert(getPointer(event, this)[0]);
421
+
422
+ if (stepType === "step-after" && inverted < xs) {
423
+ index -= 1;
424
+ } else if (stepType === "step-before" && inverted > xs) {
425
+ index += 1;
426
+ }
427
+ }
428
+
409
429
  // do nothing while dragging/flowing
410
430
  if (state.dragging || state.flowing || $$.hasArcType() ||
411
- !d || (config.tooltip_grouped && d && d.index === eventReceiver.currentIdx)
431
+ (config.tooltip_grouped && index === eventReceiver.currentIdx)
412
432
  ) {
413
433
  return;
414
434
  }
415
435
 
416
- const {index} = d;
417
-
418
436
  if (index !== eventReceiver.currentIdx) {
419
437
  $$.setOverOut(false, eventReceiver.currentIdx);
420
438
  eventReceiver.currentIdx = index;
@@ -210,7 +210,7 @@ export default {
210
210
 
211
211
  if (startEvent?.type.indexOf("touch") > -1) {
212
212
  startEvent = startEvent.changedTouches[0];
213
- e = e.changedTouches[0];
213
+ e = e?.changedTouches?.[0];
214
214
  }
215
215
 
216
216
  // if click, do nothing. otherwise, click interaction will be canceled.
@@ -19,41 +19,39 @@ export default {
19
19
  if (dataGroups.length > 0) {
20
20
  const hasValue = $$[`has${isMin ? "Negative" : "Positive"}ValueInTargets`](targets);
21
21
 
22
- for (let j = 0, idsInGroup; (idsInGroup = dataGroups[j]); j++) {
22
+ dataGroups.forEach(groupIds => {
23
23
  // Determine baseId
24
- idsInGroup = idsInGroup.filter(v => ids.indexOf(v) >= 0);
24
+ const idsInGroup = groupIds
25
+ .filter(v => ids.indexOf(v) >= 0);
25
26
 
26
- if (idsInGroup.length === 0) {
27
- continue;
28
- }
29
-
30
- const baseId = idsInGroup[0];
31
- const baseAxisId = axis.getId(baseId);
32
-
33
- // Initialize base value. Set to 0 if not match with the condition
34
- if (hasValue && ys[baseId]) {
35
- ys[baseId] = ys[baseId].map(v => (
36
- (isMin ? v < 0 : v > 0) ? v : 0
37
- ));
38
- }
27
+ if (idsInGroup.length) {
28
+ const baseId = idsInGroup[0];
29
+ const baseAxisId = axis.getId(baseId);
39
30
 
40
- for (let k = 1, id; (id = idsInGroup[k]); k++) {
41
- if (!ys[id]) {
42
- continue;
31
+ // Initialize base value. Set to 0 if not match with the condition
32
+ if (hasValue && ys[baseId]) {
33
+ ys[baseId] = ys[baseId]
34
+ .map(v => ((isMin ? v < 0 : v > 0) ? v : 0));
43
35
  }
44
36
 
45
- const axisId = axis.getId(id);
46
-
47
- ys[id].forEach((v, i) => {
48
- const val = +v;
49
- const meetCondition = isMin ? val > 0 : val < 0;
50
-
51
- if (axisId === baseAxisId && !(hasValue && meetCondition)) {
52
- ys[baseId][i] += val;
53
- }
54
- });
37
+ idsInGroup
38
+ .filter((v, i) => i > 0)
39
+ .forEach(id => {
40
+ if (ys[id]) {
41
+ const axisId = axis.getId(id);
42
+
43
+ ys[id].forEach((v, i) => {
44
+ const val = +v;
45
+ const meetCondition = isMin ? val > 0 : val < 0;
46
+
47
+ if (axisId === baseAxisId && !(hasValue && meetCondition)) {
48
+ ys[baseId][i] += val;
49
+ }
50
+ });
51
+ }
52
+ });
55
53
  }
56
- }
54
+ });
57
55
  }
58
56
 
59
57
  return getMinMax(type, Object.keys(ys).map(key => getMinMax(type, ys[key])));
@@ -622,8 +622,9 @@ export default {
622
622
  .attr("href", (data, idx, selection) => {
623
623
  const node = selection[idx];
624
624
  const nodeName = node.nodeName.toLowerCase();
625
+ const id = $$.getTargetSelectorSuffix(data);
625
626
 
626
- return nodeName === "use" ? `#${state.datetimeId}-point-${data}` : undefined;
627
+ return nodeName === "use" ? `#${state.datetimeId}-point${id}` : undefined;
627
628
  });
628
629
  } else {
629
630
  l.append("line")