billboard.js 3.5.0-next.1 → 3.5.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 (81) hide show
  1. package/README.md +5 -2
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +795 -461
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +1968 -1320
  7. package/dist/billboard.pkgd.min.js +3 -3
  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 +72 -27
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +72 -27
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +72 -27
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +72 -27
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1172 -858
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1243 -884
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1244 -885
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1245 -886
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1246 -887
  23. package/dist/theme/datalab.css +1 -1
  24. package/dist/theme/datalab.min.css +1 -1
  25. package/dist/theme/graph.css +1 -1
  26. package/dist/theme/graph.min.css +1 -1
  27. package/dist/theme/insight.css +1 -1
  28. package/dist/theme/insight.min.css +1 -1
  29. package/dist-esm/billboard.js +662 -368
  30. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -3
  32. package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -3
  33. package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -3
  34. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -3
  35. package/package.json +26 -26
  36. package/src/Chart/api/chart.ts +4 -1
  37. package/src/Chart/api/data.ts +2 -2
  38. package/src/Chart/api/flow.ts +125 -115
  39. package/src/Chart/api/selection.ts +1 -1
  40. package/src/ChartInternal/Axis/AxisRenderer.ts +1 -1
  41. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  42. package/src/ChartInternal/ChartInternal.ts +39 -18
  43. package/src/ChartInternal/data/IData.ts +2 -2
  44. package/src/ChartInternal/data/convert.helper.ts +226 -0
  45. package/src/ChartInternal/data/convert.ts +44 -210
  46. package/src/ChartInternal/data/data.ts +1 -1
  47. package/src/ChartInternal/data/load.ts +5 -4
  48. package/src/ChartInternal/interactions/drag.ts +1 -1
  49. package/src/ChartInternal/internals/class.ts +1 -1
  50. package/src/ChartInternal/internals/color.ts +39 -41
  51. package/src/ChartInternal/internals/domain.ts +1 -1
  52. package/src/ChartInternal/internals/format.ts +1 -1
  53. package/src/ChartInternal/internals/legend.ts +21 -6
  54. package/src/ChartInternal/internals/region.ts +1 -1
  55. package/src/ChartInternal/internals/scale.ts +1 -1
  56. package/src/ChartInternal/internals/size.axis.ts +1 -1
  57. package/src/ChartInternal/internals/style.ts +54 -0
  58. package/src/ChartInternal/internals/text.ts +6 -6
  59. package/src/ChartInternal/internals/tooltip.ts +1 -1
  60. package/src/ChartInternal/shape/arc.ts +6 -5
  61. package/src/ChartInternal/shape/area.ts +16 -8
  62. package/src/ChartInternal/shape/bar.ts +13 -10
  63. package/src/ChartInternal/shape/line.ts +3 -2
  64. package/src/ChartInternal/shape/point.ts +16 -10
  65. package/src/ChartInternal/shape/polar.ts +2 -2
  66. package/src/ChartInternal/shape/shape.ts +2 -2
  67. package/src/Plugin/sparkline/index.ts +1 -1
  68. package/src/Plugin/textoverlap/index.ts +5 -2
  69. package/src/config/Options/Options.ts +2 -0
  70. package/src/config/Options/common/boost.ts +31 -0
  71. package/src/config/Options/data/data.ts +1 -1
  72. package/src/config/Options/shape/area.ts +6 -1
  73. package/src/config/Store/Element.ts +1 -1
  74. package/src/config/Store/State.ts +3 -0
  75. package/src/module/Cache.ts +1 -1
  76. package/src/module/browser.ts +2 -1
  77. package/src/module/generator.ts +8 -13
  78. package/src/module/util.ts +41 -1
  79. package/src/module/worker.ts +101 -0
  80. package/types/axis.d.ts +2 -2
  81. package/types/options.d.ts +24 -0
package/dist/billboard.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.5.0-next.1
8
+ * @version 3.5.1
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -241,12 +241,13 @@ win.requestIdleCallback = win.requestIdleCallback || function (cb) {
241
241
  _newArrowCheck(this, _this);
242
242
 
243
243
  return setTimeout(cb, 1);
244
- }.bind(undefined);
244
+ }.bind(undefined); // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
245
+
245
246
 
246
- win.cancelIdleCallback = win.cancelIdleCallback || function (id) {
247
+ win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
247
248
  _newArrowCheck(this, _this);
248
249
 
249
- return clearTimeout(id);
250
+ return setTimeout(cb, 1);
250
251
  }.bind(undefined);
251
252
 
252
253
  var browser_doc = win == null ? void 0 : win.document;
@@ -888,6 +889,29 @@ var toArray = function (v) {
888
889
 
889
890
  return [].slice.call(v);
890
891
  }.bind(undefined);
892
+ /**
893
+ * Add CSS rules
894
+ * @param {object} style Style object
895
+ * @param {string} selector Selector string
896
+ * @param {Array} prop Prps arrary
897
+ * @returns {number} Newely added rule index
898
+ * @private
899
+ */
900
+
901
+
902
+ function addCssRules(style, selector, prop) {
903
+ var _this9 = this,
904
+ rootSelctor = style.rootSelctor,
905
+ sheet = style.sheet,
906
+ getSelector = function (s) {
907
+ _newArrowCheck(this, _this9);
908
+
909
+ return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
910
+ }.bind(this),
911
+ rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
912
+
913
+ return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
914
+ }
891
915
  /**
892
916
  * Get css rules for specified stylesheets
893
917
  * @param {Array} styleSheets The stylesheets to get the rules from
@@ -897,11 +921,11 @@ var toArray = function (v) {
897
921
 
898
922
 
899
923
  function getCssRules(styleSheets) {
900
- var _this9 = this,
924
+ var _this10 = this,
901
925
  rules = [];
902
926
 
903
927
  styleSheets.forEach(function (sheet) {
904
- _newArrowCheck(this, _this9);
928
+ _newArrowCheck(this, _this10);
905
929
 
906
930
  try {
907
931
  if (sheet.cssRules && sheet.cssRules.length) {
@@ -942,16 +966,16 @@ function getTranslation(node) {
942
966
 
943
967
 
944
968
  function getUnique(data) {
945
- var _this10 = this,
969
+ var _this11 = this,
946
970
  isDate = data[0] instanceof Date,
947
971
  d = (isDate ? data.map(Number) : data).filter(function (v, i, self) {
948
- _newArrowCheck(this, _this10);
972
+ _newArrowCheck(this, _this11);
949
973
 
950
974
  return self.indexOf(v) === i;
951
975
  }.bind(this));
952
976
 
953
977
  return isDate ? d.map(function (v) {
954
- _newArrowCheck(this, _this10);
978
+ _newArrowCheck(this, _this11);
955
979
 
956
980
  return new Date(v);
957
981
  }.bind(this)) : d;
@@ -965,10 +989,10 @@ function getUnique(data) {
965
989
 
966
990
 
967
991
  function mergeArray(arr) {
968
- var _this11 = this;
992
+ var _this12 = this;
969
993
 
970
994
  return arr && arr.length ? arr.reduce(function (p, c) {
971
- _newArrowCheck(this, _this11);
995
+ _newArrowCheck(this, _this12);
972
996
 
973
997
  return p.concat(c);
974
998
  }.bind(this)) : [];
@@ -983,7 +1007,7 @@ function mergeArray(arr) {
983
1007
 
984
1008
 
985
1009
  function mergeObj(target) {
986
- for (var _this12 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
1010
+ for (var _this13 = this, _len4 = arguments.length, objectN = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
987
1011
  objectN[_key4 - 1] = arguments[_key4];
988
1012
  }
989
1013
 
@@ -995,7 +1019,7 @@ function mergeObj(target) {
995
1019
 
996
1020
  if (isObject(target) && isObject(source)) {
997
1021
  Object.keys(source).forEach(function (key) {
998
- _newArrowCheck(this, _this12);
1022
+ _newArrowCheck(this, _this13);
999
1023
 
1000
1024
  var value = source[key];
1001
1025
 
@@ -1020,7 +1044,7 @@ function mergeObj(target) {
1020
1044
 
1021
1045
 
1022
1046
  function sortValue(data, isAsc) {
1023
- var _this13 = this;
1047
+ var _this14 = this;
1024
1048
 
1025
1049
  if (isAsc === void 0) {
1026
1050
  isAsc = !0;
@@ -1030,24 +1054,24 @@ function sortValue(data, isAsc) {
1030
1054
 
1031
1055
  if (data[0] instanceof Date) {
1032
1056
  fn = isAsc ? function (a, b) {
1033
- _newArrowCheck(this, _this13);
1057
+ _newArrowCheck(this, _this14);
1034
1058
 
1035
1059
  return a - b;
1036
1060
  }.bind(this) : function (a, b) {
1037
- _newArrowCheck(this, _this13);
1061
+ _newArrowCheck(this, _this14);
1038
1062
 
1039
1063
  return b - a;
1040
1064
  }.bind(this);
1041
1065
  } else {
1042
1066
  if (isAsc && !data.every(isNaN)) {
1043
1067
  fn = function (a, b) {
1044
- _newArrowCheck(this, _this13);
1068
+ _newArrowCheck(this, _this14);
1045
1069
 
1046
1070
  return a - b;
1047
1071
  }.bind(this);
1048
1072
  } else if (!isAsc) {
1049
1073
  fn = function (a, b) {
1050
- _newArrowCheck(this, _this13);
1074
+ _newArrowCheck(this, _this14);
1051
1075
 
1052
1076
  return a > b && -1 || a < b && 1 || a === b && 0;
1053
1077
  }.bind(this);
@@ -1066,9 +1090,9 @@ function sortValue(data, isAsc) {
1066
1090
 
1067
1091
 
1068
1092
  function getMinMax(type, data) {
1069
- var _this14 = this,
1093
+ var _this15 = this,
1070
1094
  res = data.filter(function (v) {
1071
- _newArrowCheck(this, _this14);
1095
+ _newArrowCheck(this, _this15);
1072
1096
 
1073
1097
  return notEmpty(v);
1074
1098
  }.bind(this));
@@ -1113,12 +1137,12 @@ var getRange = function (start, end, step) {
1113
1137
  }.bind(undefined),
1114
1138
  emulateEvent = {
1115
1139
  mouse: function () {
1116
- var _this15 = this;
1140
+ var _this16 = this;
1117
1141
 
1118
1142
  _newArrowCheck(this, util_this);
1119
1143
 
1120
1144
  var getParams = function () {
1121
- _newArrowCheck(this, _this15);
1145
+ _newArrowCheck(this, _this16);
1122
1146
 
1123
1147
  return {
1124
1148
  bubbles: !1,
@@ -1138,7 +1162,7 @@ var getRange = function (start, end, step) {
1138
1162
  params = getParams();
1139
1163
  }
1140
1164
 
1141
- _newArrowCheck(this, _this15);
1165
+ _newArrowCheck(this, _this16);
1142
1166
 
1143
1167
  el.dispatchEvent(new MouseEvent(eventType, params));
1144
1168
  }.bind(this);
@@ -1149,7 +1173,7 @@ var getRange = function (start, end, step) {
1149
1173
  params = getParams();
1150
1174
  }
1151
1175
 
1152
- _newArrowCheck(this, _this15);
1176
+ _newArrowCheck(this, _this16);
1153
1177
 
1154
1178
  var mouseEvent = browser_doc.createEvent("MouseEvent"); // https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
1155
1179
 
@@ -1250,7 +1274,7 @@ function isTabVisible() {
1250
1274
 
1251
1275
 
1252
1276
  function convertInputType(mouse, touch) {
1253
- var _this16 = this,
1277
+ var _this17 = this,
1254
1278
  DocumentTouch = win.DocumentTouch,
1255
1279
  matchMedia = win.matchMedia,
1256
1280
  navigator = win.navigator,
@@ -1279,13 +1303,34 @@ function convertInputType(mouse, touch) {
1279
1303
 
1280
1304
 
1281
1305
  var hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some(function (v) {
1282
- _newArrowCheck(this, _this16);
1306
+ _newArrowCheck(this, _this17);
1283
1307
 
1284
1308
  return matchMedia == null ? void 0 : matchMedia("(" + v + ")").matches;
1285
1309
  }.bind(this)); // fallback to 'mouse' if no input type is detected.
1286
1310
 
1287
1311
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
1288
1312
  }
1313
+ /**
1314
+ * Run function until given condition function return true
1315
+ * @param {Function} fn Function to be executed when condition is true
1316
+ * @param {Function} conditionFn Condition function to check if condition is true
1317
+ * @private
1318
+ */
1319
+
1320
+
1321
+ function runUntil(fn, conditionFn) {
1322
+ var _this18 = this;
1323
+
1324
+ if (conditionFn() === !1) {
1325
+ win.requestAnimationFrame(function () {
1326
+ _newArrowCheck(this, _this18);
1327
+
1328
+ return runUntil(fn, conditionFn);
1329
+ }.bind(this));
1330
+ } else {
1331
+ fn();
1332
+ }
1333
+ }
1289
1334
  ;// CONCATENATED MODULE: ./src/module/error.ts
1290
1335
 
1291
1336
 
@@ -1629,6 +1674,8 @@ var State = function () {
1629
1674
  xAxisHeight: 0,
1630
1675
  hasAxis: !1,
1631
1676
  hasRadar: !1,
1677
+ // for data CSS rule index (used when boost.useCssRule is true)
1678
+ cssRule: {},
1632
1679
  current: {
1633
1680
  // chart whole dimension
1634
1681
  width: 0,
@@ -2182,6 +2229,39 @@ var Store = /*#__PURE__*/function () {
2182
2229
  */
2183
2230
  regions: []
2184
2231
  });
2232
+ ;// CONCATENATED MODULE: ./src/config/Options/common/boost.ts
2233
+ /**
2234
+ * Copyright (c) 2017 ~ present NAVER Corp.
2235
+ * billboard.js project is licensed under the MIT license
2236
+ */
2237
+
2238
+ /**
2239
+ * boost config options
2240
+ */
2241
+ /* harmony default export */ var boost = ({
2242
+ /**
2243
+ * Set boost options
2244
+ * @name boost
2245
+ * @memberof Options
2246
+ * @type {object}
2247
+ * @property {object} boost boost object
2248
+ * @property {boolean} [boost.useCssRule=false] Avoid setting inline styles for each shape elements.
2249
+ * - **NOTE:**
2250
+ * - Will append &lt;style> to the head tag and will add shpes' CSS rules dynamically.
2251
+ * - For now, covers colors related properties (fill, stroke, etc.) only.
2252
+ * @property {boolean} [boost.useWorker=false] Use Web Worker as possible for processing.
2253
+ * - **NOTE:**
2254
+ * - For now, only applies for data conversion at the initial time.
2255
+ * - As of Web Worker's async nature, handling chart instance synchrously is not recommended.
2256
+ * @example
2257
+ * boost: {
2258
+ * useCssRule: true,
2259
+ * useWorker: false
2260
+ * }
2261
+ */
2262
+ boost_useCssRule: !1,
2263
+ boost_useWorker: !1
2264
+ });
2185
2265
  ;// CONCATENATED MODULE: ./src/config/Options/data/data.ts
2186
2266
 
2187
2267
 
@@ -3589,6 +3669,7 @@ function Options_objectSpread(target) { for (var i = 1, source; i < arguments.le
3589
3669
 
3590
3670
 
3591
3671
 
3672
+
3592
3673
  /**
3593
3674
  * Class to set options on generating chart.
3594
3675
  * - It's instantiated internally, not exposed for public.
@@ -3608,7 +3689,7 @@ var Options = /*#__PURE__*/function () {
3608
3689
  };
3609
3690
 
3610
3691
  function Options() {
3611
- return deepClone(main, data, color, interaction, legend, title, tooltip, Options.data);
3692
+ return deepClone(main, boost, data, color, interaction, legend, title, tooltip, Options.data);
3612
3693
  }
3613
3694
 
3614
3695
  return Options;
@@ -3848,12 +3929,13 @@ function generateResize(option) {
3848
3929
  function generateWait() {
3849
3930
  var transitionsToWait = [],
3850
3931
  f = function (selection, callback) {
3851
- var timer;
3932
+ var _this5 = this;
3933
+
3852
3934
  /**
3853
3935
  * Check if transition is complete
3936
+ * @returns {boolean} Whether transition is complete
3854
3937
  * @private
3855
3938
  */
3856
-
3857
3939
  function loop() {
3858
3940
  var done = 0;
3859
3941
 
@@ -3876,16 +3958,14 @@ function generateWait() {
3876
3958
  }
3877
3959
  }
3878
3960
 
3879
- timer && generator_clearTimeout(timer);
3880
-
3881
- if (done === transitionsToWait.length) {
3882
- callback == null ? void 0 : callback();
3883
- } else {
3884
- timer = generator_setTimeout(loop, 50);
3885
- }
3961
+ return done === transitionsToWait.length;
3886
3962
  }
3887
3963
 
3888
- loop();
3964
+ runUntil(function () {
3965
+ _newArrowCheck(this, _this5);
3966
+
3967
+ callback == null ? void 0 : callback();
3968
+ }.bind(this), loop);
3889
3969
  }; // 'f' is called as selection.call(f, ...);
3890
3970
 
3891
3971
 
@@ -3895,199 +3975,188 @@ function generateWait() {
3895
3975
 
3896
3976
  return f;
3897
3977
  }
3898
- // EXTERNAL MODULE: external {"commonjs":"d3-dsv","commonjs2":"d3-dsv","amd":"d3-dsv","root":"d3"}
3899
- var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_require__(5);
3900
- ;// CONCATENATED MODULE: ./src/ChartInternal/data/convert.ts
3901
-
3902
-
3978
+ ;// CONCATENATED MODULE: ./src/module/worker.ts
3903
3979
  /**
3904
3980
  * Copyright (c) 2017 ~ present NAVER Corp.
3905
3981
  * billboard.js project is licensed under the MIT license
3906
3982
  */
3983
+ // Store blob in memory
3907
3984
 
3908
-
3985
+ var blob = {};
3909
3986
  /**
3910
- * Data convert
3911
- * @memberof ChartInternal
3987
+ * Get Object URL
3988
+ * @param {Function} fn Function to be executed in worker
3989
+ * @param {Array} depsFn Dependency functions to run given function(fn).
3990
+ * @returns {string}
3912
3991
  * @private
3913
3992
  */
3914
3993
 
3915
- /* harmony default export */ var convert = ({
3916
- /**
3917
- * Convert data according its type
3918
- * @param {object} args data object
3919
- * @param {Function} [callback] callback for url(XHR) type loading
3920
- * @returns {object}
3921
- * @private
3922
- */
3923
- convertData: function convertData(args, callback) {
3924
- var _this = this,
3925
- data;
3994
+ function getObjectURL(fn, depsFn) {
3995
+ var fnString = fn.toString(),
3996
+ key = fnString.replace(/(function|[\s\W\n])/g, "").substring(0, 15);
3926
3997
 
3927
- if (args.bindto) {
3928
- data = {};
3929
- ["url", "mimeType", "headers", "keys", "json", "keys", "rows", "columns"].forEach(function (v) {
3930
- _newArrowCheck(this, _this);
3998
+ if (!(key in blob)) {
3999
+ var _depsFn$map$join;
3931
4000
 
3932
- var key = "data_" + v;
4001
+ // Web Worker body
4002
+ blob[key] = new win.Blob([((_depsFn$map$join = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _depsFn$map$join : "") + "\n\n\t\t\tself.onmessage=function({data}) {\n\t\t\t\tconst result = (" + fnString + ").apply(null, data);\n\t\t\t\tself.postMessage(result);\n\t\t\t};"], {
4003
+ type: "text/javascript"
4004
+ });
4005
+ }
3933
4006
 
3934
- if (key in args) {
3935
- data[v] = args[key];
3936
- }
3937
- }.bind(this));
3938
- } else {
3939
- data = args;
3940
- }
4007
+ return win.URL.createObjectURL(blob[key]);
4008
+ }
4009
+ /**
4010
+ * Create and run on Web Worker
4011
+ * @param {boolean} useWorker Use Web Worker
4012
+ * @param {Function} fn Function to be executed in worker
4013
+ * @param {Function} callback Callback function to receive result from worker
4014
+ * @param {Array} depsFn Dependency functions to run given function(fn).
4015
+ * @returns {object}
4016
+ * @example
4017
+ * const worker = runWorker(function(arg) {
4018
+ * // do some tasks...
4019
+ * console.log("param:", A(arg));
4020
+ *
4021
+ * return 1234;
4022
+ * }, function(data) {
4023
+ * // callback after worker is done
4024
+ * console.log("result:", data);
4025
+ * },
4026
+ * [function A(){}]
4027
+ * );
4028
+ *
4029
+ * worker(11111);
4030
+ * @private
4031
+ */
3941
4032
 
3942
- if (data.url && callback) {
3943
- this.convertUrlToData(data.url, data.mimeType, data.headers, data.keys, callback);
3944
- } else if (data.json) {
3945
- data = this.convertJsonToData(data.json, data.keys);
3946
- } else if (data.rows) {
3947
- data = this.convertRowsToData(data.rows);
3948
- } else if (data.columns) {
3949
- data = this.convertColumnsToData(data.columns);
3950
- } else if (args.bindto) {
3951
- throw Error("url or json or rows or columns is required.");
3952
- }
3953
4033
 
3954
- return isArray(data) && data;
3955
- },
4034
+ function runWorker(useWorker, fn, callback, depsFn) {
4035
+ if (useWorker === void 0) {
4036
+ useWorker = !0;
4037
+ }
3956
4038
 
3957
- /**
3958
- * Convert URL data
3959
- * @param {string} url Remote URL
3960
- * @param {string} mimeType MIME type string: json | csv | tsv
3961
- * @param {object} headers Header object
3962
- * @param {object} keys Key object
3963
- * @param {Function} done Callback function
3964
- * @private
3965
- */
3966
- convertUrlToData: function convertUrlToData(url, mimeType, headers, keys, done) {
3967
- var _this2 = this;
4039
+ var runFn;
3968
4040
 
3969
- if (mimeType === void 0) {
3970
- mimeType = "csv";
3971
- }
4041
+ if (win.Worker && useWorker) {
4042
+ var src = getObjectURL(fn, depsFn),
4043
+ worker = new win.Worker(src);
3972
4044
 
3973
- var req = new XMLHttpRequest();
3974
- req.open("GET", url);
4045
+ runFn = function () {
4046
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
4047
+ args[_key] = arguments[_key];
4048
+ }
3975
4049
 
3976
- if (headers) {
3977
- Object.keys(headers).forEach(function (key) {
3978
- _newArrowCheck(this, _this2);
4050
+ // trigger worker
4051
+ worker.postMessage(args); // listen worker
3979
4052
 
3980
- req.setRequestHeader(key, headers[key]);
3981
- }.bind(this));
3982
- }
4053
+ worker.onmessage = function (e) {
4054
+ // release object URL from memory
4055
+ win.URL.revokeObjectURL(src);
4056
+ return callback(e.data);
4057
+ }; // handle error
3983
4058
 
3984
- req.onreadystatechange = function () {
3985
- _newArrowCheck(this, _this2);
3986
4059
 
3987
- if (req.readyState === 4) {
3988
- if (req.status === 200) {
3989
- var response = req.responseText;
3990
- response && done.call(this, this["convert" + capitalize(mimeType) + "ToData"](mimeType === "json" ? JSON.parse(response) : response, keys));
3991
- } else {
3992
- throw new Error(url + ": Something went wrong loading!");
3993
- }
3994
- }
3995
- }.bind(this);
4060
+ worker.onerror = function (e) {
4061
+ console.error(e);
4062
+ }; // return new Promise((resolve, reject) => {
4063
+ // worker.onmessage = ({data}) => resolve(data);
4064
+ // worker.onerror = reject;
4065
+ // });
3996
4066
 
3997
- req.send();
3998
- },
4067
+ };
4068
+ } else {
4069
+ runFn = function () {
4070
+ var res = fn.apply(void 0, arguments);
4071
+ callback(res);
4072
+ };
4073
+ }
3999
4074
 
4000
- /**
4001
- * Convert CSV/TSV data
4002
- * @param {object} parser Parser object
4003
- * @param {object} xsv Data
4004
- * @private
4005
- * @returns {object}
4006
- */
4007
- convertCsvTsvToData: function convertCsvTsvToData(parser, xsv) {
4008
- var _this3 = this,
4009
- rows = parser.rows(xsv),
4010
- d;
4075
+ return runFn;
4076
+ }
4077
+ // EXTERNAL MODULE: external {"commonjs":"d3-dsv","commonjs2":"d3-dsv","amd":"d3-dsv","root":"d3"}
4078
+ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_require__(5);
4079
+ ;// CONCATENATED MODULE: ./src/ChartInternal/data/convert.helper.ts
4011
4080
 
4012
- if (rows.length === 1) {
4013
- d = [{}];
4014
- rows[0].forEach(function (id) {
4015
- _newArrowCheck(this, _this3);
4016
4081
 
4017
- d[0][id] = null;
4018
- }.bind(this));
4019
- } else {
4020
- d = parser.parse(xsv);
4021
- }
4082
+ /**
4083
+ * Copyright (c) 2017 ~ present NAVER Corp.
4084
+ * billboard.js project is licensed under the MIT license
4085
+ */
4022
4086
 
4023
- return d;
4024
- },
4025
- convertCsvToData: function convertCsvToData(xsv) {
4026
- return this.convertCsvTsvToData({
4027
- rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.csvParseRows,
4028
- parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.csvParse
4029
- }, xsv);
4030
- },
4031
- convertTsvToData: function convertTsvToData(tsv) {
4032
- return this.convertCsvTsvToData({
4033
- rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.tsvParseRows,
4034
- parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.tsvParse
4035
- }, tsv);
4036
- },
4037
- convertJsonToData: function convertJsonToData(json, keysParam) {
4038
- var _this4 = this,
4039
- config = this.config,
4040
- newRows = [],
4041
- targetKeys,
4042
- data;
4087
+ /* eslint-disable */
4043
4088
 
4044
- if (isArray(json)) {
4045
- var keys = keysParam || config.data_keys;
4046
4089
 
4047
- if (keys.x) {
4048
- targetKeys = keys.value.concat(keys.x);
4049
- config.data_x = keys.x;
4050
- } else {
4051
- targetKeys = keys.value;
4052
- }
4090
+ /***** Functions to be executed on Web Worker *****
4091
+ * NOTE: Don't allowed to use
4092
+ * - arrow function syntax
4093
+ * - Utils functions
4094
+ */
4053
4095
 
4054
- newRows.push(targetKeys);
4055
- json.forEach(function (o) {
4056
- var _this5 = this;
4096
+ /**
4097
+ * Convert Columns data
4098
+ * @param {object} columns
4099
+ * @returns {Array}
4100
+ * @private
4101
+ */
4057
4102
 
4058
- _newArrowCheck(this, _this4);
4103
+ function columns(columns) {
4104
+ var newRows = [];
4105
+ columns.forEach(function (col, i) {
4106
+ var key = col[0];
4107
+ col.forEach(function (v, j) {
4108
+ if (j > 0) {
4109
+ if (typeof newRows[j - 1] === "undefined") {
4110
+ newRows[j - 1] = {};
4111
+ }
4059
4112
 
4060
- var newRow = targetKeys.map(function (key) {
4061
- _newArrowCheck(this, _this5);
4113
+ if (typeof v === "undefined") {
4114
+ throw new Error("Source data is missing a component at (" + i + ", " + j + ")!");
4115
+ }
4062
4116
 
4063
- // convert undefined to null because undefined data will be removed in convertDataToTargets()
4064
- var v = this.findValueInJson(o, key);
4117
+ newRows[j - 1][key] = v;
4118
+ }
4119
+ });
4120
+ });
4121
+ return newRows;
4122
+ }
4123
+ /**
4124
+ * Convert Rows data
4125
+ * @param {object} columns
4126
+ * @returns {Array}
4127
+ * @private
4128
+ */
4065
4129
 
4066
- if (isUndefined(v)) {
4067
- v = null;
4068
- }
4069
4130
 
4070
- return v;
4071
- }.bind(this));
4072
- newRows.push(newRow);
4073
- }.bind(this));
4074
- data = this.convertRowsToData(newRows);
4075
- } else {
4076
- Object.keys(json).forEach(function (key) {
4077
- _newArrowCheck(this, _this4);
4131
+ function rows(rows) {
4132
+ var keys = rows[0],
4133
+ newRows = [];
4134
+ rows.forEach(function (row, i) {
4135
+ if (i > 0) {
4136
+ var newRow = {};
4137
+ row.forEach(function (v, j) {
4138
+ if (typeof v === "undefined") {
4139
+ throw new Error("Source data is missing a component at (" + i + ", " + j + ")!");
4140
+ }
4078
4141
 
4079
- var tmp = json[key].concat();
4080
- tmp.unshift(key);
4081
- newRows.push(tmp);
4082
- }.bind(this));
4083
- data = this.convertColumnsToData(newRows);
4142
+ newRow[keys[j]] = v;
4143
+ });
4144
+ newRows.push(newRow);
4084
4145
  }
4146
+ });
4147
+ return newRows;
4148
+ }
4149
+ /**
4150
+ * Convert JSON data
4151
+ * @param {object} columns
4152
+ * @returns {Array}
4153
+ * @private
4154
+ */
4085
4155
 
4086
- return data;
4087
- },
4088
- findValueInJson: function findValueInJson(object, path) {
4089
- var _this6 = this;
4090
4156
 
4157
+ function json(json, keysParam) {
4158
+ var newRows = [],
4159
+ findValueInJson = function (object, path) {
4091
4160
  if (object[path] !== undefined) {
4092
4161
  return object[path];
4093
4162
  }
@@ -4097,68 +4166,206 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4097
4166
  target = object; // convert indexes to properties (replace [] with .)
4098
4167
 
4099
4168
  pathArray.some(function (k) {
4100
- _newArrowCheck(this, _this6);
4101
-
4102
4169
  return !(target = target && k in target ? target[k] : undefined);
4103
- }.bind(this));
4170
+ });
4104
4171
  return target;
4105
4172
  },
4106
- convertRowsToData: function convertRowsToData(rows) {
4107
- var _this7 = this,
4108
- keys = rows[0],
4109
- newRows = [];
4173
+ targetKeys,
4174
+ data;
4110
4175
 
4111
- rows.forEach(function (row, i) {
4112
- var _this8 = this;
4176
+ if (Array.isArray(json)) {
4177
+ if (keysParam.x) {
4178
+ targetKeys = keysParam.value.concat(keysParam.x);
4179
+ } else {
4180
+ targetKeys = keysParam.value;
4181
+ }
4113
4182
 
4114
- _newArrowCheck(this, _this7);
4183
+ newRows.push(targetKeys);
4184
+ json.forEach(function (o) {
4185
+ var newRow = targetKeys.map(function (key) {
4186
+ // convert undefined to null because undefined data will be removed in convertDataToTargets()
4187
+ var v = findValueInJson(o, key);
4115
4188
 
4116
- if (i > 0) {
4117
- var newRow = {};
4118
- row.forEach(function (v, j) {
4119
- _newArrowCheck(this, _this8);
4189
+ if (typeof v === "undefined") {
4190
+ v = null;
4191
+ }
4120
4192
 
4121
- if (isUndefined(v)) {
4122
- throw new Error("Source data is missing a component at (" + i + ", " + j + ")!");
4123
- }
4193
+ return v;
4194
+ });
4195
+ newRows.push(newRow);
4196
+ });
4197
+ data = rows(newRows);
4198
+ } else {
4199
+ Object.keys(json).forEach(function (key) {
4200
+ var tmp = json[key].concat();
4201
+ tmp.unshift(key);
4202
+ newRows.push(tmp);
4203
+ });
4204
+ data = columns(newRows);
4205
+ }
4124
4206
 
4125
- newRow[keys[j]] = v;
4126
- }.bind(this));
4127
- newRows.push(newRow);
4207
+ return data;
4208
+ }
4209
+ /***** Functions can't be executed on Web Worker *****/
4210
+
4211
+ /**
4212
+ * Convert URL data
4213
+ * @param {string} url Remote URL
4214
+ * @param {string} mimeType MIME type string: json | csv | tsv
4215
+ * @param {object} headers Header object
4216
+ * @param {object} keys Key object
4217
+ * @param {Function} done Callback function
4218
+ * @private
4219
+ */
4220
+
4221
+
4222
+ function url(url, mimeType, headers, keys, done) {
4223
+ if (mimeType === void 0) {
4224
+ mimeType = "csv";
4225
+ }
4226
+
4227
+ var req = new XMLHttpRequest(),
4228
+ converter = {
4229
+ csv: csv,
4230
+ tsv: tsv,
4231
+ json: json
4232
+ };
4233
+ req.open("GET", url);
4234
+
4235
+ if (headers) {
4236
+ Object.keys(headers).forEach(function (key) {
4237
+ req.setRequestHeader(key, headers[key]);
4238
+ });
4239
+ }
4240
+
4241
+ req.onreadystatechange = function () {
4242
+ if (req.readyState === 4) {
4243
+ if (req.status === 200) {
4244
+ var response = req.responseText;
4245
+ response && done.call(this, converter[mimeType](mimeType === "json" ? JSON.parse(response) : response, keys));
4246
+ } else {
4247
+ throw new Error(url + ": Something went wrong loading!");
4128
4248
  }
4249
+ }
4250
+ };
4251
+
4252
+ req.send();
4253
+ }
4254
+ /**
4255
+ * Convert CSV/TSV data
4256
+ * @param {object} parser Parser object
4257
+ * @param {object} xsv Data
4258
+ * @returns {object}
4259
+ * @private
4260
+ */
4261
+
4262
+
4263
+ function convertCsvTsvToData(parser, xsv) {
4264
+ var _this = this,
4265
+ rows = parser.rows(xsv),
4266
+ d;
4267
+
4268
+ if (rows.length === 1) {
4269
+ d = [{}];
4270
+ rows[0].forEach(function (id) {
4271
+ _newArrowCheck(this, _this);
4272
+
4273
+ d[0][id] = null;
4129
4274
  }.bind(this));
4130
- return newRows;
4131
- },
4132
- convertColumnsToData: function convertColumnsToData(columns) {
4133
- var _this9 = this,
4134
- newRows = [];
4275
+ } else {
4276
+ d = parser.parse(xsv);
4277
+ }
4135
4278
 
4136
- columns.forEach(function (col, i) {
4137
- var _this10 = this;
4279
+ return d;
4280
+ }
4138
4281
 
4139
- _newArrowCheck(this, _this9);
4282
+ function csv(xsv) {
4283
+ return convertCsvTsvToData({
4284
+ rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.csvParseRows,
4285
+ parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.csvParse
4286
+ }, xsv);
4287
+ }
4140
4288
 
4141
- var key = col[0];
4142
- col.forEach(function (v, j) {
4143
- _newArrowCheck(this, _this10);
4289
+ function tsv(tsv) {
4290
+ return convertCsvTsvToData({
4291
+ rows: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.tsvParseRows,
4292
+ parse: external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_.tsvParse
4293
+ }, tsv);
4294
+ }
4295
+ ;// CONCATENATED MODULE: ./src/ChartInternal/data/convert.ts
4296
+
4297
+
4298
+ /**
4299
+ * Copyright (c) 2017 ~ present NAVER Corp.
4300
+ * billboard.js project is licensed under the MIT license
4301
+ */
4302
+
4303
+
4304
+
4305
+
4306
+ /**
4307
+ * Get data key for JSON
4308
+ * @param {string|object} keysParam Key params
4309
+ * @param {object} config Config object
4310
+ * @returns {string} Data key
4311
+ * @private
4312
+ */
4313
+ function getDataKeyForJson(keysParam, config) {
4314
+ var keys = keysParam || (config == null ? void 0 : config.data_keys);
4315
+
4316
+ if (keys != null && keys.x) {
4317
+ config.data_x = keys.x;
4318
+ }
4319
+
4320
+ return keys;
4321
+ }
4322
+ /**
4323
+ * Data convert
4324
+ * @memberof ChartInternal
4325
+ * @private
4326
+ */
4327
+
4328
+
4329
+ /* harmony default export */ var convert = ({
4330
+ /**
4331
+ * Convert data according its type
4332
+ * @param {object} args data object
4333
+ * @param {Function} [callback] callback for url(XHR) type loading
4334
+ * @private
4335
+ */
4336
+ convertData: function convertData(args, callback) {
4337
+ var _this = this,
4338
+ config = this.config,
4339
+ useWorker = config.boost_useWorker,
4340
+ data = args;
4144
4341
 
4145
- if (j > 0) {
4146
- if (isUndefined(newRows[j - 1])) {
4147
- newRows[j - 1] = {};
4148
- }
4342
+ if (args.bindto) {
4343
+ data = {};
4344
+ ["url", "mimeType", "headers", "keys", "json", "keys", "rows", "columns"].forEach(function (v) {
4345
+ _newArrowCheck(this, _this);
4149
4346
 
4150
- if (isUndefined(v)) {
4151
- throw new Error("Source data is missing a component at (" + i + ", " + j + ")!");
4152
- }
4347
+ var key = "data_" + v;
4153
4348
 
4154
- newRows[j - 1][key] = v;
4349
+ if (key in args) {
4350
+ data[v] = args[key];
4155
4351
  }
4156
4352
  }.bind(this));
4157
- }.bind(this));
4158
- return newRows;
4353
+ }
4354
+
4355
+ if (data.url && callback) {
4356
+ url(data.url, data.mimeType, data.headers, getDataKeyForJson(data.keys, config), callback);
4357
+ } else if (data.json) {
4358
+ runWorker(useWorker, json, callback, [columns, rows])(data.json, getDataKeyForJson(data.keys, config));
4359
+ } else if (data.rows) {
4360
+ runWorker(useWorker, rows, callback)(data.rows);
4361
+ } else if (data.columns) {
4362
+ runWorker(useWorker, columns, callback)(data.columns);
4363
+ } else if (args.bindto) {
4364
+ throw Error("url or json or rows or columns is required.");
4365
+ }
4159
4366
  },
4160
4367
  convertDataToTargets: function convertDataToTargets(data, appendXs) {
4161
- var _this11 = this,
4368
+ var _this2 = this,
4162
4369
  $$ = this,
4163
4370
  axis = $$.axis,
4164
4371
  config = $$.config,
@@ -4179,9 +4386,9 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4179
4386
  xsData;
4180
4387
  // save x for update data by load when custom x and bb.x API
4181
4388
  ids.forEach(function (id) {
4182
- var _this12 = this;
4389
+ var _this3 = this;
4183
4390
 
4184
- _newArrowCheck(this, _this11);
4391
+ _newArrowCheck(this, _this2);
4185
4392
 
4186
4393
  var xKey = this.getXKey(id);
4187
4394
 
@@ -4189,11 +4396,11 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4189
4396
  // if included in input data
4190
4397
  if (xs.indexOf(xKey) >= 0) {
4191
4398
  xsData = (appendXs && $$.data.xs[id] || []).concat(data.map(function (d) {
4192
- _newArrowCheck(this, _this12);
4399
+ _newArrowCheck(this, _this3);
4193
4400
 
4194
4401
  return d[xKey];
4195
4402
  }.bind(this)).filter(isValue).map(function (rawX, i) {
4196
- _newArrowCheck(this, _this12);
4403
+ _newArrowCheck(this, _this3);
4197
4404
 
4198
4405
  return $$.generateTargetX(rawX, id, i);
4199
4406
  }.bind(this)));
@@ -4207,7 +4414,7 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4207
4414
 
4208
4415
  } else {
4209
4416
  xsData = data.map(function (d, i) {
4210
- _newArrowCheck(this, _this12);
4417
+ _newArrowCheck(this, _this3);
4211
4418
 
4212
4419
  return i;
4213
4420
  }.bind(this));
@@ -4217,7 +4424,7 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4217
4424
  }.bind(this)); // check x is defined
4218
4425
 
4219
4426
  ids.forEach(function (id) {
4220
- _newArrowCheck(this, _this11);
4427
+ _newArrowCheck(this, _this2);
4221
4428
 
4222
4429
  if (!this.data.xs[id]) {
4223
4430
  throw new Error("x is not defined for id = \"" + id + "\".");
@@ -4225,19 +4432,19 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4225
4432
  }.bind(this)); // convert to target
4226
4433
 
4227
4434
  var targets = ids.map(function (id, index) {
4228
- var _this13 = this;
4435
+ var _this4 = this;
4229
4436
 
4230
- _newArrowCheck(this, _this11);
4437
+ _newArrowCheck(this, _this2);
4231
4438
 
4232
4439
  var convertedId = config.data_idConverter.bind($$.api)(id),
4233
4440
  xKey = $$.getXKey(id),
4234
4441
  isCategory = isCustomX && isCategorized,
4235
4442
  hasCategory = isCategory && data.map(function (v) {
4236
- _newArrowCheck(this, _this13);
4443
+ _newArrowCheck(this, _this4);
4237
4444
 
4238
4445
  return v.x;
4239
4446
  }.bind(this)).every(function (v) {
4240
- _newArrowCheck(this, _this13);
4447
+ _newArrowCheck(this, _this4);
4241
4448
 
4242
4449
  return config.axis_x_categories.indexOf(v) > -1;
4243
4450
  }.bind(this)),
@@ -4247,7 +4454,7 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4247
4454
  id: convertedId,
4248
4455
  id_org: id,
4249
4456
  values: data.map(function (d, i) {
4250
- _newArrowCheck(this, _this13);
4457
+ _newArrowCheck(this, _this4);
4251
4458
 
4252
4459
  var rawX = d[xKey],
4253
4460
  value = d[id],
@@ -4277,10 +4484,11 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4277
4484
  return {
4278
4485
  x: x,
4279
4486
  value: value,
4280
- id: convertedId
4487
+ id: convertedId,
4488
+ index: -1
4281
4489
  };
4282
4490
  }.bind(this)).filter(function (v) {
4283
- _newArrowCheck(this, _this13);
4491
+ _newArrowCheck(this, _this4);
4284
4492
 
4285
4493
  return isDefined(v.x);
4286
4494
  }.bind(this))
@@ -4288,14 +4496,14 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4288
4496
  }.bind(this)); // finish targets
4289
4497
 
4290
4498
  targets.forEach(function (t) {
4291
- var _this14 = this;
4499
+ var _this5 = this;
4292
4500
 
4293
- _newArrowCheck(this, _this11);
4501
+ _newArrowCheck(this, _this2);
4294
4502
 
4295
4503
  // sort values by its x
4296
4504
  if (config.data_xSort) {
4297
4505
  t.values = t.values.sort(function (v1, v2) {
4298
- _newArrowCheck(this, _this14);
4506
+ _newArrowCheck(this, _this5);
4299
4507
 
4300
4508
  var x1 = v1.x || v1.x === 0 ? v1.x : Infinity,
4301
4509
  x2 = v2.x || v2.x === 0 ? v2.x : Infinity;
@@ -4305,13 +4513,13 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4305
4513
 
4306
4514
 
4307
4515
  t.values.forEach(function (v, i) {
4308
- _newArrowCheck(this, _this14);
4516
+ _newArrowCheck(this, _this5);
4309
4517
 
4310
4518
  return v.index = i;
4311
4519
  }.bind(this)); // this needs to be sorted because its index and value.index is identical
4312
4520
 
4313
4521
  $$.data.xs[t.id].sort(function (v1, v2) {
4314
- _newArrowCheck(this, _this14);
4522
+ _newArrowCheck(this, _this5);
4315
4523
 
4316
4524
  return v1 - v2;
4317
4525
  }.bind(this));
@@ -4322,7 +4530,7 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4322
4530
 
4323
4531
  if (config.data_type) {
4324
4532
  $$.setTargetType($$.mapToIds(targets).filter(function (id) {
4325
- _newArrowCheck(this, _this11);
4533
+ _newArrowCheck(this, _this2);
4326
4534
 
4327
4535
  return !(id in config.data_types);
4328
4536
  }.bind(this)), config.data_type);
@@ -4330,7 +4538,7 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4330
4538
 
4331
4539
 
4332
4540
  targets.forEach(function (d) {
4333
- _newArrowCheck(this, _this11);
4541
+ _newArrowCheck(this, _this2);
4334
4542
 
4335
4543
  return $$.cache.add(d.id_org, d, !0);
4336
4544
  }.bind(this));
@@ -5583,13 +5791,13 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
5583
5791
 
5584
5792
 
5585
5793
  $$.cache.reset();
5586
- var data = args.data || $$.convertData(args, function (d) {
5794
+ $$.convertData(args, function (d) {
5587
5795
  _newArrowCheck(this, _this2);
5588
5796
 
5589
- return $$.load($$.convertDataToTargets(d), args);
5797
+ var data = args.data || d;
5798
+ args.append && (data.__append__ = !0);
5799
+ data && $$.load($$.convertDataToTargets(data), args);
5590
5800
  }.bind(this));
5591
- args.append && (data.__append__ = !0);
5592
- data && $$.load($$.convertDataToTargets(data), args);
5593
5801
  },
5594
5802
  unload: function unload(rawTargetIds, customDoneCb) {
5595
5803
  var _this3 = this,
@@ -6132,52 +6340,52 @@ var colorizePattern = function (pattern, color, id) {
6132
6340
  id: id,
6133
6341
  node: node.node()
6134
6342
  };
6135
- }.bind(undefined),
6136
- schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"]; // Replacement of d3.schemeCategory10.
6137
- // Contained differently depend on d3 version: v4(d3-scale), v5(d3-scale-chromatic)
6343
+ }.bind(undefined);
6344
+ /**
6345
+ * Get color pattern from CSS file
6346
+ * CSS should be defined as: background-image: url("#00c73c;#fa7171; ...");
6347
+ * @param {d3Selection} element Chart element
6348
+ * @returns {Array}
6349
+ * @private
6350
+ */
6138
6351
 
6139
6352
 
6140
- /* harmony default export */ var internals_color = ({
6141
- /**
6142
- * Get color pattern from CSS file
6143
- * CSS should be defined as: background-image: url("#00c73c;#fa7171; ...");
6144
- * @returns {Array}
6145
- * @private
6146
- */
6147
- getColorFromCss: function getColorFromCss() {
6148
- var _this2 = this,
6149
- cacheKey = KEY.colorPattern,
6150
- body = browser_doc.body,
6151
- pattern = body[cacheKey];
6152
-
6153
- if (!pattern) {
6154
- var span = browser_doc.createElement("span");
6155
- span.className = $COLOR.colorPattern;
6156
- span.style.display = "none";
6157
- body.appendChild(span);
6158
- var content = win.getComputedStyle(span).backgroundImage;
6159
- span.parentNode.removeChild(span);
6160
-
6161
- if (content.indexOf(";") > -1) {
6162
- pattern = content.replace(/url[^#]*|["'()]|(\s|%20)/g, "").split(";").map(function (v) {
6163
- _newArrowCheck(this, _this2);
6353
+ function getColorFromCss(element) {
6354
+ var _this2 = this,
6355
+ cacheKey = KEY.colorPattern,
6356
+ body = browser_doc.body,
6357
+ pattern = body[cacheKey];
6164
6358
 
6165
- return v.trim().replace(/[\"'\s]/g, "");
6166
- }.bind(this)).filter(Boolean);
6167
- body[cacheKey] = pattern;
6168
- }
6359
+ if (!pattern) {
6360
+ var content = element.classed($COLOR.colorPattern, !0).style("background-image");
6361
+ element.classed($COLOR.colorPattern, !1);
6362
+
6363
+ if (content.indexOf(";") > -1) {
6364
+ pattern = content.replace(/url[^#]*|["'()]|(\s|%20)/g, "").split(";").map(function (v) {
6365
+ _newArrowCheck(this, _this2);
6366
+
6367
+ return v.trim().replace(/[\"'\s]/g, "");
6368
+ }.bind(this)).filter(Boolean);
6369
+ body[cacheKey] = pattern;
6169
6370
  }
6371
+ }
6170
6372
 
6171
- return pattern;
6172
- },
6373
+ return pattern;
6374
+ } // Replacement of d3.schemeCategory10.
6375
+ // Contained differently depend on d3 version: v4(d3-scale), v5(d3-scale-chromatic)
6376
+
6377
+
6378
+ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"];
6379
+ /* harmony default export */ var internals_color = ({
6173
6380
  generateColor: function generateColor() {
6174
6381
  var _this3 = this,
6175
6382
  $$ = this,
6383
+ $el = $$.$el,
6176
6384
  config = $$.config,
6177
6385
  colors = config.data_colors,
6178
6386
  callback = config.data_color,
6179
6387
  ids = [],
6180
- pattern = notEmpty(config.color_pattern) ? config.color_pattern : (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleOrdinal)($$.getColorFromCss() || schemeCategory10).range(),
6388
+ pattern = notEmpty(config.color_pattern) ? config.color_pattern : (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleOrdinal)(getColorFromCss($el.chart) || schemeCategory10).range(),
6181
6389
  originalColorPattern = pattern;
6182
6390
 
6183
6391
  if (isFunction(config.color_tiles)) {
@@ -7206,11 +7414,13 @@ function getFormat($$, typeValue, v) {
7206
7414
  setLegendItem: function setLegendItem(item) {
7207
7415
  var _this3 = this,
7208
7416
  $$ = this,
7417
+ $el = $$.$el,
7209
7418
  api = $$.api,
7210
7419
  config = $$.config,
7211
7420
  state = $$.state,
7212
7421
  isTouch = state.inputType === "touch",
7213
- hasGauge = $$.hasType("gauge");
7422
+ hasGauge = $$.hasType("gauge"),
7423
+ useCssRule = config.boost_useCssRule;
7214
7424
 
7215
7425
  item.attr("class", function (id) {
7216
7426
  var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
@@ -7223,7 +7433,17 @@ function getFormat($$, typeValue, v) {
7223
7433
  }.bind(this));
7224
7434
 
7225
7435
  if (config.interaction_enabled) {
7226
- item.style("cursor", "pointer").on("click", function (event, id) {
7436
+ if (useCssRule) {
7437
+ [["." + $LEGEND.legendItem, "cursor:pointer"], ["." + $LEGEND.legendItem + " text", "pointer-events:none"], ["." + $LEGEND.legendItemPoint + " text", "pointer-events:none"], ["." + $LEGEND.legendItemTile, "pointer-events:none"], ["." + $LEGEND.legendItemEvent, "fill-opacity:0"]].forEach(function (v) {
7438
+ _newArrowCheck(this, _this3);
7439
+
7440
+ var selector = v[0],
7441
+ props = v[1];
7442
+ $$.setCssRule(!1, selector, [props])($el.legend);
7443
+ }.bind(this));
7444
+ }
7445
+
7446
+ item.style("cursor", $$.getStylePropValue("pointer")).on("click", function (event, id) {
7227
7447
  if (!callFn(config.legend_item_onclick, api, id)) {
7228
7448
  if (event.altKey) {
7229
7449
  api.hide();
@@ -7466,8 +7686,8 @@ function getFormat($$, typeValue, v) {
7466
7686
  return isDefined(config.data_names[id]) ? config.data_names[id] : id;
7467
7687
  }.bind(this)).each(function (id, i) {
7468
7688
  updatePositions(this, id, i);
7469
- }).style("pointer-events", "none").attr("x", isLegendRightOrInset ? xForLegendText : pos).attr("y", isLegendRightOrInset ? pos : yForLegendText);
7470
- l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", "0").attr("x", isLegendRightOrInset ? xForLegendRect : pos).attr("y", isLegendRightOrInset ? pos : yForLegendRect);
7689
+ }).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ? xForLegendText : pos).attr("y", isLegendRightOrInset ? pos : yForLegendText);
7690
+ l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ? xForLegendRect : pos).attr("y", isLegendRightOrInset ? pos : yForLegendRect);
7471
7691
 
7472
7692
  var getColor = function (id) {
7473
7693
  _newArrowCheck(this, _this4);
@@ -7491,7 +7711,7 @@ function getFormat($$, typeValue, v) {
7491
7711
  }
7492
7712
 
7493
7713
  return browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, "hasValidPointType" in $$ && $$.hasValidPointType(point) ? point : "use");
7494
- }.bind(this)).attr("class", $LEGEND.legendItemPoint).style("fill", getColor).style("pointer-events", "none").attr("href", function (data, idx, selection) {
7714
+ }.bind(this)).attr("class", $LEGEND.legendItemPoint).style("fill", getColor).style("pointer-events", $$.getStylePropValue("none")).attr("href", function (data, idx, selection) {
7495
7715
  _newArrowCheck(this, _this4);
7496
7716
 
7497
7717
  var node = selection[idx],
@@ -7500,7 +7720,7 @@ function getFormat($$, typeValue, v) {
7500
7720
  return nodeName === "use" ? "#" + state.datetimeId + "-point" + id : undefined;
7501
7721
  }.bind(this));
7502
7722
  } else {
7503
- l.append("line").attr("class", $LEGEND.legendItemTile).style("stroke", getColor).style("pointer-events", "none").attr("x1", isLegendRightOrInset ? x1ForLegendTile : pos).attr("y1", isLegendRightOrInset ? pos : yForLegendTile).attr("x2", isLegendRightOrInset ? x2ForLegendTile : pos).attr("y2", isLegendRightOrInset ? pos : yForLegendTile).attr("stroke-width", config.legend_item_tile_height);
7723
+ l.append("line").attr("class", $LEGEND.legendItemTile).style("stroke", getColor).style("pointer-events", $$.getStylePropValue("none")).attr("x1", isLegendRightOrInset ? x1ForLegendTile : pos).attr("y1", isLegendRightOrInset ? pos : yForLegendTile).attr("x2", isLegendRightOrInset ? x2ForLegendTile : pos).attr("y2", isLegendRightOrInset ? pos : yForLegendTile).attr("stroke-width", config.legend_item_tile_height);
7504
7724
  } // Set background for inset legend
7505
7725
 
7506
7726
 
@@ -8981,6 +9201,68 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
8981
9201
  }
8982
9202
  }
8983
9203
  });
9204
+ ;// CONCATENATED MODULE: ./src/ChartInternal/internals/style.ts
9205
+
9206
+
9207
+ /**
9208
+ * Copyright (c) 2017 ~ present NAVER Corp.
9209
+ * billboard.js project is licensed under the MIT license
9210
+ */
9211
+
9212
+
9213
+ /* harmony default export */ var style = ({
9214
+ /**
9215
+ * Add props color css rule to given selector
9216
+ * @param {boolean} withShape Set shpes' prefix class
9217
+ * @param {string} selector CSS selector
9218
+ * @param {Array} props CSS props list
9219
+ * @param {Function} propsFn Function to retrieve value or determine for props
9220
+ * @returns {Function}
9221
+ * @private
9222
+ */
9223
+ setCssRule: function setCssRule(withShape, selector, props, propsFn) {
9224
+ var _this = this,
9225
+ $$ = this,
9226
+ config = $$.config,
9227
+ _$$$state = $$.state,
9228
+ cssRule = _$$$state.cssRule,
9229
+ style = _$$$state.style;
9230
+
9231
+ return config.boost_useCssRule ? function (selection) {
9232
+ var _this2 = this;
9233
+
9234
+ _newArrowCheck(this, _this);
9235
+
9236
+ selection.each(function (d) {
9237
+ var _this3 = this;
9238
+
9239
+ _newArrowCheck(this, _this2);
9240
+
9241
+ var res = propsFn && (propsFn == null ? void 0 : propsFn.call($$, d)),
9242
+ shapeSelector = "" + (withShape ? "." + ($SHAPE.shapes + $$.getTargetSelectorSuffix(d.id)) : "") + selector;
9243
+ selector in cssRule && style.sheet.deleteRule(cssRule[shapeSelector]);
9244
+ $$.state.cssRule[shapeSelector] = addCssRules(style, shapeSelector, props.filter(Boolean).map(function (v) {
9245
+ _newArrowCheck(this, _this3);
9246
+
9247
+ return isString(res) && v.indexOf(":") === -1 ? v + ": " + res : v || "";
9248
+ }.bind(this)));
9249
+ }.bind(this));
9250
+ }.bind(this) : function () {
9251
+ _newArrowCheck(this, _this);
9252
+ }.bind(this);
9253
+ },
9254
+
9255
+ /**
9256
+ * Get style prop value
9257
+ * @param {Function|string} v Value
9258
+ * @returns {string|null}
9259
+ * @private
9260
+ */
9261
+ getStylePropValue: function getStylePropValue(v) {
9262
+ var useCssRule = this.config.boost_useCssRule;
9263
+ return useCssRule ? null : isFunction(v) ? v.bind(this) : v;
9264
+ }
9265
+ });
8984
9266
  ;// CONCATENATED MODULE: ./src/ChartInternal/internals/text.ts
8985
9267
 
8986
9268
 
@@ -9029,7 +9311,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9029
9311
  $$ = this,
9030
9312
  value = d.value,
9031
9313
  isCandlestickType = $$.isCandlestickType(d),
9032
- isNegative = value < 0 || isCandlestickType && !((_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp),
9314
+ isNegative = isNumber(value) && value < 0 || isCandlestickType && !((_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp),
9033
9315
  x = pos.x,
9034
9316
  y = pos.y,
9035
9317
  gap = 4,
@@ -9099,7 +9381,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9099
9381
 
9100
9382
  return classChartText(d) + classFocus(d);
9101
9383
  }.bind(this)),
9102
- mainTextEnter = mainTextUpdate.enter().append("g").style("opacity", "0").attr("class", classChartText).style("pointer-events", "none");
9384
+ mainTextEnter = mainTextUpdate.enter().append("g").style("opacity", "0").attr("class", classChartText).call($$.setCssRule(!0, " ." + $TEXT.text, ["fill", "pointer-events:none"], $$.updateTextColor));
9103
9385
 
9104
9386
  mainTextEnter.append("g").attr("class", classTexts);
9105
9387
  },
@@ -9130,7 +9412,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9130
9412
  }
9131
9413
 
9132
9414
  return config.axis_rotated ? isEndAnchor ? "end" : "start" : "middle";
9133
- }.bind(this)).style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", "0").each(function (d, i, texts) {
9415
+ }.bind(this)).style("fill", $$.getStylePropValue($$.updateTextColor)).style("fill-opacity", "0").each(function (d, i, texts) {
9134
9416
  var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
9135
9417
  value = d.value;
9136
9418
 
@@ -9227,7 +9509,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9227
9509
  angle = config.data_labels.rotate,
9228
9510
  anchorString = getRotateAnchor(angle),
9229
9511
  rotateString = angle ? "rotate(" + angle + ")" : "";
9230
- $$.$el.text.style("fill", $$.updateTextColor.bind($$)).attr("filter", $$.updateTextBacgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) {
9512
+ $$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr("filter", $$.updateTextBacgroundColor.bind($$)).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function (d, i) {
9231
9513
  // do not apply transition for newly added text elements
9232
9514
  var node = $T(this, !!(withTransition && this.getAttribute("x")), t),
9233
9515
  isInverted = config["axis_" + (axis == null ? void 0 : axis.getId(d.id)) + "_inverted"],
@@ -10600,6 +10882,7 @@ function getTextPos(pos, width) {
10600
10882
 
10601
10883
 
10602
10884
 
10885
+
10603
10886
  /**
10604
10887
  * Internal chart class.
10605
10888
  * - Note: Instantiated internally, not exposed for public.
@@ -10727,19 +11010,28 @@ var ChartInternal = /*#__PURE__*/function () {
10727
11010
  var $$ = this,
10728
11011
  config = $$.config,
10729
11012
  state = $$.state,
10730
- $el = $$.$el;
11013
+ $el = $$.$el,
11014
+ useCssRule = config.boost_useCssRule;
10731
11015
  checkModuleImport($$);
10732
11016
  state.hasAxis = !$$.hasArcType();
10733
- state.hasRadar = !state.hasAxis && $$.hasType("radar"); // when 'padding=false' is set, disable axes and subchart. Because they are useless.
11017
+ state.hasRadar = !state.hasAxis && $$.hasType("radar"); // datetime to be used for uniqueness
10734
11018
 
10735
- if (config.padding === !1) {
10736
- config.axis_x_show = !1;
10737
- config.axis_y_show = !1;
10738
- config.axis_y2_show = !1;
10739
- config.subchart_show = !1;
11019
+ state.datetimeId = "bb-" + +new Date() * getRandom();
11020
+
11021
+ if (useCssRule) {
11022
+ // append style element
11023
+ var styleEl = browser_doc.createElement("style"); // styleEl.id = styleId;
11024
+
11025
+ styleEl.type = "text/css";
11026
+ browser_doc.head.appendChild(styleEl);
11027
+ state.style = {
11028
+ rootSelctor: "." + state.datetimeId,
11029
+ sheet: styleEl.sheet
11030
+ }; // used on .destroy()
11031
+
11032
+ $el.style = styleEl;
10740
11033
  }
10741
11034
 
10742
- $$.initParams();
10743
11035
  var bindto = {
10744
11036
  element: config.bindto,
10745
11037
  classname: "bb"
@@ -10757,7 +11049,8 @@ var ChartInternal = /*#__PURE__*/function () {
10757
11049
  $el.chart = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.body.appendChild(browser_doc.createElement("div")));
10758
11050
  }
10759
11051
 
10760
- $el.chart.html("").classed(bindto.classname, !0).style("position", "relative");
11052
+ $el.chart.html("").classed(bindto.classname, !0).classed(state.datetimeId, useCssRule).style("position", "relative");
11053
+ $$.initParams();
10761
11054
  $$.initToRender();
10762
11055
  }
10763
11056
  /**
@@ -10796,9 +11089,12 @@ var ChartInternal = /*#__PURE__*/function () {
10796
11089
  }
10797
11090
 
10798
11091
  if (!isLazy || forced) {
10799
- var convertedData = $$.convertData(config, $$.initWithData);
10800
- convertedData && $$.initWithData(convertedData);
10801
- $$.afterInit();
11092
+ $$.convertData(config, function (res) {
11093
+ _newArrowCheck(this, _this);
11094
+
11095
+ $$.initWithData(res);
11096
+ $$.afterInit();
11097
+ }.bind(this));
10802
11098
  }
10803
11099
  };
10804
11100
 
@@ -10810,10 +11106,16 @@ var ChartInternal = /*#__PURE__*/function () {
10810
11106
  state = $$.state,
10811
11107
  isRotated = config.axis_rotated;
10812
11108
 
10813
- // datetime to be used for uniqueness
10814
- state.datetimeId = "bb-" + +new Date() * getRandom();
11109
+ // color settings
10815
11110
  $$.color = $$.generateColor();
10816
- $$.levelColor = $$.generateLevelColor();
11111
+ $$.levelColor = $$.generateLevelColor(); // when 'padding=false' is set, disable axes and subchart. Because they are useless.
11112
+
11113
+ if (config.padding === !1) {
11114
+ config.axis_x_show = !1;
11115
+ config.axis_y_show = !1;
11116
+ config.axis_y2_show = !1;
11117
+ config.subchart_show = !1;
11118
+ }
10817
11119
 
10818
11120
  if ($$.hasPointType()) {
10819
11121
  $$.point = $$.generatePoint();
@@ -11277,7 +11579,7 @@ var ChartInternal = /*#__PURE__*/function () {
11277
11579
  list.push(function () {
11278
11580
  _newArrowCheck(this, _this9);
11279
11581
 
11280
- return callFn(config.onresize, $$, $$.api);
11582
+ return callFn(config.onresize, $$.api);
11281
11583
  }.bind(this));
11282
11584
 
11283
11585
  if (config.resize_auto) {
@@ -11298,7 +11600,7 @@ var ChartInternal = /*#__PURE__*/function () {
11298
11600
  list.push(function () {
11299
11601
  _newArrowCheck(this, _this9);
11300
11602
 
11301
- callFn(config.onresized, $$, $$.api);
11603
+ callFn(config.onresized, $$.api);
11302
11604
  state.resizing = !1;
11303
11605
  }.bind(this)); // add resize functions
11304
11606
 
@@ -11341,7 +11643,7 @@ var ChartInternal = /*#__PURE__*/function () {
11341
11643
 
11342
11644
 
11343
11645
  extend(ChartInternal.prototype, [// common
11344
- convert, data_data, load, category, internals_class, internals_color, domain, interactions_interaction, format, internals_legend, redraw, scale, shape, size, internals_text, internals_title, internals_tooltip, transform, type]);
11646
+ convert, data_data, load, category, internals_class, internals_color, domain, interactions_interaction, format, internals_legend, redraw, scale, shape, size, style, internals_text, internals_title, internals_tooltip, transform, type]);
11345
11647
  ;// CONCATENATED MODULE: ./src/config/config.ts
11346
11648
 
11347
11649
 
@@ -11499,6 +11801,7 @@ function loadConfig(config) {
11499
11801
  $$ = this.internal,
11500
11802
  _$$$$el = $$.$el,
11501
11803
  chart = _$$$$el.chart,
11804
+ style = _$$$$el.style,
11502
11805
  svg = _$$$$el.svg;
11503
11806
 
11504
11807
  if (notEmpty($$)) {
@@ -11510,7 +11813,9 @@ function loadConfig(config) {
11510
11813
  svg.select("*").interrupt();
11511
11814
  $$.resizeFunction.clear();
11512
11815
  win.removeEventListener("resize", $$.resizeFunction);
11513
- chart.classed("bb", !1).style("position", null).selectChildren().remove(); // releasing own references
11816
+ chart.classed("bb", !1).style("position", null).selectChildren().remove(); // remove <style> element added by boost.useCssRule option
11817
+
11818
+ style && style.parentNode.removeChild(style); // releasing own references
11514
11819
 
11515
11820
  Object.keys(this).forEach(function (key) {
11516
11821
  var _this2 = this;
@@ -13616,158 +13921,173 @@ extend(regions, {
13616
13921
  flow: function flow(args) {
13617
13922
  var _this = this,
13618
13923
  $$ = this.internal,
13619
- data,
13620
- domain,
13621
- length = 0,
13622
- tail = 0,
13623
- diff,
13624
- to;
13924
+ data;
13625
13925
 
13626
13926
  if (args.json || args.rows || args.columns) {
13627
- data = $$.convertData(args);
13628
- }
13927
+ $$.convertData(args, function (res) {
13928
+ _newArrowCheck(this, _this);
13629
13929
 
13630
- if ($$.state.redrawing || !data || !isTabVisible()) {
13631
- return;
13930
+ data = res;
13931
+
13932
+ _();
13933
+ }.bind(this));
13632
13934
  }
13935
+ /**
13936
+ * Process flows
13937
+ * @private
13938
+ */
13633
13939
 
13634
- var notfoundIds = [],
13635
- orgDataCount = $$.getMaxDataCount(),
13636
- targets = $$.convertDataToTargets(data, !0),
13637
- isTimeSeries = $$.axis.isTimeSeries();
13638
- // Update/Add data
13639
- $$.data.targets.forEach(function (t) {
13640
- _newArrowCheck(this, _this);
13641
13940
 
13642
- var found = !1;
13941
+ function _() {
13942
+ var _this2 = this,
13943
+ domain,
13944
+ length = 0,
13945
+ tail = 0,
13946
+ diff,
13947
+ to;
13643
13948
 
13644
- for (var i = 0; i < targets.length; i++) {
13645
- if (t.id === targets[i].id) {
13646
- found = !0;
13949
+ if ($$.state.redrawing || !data || !isTabVisible()) {
13950
+ return;
13951
+ }
13647
13952
 
13648
- if (t.values[t.values.length - 1]) {
13649
- tail = t.values[t.values.length - 1].index + 1;
13650
- }
13953
+ var notfoundIds = [],
13954
+ orgDataCount = $$.getMaxDataCount(),
13955
+ targets = $$.convertDataToTargets(data, !0),
13956
+ isTimeSeries = $$.axis.isTimeSeries();
13957
+ // Update/Add data
13958
+ $$.data.targets.forEach(function (t) {
13959
+ _newArrowCheck(this, _this2);
13651
13960
 
13652
- length = targets[i].values.length;
13961
+ var found = !1;
13653
13962
 
13654
- for (var j = 0; j < length; j++) {
13655
- targets[i].values[j].index = tail + j;
13963
+ for (var i = 0; i < targets.length; i++) {
13964
+ if (t.id === targets[i].id) {
13965
+ found = !0;
13656
13966
 
13657
- if (!isTimeSeries) {
13658
- targets[i].values[j].x = tail + j;
13967
+ if (t.values[t.values.length - 1]) {
13968
+ tail = t.values[t.values.length - 1].index + 1;
13659
13969
  }
13660
- }
13661
-
13662
- t.values = t.values.concat(targets[i].values);
13663
- targets.splice(i, 1);
13664
- break;
13665
- }
13666
- }
13667
13970
 
13668
- found || notfoundIds.push(t.id);
13669
- }.bind(this)); // Append null for not found targets
13971
+ length = targets[i].values.length;
13670
13972
 
13671
- $$.data.targets.forEach(function (t) {
13672
- _newArrowCheck(this, _this);
13973
+ for (var j = 0; j < length; j++) {
13974
+ targets[i].values[j].index = tail + j;
13673
13975
 
13674
- for (var i = 0; i < notfoundIds.length; i++) {
13675
- if (t.id === notfoundIds[i]) {
13676
- tail = t.values[t.values.length - 1].index + 1;
13976
+ if (!isTimeSeries) {
13977
+ targets[i].values[j].x = tail + j;
13978
+ }
13979
+ }
13677
13980
 
13678
- for (var j = 0; j < length; j++) {
13679
- t.values.push({
13680
- id: t.id,
13681
- index: tail + j,
13682
- x: isTimeSeries ? $$.getOtherTargetX(tail + j) : tail + j,
13683
- value: null
13684
- });
13981
+ t.values = t.values.concat(targets[i].values);
13982
+ targets.splice(i, 1);
13983
+ break;
13685
13984
  }
13686
13985
  }
13687
- }
13688
- }.bind(this)); // Generate null values for new target
13689
13986
 
13690
- if ($$.data.targets.length) {
13691
- targets.forEach(function (t) {
13692
- var _this2 = this;
13987
+ found || notfoundIds.push(t.id);
13988
+ }.bind(this)); // Append null for not found targets
13693
13989
 
13694
- _newArrowCheck(this, _this);
13990
+ $$.data.targets.forEach(function (t) {
13991
+ _newArrowCheck(this, _this2);
13695
13992
 
13696
- var missing = [];
13993
+ for (var i = 0; i < notfoundIds.length; i++) {
13994
+ if (t.id === notfoundIds[i]) {
13995
+ tail = t.values[t.values.length - 1].index + 1;
13697
13996
 
13698
- for (var i = $$.data.targets[0].values[0].index; i < tail; i++) {
13699
- missing.push({
13700
- id: t.id,
13701
- index: i,
13702
- x: isTimeSeries ? $$.getOtherTargetX(i) : i,
13703
- value: null
13704
- });
13997
+ for (var j = 0; j < length; j++) {
13998
+ t.values.push({
13999
+ id: t.id,
14000
+ index: tail + j,
14001
+ x: isTimeSeries ? $$.getOtherTargetX(tail + j) : tail + j,
14002
+ value: null
14003
+ });
14004
+ }
14005
+ }
13705
14006
  }
14007
+ }.bind(this)); // Generate null values for new target
14008
+
14009
+ if ($$.data.targets.length) {
14010
+ targets.forEach(function (t) {
14011
+ var _this3 = this;
13706
14012
 
13707
- t.values.forEach(function (v) {
13708
14013
  _newArrowCheck(this, _this2);
13709
14014
 
13710
- v.index += tail;
14015
+ var missing = [];
13711
14016
 
13712
- if (!isTimeSeries) {
13713
- v.x += tail;
14017
+ for (var i = $$.data.targets[0].values[0].index; i < tail; i++) {
14018
+ missing.push({
14019
+ id: t.id,
14020
+ index: i,
14021
+ x: isTimeSeries ? $$.getOtherTargetX(i) : i,
14022
+ value: null
14023
+ });
13714
14024
  }
14025
+
14026
+ t.values.forEach(function (v) {
14027
+ _newArrowCheck(this, _this3);
14028
+
14029
+ v.index += tail;
14030
+
14031
+ if (!isTimeSeries) {
14032
+ v.x += tail;
14033
+ }
14034
+ }.bind(this));
14035
+ t.values = missing.concat(t.values);
13715
14036
  }.bind(this));
13716
- t.values = missing.concat(t.values);
13717
- }.bind(this));
13718
- }
14037
+ }
13719
14038
 
13720
- $$.data.targets = $$.data.targets.concat(targets); // add remained
13721
- // check data count because behavior needs to change when it"s only one
13722
- // const dataCount = $$.getMaxDataCount();
14039
+ $$.data.targets = $$.data.targets.concat(targets); // add remained
14040
+ // check data count because behavior needs to change when it"s only one
14041
+ // const dataCount = $$.getMaxDataCount();
13723
14042
 
13724
- var baseTarget = $$.data.targets[0],
13725
- baseValue = baseTarget.values[0];
14043
+ var baseTarget = $$.data.targets[0],
14044
+ baseValue = baseTarget.values[0];
13726
14045
 
13727
- // Update length to flow if needed
13728
- if (isDefined(args.to)) {
13729
- length = 0;
13730
- to = isTimeSeries ? parseDate.call($$, args.to) : args.to;
13731
- baseTarget.values.forEach(function (v) {
13732
- _newArrowCheck(this, _this);
14046
+ // Update length to flow if needed
14047
+ if (isDefined(args.to)) {
14048
+ length = 0;
14049
+ to = isTimeSeries ? parseDate.call($$, args.to) : args.to;
14050
+ baseTarget.values.forEach(function (v) {
14051
+ _newArrowCheck(this, _this2);
13733
14052
 
13734
- v.x < to && length++;
13735
- }.bind(this));
13736
- } else if (isDefined(args.length)) {
13737
- length = args.length;
13738
- } // If only one data, update the domain to flow from left edge of the chart
14053
+ v.x < to && length++;
14054
+ }.bind(this));
14055
+ } else if (isDefined(args.length)) {
14056
+ length = args.length;
14057
+ } // If only one data, update the domain to flow from left edge of the chart
13739
14058
 
13740
14059
 
13741
- if (!orgDataCount) {
13742
- if (isTimeSeries) {
13743
- diff = baseTarget.values.length > 1 ? baseTarget.values[baseTarget.values.length - 1].x - baseValue.x : baseValue.x - $$.getXDomain($$.data.targets)[0];
13744
- } else {
13745
- diff = 1;
13746
- }
14060
+ if (!orgDataCount) {
14061
+ if (isTimeSeries) {
14062
+ diff = baseTarget.values.length > 1 ? baseTarget.values[baseTarget.values.length - 1].x - baseValue.x : baseValue.x - $$.getXDomain($$.data.targets)[0];
14063
+ } else {
14064
+ diff = 1;
14065
+ }
13747
14066
 
13748
- domain = [baseValue.x - diff, baseValue.x];
13749
- } else if (orgDataCount === 1 && isTimeSeries) {
13750
- diff = (baseTarget.values[baseTarget.values.length - 1].x - baseValue.x) / 2;
13751
- domain = [new Date(+baseValue.x - diff), new Date(+baseValue.x + diff)];
13752
- }
14067
+ domain = [baseValue.x - diff, baseValue.x];
14068
+ } else if (orgDataCount === 1 && isTimeSeries) {
14069
+ diff = (baseTarget.values[baseTarget.values.length - 1].x - baseValue.x) / 2;
14070
+ domain = [new Date(+baseValue.x - diff), new Date(+baseValue.x + diff)];
14071
+ }
13753
14072
 
13754
- domain && $$.updateXDomain(null, !0, !0, !1, domain); // Set targets
14073
+ domain && $$.updateXDomain(null, !0, !0, !1, domain); // Set targets
13755
14074
 
13756
- $$.updateTargets($$.data.targets); // Redraw with new targets
14075
+ $$.updateTargets($$.data.targets); // Redraw with new targets
13757
14076
 
13758
- $$.redraw({
13759
- flow: {
13760
- index: baseValue.index,
13761
- length: length,
13762
- duration: isValue(args.duration) ? args.duration : $$.config.transition_duration,
13763
- done: args.done,
13764
- orgDataCount: orgDataCount
13765
- },
13766
- withLegend: !0,
13767
- withTransition: orgDataCount > 1,
13768
- withTrimXDomain: !1,
13769
- withUpdateXAxis: !0
13770
- });
14077
+ $$.redraw({
14078
+ flow: {
14079
+ index: baseValue.index,
14080
+ length: length,
14081
+ duration: isValue(args.duration) ? args.duration : $$.config.transition_duration,
14082
+ done: args.done,
14083
+ orgDataCount: orgDataCount
14084
+ },
14085
+ withLegend: !0,
14086
+ withTransition: orgDataCount > 1,
14087
+ withTrimXDomain: !1,
14088
+ withUpdateXAxis: !0
14089
+ });
14090
+ }
13771
14091
  }
13772
14092
  });
13773
14093
  // EXTERNAL MODULE: external {"commonjs":"d3-axis","commonjs2":"d3-axis","amd":"d3-axis","root":"d3"}
@@ -19637,10 +19957,10 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
19637
19957
 
19638
19958
  return classChartArc(d) + classFocus(d.data);
19639
19959
  }.bind(this)),
19640
- mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc);
19960
+ mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc).call(this.setCssRule(!1, "." + $ARC.chartArcs + " text", ["pointer-events:none", "text-anchor:middle"]));
19641
19961
 
19642
19962
  mainPieEnter.append("g").attr("class", classArcs).merge(mainPieUpdate);
19643
- mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : ".35em").style("opacity", "0").style("text-anchor", "middle").style("pointer-events", "none");
19963
+ mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : ".35em").style("opacity", "0").style("text-anchor", $$.getStylePropValue("middle")).style("pointer-events", $$.getStylePropValue("none"));
19644
19964
  $el.text = chartArcs.selectAll("." + $COMMON.target + " text"); // MEMO: can not keep same color..., but not bad to update color in redraw
19645
19965
  // mainPieUpdate.exit().remove();
19646
19966
  },
@@ -20121,8 +20441,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20121
20441
 
20122
20442
  if ($$.isAreaType(d)) {
20123
20443
  var area = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.area)();
20124
- area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue) // @ts-ignore
20125
- .y0(config.area_above ? 0 : value0).y1(value1);
20444
+ area = isRotated ? area.y(xValue).x0(value0).x1(value1) : area.x(xValue).y0(config.area_above ? 0 : config.area_below ? $$.state.height : value0).y1(value1);
20126
20445
 
20127
20446
  if (!lineConnectNull) {
20128
20447
  area = area.defined(function (d) {
@@ -20161,10 +20480,11 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20161
20480
  var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
20162
20481
  offset = areaOffset(d, i) || y0,
20163
20482
  posX = x(d),
20483
+ value = d.value,
20164
20484
  posY = y(d);
20165
20485
 
20166
20486
  // fix posY not to overflow opposite quadrant
20167
- if (config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY)) {
20487
+ if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
20168
20488
  posY = y0;
20169
20489
  } // 1 point that marks the area position
20170
20490
 
@@ -20190,7 +20510,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20190
20510
  config = this.config,
20191
20511
  clip = this.state.clip;
20192
20512
  $el.bar = $el.main.select("." + $COMMON.chart) // should positioned at the beginning of the shape node to not overlap others
20193
- .insert("g", ":first-child").attr("class", $BAR.chartBars); // set clip-path attribute when condition meet
20513
+ .insert("g", ":first-child").attr("class", $BAR.chartBars).call(this.setCssRule(!1, "." + $BAR.chartBars, ["pointer-events:none"])); // set clip-path attribute when condition meet
20194
20514
  // https://github.com/naver/billboard.js/issues/2421
20195
20515
 
20196
20516
  if (config.clipPath === !1 && (config.bar_radius || config.bar_radius_ratio)) {
@@ -20227,13 +20547,13 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20227
20547
 
20228
20548
  return classChartBar(d) + classFocus(d);
20229
20549
  }.bind(this)),
20230
- mainBarEnter = mainBarUpdate.enter().append("g").attr("class", classChartBar).style("opacity", "0").style("pointer-events", "none");
20550
+ mainBarEnter = mainBarUpdate.enter().append("g").attr("class", classChartBar).style("opacity", "0").style("pointer-events", $$.getStylePropValue("none"));
20231
20551
  // Bars for each data
20232
20552
  mainBarEnter.append("g").attr("class", classBars).style("cursor", function (d) {
20233
20553
  _newArrowCheck(this, _this);
20234
20554
 
20235
20555
  return isSelectable != null && isSelectable.bind != null && isSelectable.bind($$.api)(d) ? "pointer" : null;
20236
- }.bind(this));
20556
+ }.bind(this)).call($$.setCssRule(!0, " ." + $BAR.bar, ["fill"], $$.color));
20237
20557
  },
20238
20558
 
20239
20559
  /**
@@ -20255,7 +20575,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20255
20575
  initialOpacity = $$.initialOpacity.bind($$),
20256
20576
  bar = $root.main.selectAll("." + $BAR.bars).selectAll("." + $BAR.bar).data($$.labelishData.bind($$));
20257
20577
  $T(bar.exit(), withTransition).style("opacity", "0").remove();
20258
- $root.bar = bar.enter().append("path").attr("class", classBar).style("fill", $$.color).merge(bar).style("opacity", initialOpacity);
20578
+ $root.bar = bar.enter().append("path").attr("class", classBar).style("fill", $$.getStylePropValue($$.color)).merge(bar).style("opacity", initialOpacity);
20259
20579
  },
20260
20580
 
20261
20581
  /**
@@ -20280,7 +20600,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20280
20600
  _newArrowCheck(this, _this3);
20281
20601
 
20282
20602
  return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d);
20283
- }.bind(this)).style("fill", $$.color).style("opacity", null)];
20603
+ }.bind(this)).style("fill", $$.getStylePropValue($$.color)).style("opacity", null)];
20284
20604
  },
20285
20605
 
20286
20606
  /**
@@ -20396,7 +20716,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20396
20716
  return v.values.filter(function (v2) {
20397
20717
  _newArrowCheck(this, _this6);
20398
20718
 
20399
- return v2.index === index && (value > 0 ? v2.value > 0 : v2.value < 0);
20719
+ return v2.index === index && (isNumber(value) && value > 0 ? v2.value > 0 : v2.value < 0);
20400
20720
  }.bind(this))[0];
20401
20721
  }.bind(this)).filter(Boolean).map(function (v) {
20402
20722
  _newArrowCheck(this, _this5);
@@ -20433,11 +20753,12 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
20433
20753
  var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
20434
20754
  offset = barOffset(d, i) || y0,
20435
20755
  width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
20756
+ value = d.value,
20436
20757
  posX = barX(d),
20437
20758
  posY = barY(d);
20438
20759
 
20439
20760
  // fix posY not to overflow opposite quadrant
20440
- if (config.axis_rotated && (d.value > 0 && posY < y0 || d.value < 0 && y0 < posY)) {
20761
+ if (config.axis_rotated && (value > 0 && posY < y0 || value < 0 && y0 < posY)) {
20441
20762
  posY = y0;
20442
20763
  }
20443
20764
 
@@ -20914,7 +21235,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
20914
21235
  /* harmony default export */ var line = ({
20915
21236
  initLine: function initLine() {
20916
21237
  var $el = this.$el;
20917
- $el.line = $el.main.select("." + $COMMON.chart).append("g").attr("class", $LINE.chartLines);
21238
+ $el.line = $el.main.select("." + $COMMON.chart).append("g").attr("class", $LINE.chartLines).call(this.setCssRule(!1, "." + $LINE.chartLines, ["pointer-events:none"]));
20918
21239
  },
20919
21240
  updateTargetsForLine: function updateTargetsForLine(t) {
20920
21241
  var _this = this,
@@ -20941,7 +21262,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
20941
21262
 
20942
21263
  return classChartLine(d) + classFocus(d);
20943
21264
  }.bind(this)),
20944
- mainLineEnter = mainLineUpdate.enter().append("g").attr("class", classChartLine).style("opacity", "0").style("pointer-events", "none");
21265
+ mainLineEnter = mainLineUpdate.enter().append("g").attr("class", classChartLine).style("opacity", "0").style("pointer-events", $$.getStylePropValue("none"));
20945
21266
  // Lines for each data
20946
21267
  mainLineEnter.append("g").attr("class", classLines); // Areas
20947
21268
 
@@ -21344,10 +21665,11 @@ var getTransitionName = function () {
21344
21665
 
21345
21666
  return $$.generateClass($SELECT.selectedCircles, d.id);
21346
21667
  }.bind(this));
21347
- enterNode.append("g").attr("class", classCircles).style("cursor", function (d) {
21668
+ enterNode.append("g").attr("class", classCircles).call(function (selection) {
21348
21669
  _newArrowCheck(this, _this2);
21349
21670
 
21350
- return isFunction(isSelectable) && isSelectable(d) ? "pointer" : null;
21671
+ $$.setCssRule(!0, "." + $CIRCLE.circles, ["cursor:pointer"], isSelectable)(selection);
21672
+ $$.setCssRule(!0, " ." + $CIRCLE.circle, ["fill", "stroke"], $$.color)(selection);
21351
21673
  }.bind(this)).style("opacity", function () {
21352
21674
  var parent = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this.parentNode); // if the parent node is .bb-chart-circles (bubble, scatter), initialize <g bb-circles> with opacity "0"
21353
21675
 
@@ -21387,8 +21709,8 @@ var getTransitionName = function () {
21387
21709
  return $$.isLineType(d) && $$.shouldDrawPointsForLine(d) || $$.isBubbleType(d) || $$.isRadarType(d) || $$.isScatterType(d) ? focusOnly ? [d.values[0]] : d.values : [];
21388
21710
  }.bind(this));
21389
21711
  circles.exit().remove();
21390
- circles.enter().filter(Boolean).append($$.point("create", this, $$.pointR.bind($$), $$.color));
21391
- $root.circle = $root.main.selectAll("." + $CIRCLE.circles + " ." + $CIRCLE.circle).style("stroke", $$.color).style("opacity", $$.initialOpacityForCircle.bind($$));
21712
+ circles.enter().filter(Boolean).append($$.point("create", this, $$.pointR.bind($$), $$.getStylePropValue($$.color)));
21713
+ $root.circle = $root.main.selectAll("." + $CIRCLE.circles + " ." + $CIRCLE.circle).style("stroke", $$.getStylePropValue($$.color)).style("opacity", $$.initialOpacityForCircle.bind($$));
21392
21714
  }
21393
21715
  },
21394
21716
  redrawCircle: function redrawCircle(cx, cy, withTransition, flow, isSub) {
@@ -21407,7 +21729,7 @@ var getTransitionName = function () {
21407
21729
  return [];
21408
21730
  }
21409
21731
 
21410
- var fn = $$.point("update", $$, cx, cy, $$.color, withTransition, flow, selectedCircles),
21732
+ var fn = $$.point("update", $$, cx, cy, $$.getStylePropValue($$.color), withTransition, flow, selectedCircles),
21411
21733
  posAttr = $$.isCirclePoint() ? "c" : "",
21412
21734
  t = getRandom(),
21413
21735
  opacityStyleFn = $$.opacityForCircle.bind($$),
@@ -21440,7 +21762,7 @@ var getTransitionName = function () {
21440
21762
  var cx = (hasRadar ? $$.radarCircleX : $$.circleX).bind($$),
21441
21763
  cy = (hasRadar ? $$.radarCircleY : $$.circleY).bind($$),
21442
21764
  withTransition = toggling || isUndefined(d),
21443
- fn = $$.point("update", $$, cx, cy, $$.color, resizing ? !1 : withTransition);
21765
+ fn = $$.point("update", $$, cx, cy, $$.getStylePropValue($$.color), resizing ? !1 : withTransition);
21444
21766
 
21445
21767
  if (d) {
21446
21768
  circle = circle.filter(function (t) {
@@ -21541,7 +21863,12 @@ var getTransitionName = function () {
21541
21863
  return (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($COMMON.EXPANDED);
21542
21864
  }).classed($COMMON.EXPANDED, !1);
21543
21865
  circles.attr("r", r);
21544
- $$.isCirclePoint() || circles.attr("transform", "scale(" + r(circles) / $$.config.point_r + ")");
21866
+
21867
+ if (!$$.isCirclePoint()) {
21868
+ var _scale = r(circles) / $$.config.point_r;
21869
+
21870
+ circles.attr("transform", _scale !== 1 ? "scale(" + _scale + ")" : null);
21871
+ }
21545
21872
  },
21546
21873
  pointR: function (d) {
21547
21874
  var $$ = this,
@@ -21715,7 +22042,7 @@ var getTransitionName = function () {
21715
22042
  };
21716
22043
  },
21717
22044
  custom: {
21718
- create: function create(element, id, sizeFn, fillStyleFn) {
22045
+ create: function create(element, id, fillStyleFn) {
21719
22046
  return element.append("use").attr("xlink:href", "#" + id).attr("class", this.updatePointClass.bind(this)).style("fill", fillStyleFn).node();
21720
22047
  },
21721
22048
  update: function update(element, xPosFn, yPosFn, fillStyleFn, withTransition, flow, selectedCircles) {
@@ -21865,8 +22192,10 @@ function getDataMax($$) {
21865
22192
  * @private
21866
22193
  */
21867
22194
  getPolarOuterRadius: function getPolarOuterRadius(d, outerRadius) {
21868
- var dataMax = getDataMax(this);
21869
- return (d == null ? void 0 : d.data.values[0].value) / dataMax * outerRadius;
22195
+ var _d$data$values$0$valu,
22196
+ dataMax = getDataMax(this);
22197
+
22198
+ return ((_d$data$values$0$valu = d == null ? void 0 : d.data.values[0].value) != null ? _d$data$values$0$valu : 0) / dataMax * outerRadius;
21870
22199
  },
21871
22200
 
21872
22201
  /**
@@ -22486,7 +22815,9 @@ var cacheKey = KEY.radarPoints;
22486
22815
  * @memberof Options
22487
22816
  * @type {object}
22488
22817
  * @property {object} area Area object
22489
- * @property {boolean} [area.above=false] Set background area above the data chart line.
22818
+ * @property {boolean} [area.above=false] Set background area `above` the data chart line.
22819
+ * @property {boolean} [area.below=false] Set background area `below` the data chart line.
22820
+ * - **NOTE**: Can't be used along with `above` option. When above & below options are set to true, `above` will be prioritized.
22490
22821
  * @property {boolean} [area.front=true] Set area node to be positioned over line node.
22491
22822
  * @property {boolean|object} [area.linearGradient=false] Set the linear gradient on area.<br><br>
22492
22823
  * Or customize by giving below object value:
@@ -22497,10 +22828,12 @@ var cacheKey = KEY.radarPoints;
22497
22828
  * @see [MDN's &lt;linearGradient>](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient), [&lt;stop>](https://developer.mozilla.org/en-US/docs/Web/SVG/Element/stop)
22498
22829
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.AreaChart)
22499
22830
  * @see [Demo: above](https://naver.github.io/billboard.js/demo/#AreaChartOptions.Above)
22831
+ * @see [Demo: below](https://naver.github.io/billboard.js/demo/#AreaChartOptions.Below)
22500
22832
  * @see [Demo: linearGradient](https://naver.github.io/billboard.js/demo/#AreaChartOptions.LinearGradient)
22501
22833
  * @example
22502
22834
  * area: {
22503
22835
  * above: true,
22836
+ * below: false,
22504
22837
  * zerobased: false,
22505
22838
  *
22506
22839
  * // <g class='bb-areas'> will be positioned behind the line <g class='bb-lines'> in stacking order
@@ -22532,6 +22865,7 @@ var cacheKey = KEY.radarPoints;
22532
22865
  * }
22533
22866
  */
22534
22867
  area_above: !1,
22868
+ area_below: !1,
22535
22869
  area_front: !0,
22536
22870
  area_linearGradient: !1,
22537
22871
  area_zerobased: !0
@@ -25602,7 +25936,7 @@ var _defaults = {},
25602
25936
  * bb.version; // "1.0.0"
25603
25937
  * @memberof bb
25604
25938
  */
25605
- version: "3.5.0-next.1",
25939
+ version: "3.5.1",
25606
25940
 
25607
25941
  /**
25608
25942
  * Generate chart
@@ -25737,7 +26071,7 @@ var _defaults = {},
25737
26071
  };
25738
26072
  /**
25739
26073
  * @namespace bb
25740
- * @version 3.5.0-next.1
26074
+ * @version 3.5.1
25741
26075
  */
25742
26076
  ;// CONCATENATED MODULE: ./src/index.ts
25743
26077