@d3plus/core 3.0.15 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88482 -2998
  3. package/es/index.js +1 -1
  4. package/es/src/charts/AreaPlot.js +1 -3
  5. package/es/src/charts/BarChart.js +1 -3
  6. package/es/src/charts/BoxWhisker.js +2 -4
  7. package/es/src/charts/BumpChart.js +4 -5
  8. package/es/src/charts/Donut.js +1 -3
  9. package/es/src/charts/Geomap.js +47 -88
  10. package/es/src/charts/LinePlot.js +1 -3
  11. package/es/src/charts/Matrix.js +27 -46
  12. package/es/src/charts/Network.js +87 -81
  13. package/es/src/charts/Pack.js +21 -34
  14. package/es/src/charts/Pie.js +12 -24
  15. package/es/src/charts/Plot.js +226 -321
  16. package/es/src/charts/Priestley.js +18 -36
  17. package/es/src/charts/Radar.js +100 -47
  18. package/es/src/charts/RadialMatrix.js +35 -47
  19. package/es/src/charts/Rings.js +99 -90
  20. package/es/src/charts/Sankey.js +85 -75
  21. package/es/src/charts/StackedArea.js +1 -3
  22. package/es/src/charts/Tree.js +27 -28
  23. package/es/src/charts/Treemap.js +117 -71
  24. package/es/src/charts/Viz.js +297 -493
  25. package/es/src/charts/drawSteps/drawAttribution.js +1 -1
  26. package/es/src/charts/drawSteps/drawBack.js +1 -2
  27. package/es/src/charts/drawSteps/drawColorScale.js +1 -2
  28. package/es/src/charts/drawSteps/drawLegend.js +8 -10
  29. package/es/src/charts/drawSteps/drawSubtitle.js +1 -3
  30. package/es/src/charts/drawSteps/drawTimeline.js +12 -9
  31. package/es/src/charts/drawSteps/drawTitle.js +1 -3
  32. package/es/src/charts/drawSteps/drawTotal.js +1 -3
  33. package/es/src/charts/drawSteps/zoomControls.js +19 -21
  34. package/es/src/charts/events/click.legend.js +2 -3
  35. package/es/src/charts/events/click.shape.js +2 -4
  36. package/es/src/charts/events/mouseenter.js +7 -8
  37. package/es/src/charts/events/mouseleave.js +1 -3
  38. package/es/src/charts/events/mousemove.legend.js +3 -4
  39. package/es/src/charts/events/mousemove.shape.js +2 -4
  40. package/es/src/charts/events/touchstart.body.js +1 -1
  41. package/es/src/charts/helpers/matrixData.js +11 -4
  42. package/es/src/charts/helpers/tileAttributions.js +2 -1
  43. package/es/src/charts/plotBuffers/Bar.js +55 -12
  44. package/es/src/charts/plotBuffers/Box.js +55 -12
  45. package/es/src/charts/plotBuffers/Circle.js +9 -11
  46. package/es/src/charts/plotBuffers/Line.js +4 -6
  47. package/es/src/charts/plotBuffers/Rect.js +10 -12
  48. package/es/src/charts/plotBuffers/discreteBuffer.js +4 -2
  49. package/es/src/charts/plotBuffers/numericBuffer.js +7 -6
  50. package/es/src/components/Axis.js +298 -426
  51. package/es/src/components/AxisBottom.js +1 -3
  52. package/es/src/components/AxisLeft.js +1 -3
  53. package/es/src/components/AxisRight.js +1 -3
  54. package/es/src/components/AxisTop.js +1 -3
  55. package/es/src/components/ColorScale.js +80 -197
  56. package/es/src/components/Legend.js +82 -135
  57. package/es/src/components/Message.js +27 -19
  58. package/es/src/components/TextBox.js +106 -262
  59. package/es/src/components/Timeline.js +88 -155
  60. package/es/src/components/Tooltip.js +301 -330
  61. package/es/src/shapes/Area.js +95 -74
  62. package/es/src/shapes/Bar.js +46 -86
  63. package/es/src/shapes/Box.js +104 -118
  64. package/es/src/shapes/Circle.js +29 -30
  65. package/es/src/shapes/Image.js +44 -102
  66. package/es/src/shapes/Line.js +74 -40
  67. package/es/src/shapes/Path.js +23 -25
  68. package/es/src/shapes/Rect.js +29 -41
  69. package/es/src/shapes/Shape.js +152 -369
  70. package/es/src/shapes/Whisker.js +89 -90
  71. package/es/src/utils/AccessorFn.js +4 -0
  72. package/es/src/utils/BaseClass.js +53 -82
  73. package/es/src/utils/D3plusConfig.js +1 -0
  74. package/es/src/utils/RESET.js +2 -4
  75. package/es/src/utils/accessor.js +4 -5
  76. package/es/src/utils/configPrep.js +13 -12
  77. package/es/src/utils/constant.js +2 -3
  78. package/es/src/utils/getProp.js +4 -4
  79. package/es/src/utils/index.js +0 -1
  80. package/package.json +29 -22
  81. package/types/index.d.ts +5 -0
  82. package/types/src/charts/AreaPlot.d.ts +16 -0
  83. package/types/src/charts/BarChart.d.ts +16 -0
  84. package/types/src/charts/BoxWhisker.d.ts +11 -0
  85. package/types/src/charts/BumpChart.d.ts +36 -0
  86. package/types/src/charts/Donut.d.ts +11 -0
  87. package/types/src/charts/Geomap.d.ts +120 -0
  88. package/types/src/charts/LinePlot.d.ts +15 -0
  89. package/types/src/charts/Matrix.d.ts +74 -0
  90. package/types/src/charts/Network.d.ts +78 -0
  91. package/types/src/charts/Pack.d.ts +47 -0
  92. package/types/src/charts/Pie.d.ts +44 -0
  93. package/types/src/charts/Plot.d.ts +199 -0
  94. package/types/src/charts/Priestley.d.ts +37 -0
  95. package/types/src/charts/Radar.d.ts +38 -0
  96. package/types/src/charts/RadialMatrix.d.ts +78 -0
  97. package/types/src/charts/Rings.d.ts +74 -0
  98. package/types/src/charts/Sankey.d.ts +81 -0
  99. package/types/src/charts/StackedArea.d.ts +14 -0
  100. package/types/src/charts/Tree.d.ts +33 -0
  101. package/types/src/charts/Treemap.d.ts +51 -0
  102. package/types/src/charts/Viz.d.ts +402 -0
  103. package/types/src/charts/drawSteps/drawAttribution.d.ts +7 -0
  104. package/types/src/charts/drawSteps/drawBack.d.ts +6 -0
  105. package/types/src/charts/drawSteps/drawColorScale.d.ts +6 -0
  106. package/types/src/charts/drawSteps/drawLegend.d.ts +12 -0
  107. package/types/src/charts/drawSteps/drawSubtitle.d.ts +7 -0
  108. package/types/src/charts/drawSteps/drawTimeline.d.ts +7 -0
  109. package/types/src/charts/drawSteps/drawTitle.d.ts +7 -0
  110. package/types/src/charts/drawSteps/drawTotal.d.ts +7 -0
  111. package/types/src/charts/drawSteps/zoomControls.d.ts +7 -0
  112. package/types/src/charts/events/click.legend.d.ts +8 -0
  113. package/types/src/charts/events/click.shape.d.ts +8 -0
  114. package/types/src/charts/events/mouseenter.d.ts +8 -0
  115. package/types/src/charts/events/mouseleave.d.ts +8 -0
  116. package/types/src/charts/events/mousemove.legend.d.ts +9 -0
  117. package/types/src/charts/events/mousemove.shape.d.ts +9 -0
  118. package/types/src/charts/events/touchstart.body.d.ts +7 -0
  119. package/types/src/charts/helpers/matrixData.d.ts +11 -0
  120. package/types/src/charts/helpers/tileAttributions.d.ts +6 -0
  121. package/types/src/charts/index.d.ts +21 -0
  122. package/types/src/charts/plotBuffers/Bar.d.ts +16 -0
  123. package/types/src/charts/plotBuffers/Box.d.ts +16 -0
  124. package/types/src/charts/plotBuffers/Circle.d.ts +20 -0
  125. package/types/src/charts/plotBuffers/Line.d.ts +16 -0
  126. package/types/src/charts/plotBuffers/Rect.d.ts +19 -0
  127. package/types/src/charts/plotBuffers/discreteBuffer.d.ts +7 -0
  128. package/types/src/charts/plotBuffers/numericBuffer.d.ts +5 -0
  129. package/types/src/components/Axis.d.ts +309 -0
  130. package/types/src/components/AxisBottom.d.ts +11 -0
  131. package/types/src/components/AxisLeft.d.ts +11 -0
  132. package/types/src/components/AxisRight.d.ts +11 -0
  133. package/types/src/components/AxisTop.d.ts +11 -0
  134. package/types/src/components/ColorScale.d.ts +208 -0
  135. package/types/src/components/Legend.d.ts +157 -0
  136. package/types/src/components/Message.d.ts +40 -0
  137. package/types/src/components/TextBox.d.ts +278 -0
  138. package/types/src/components/Timeline.d.ts +157 -0
  139. package/types/src/components/Tooltip.d.ts +297 -0
  140. package/types/src/components/index.d.ts +11 -0
  141. package/types/src/shapes/Area.d.ts +81 -0
  142. package/types/src/shapes/Bar.d.ts +104 -0
  143. package/types/src/shapes/Box.d.ts +121 -0
  144. package/types/src/shapes/Circle.d.ts +44 -0
  145. package/types/src/shapes/Image.d.ts +124 -0
  146. package/types/src/shapes/Line.d.ts +48 -0
  147. package/types/src/shapes/Path.d.ts +38 -0
  148. package/types/src/shapes/Rect.d.ts +54 -0
  149. package/types/src/shapes/Shape.d.ts +378 -0
  150. package/types/src/shapes/Whisker.d.ts +96 -0
  151. package/types/src/shapes/index.d.ts +10 -0
  152. package/types/src/utils/AccessorFn.d.ts +6 -0
  153. package/types/src/utils/BaseClass.d.ts +76 -0
  154. package/types/src/utils/D3plusConfig.d.ts +164 -0
  155. package/types/src/utils/RESET.d.ts +3 -0
  156. package/types/src/utils/accessor.d.ts +13 -0
  157. package/types/src/utils/configPrep.d.ts +28 -0
  158. package/types/src/utils/constant.d.ts +11 -0
  159. package/types/src/utils/getProp.d.ts +9 -0
  160. package/types/src/utils/index.d.ts +8 -0
  161. package/umd/d3plus-core.full.js +20134 -18708
  162. package/umd/d3plus-core.full.js.map +1 -1
  163. package/umd/d3plus-core.full.min.js +2922 -5396
  164. package/umd/d3plus-core.js +1927 -4081
  165. package/umd/d3plus-core.js.map +1 -1
  166. package/umd/d3plus-core.min.js +1607 -3939
  167. package/es/src/utils/uuid.js +0 -13
@@ -70,6 +70,14 @@ function _inherits(subClass, superClass) {
70
70
  });
71
71
  if (superClass) _set_prototype_of(subClass, superClass);
72
72
  }
73
+ function _instanceof(left, right) {
74
+ "@swc/helpers - instanceof";
75
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
76
+ return !!right[Symbol.hasInstance](left);
77
+ } else {
78
+ return left instanceof right;
79
+ }
80
+ }
73
81
  function _iterable_to_array(iter) {
74
82
  if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
75
83
  }
@@ -147,10 +155,11 @@ import { timeFormat, timeFormatDefaultLocale } from "d3-time-format";
147
155
  import * as scales from "d3-scale";
148
156
  import { select } from "d3-selection";
149
157
  import { transition } from "d3-transition";
158
+ // @ts-ignore
150
159
  import pkg from "open-color/open-color.js";
151
160
  var openColor = pkg.theme;
152
- import { colorDefaults } from "@d3plus/color";
153
- import { assign, attrize, date, elem, rtl as detectRTL } from "@d3plus/dom";
161
+ import { colorContrast, colorDefaults } from "@d3plus/color";
162
+ import { assign, attrize, backgroundColor, date, elem, rtl as detectRTL } from "@d3plus/dom";
154
163
  import { formatAbbreviate, formatDate } from "@d3plus/format";
155
164
  import { formatLocale, locale } from "@d3plus/locales";
156
165
  import { closest } from "@d3plus/math";
@@ -158,16 +167,16 @@ import { fontFamily as d3plusFontFamily, textWrap } from "@d3plus/text";
158
167
  import { TextBox } from "../components/index.js";
159
168
  import * as shapes from "../shapes/index.js";
160
169
  import { configPrep, BaseClass, constant } from "../utils/index.js";
161
- /* catches for -0 and less */ var isNegative = function(d) {
170
+ /* catches for -0 and less*/ var isNegative = function isNegative(d) {
162
171
  return d < 0 || Object.is(d, -0);
163
172
  };
164
- var floorPow = function(d) {
165
- return Math.pow(10, Math.floor(Math.log10(Math.abs(d)))) * Math.pow(-1, isNegative(d));
173
+ var floorPow = function floorPow(d) {
174
+ return Math.pow(10, Math.floor(Math.log10(Math.abs(d)))) * Math.pow(-1, isNegative(d) ? 1 : 0);
166
175
  };
167
- var ceilPow = function(d) {
168
- return Math.pow(10, Math.ceil(Math.log10(Math.abs(d)))) * Math.pow(-1, isNegative(d));
176
+ var ceilPow = function ceilPow(d) {
177
+ return Math.pow(10, Math.ceil(Math.log10(Math.abs(d)))) * Math.pow(-1, isNegative(d) ? 1 : 0);
169
178
  };
170
- var fixFloat = function(d) {
179
+ var fixFloat = function fixFloat(d) {
171
180
  var str = "".concat(d);
172
181
  if (str.includes("e-") || str === "0") return 0;
173
182
  var nineMatch = str.match(/(-*[0-9]+\.[0]*)([0-8]+)9{3,}[0-9]+$/);
@@ -181,8 +190,10 @@ var maxTimezoneOffset = 1000 * 60 * 60 * 26;
181
190
  * Calculates ticks from a given scale (negative and/or positive)
182
191
  * @param {scale} scale A d3-scale object
183
192
  * @private
184
- */ function calculateStep(scale) {
193
+ */ function calculateStep(// eslint-disable-next-line @typescript-eslint/no-explicit-any
194
+ scale) {
185
195
  var minorTicks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
196
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
186
197
  var stepScale = scales.scaleLinear().domain([
187
198
  200,
188
199
  1200
@@ -218,7 +229,8 @@ var maxTimezoneOffset = 1000 * 60 * 60 * 26;
218
229
  * Calculates ticks from a given scale (negative and/or positive)
219
230
  * @param {scale} scale A d3-scale object
220
231
  * @private
221
- */ function calculateTicks(scale) {
232
+ */ function calculateTicks(// eslint-disable-next-line @typescript-eslint/no-explicit-any
233
+ scale) {
222
234
  var minorTicks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
223
235
  var ticks = [];
224
236
  var scaleClone = scale.copy();
@@ -301,10 +313,21 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
301
313
  function Axis() {
302
314
  _class_call_check(this, Axis);
303
315
  var _this;
304
- _this = _call_super(this, Axis);
316
+ _this = _call_super(this, Axis), _define_property(_this, "_select", void 0), _define_property(_this, "_align", void 0), _define_property(_this, "_barConfig", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
317
+ _define_property(_this, "_data", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
318
+ _define_property(_this, "_domain", void 0), _define_property(_this, "_duration", void 0), _define_property(_this, "_gridConfig", void 0), _define_property(_this, "_gridLog", void 0), _define_property(_this, "_gridSize", void 0), _define_property(_this, "_grid", void 0), _define_property(_this, "_height", void 0), _define_property(_this, "_labelOffset", void 0), _define_property(_this, "_labelRotation", void 0), _define_property(_this, "_labels", void 0), _define_property(_this, "_margin", void 0), _define_property(_this, "_maxSize", void 0), _define_property(_this, "_minSize", void 0), _define_property(_this, "_orient", void 0), _define_property(_this, "_outerBounds", void 0), _define_property(_this, "_padding", void 0), _define_property(_this, "_paddingInner", void 0), _define_property(_this, "_paddingOuter", void 0), _define_property(_this, "_position", void 0), _define_property(_this, "_range", void 0), _define_property(_this, "_rounding", void 0), _define_property(_this, "_roundingInsideMinPrefix", void 0), _define_property(_this, "_roundingInsideMinSuffix", void 0), _define_property(_this, "_roundingInsideMaxPrefix", void 0), _define_property(_this, "_roundingInsideMaxSuffix", void 0), _define_property(_this, "_scale", void 0), _define_property(_this, "_scalePadding", void 0), _define_property(_this, "_shape", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
319
+ _define_property(_this, "_shapeConfig", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
320
+ _define_property(_this, "_tickFormat", void 0), _define_property(_this, "_ticks", void 0), _define_property(_this, "_tickSize", void 0), _define_property(_this, "_tickSuffix", void 0), _define_property(_this, "_tickUnit", void 0), _define_property(_this, "_timeLocale", void 0), _define_property(_this, "_title", void 0), _define_property(_this, "_titleClass", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
321
+ _define_property(_this, "_titleConfig", void 0), _define_property(_this, "_width", void 0), // D3 scales have complex polymorphic types that vary at runtime
322
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
323
+ _define_property(_this, "_d3Scale", void 0), // eslint-disable-next-line @typescript-eslint/no-explicit-any
324
+ _define_property(_this, "_d3ScaleNegative", void 0), _define_property(_this, "_group", void 0), _define_property(_this, "_lastScale", void 0), _define_property(_this, "_availableTicks", void 0), _define_property(_this, "_visibleTicks", void 0), _define_property(_this, "_transition", void 0), _define_property(_this, "_userFormat", void 0);
305
325
  _this._align = "middle";
306
326
  _this._barConfig = {
307
- stroke: openColor.colors.gray[600],
327
+ stroke: function stroke() {
328
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
329
+ return colorContrast(bg);
330
+ },
308
331
  "stroke-width": 1
309
332
  };
310
333
  _this._data = [];
@@ -314,7 +337,11 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
314
337
  ];
315
338
  _this._duration = 600;
316
339
  _this._gridConfig = {
317
- stroke: colorDefaults.light,
340
+ stroke: function stroke() {
341
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
342
+ var contrast = colorContrast(bg);
343
+ return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
344
+ },
318
345
  "stroke-width": 1
319
346
  };
320
347
  _this._gridLog = false;
@@ -340,35 +367,44 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
340
367
  _this._scalePadding = 0.5;
341
368
  _this._shape = "Line";
342
369
  _this._shapeConfig = {
343
- fill: openColor.colors.gray[600],
344
- height: function(d) {
370
+ fill: function fill() {
371
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
372
+ return colorContrast(bg);
373
+ },
374
+ height: function height(d) {
345
375
  return d.tick ? 8 : 0;
346
376
  },
347
- label: function(d) {
377
+ label: function label(d) {
348
378
  return d.text;
349
379
  },
350
- labelBounds: function(d) {
380
+ labelBounds: function labelBounds(d) {
351
381
  return d.labelBounds;
352
382
  },
353
383
  labelConfig: {
354
- fontColor: openColor.colors.gray[600],
384
+ fontColor: function fontColor() {
385
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
386
+ return colorContrast(bg);
387
+ },
355
388
  fontResize: false,
356
389
  fontSize: constant(12),
357
390
  padding: 5,
358
- textAnchor: function() {
359
- var rtl = detectRTL(_this._select.node());
391
+ textAnchor: function textAnchor() {
392
+ var rtl = detectRTL();
360
393
  return _this._orient === "left" ? rtl ? "start" : "end" : _this._orient === "right" ? rtl ? "end" : "start" : _this._labelRotation ? _this._orient === "bottom" ? "end" : "start" : "middle";
361
394
  },
362
- verticalAlign: function() {
395
+ verticalAlign: function verticalAlign() {
363
396
  return _this._orient === "bottom" ? "top" : _this._orient === "top" ? "bottom" : "middle";
364
397
  }
365
398
  },
366
- r: function(d) {
399
+ r: function r(d) {
367
400
  return d.tick ? 4 : 0;
368
401
  },
369
- stroke: openColor.colors.gray[600],
402
+ stroke: function stroke() {
403
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
404
+ return colorContrast(bg);
405
+ },
370
406
  strokeWidth: 1,
371
- width: function(d) {
407
+ width: function width(d) {
372
408
  return d.tick ? 8 : 0;
373
409
  }
374
410
  };
@@ -378,21 +414,31 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
378
414
  _this._timeLocale = undefined;
379
415
  _this._titleClass = new TextBox();
380
416
  _this._titleConfig = {
381
- fontColor: colorDefaults.dark,
417
+ fontColor: function fontColor() {
418
+ var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
419
+ return colorContrast(bg);
420
+ },
382
421
  fontSize: 12,
383
422
  textAnchor: "middle"
384
423
  };
385
424
  _this._width = 400;
425
+ _this._margin = {
426
+ top: 0,
427
+ right: 0,
428
+ bottom: 0,
429
+ left: 0
430
+ };
431
+ _this._availableTicks = [];
432
+ _this._visibleTicks = [];
386
433
  return _this;
387
434
  }
388
435
  _create_class(Axis, [
389
436
  {
390
437
  /**
391
- @memberof Axis
392
- @desc Sets positioning for the axis bar.
393
- @param {D3Selection} *bar*
394
- @private
395
- */ key: "_barPosition",
438
+ Sets positioning for the axis bar.
439
+ @param bar @private
440
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
441
+ key: "_barPosition",
396
442
  value: function _barPosition(bar) {
397
443
  var _this__position = this._position, height = _this__position.height, x = _this__position.x, y = _this__position.y, opposite = _this__position.opposite, offset = this._margin[opposite], position = [
398
444
  "top",
@@ -408,10 +454,9 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
408
454
  },
409
455
  {
410
456
  /**
411
- @memberof Axis
412
- @desc Returns the scale's domain, taking into account negative and positive log scales.
457
+ Returns the scale's domain, taking into account negative and positive log scales.
413
458
  @private
414
- */ key: "_getDomain",
459
+ */ key: "_getDomain",
415
460
  value: function _getDomain() {
416
461
  var ticks = [];
417
462
  if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.domain();
@@ -426,11 +471,9 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
426
471
  },
427
472
  {
428
473
  /**
429
- @memberof Axis
430
- @desc Returns a value's scale position, taking into account negative and positive log scales.
431
- @param {Number|String} *d*
432
- @private
433
- */ key: "_getPosition",
474
+ Returns a value's scale position, taking into account negative and positive log scales.
475
+ @param d @private
476
+ */ key: "_getPosition",
434
477
  value: function _getPosition(d) {
435
478
  if (this._scale === "log") {
436
479
  if (d === 0) return (this._d3Scale || this._d3ScaleNegative).range()[this._d3Scale ? 0 : 1];
@@ -443,10 +486,9 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
443
486
  },
444
487
  {
445
488
  /**
446
- @memberof Axis
447
- @desc Returns the scale's range, taking into account negative and positive log scales.
489
+ Returns the scale's range, taking into account negative and positive log scales.
448
490
  @private
449
- */ key: "_getRange",
491
+ */ key: "_getRange",
450
492
  value: function _getRange() {
451
493
  var ticks = [];
452
494
  if (this._d3ScaleNegative) ticks = this._d3ScaleNegative.range();
@@ -456,10 +498,9 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
456
498
  },
457
499
  {
458
500
  /**
459
- @memberof Axis
460
- @desc Returns the scale's labels, taking into account negative and positive log scales.
501
+ Returns the scale's labels, taking into account negative and positive log scales.
461
502
  @private
462
- */ key: "_getLabels",
503
+ */ key: "_getLabels",
463
504
  value: function _getLabels() {
464
505
  var labels = [];
465
506
  if (this._d3ScaleNegative) labels = labels.concat(calculateTicks.bind(this)(this._d3ScaleNegative, false));
@@ -489,10 +530,9 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
489
530
  },
490
531
  {
491
532
  /**
492
- @memberof Axis
493
- @desc Returns the scale's ticks, taking into account negative and positive log scales.
533
+ Returns the scale's ticks, taking into account negative and positive log scales.
494
534
  @private
495
- */ key: "_getTicks",
535
+ */ key: "_getTicks",
496
536
  value: function _getTicks() {
497
537
  if ([
498
538
  "band",
@@ -511,11 +551,10 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
511
551
  },
512
552
  {
513
553
  /**
514
- @memberof Axis
515
- @desc Sets positioning for the grid lines.
516
- @param {D3Selection} *lines*
517
- @private
518
- */ key: "_gridPosition",
554
+ Sets positioning for the grid lines.
555
+ @param lines @private
556
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
557
+ key: "_gridPosition",
519
558
  value: function _gridPosition(lines) {
520
559
  var last = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
521
560
  var _this__position = this._position, height = _this__position.height, x = _this__position.x, y = _this__position.y, opposite = _this__position.opposite, offset = this._margin[opposite], position = [
@@ -524,7 +563,7 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
524
563
  ].includes(this._orient) ? this._outerBounds[y] + this._outerBounds[height] - offset : this._outerBounds[y] + offset, scale = last ? this._lastScale || this._getPosition.bind(this) : this._getPosition.bind(this), size = [
525
564
  "top",
526
565
  "left"
527
- ].includes(this._orient) ? offset : -offset, xDiff = this._scale === "band" ? this._d3Scale.bandwidth() / 2 : 0, xPos = function(d) {
566
+ ].includes(this._orient) ? offset : -offset, xDiff = this._scale === "band" ? this._d3Scale.bandwidth() / 2 : 0, xPos = function xPos(d) {
528
567
  return scale(d.id) + xDiff;
529
568
  };
530
569
  lines.call(attrize, this._gridConfig).attr("".concat(x, "1"), xPos).attr("".concat(x, "2"), xPos).attr("".concat(y, "1"), position).attr("".concat(y, "2"), last ? position : position + size);
@@ -532,24 +571,23 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
532
571
  },
533
572
  {
534
573
  /**
535
- @memberof Axis
536
- @desc Renders the current Axis to the page. If a *callback* is specified, it will be called once the legend is done drawing.
537
- @param {Function} [*callback* = undefined]
538
- @chainable
539
- */ key: "render",
574
+ Renders the current Axis to the page.
575
+ @param callback Optional callback invoked after rendering completes.
576
+ */ key: "render",
540
577
  value: function render(callback) {
541
578
  var _this = this;
579
+ var _this1 = this;
542
580
  /**
543
581
  * Creates an SVG element to contain the axis if none
544
582
  * has been specified using the "select" method.
545
- */ if (this._select === void 0) {
583
+ */ if (this._select === void 0) {
546
584
  this.select(select("body").append("svg").attr("width", "".concat(this._width, "px")).attr("height", "".concat(this._height, "px")).node());
547
585
  }
548
586
  var timeLocale = this._timeLocale || locale[this._locale] || locale["en-US"];
549
- timeFormatDefaultLocale(timeLocale).format();
587
+ timeFormatDefaultLocale(timeLocale);
550
588
  /**
551
589
  * Declares some commonly used variables.
552
- */ var _this__position = this._position, width = _this__position.width, height = _this__position.height, x = _this__position.x, y = _this__position.y, horizontal = _this__position.horizontal, opposite = _this__position.opposite, clipId = "d3plus-Axis-clip-".concat(this._uuid), flip = [
590
+ */ var _this__position = this._position, width = _this__position.width, height = _this__position.height, x = _this__position.x, y = _this__position.y, horizontal = _this__position.horizontal, opposite = _this__position.opposite, clipId = "d3plus-Axis-clip-".concat(this._uuid), flip = [
553
591
  "top",
554
592
  "left"
555
593
  ].includes(this._orient), p = this._padding, parent = this._select, rangeOuter = [
@@ -562,16 +600,17 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
562
600
  } : tickValue;
563
601
  /**
564
602
  * Zeros out the margins for re-calculation.
565
- */ var margin = this._margin = {
603
+ */ var margin = this._margin = {
566
604
  top: 0,
567
605
  right: 0,
568
606
  bottom: 0,
569
607
  left: 0
570
608
  };
571
- var labels, range, ticks;
609
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
610
+ var labels = [], range = [], ticks = [];
572
611
  /**
573
612
  * Constructs the tick formatter function.
574
- */ var tickFormat = this._tickFormat ? this._tickFormat : function(d) {
613
+ */ var tickFormat = this._tickFormat ? this._tickFormat : function(d) {
575
614
  if (isNaN(d) || [
576
615
  "band",
577
616
  "ordinal",
@@ -579,16 +618,20 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
579
618
  ].includes(_this._scale)) {
580
619
  return d;
581
620
  } else if (_this._scale === "time") {
582
- var refData = (_this._data.length ? _this._data : _this._domain).map(date).sort(function(a, b) {
621
+ var refData = (_this._data.length ? _this._data : _this._domain).map(function(v) {
622
+ return date(v);
623
+ }).filter(function(d) {
624
+ return _instanceof(d, Date);
625
+ }).sort(function(a, b) {
583
626
  return +a - +b;
584
627
  });
585
628
  return formatDate(d, refData, timeFormat).replace(/^Q/g, timeLocale.quarter);
586
629
  } else if (_this._scale === "linear" && _this._tickSuffix === "smallest") {
587
- var _$locale = _type_of(_this._locale) === "object" ? _this._locale : formatLocale[_this._locale];
588
- var separator = _$locale.separator, suffixes = _$locale.suffixes;
630
+ var loc = _type_of(_this._locale) === "object" ? _this._locale : formatLocale[_this._locale];
631
+ var separator = loc.separator, suffixes = loc.suffixes;
589
632
  var suff = d >= 1000 ? suffixes[_this._tickUnit + 8] : "";
590
633
  var tick = d / Math.pow(10, 3 * _this._tickUnit);
591
- var number = formatAbbreviate(tick, _$locale, ",.".concat(tick.toString().length, "r"));
634
+ var number = formatAbbreviate(tick, loc, ",.".concat(tick.toString().length, "r"));
592
635
  return "".concat(number).concat(separator).concat(suff);
593
636
  } else {
594
637
  var inverted = ticks[1] < ticks[0];
@@ -602,27 +645,27 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
602
645
  /**
603
646
  * (Re)calculates the internal d3 scale
604
647
  * @param {} newRange
605
- */ function setScale() {
606
- var _this = this;
607
- var newRange = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this._range;
648
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
649
+ var setScale = function setScale() {
650
+ var newRange = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : _this1._range;
608
651
  /**
609
652
  * Calculates the internal "range" array to use, including
610
653
  * fallbacks if not specified with the "range" method.
611
- */ range = newRange ? newRange.slice() : [
654
+ */ range = newRange ? newRange.slice() : [
612
655
  undefined,
613
656
  undefined
614
657
  ];
615
658
  var _rangeOuter = _sliced_to_array(rangeOuter, 2), minRange = _rangeOuter[0], maxRange = _rangeOuter[1];
616
- if (this._range) {
617
- if (this._range[0] !== undefined) minRange = this._range[0];
618
- if (this._range[this._range.length - 1] !== undefined) maxRange = this._range[this._range.length - 1];
659
+ if (_this1._range) {
660
+ if (_this1._range[0] !== undefined) minRange = _this1._range[0];
661
+ if (_this1._range[_this1._range.length - 1] !== undefined) maxRange = _this1._range[_this1._range.length - 1];
619
662
  }
620
663
  if (range[0] === undefined || range[0] < minRange) range[0] = minRange;
621
664
  if (range[1] === undefined || range[1] > maxRange) range[1] = maxRange;
622
665
  var sizeInner = maxRange - minRange;
623
- if (this._scale === "ordinal" && this._domain.length > range.length) {
624
- if (newRange === this._range) {
625
- var buckets = this._domain.length + 1;
666
+ if (_this1._scale === "ordinal" && _this1._domain.length > range.length) {
667
+ if (newRange === _this1._range) {
668
+ var buckets = _this1._domain.length + 1;
626
669
  range = d3Range(buckets).map(function(d) {
627
670
  return range[0] + sizeInner * (d / (buckets - 1));
628
671
  }).slice(1, buckets);
@@ -630,35 +673,23 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
630
673
  return d - range[0] / 2;
631
674
  });
632
675
  } else {
633
- var buckets1 = this._domain.length;
676
+ var buckets1 = _this1._domain.length;
634
677
  var size = range[1] - range[0];
635
678
  range = d3Range(buckets1).map(function(d) {
636
679
  return range[0] + size * (d / (buckets1 - 1));
637
680
  });
638
681
  }
639
682
  }
640
- // else if (newRange === this._range) {
641
- // const tickScale = scales.scaleSqrt().domain([10, 400]).range([10, 50]);
642
- // const domain = this._scale === "time" ? this._domain.map(date) : this._domain;
643
- // const scaleTicks = d3Ticks(domain[0], domain[1], Math.floor(sizeInner / tickScale(sizeInner)));
644
- // // labels = (this._labels
645
- // // ? this._scale === "time" ? this._labels.map(date) : this._labels
646
- // // : scaleTicks).slice();
647
- // // const buckets = labels.length;
648
- // // if (buckets) {
649
- // // const pad = Math.ceil(sizeInner / buckets / 2);
650
- // // range = [range[0] + pad, range[1] - pad];
651
- // // }
652
- // }
653
683
  /**
654
684
  * Sets up the initial d3 scale, using this._domain and the
655
685
  * previously defined range variable.
656
- */ var scale = "scale".concat(this._scale.charAt(0).toUpperCase()).concat(this._scale.slice(1));
657
- var initialDomain = this._domain.slice();
658
- this._d3Scale = scales[scale]().domain(this._scale === "time" ? initialDomain.map(date) : initialDomain).range(range);
659
- if (this._rounding !== "none") {
660
- var roundDomain = function() {
661
- var zeroLength = function(d) {
686
+ */ var scale = "scale".concat(_this1._scale.charAt(0).toUpperCase()).concat(_this1._scale.slice(1));
687
+ var initialDomain = _this1._domain.slice();
688
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
689
+ _this1._d3Scale = scales[scale]().domain(_this1._scale === "time" ? initialDomain.map(date) : initialDomain).range(range);
690
+ if (_this1._rounding !== "none") {
691
+ var roundDomain = function roundDomain() {
692
+ var zeroLength = function zeroLength(d) {
662
693
  if (smallScale) {
663
694
  if (!d) return 0;
664
695
  var m = "".concat(d).match(/0\.(0*)/);
@@ -678,68 +709,68 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
678
709
  }) && initialDomain.some(function(d) {
679
710
  return d > 0;
680
711
  });
681
- var zeros = zeroArray.length === 1 ? zeroArray[0] : zeroArray[0] > 1 && zeroArray[0] === zeroArray[1] ? zeroArray[0] - 1 : _this._rounding === "outside" || !diverging ? zeroArray[0] + (zeroArray[1] - zeroArray[0]) / 2 : max(zeroArray);
712
+ var zeros = zeroArray.length === 1 ? zeroArray[0] : zeroArray[0] > 1 && zeroArray[0] === zeroArray[1] ? zeroArray[0] - 1 : _this1._rounding === "outside" || !diverging ? zeroArray[0] + (zeroArray[1] - zeroArray[0]) / 2 : max(zeroArray);
682
713
  var factor = zeros < 1 ? fixFloat(zeros) : +"1".concat(Array(Math.floor(fixFloat(zeros)) - 1).fill(0).join(""));
683
714
  if (factor >= Math.abs(initialDomain[1] - initialDomain[0])) factor /= 2;
684
715
  var inverted = initialDomain[1] < initialDomain[0];
685
716
  var newDomain = [
686
- Math[_this._rounding === "outside" ? inverted ? "ceil" : "floor" : inverted ? "floor" : "ceil"](initialDomain[0] / factor) * factor,
687
- Math[_this._rounding === "outside" ? inverted ? "floor" : "ceil" : inverted ? "ceil" : "floor"](initialDomain[1] / factor) * factor
717
+ Math[_this1._rounding === "outside" ? inverted ? "ceil" : "floor" : inverted ? "floor" : "ceil"](initialDomain[0] / factor) * factor,
718
+ Math[_this1._rounding === "outside" ? inverted ? "floor" : "ceil" : inverted ? "ceil" : "floor"](initialDomain[1] / factor) * factor
688
719
  ];
689
- if (_this._scale === "log") {
720
+ if (_this1._scale === "log") {
690
721
  if (newDomain[0] === 0) newDomain[0] = initialDomain[0];
691
722
  if (newDomain[1] === 0) newDomain[1] = initialDomain[1];
692
723
  }
693
- _this._d3Scale.domain(newDomain.map(fixFloat));
724
+ _this1._d3Scale.domain(newDomain.map(fixFloat));
694
725
  };
695
- if (this._scale === "linear") {
696
- roundDomain.bind(this)();
697
- } else if (this._scale === "log") {
726
+ if (_this1._scale === "linear") {
727
+ roundDomain.bind(_this1)();
728
+ } else if (_this1._scale === "log") {
698
729
  var powDomain = [];
699
730
  var inverted = initialDomain[1] < initialDomain[0];
700
- powDomain[0] = (this._rounding === "outside" ? isNegative(initialDomain[0]) ? inverted ? floorPow : ceilPow : inverted ? ceilPow : floorPow : isNegative(initialDomain[0]) ? inverted ? ceilPow : floorPow : inverted ? floorPow : ceilPow)(initialDomain[0]);
701
- powDomain[1] = (this._rounding === "inside" ? isNegative(initialDomain[1]) ? inverted ? floorPow : ceilPow : inverted ? ceilPow : floorPow : isNegative(initialDomain[1]) ? inverted ? ceilPow : floorPow : inverted ? floorPow : ceilPow)(initialDomain[1]);
731
+ powDomain[0] = (_this1._rounding === "outside" ? isNegative(initialDomain[0]) ? inverted ? floorPow : ceilPow : inverted ? ceilPow : floorPow : isNegative(initialDomain[0]) ? inverted ? ceilPow : floorPow : inverted ? floorPow : ceilPow)(initialDomain[0]);
732
+ powDomain[1] = (_this1._rounding === "inside" ? isNegative(initialDomain[1]) ? inverted ? floorPow : ceilPow : inverted ? ceilPow : floorPow : isNegative(initialDomain[1]) ? inverted ? ceilPow : floorPow : inverted ? floorPow : ceilPow)(initialDomain[1]);
702
733
  var powInverted = powDomain[1] < powDomain[0];
703
734
  if (powDomain[0] !== powDomain[1] && powDomain.some(function(d) {
704
735
  return Math.abs(d) > 10;
705
736
  }) && powInverted === inverted) {
706
- this._d3Scale.domain(powDomain);
737
+ _this1._d3Scale.domain(powDomain);
707
738
  } else {
708
- roundDomain.bind(this)();
739
+ roundDomain.bind(_this1)();
709
740
  }
710
741
  }
711
742
  }
712
- if (this._d3Scale.padding) this._d3Scale.padding(this._scalePadding);
713
- if (this._d3Scale.paddingInner) this._d3Scale.paddingInner(this._paddingInner);
714
- if (this._d3Scale.paddingOuter) this._d3Scale.paddingOuter(this._paddingOuter);
743
+ if (_this1._d3Scale.padding) _this1._d3Scale.padding(_this1._scalePadding);
744
+ if (_this1._d3Scale.paddingInner) _this1._d3Scale.paddingInner(_this1._paddingInner);
745
+ if (_this1._d3Scale.paddingOuter) _this1._d3Scale.paddingOuter(_this1._paddingOuter);
715
746
  /**
716
747
  * Constructs a separate "negative only" scale for logarithmic
717
748
  * domains, as they cannot pass zero.
718
- */ this._d3ScaleNegative = null;
719
- if (this._scale === "log") {
720
- var domain = this._d3Scale.domain();
749
+ */ _this1._d3ScaleNegative = null;
750
+ if (_this1._scale === "log") {
751
+ var domain = _this1._d3Scale.domain();
721
752
  if (domain[0] === 0) {
722
753
  var smallestNumber = min([
723
- min(this._data),
754
+ min(_this1._data),
724
755
  Math.abs(domain[1])
725
756
  ]);
726
757
  domain[0] = smallestNumber === 0 || smallestNumber === 1 ? 1e-6 : smallestNumber <= 1 ? floorPow(smallestNumber) : 1;
727
758
  if (isNegative(domain[1])) domain[0] *= -1;
728
759
  } else if (domain[domain.length - 1] === 0) {
729
760
  var smallestNumber1 = min([
730
- min(this._data),
761
+ min(_this1._data),
731
762
  Math.abs(domain[0])
732
763
  ]);
733
764
  domain[domain.length - 1] = smallestNumber1 === 0 || smallestNumber1 === 1 ? 1e-6 : smallestNumber1 <= 1 ? floorPow(smallestNumber1) : 1;
734
765
  if (isNegative(domain[0])) domain[domain.length - 1] *= -1;
735
766
  }
736
- var range1 = this._d3Scale.range();
767
+ var range1 = _this1._d3Scale.range();
737
768
  // all negatives
738
769
  if (isNegative(domain[0]) && isNegative(domain[domain.length - 1])) {
739
- this._d3ScaleNegative = this._d3Scale.copy().domain(domain).range(range1);
740
- this._d3Scale = null;
770
+ _this1._d3ScaleNegative = _this1._d3Scale.copy().domain(domain).range(range1);
771
+ _this1._d3Scale = null;
741
772
  } else if (domain[0] > 0 && domain[domain.length - 1] > 0) {
742
- this._d3Scale.domain(domain).range(range1);
773
+ _this1._d3Scale.domain(domain).range(range1);
743
774
  } else {
744
775
  var powers = domain.map(function(d) {
745
776
  return Math.log10(Math.abs(d));
@@ -749,14 +780,14 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
749
780
  var leftPercentage = powers[0] / sum(powers);
750
781
  var zero = leftPercentage * (range1[1] - range1[0]);
751
782
  var minPositive = min([
752
- min(this._data.filter(function(d) {
783
+ min(_this1._data.filter(function(d) {
753
784
  return d >= 0;
754
785
  })),
755
786
  Math.abs(domain[1])
756
787
  ]);
757
788
  if (minPositive === 1) minPositive = 1e-6;
758
789
  var minNegative = min([
759
- min(this._data.filter(isNegative)),
790
+ min(_this1._data.filter(isNegative)),
760
791
  Math.abs(domain[0])
761
792
  ]);
762
793
  if (minNegative === 1) minNegative = 1e-6;
@@ -766,15 +797,15 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
766
797
  Math.abs(minPosPow),
767
798
  Math.abs(minNegPow)
768
799
  ]);
769
- this._d3ScaleNegative = this._d3Scale.copy();
770
- (isNegative(domain[0]) ? this._d3Scale : this._d3ScaleNegative).domain([
800
+ _this1._d3ScaleNegative = _this1._d3Scale.copy();
801
+ (isNegative(domain[0]) ? _this1._d3Scale : _this1._d3ScaleNegative).domain([
771
802
  isNegative(domain[0]) ? minValue : -minValue,
772
803
  domain[1]
773
804
  ]).range([
774
805
  range1[0] + zero,
775
806
  range1[1]
776
807
  ]);
777
- (isNegative(domain[0]) ? this._d3ScaleNegative : this._d3Scale).domain([
808
+ (isNegative(domain[0]) ? _this1._d3ScaleNegative : _this1._d3Scale).domain([
778
809
  domain[0],
779
810
  isNegative(domain[0]) ? -minValue : minValue
780
811
  ]).range([
@@ -786,32 +817,32 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
786
817
  /**
787
818
  * Determines the of values array to use
788
819
  * for the "ticks" and the "labels"
789
- */ ticks = (this._ticks ? this._scale === "time" ? this._ticks.map(date) : this._ticks : (this._d3Scale ? this._d3Scale.ticks : this._d3ScaleNegative.ticks) ? this._getTicks() : this._domain).slice();
790
- labels = (this._labels ? this._scale === "time" ? this._labels.map(date) : this._labels : (this._d3Scale ? this._d3Scale.ticks : this._d3ScaleNegative.ticks) ? this._getLabels() : ticks).slice();
791
- if (this._scale === "time") {
820
+ */ ticks = (_this1._ticks ? _this1._scale === "time" ? _this1._ticks.map(date) : _this1._ticks : (_this1._d3Scale ? _this1._d3Scale.ticks : _this1._d3ScaleNegative.ticks) ? _this1._getTicks() : _this1._domain).slice();
821
+ labels = (_this1._labels ? _this1._scale === "time" ? _this1._labels.map(date) : _this1._labels : (_this1._d3Scale ? _this1._d3Scale.ticks : _this1._d3ScaleNegative.ticks) ? _this1._getLabels() : ticks).slice();
822
+ if (_this1._scale === "time") {
792
823
  ticks = ticks.map(Number);
793
824
  labels = labels.map(Number);
794
825
  }
795
826
  ticks = ticks.sort(function(a, b) {
796
- return _this._getPosition(a) - _this._getPosition(b);
827
+ return _this1._getPosition(a) - _this1._getPosition(b);
797
828
  });
798
829
  labels = labels.sort(function(a, b) {
799
- return _this._getPosition(a) - _this._getPosition(b);
830
+ return _this1._getPosition(a) - _this1._getPosition(b);
800
831
  });
801
832
  /**
802
833
  * Get the smallest suffix.
803
- */ if (this._scale === "linear" && this._tickSuffix === "smallest") {
834
+ */ if (_this1._scale === "linear" && _this1._tickSuffix === "smallest") {
804
835
  var suffixes = labels.filter(function(d) {
805
836
  return d >= 1000;
806
837
  });
807
838
  if (suffixes.length > 0) {
808
839
  var _Math;
809
- var _$min = (_Math = Math).min.apply(_Math, _to_consumable_array(suffixes));
840
+ var minVal = (_Math = Math).min.apply(_Math, _to_consumable_array(suffixes));
810
841
  var i = 1;
811
842
  while(i && i < 7){
812
843
  var n = Math.pow(10, 3 * i);
813
- if (_$min / n >= 1) {
814
- this._tickUnit = i;
844
+ if (minVal / n >= 1) {
845
+ _this1._tickUnit = i;
815
846
  i += 1;
816
847
  } else {
817
848
  break;
@@ -821,38 +852,43 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
821
852
  }
822
853
  /**
823
854
  * Removes ticks when they overlap other ticks.
824
- */ var pixels = [];
825
- this._availableTicks = ticks;
855
+ */ var pixels = [];
856
+ _this1._availableTicks = ticks;
826
857
  ticks.forEach(function(d, i) {
827
858
  var s = tickGet({
828
859
  id: d,
829
860
  tick: true
830
861
  }, i);
831
- if (_this._shape === "Circle") s *= 2;
832
- var t = _this._getPosition(d);
833
- if (!pixels.length || Math.abs(closest(t, pixels) - t) > s * 2) pixels.push(t);
862
+ if (_this1._shape === "Circle") s *= 2;
863
+ var t = _this1._getPosition(d);
864
+ if (!pixels.length || Math.abs(closest(t, pixels.filter(function(p) {
865
+ return p !== false;
866
+ })) - t) > s * 2) pixels.push(t);
834
867
  else pixels.push(false);
835
868
  });
836
- ticks = ticks.filter(function(d, i) {
869
+ ticks = ticks.filter(function(_d, i) {
837
870
  return pixels[i] !== false;
838
871
  });
839
- this._visibleTicks = ticks;
840
- }
841
- setScale.bind(this)();
872
+ _this1._visibleTicks = ticks;
873
+ };
874
+ setScale();
842
875
  /**
843
876
  * Pre-calculates the size of the title, if defined, in order
844
877
  * to adjust the internal margins.
845
- */ if (this._title) {
878
+ */ if (this._title) {
846
879
  var _this__titleConfig = this._titleConfig, fontFamily = _this__titleConfig.fontFamily, fontSize = _this__titleConfig.fontSize, lineHeight = _this__titleConfig.lineHeight;
847
- var titleWrap = textWrap().fontFamily(typeof fontFamily === "function" ? fontFamily() : fontFamily).fontSize(typeof fontSize === "function" ? fontSize() : fontSize).lineHeight(typeof lineHeight === "function" ? lineHeight() : lineHeight).width(range[range.length - 1] - range[0] - p * 2).height(this["_".concat(height)] - this._tickSize - p * 2);
880
+ var titleWrap = textWrap().fontFamily(typeof fontFamily === "function" ? fontFamily() : fontFamily).fontSize(typeof fontSize === "function" ? fontSize() : fontSize).lineHeight(typeof lineHeight === "function" ? lineHeight() : lineHeight).width(range[range.length - 1] - range[0] - p * 2)// eslint-disable-next-line @typescript-eslint/no-explicit-any
881
+ .height(this["_".concat(height)] - this._tickSize - p * 2);
848
882
  var lines = titleWrap(this._title).lines.length;
849
883
  margin[this._orient] = lines * titleWrap.lineHeight() + p;
850
884
  }
885
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
851
886
  var hBuff = this._shape === "Circle" ? typeof this._shapeConfig.r === "function" ? this._shapeConfig.r({
852
887
  tick: true
853
888
  }) : this._shapeConfig.r : this._shape === "Rect" ? typeof this._shapeConfig[height] === "function" ? this._shapeConfig[height]({
854
889
  tick: true
855
- }) : this._shapeConfig[height] : this._tickSize, wBuff = tickGet({
890
+ }) : this._shapeConfig[height] : this._tickSize, // eslint-disable-next-line @typescript-eslint/no-explicit-any
891
+ wBuff = tickGet({
856
892
  tick: true
857
893
  });
858
894
  if (typeof hBuff === "function") hBuff = max(ticks.map(hBuff));
@@ -862,20 +898,21 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
862
898
  /**
863
899
  * Calculates the text wrapping and size of a given textData object.
864
900
  * @param {Object} datum
865
- */ function calculateLabelSize(datum) {
901
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
902
+ var calculateLabelSize = function calculateLabelSize(datum) {
866
903
  var d = datum.d, i = datum.i, fF = datum.fF, fP = datum.fP, fS = datum.fS, rotate = datum.rotate, space = datum.space;
867
904
  var h = rotate ? "width" : "height", w = rotate ? "height" : "width";
868
905
  var wSize = min([
869
- this._maxSize,
870
- this._width
906
+ _this._maxSize,
907
+ _this._width
871
908
  ]);
872
909
  var hSize = min([
873
- this._maxSize,
874
- this._height
910
+ _this._maxSize,
911
+ _this._height
875
912
  ]);
876
- var wrap = textWrap().fontFamily(fF).fontSize(fS).lineHeight(this._shapeConfig.lineHeight ? this._shapeConfig.lineHeight(d, i) : undefined);
877
- wrap[w](horizontal ? space : wSize - hBuff - p - this._margin.left - this._margin.right);
878
- wrap[h](horizontal ? hSize - hBuff - p - this._margin.top - this._margin.bottom : space);
913
+ var wrap = textWrap().fontFamily(fF).fontSize(fS).lineHeight(_this._shapeConfig.lineHeight ? _this._shapeConfig.lineHeight(d, i) : undefined);
914
+ wrap[w](horizontal ? space : wSize - hBuff - p - _this._margin.left - _this._margin.right);
915
+ wrap[h](horizontal ? hSize - hBuff - p - _this._margin.top - _this._margin.bottom : space);
879
916
  var res = wrap(tickFormat(d));
880
917
  res.lines = res.lines.filter(function(d) {
881
918
  return d !== "";
@@ -883,10 +920,12 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
883
920
  res.width = res.lines.length ? Math.ceil(max(res.widths)) : 0;
884
921
  res.height = res.lines.length ? Math.ceil(res.lines.length * wrap.lineHeight()) + fP : 0;
885
922
  return res;
886
- }
887
- /** Calculates label offsets */ function calculateOffset() {
923
+ };
924
+ /** Calculates label offsets*/ // eslint-disable-next-line @typescript-eslint/no-explicit-any
925
+ var calculateOffset = function calculateOffset() {
888
926
  var arr = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
889
927
  var offset = 0;
928
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
890
929
  arr.forEach(function(datum) {
891
930
  var prev = arr[datum.i - 1];
892
931
  var h = datum.rotate && horizontal || !datum.rotate && !horizontal ? "width" : "height", w = datum.rotate && horizontal || !datum.rotate && !horizontal ? "height" : "width";
@@ -899,20 +938,22 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
899
938
  } else offset = 1;
900
939
  }
901
940
  });
902
- }
941
+ };
942
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
903
943
  var textData = [];
904
- function createTextData() {
905
- var _this = this;
944
+ var createTextData = function createTextData() {
906
945
  var offset = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 1;
907
- var fontSize = this._shapeConfig.labelConfig.fontSize;
908
- var fontFamily = this._shapeConfig.labelConfig.fontFamily || d3plusFontFamily;
909
- var fontPadding = this._shapeConfig.labelConfig.padding;
946
+ var fontSize = _this1._shapeConfig.labelConfig.fontSize;
947
+ var fontFamily = _this1._shapeConfig.labelConfig.fontFamily || d3plusFontFamily;
948
+ var fontPadding = _this1._shapeConfig.labelConfig.padding;
910
949
  /**
911
950
  * Calculates the space each label would take up, given
912
951
  * the provided this._space size.
913
- */ textData = labels.map(function(d, i) {
914
- var fF = typeof fontFamily === "function" ? fontFamily(d, i) : fontFamily, fP = typeof fontPadding === "function" ? fontPadding(d, i) : fontPadding, fS = typeof fontSize === "function" ? fontSize(d, i) : fontSize, position = _this._getPosition(d);
915
- var lineHeight = _this._shapeConfig.lineHeight ? _this._shapeConfig.lineHeight(d, i) : fS * 1.4;
952
+ */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
953
+ textData = labels.map(function(d, i) {
954
+ var fF = typeof fontFamily === "function" ? fontFamily(d, i) : fontFamily, fP = typeof fontPadding === "function" ? fontPadding(d, i) : fontPadding, fS = typeof fontSize === "function" ? fontSize(d, i) : fontSize, position = _this1._getPosition(d);
955
+ var lineHeight = _this1._shapeConfig.lineHeight ? _this1._shapeConfig.lineHeight(d, i) : fS * 1.4;
956
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
916
957
  var datum = {
917
958
  d: d,
918
959
  i: i,
@@ -921,17 +962,17 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
921
962
  fS: fS,
922
963
  lineHeight: lineHeight,
923
964
  position: position,
924
- rotate: _this._labelRotation
965
+ rotate: _this1._labelRotation
925
966
  };
926
967
  return datum;
927
968
  });
928
- var maxSpace = this._scale === "band" ? this._d3Scale.bandwidth() : textData.reduce(function(s, d, i) {
969
+ var maxSpace = _this1._scale === "band" ? _this1._d3Scale.bandwidth() : textData.reduce(function(s, d, i) {
929
970
  var position = d.position;
930
971
  var prevPosition = !i ? textData.length === 1 ? rangeOuter[0] : position - (textData[i + 1].position - position) : position - (position - textData[i - 1].position);
931
972
  var prevSpace = Math.abs(position - prevPosition);
932
973
  var nextPosition = i == textData.length - 1 ? textData.length === 1 ? rangeOuter[1] : position + (position - textData[i - 1].position) : position - (position - textData[i + 1].position);
933
974
  var nextSpace = Math.abs(position - nextPosition);
934
- var mod = _this._scale === "point" ? 1 : 2;
975
+ var mod = _this1._scale === "point" ? 1 : 2;
935
976
  return max([
936
977
  max([
937
978
  prevSpace,
@@ -940,21 +981,25 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
940
981
  s
941
982
  ]);
942
983
  }, 0);
984
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
943
985
  textData = textData.map(function(datum) {
944
986
  datum.space = maxSpace - datum.fP * 2;
945
- var res = calculateLabelSize.bind(_this)(datum);
987
+ var res = calculateLabelSize(datum);
946
988
  return Object.assign(res, datum);
947
989
  });
948
990
  var reverseTextData = textData.slice().reverse();
991
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
949
992
  textData.forEach(function(datum) {
950
993
  var fP = datum.fP, i = datum.i, position = datum.position;
951
994
  var sizeName = horizontal ? "width" : "height";
995
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
952
996
  var prev = i ? reverseTextData.find(function(t) {
953
997
  return t.i < i && !t.truncated;
954
998
  }) : false;
955
999
  if (i === textData.length - 1) {
956
1000
  while(prev && position - datum[sizeName] / 2 - fP < prev.position + prev[sizeName] / 2){
957
1001
  prev.truncated = true;
1002
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
958
1003
  prev = reverseTextData.find(function(t) {
959
1004
  return t.i < i && !t.truncated;
960
1005
  });
@@ -962,25 +1007,26 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
962
1007
  }
963
1008
  datum.truncated = prev ? position - datum[sizeName] / 2 - fP < prev.position + prev[sizeName] / 2 : false;
964
1009
  });
965
- if (offset > 1) calculateOffset.bind(this)(textData);
966
- }
967
- createTextData.bind(this)();
968
- var offsetEnabled = this._labelOffset && textData.some(function(d) {
1010
+ if (offset > 1) calculateOffset(textData);
1011
+ };
1012
+ createTextData();
1013
+ var offsetEnabled = // eslint-disable-next-line @typescript-eslint/no-explicit-any
1014
+ this._labelOffset && textData.some(function(d) {
969
1015
  return d.truncated;
970
1016
  });
971
- if (offsetEnabled) createTextData.bind(this)(2);
1017
+ if (offsetEnabled) createTextData(2);
972
1018
  /**
973
1019
  * "spillover" will contain the pixel spillover of the first and last label,
974
1020
  * and then adjust the scale range accordingly.
975
- */ var spillovers = [
1021
+ */ var spillovers = [
976
1022
  0,
977
1023
  1
978
1024
  ].map(function(index) {
979
1025
  var datum = textData[index ? textData.length - 1 : 0];
980
1026
  if (!datum) return 0;
981
- var height = datum.height, position = datum.position, rotate = datum.rotate, width = datum.width;
1027
+ var dHeight = datum.height, position = datum.position, rotate = datum.rotate, dWidth = datum.width;
982
1028
  var compPosition = index ? rangeOuter[1] : rangeOuter[0];
983
- var halfSpace = (rotate || !horizontal ? height : width) / 2;
1029
+ var halfSpace = (rotate || !horizontal ? dHeight : dWidth) / 2;
984
1030
  if (Math.abs(position - compPosition) >= halfSpace) return 0;
985
1031
  var spill = halfSpace - (position - compPosition);
986
1032
  return Math.abs(spill);
@@ -995,26 +1041,30 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
995
1041
  if (this._range[this._range.length - 1] !== undefined) newRange[1] = this._range[this._range.length - 1];
996
1042
  }
997
1043
  if (newRange[0] !== first || newRange[1] !== last) {
998
- setScale.bind(this)(newRange);
999
- createTextData.bind(this)(offsetEnabled ? 2 : 1);
1044
+ setScale(newRange);
1045
+ createTextData(offsetEnabled ? 2 : 1);
1000
1046
  }
1047
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1001
1048
  var labelHeight = max(textData, function(t) {
1002
1049
  return t.height;
1003
1050
  }) || 0;
1004
1051
  this._labelRotation = horizontal && this._labelRotation === undefined ? textData.some(function(datum) {
1005
- var i = datum.i, height = datum.height, position = datum.position, truncated = datum.truncated;
1052
+ var i = datum.i, dH = datum.height, position = datum.position, truncated = datum.truncated;
1006
1053
  var prev = textData[i - 1];
1007
- return truncated || i && prev.position + prev.height / 2 > position - height / 2;
1054
+ return truncated || i && prev.position + prev.height / 2 > position - dH / 2;
1008
1055
  }) : this._labelRotation;
1009
1056
  var globalOffset = this._labelOffset ? max(textData, function(d) {
1010
1057
  return d.offset || 0;
1011
1058
  }) : 0;
1012
- textData.forEach(function(datum) {
1059
+ textData.forEach(// eslint-disable-next-line @typescript-eslint/no-explicit-any
1060
+ function(datum) {
1013
1061
  return datum.offset = datum.offset ? globalOffset : 0;
1014
1062
  });
1015
1063
  var tBuff = this._shape === "Line" ? 0 : hBuff;
1016
1064
  var _obj;
1017
- var bounds = this._outerBounds = (_obj = {}, _define_property(_obj, height, (max(textData, function(t) {
1065
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1066
+ var bounds = this._outerBounds = (_obj = {}, _define_property(_obj, height, // eslint-disable-next-line @typescript-eslint/no-explicit-any
1067
+ (max(textData, function(t) {
1018
1068
  return Math.ceil(t[t.rotate || !horizontal ? "width" : "height"] + t.offset);
1019
1069
  }) || 0) + (textData.length ? p : 0)), _define_property(_obj, width, rangeOuter[rangeOuter.length - 1] - rangeOuter[0]), _define_property(_obj, x, rangeOuter[0]), _obj);
1020
1070
  bounds[height] = max([
@@ -1038,7 +1088,8 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
1038
1088
  return {
1039
1089
  id: d
1040
1090
  };
1041
- }), function(d) {
1091
+ }), // eslint-disable-next-line @typescript-eslint/no-explicit-any
1092
+ function(d) {
1042
1093
  return d.id;
1043
1094
  });
1044
1095
  grid.exit().transition(t).attr("opacity", 0).call(this._gridPosition.bind(this)).remove();
@@ -1046,10 +1097,13 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
1046
1097
  var labelOnly = labels.filter(function(d, i) {
1047
1098
  return textData[i].lines.length && !ticks.includes(d);
1048
1099
  });
1100
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1049
1101
  var rotated = textData.some(function(d) {
1050
1102
  return d.rotate;
1051
1103
  });
1104
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1052
1105
  var tickData = ticks.concat(labelOnly).map(function(d) {
1106
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1053
1107
  var data = textData.find(function(td) {
1054
1108
  return td.d === d;
1055
1109
  });
@@ -1062,6 +1116,7 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
1062
1116
  var labelWidth = horizontal ? space : bounds.width - margin[_this._position.opposite] - hBuff - margin[_this._orient] + p;
1063
1117
  var offset = margin[opposite], size = (hBuff + labelOffset) * (flip ? -1 : 1), yPos = flip ? bounds[y] + bounds[height] - offset : bounds[y] + offset;
1064
1118
  var _obj;
1119
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1065
1120
  var tickConfig = (_obj = {
1066
1121
  id: d,
1067
1122
  labelBounds: rotated && data ? {
@@ -1079,28 +1134,33 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
1079
1134
  size: labels.includes(d) || _this._scale === "log" && Math.log10(Math.abs(d)) % 1 === 0 ? size : ticks.includes(d) ? Math.ceil(size / 2) : _this._data.find(function(t) {
1080
1135
  return +t === d;
1081
1136
  }) ? Math.ceil(size / 4) : 0,
1082
- text: !(data || {}).truncated && labels.includes(d) ? tickFormat(d) : false,
1137
+ text: // eslint-disable-next-line @typescript-eslint/no-explicit-any
1138
+ !(data || {}).truncated && labels.includes(d) ? tickFormat(d) : false,
1083
1139
  tick: ticks.includes(d)
1084
1140
  }, _define_property(_obj, x, xPos + (_this._scale === "band" ? _this._d3Scale.bandwidth() / 2 : 0)), _define_property(_obj, y, yPos), _obj);
1085
1141
  return tickConfig;
1086
1142
  });
1087
1143
  if (this._shape === "Line") {
1088
- tickData = tickData.concat(tickData.map(function(d) {
1144
+ tickData = tickData.concat(// eslint-disable-next-line @typescript-eslint/no-explicit-any
1145
+ tickData.map(function(d) {
1089
1146
  var dupe = Object.assign({}, d);
1090
1147
  dupe[y] += d.size;
1091
1148
  return dupe;
1092
1149
  }));
1093
1150
  }
1151
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1094
1152
  new shapes[this._shape]().data(tickData).duration(this._duration).labelConfig({
1095
- ellipsis: function(d) {
1153
+ ellipsis: function ellipsis(d) {
1096
1154
  return d && d.length ? "".concat(d, "...") : "";
1097
1155
  },
1098
- rotate: function(d) {
1156
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1157
+ rotate: function rotate(d) {
1099
1158
  return d.rotate ? -90 : 0;
1100
1159
  }
1101
1160
  }).select(elem("g.ticks", {
1102
1161
  parent: group
1103
- }).node()).config(configPrep.bind(this)(this._shapeConfig)).labelConfig({
1162
+ }).node())// eslint-disable-next-line @typescript-eslint/no-explicit-any
1163
+ .config(configPrep.bind(this)(this._shapeConfig)).labelConfig({
1104
1164
  padding: 0
1105
1165
  }).render();
1106
1166
  var bar = group.selectAll("line.bar").data([
@@ -1115,184 +1175,107 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
1115
1175
  parent: group
1116
1176
  }).node()).text(function(d) {
1117
1177
  return d.text;
1118
- }).verticalAlign("middle").width(range[range.length - 1] - range[0]).x(horizontal ? range[0] : this._orient === "left" ? bounds.x + margin.left / 2 - (range[range.length - 1] - range[0]) / 2 : bounds.x + bounds.width - margin.right / 2 - (range[range.length - 1] - range[0]) / 2).y(horizontal ? this._orient === "bottom" ? bounds.y + bounds.height - margin.bottom : bounds.y : range[0] + (range[range.length - 1] - range[0]) / 2 - margin[this._orient] / 2).config(configPrep.bind(this)(this._titleConfig)).render();
1178
+ }).verticalAlign("middle").width(range[range.length - 1] - range[0]).x(horizontal ? range[0] : this._orient === "left" ? bounds.x + margin.left / 2 - (range[range.length - 1] - range[0]) / 2 : bounds.x + bounds.width - margin.right / 2 - (range[range.length - 1] - range[0]) / 2).y(horizontal ? this._orient === "bottom" ? bounds.y + bounds.height - margin.bottom : bounds.y : range[0] + (range[range.length - 1] - range[0]) / 2 - margin[this._orient] / 2)// eslint-disable-next-line @typescript-eslint/no-explicit-any
1179
+ .config(configPrep.bind(this)(this._titleConfig)).render();
1119
1180
  this._lastScale = this._getPosition.bind(this);
1120
1181
  if (callback) setTimeout(callback, this._duration + 100);
1121
1182
  return this;
1122
1183
  }
1123
1184
  },
1124
1185
  {
1125
- /**
1126
- @memberof Axis
1127
- @desc If *value* is specified, sets the horizontal alignment to the specified value and returns the current class instance.
1128
- @param {String} [*value* = "center"] Supports `"left"` and `"center"` and `"right"`.
1129
- @chainable
1130
- */ key: "align",
1186
+ key: "align",
1131
1187
  value: function align(_) {
1132
1188
  return arguments.length ? (this._align = _, this) : this._align;
1133
1189
  }
1134
1190
  },
1135
1191
  {
1136
- /**
1137
- @memberof Axis
1138
- @desc If *value* is specified, sets the axis line style and returns the current class instance.
1139
- @param {Object} [*value*]
1140
- @chainable
1141
- */ key: "barConfig",
1192
+ key: "barConfig",
1142
1193
  value: function barConfig(_) {
1143
1194
  return arguments.length ? (this._barConfig = Object.assign(this._barConfig, _), this) : this._barConfig;
1144
1195
  }
1145
1196
  },
1146
1197
  {
1147
- /**
1148
- @memberof Axis
1149
- @desc An array of data points, which helps determine which ticks should be shown and which time resolution should be displayed.
1150
- @param {Array} [*value*]
1151
- @chainable
1152
- */ key: "data",
1198
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1199
+ key: "data",
1153
1200
  value: function data(_) {
1154
1201
  return arguments.length ? (this._data = _, this) : this._data;
1155
1202
  }
1156
1203
  },
1157
1204
  {
1158
- /**
1159
- @memberof Axis
1160
- @desc If *value* is specified, sets the scale domain of the axis and returns the current class instance.
1161
- @param {Array} [*value* = [0, 10]]
1162
- @chainable
1163
- */ key: "domain",
1205
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1206
+ key: "domain",
1164
1207
  value: function domain(_) {
1165
1208
  return arguments.length ? (this._domain = _, this) : this._domain;
1166
1209
  }
1167
1210
  },
1168
1211
  {
1169
- /**
1170
- @memberof Axis
1171
- @desc If *value* is specified, sets the transition duration of the axis and returns the current class instance.
1172
- @param {Number} [*value* = 600]
1173
- @chainable
1174
- */ key: "duration",
1212
+ key: "duration",
1175
1213
  value: function duration(_) {
1176
1214
  return arguments.length ? (this._duration = _, this) : this._duration;
1177
1215
  }
1178
1216
  },
1179
1217
  {
1180
- /**
1181
- @memberof Axis
1182
- @desc If *value* is specified, sets the grid values of the axis and returns the current class instance.
1183
- @param {Array} [*value*]
1184
- @chainable
1185
- */ key: "grid",
1218
+ key: "grid",
1186
1219
  value: function grid(_) {
1187
1220
  return arguments.length ? (this._grid = _, this) : this._grid;
1188
1221
  }
1189
1222
  },
1190
1223
  {
1191
- /**
1192
- @memberof Axis
1193
- @desc If *value* is specified, sets the grid config of the axis and returns the current class instance.
1194
- @param {Object} [*value*]
1195
- @chainable
1196
- */ key: "gridConfig",
1224
+ key: "gridConfig",
1197
1225
  value: function gridConfig(_) {
1198
1226
  return arguments.length ? (this._gridConfig = Object.assign(this._gridConfig, _), this) : this._gridConfig;
1199
1227
  }
1200
1228
  },
1201
1229
  {
1202
- /**
1203
- @memberof Axis
1204
- @desc If *value* is specified, sets the grid behavior of the axis when scale is logarithmic and returns the current class instance.
1205
- @param {Boolean} [*value* = false]
1206
- @chainable
1207
- */ key: "gridLog",
1230
+ key: "gridLog",
1208
1231
  value: function gridLog(_) {
1209
1232
  return arguments.length ? (this._gridLog = _, this) : this._gridLog;
1210
1233
  }
1211
1234
  },
1212
1235
  {
1213
- /**
1214
- @memberof Axis
1215
- @desc If *value* is specified, sets the grid size of the axis and returns the current class instance.
1216
- @param {Number} [*value* = undefined]
1217
- @chainable
1218
- */ key: "gridSize",
1236
+ key: "gridSize",
1219
1237
  value: function gridSize(_) {
1220
1238
  return arguments.length ? (this._gridSize = _, this) : this._gridSize;
1221
1239
  }
1222
1240
  },
1223
1241
  {
1224
- /**
1225
- @memberof Axis
1226
- @desc If *value* is specified, sets the overall height of the axis and returns the current class instance.
1227
- @param {Number} [*value* = 100]
1228
- @chainable
1229
- */ key: "height",
1242
+ key: "height",
1230
1243
  value: function height(_) {
1231
1244
  return arguments.length ? (this._height = _, this) : this._height;
1232
1245
  }
1233
1246
  },
1234
1247
  {
1235
- /**
1236
- @memberof Axis
1237
- @desc If *value* is specified, sets the visible tick labels of the axis and returns the current class instance.
1238
- @param {Array} [*value*]
1239
- @chainable
1240
- */ key: "labels",
1248
+ key: "labels",
1241
1249
  value: function labels(_) {
1242
1250
  return arguments.length ? (this._labels = _, this) : this._labels;
1243
1251
  }
1244
1252
  },
1245
1253
  {
1246
- /**
1247
- @memberof Axis
1248
- @desc If *value* is specified, sets whether offsets will be used to position some labels further away from the axis in order to allow space for the text.
1249
- @param {Boolean} [*value* = false]
1250
- @chainable
1251
- */ key: "labelOffset",
1254
+ key: "labelOffset",
1252
1255
  value: function labelOffset(_) {
1253
1256
  return arguments.length ? (this._labelOffset = _, this) : this._labelOffset;
1254
1257
  }
1255
1258
  },
1256
1259
  {
1257
- /**
1258
- @memberof Axis
1259
- @desc If *value* is specified, sets whether whether horizontal axis labels are rotated -90 degrees.
1260
- @param {Boolean} [*value* = false]
1261
- @chainable
1262
- */ key: "labelRotation",
1260
+ key: "labelRotation",
1263
1261
  value: function labelRotation(_) {
1264
1262
  return arguments.length ? (this._labelRotation = _, this) : this._labelRotation;
1265
1263
  }
1266
1264
  },
1267
1265
  {
1268
- /**
1269
- @memberof Axis
1270
- @desc If *value* is specified, sets the maximum size allowed for the space that contains the axis tick labels and title.
1271
- @param {Number}
1272
- @chainable
1273
- */ key: "maxSize",
1266
+ key: "maxSize",
1274
1267
  value: function maxSize(_) {
1275
1268
  return arguments.length ? (this._maxSize = _, this) : this._maxSize;
1276
1269
  }
1277
1270
  },
1278
1271
  {
1279
- /**
1280
- @memberof Axis
1281
- @desc If *value* is specified, sets the minimum size alloted for the space that contains the axis tick labels and title.
1282
- @param {Number}
1283
- @chainable
1284
- */ key: "minSize",
1272
+ key: "minSize",
1285
1273
  value: function minSize(_) {
1286
1274
  return arguments.length ? (this._minSize = _, this) : this._minSize;
1287
1275
  }
1288
1276
  },
1289
1277
  {
1290
- /**
1291
- @memberof Axis
1292
- @desc If *orient* is specified, sets the orientation of the shape and returns the current class instance. If *orient* is not specified, returns the current orientation.
1293
- @param {String} [*orient* = "bottom"] Supports `"top"`, `"right"`, `"bottom"`, and `"left"` orientations.
1294
- @chainable
1295
- */ key: "orient",
1278
+ key: "orient",
1296
1279
  value: function orient(_) {
1297
1280
  if (arguments.length) {
1298
1281
  var horizontal = [
@@ -1319,253 +1302,144 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
1319
1302
  },
1320
1303
  {
1321
1304
  /**
1322
- @memberof Axis
1323
- @desc If called after the elements have been drawn to DOM, will returns the outer bounds of the axis content.
1305
+ Returns the outer bounds of the axis content. Must be called after rendering.
1324
1306
  @example
1325
1307
  {"width": 180, "height": 24, "x": 10, "y": 20}
1326
- */ key: "outerBounds",
1308
+ */ key: "outerBounds",
1327
1309
  value: function outerBounds() {
1328
1310
  return this._outerBounds;
1329
1311
  }
1330
1312
  },
1331
1313
  {
1332
- /**
1333
- @memberof Axis
1334
- @desc If *value* is specified, sets the padding between each tick label to the specified number and returns the current class instance.
1335
- @param {Number} [*value* = 10]
1336
- @chainable
1337
- */ key: "padding",
1314
+ key: "padding",
1338
1315
  value: function padding(_) {
1339
1316
  return arguments.length ? (this._padding = _, this) : this._padding;
1340
1317
  }
1341
1318
  },
1342
1319
  {
1343
- /**
1344
- @memberof Axis
1345
- @desc If *value* is specified, sets the inner padding of band scale to the specified number and returns the current class instance.
1346
- @param {Number} [*value* = 0.1]
1347
- @chainable
1348
- */ key: "paddingInner",
1320
+ key: "paddingInner",
1349
1321
  value: function paddingInner(_) {
1350
1322
  return arguments.length ? (this._paddingInner = _, this) : this._paddingInner;
1351
1323
  }
1352
1324
  },
1353
1325
  {
1354
- /**
1355
- @memberof Axis
1356
- @desc If *value* is specified, sets the outer padding of band scales to the specified number and returns the current class instance.
1357
- @param {Number} [*value* = 0.1]
1358
- @chainable
1359
- */ key: "paddingOuter",
1326
+ key: "paddingOuter",
1360
1327
  value: function paddingOuter(_) {
1361
1328
  return arguments.length ? (this._paddingOuter = _, this) : this._paddingOuter;
1362
1329
  }
1363
1330
  },
1364
1331
  {
1365
- /**
1366
- @memberof Axis
1367
- @desc If *value* is specified, sets the scale range (in pixels) of the axis and returns the current class instance. The given array must have 2 values, but one may be `undefined` to allow the default behavior for that value.
1368
- @param {Array} [*value*]
1369
- @chainable
1370
- */ key: "range",
1332
+ key: "range",
1371
1333
  value: function range(_) {
1372
1334
  return arguments.length ? (this._range = _, this) : this._range;
1373
1335
  }
1374
1336
  },
1375
1337
  {
1376
- /**
1377
- @memberof Axis
1378
- @desc Sets the rounding method, so that more evenly spaced ticks appear at the extents of the scale. Can be set to "none" (default), "outside", or "inside".
1379
- @param {String} [*value* = "none"]
1380
- @chainable
1381
- */ key: "rounding",
1338
+ key: "rounding",
1382
1339
  value: function rounding(_) {
1383
1340
  return arguments.length ? (this._rounding = _, this) : this._rounding;
1384
1341
  }
1385
1342
  },
1386
1343
  {
1387
- /**
1388
- @memberof Axis
1389
- @desc Sets the prefix used for the minimum value of "inside" rounding scales.
1390
- @param {String} [*value* = "< "]
1391
- @chainable
1392
- */ key: "roundingInsideMinPrefix",
1344
+ key: "roundingInsideMinPrefix",
1393
1345
  value: function roundingInsideMinPrefix(_) {
1394
1346
  return arguments.length ? (this._roundingInsideMinPrefix = _, this) : this._roundingInsideMinPrefix;
1395
1347
  }
1396
1348
  },
1397
1349
  {
1398
- /**
1399
- @memberof Axis
1400
- @desc Sets the suffix used for the minimum value of "inside" rounding scales.
1401
- @param {String} [*value* = ""]
1402
- @chainable
1403
- */ key: "roundingInsideMinSuffix",
1350
+ key: "roundingInsideMinSuffix",
1404
1351
  value: function roundingInsideMinSuffix(_) {
1405
1352
  return arguments.length ? (this._roundingInsideMinSuffix = _, this) : this._roundingInsideMinSuffix;
1406
1353
  }
1407
1354
  },
1408
1355
  {
1409
- /**
1410
- @memberof Axis
1411
- @desc Sets the prefix used for the maximum value of "inside" rounding scales.
1412
- @param {String} [*value* = ""]
1413
- @chainable
1414
- */ key: "roundingInsideMaxPrefix",
1356
+ key: "roundingInsideMaxPrefix",
1415
1357
  value: function roundingInsideMaxPrefix(_) {
1416
1358
  return arguments.length ? (this._roundingInsideMaxPrefix = _, this) : this._roundingInsideMaxPrefix;
1417
1359
  }
1418
1360
  },
1419
1361
  {
1420
- /**
1421
- @memberof Axis
1422
- @desc Sets the suffix used for the maximum value of "inside" rounding scales.
1423
- @param {String} [*value* = ""]
1424
- @chainable
1425
- */ key: "roundingInsideMaxSuffix",
1362
+ key: "roundingInsideMaxSuffix",
1426
1363
  value: function roundingInsideMaxSuffix(_) {
1427
1364
  return arguments.length ? (this._roundingInsideMaxSuffix = _, this) : this._roundingInsideMaxSuffix;
1428
1365
  }
1429
1366
  },
1430
1367
  {
1431
- /**
1432
- @memberof Axis
1433
- @desc If *value* is specified, sets the scale of the axis and returns the current class instance.
1434
- @param {String} [*value* = "linear"]
1435
- @chainable
1436
- */ key: "scale",
1368
+ key: "scale",
1437
1369
  value: function scale(_) {
1438
1370
  return arguments.length ? (this._scale = _, this) : this._scale;
1439
1371
  }
1440
1372
  },
1441
1373
  {
1442
- /**
1443
- @memberof Axis
1444
- @desc Sets the "padding" property of the scale, often used in point scales.
1445
- @param {Number} [*value* = 0.5]
1446
- @chainable
1447
- */ key: "scalePadding",
1374
+ key: "scalePadding",
1448
1375
  value: function scalePadding(_) {
1449
1376
  return arguments.length ? (this._scalePadding = _, this) : this._scalePadding;
1450
1377
  }
1451
1378
  },
1452
1379
  {
1453
- /**
1454
- @memberof Axis
1455
- @desc If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If *selector* is not specified, returns the current SVG container element.
1456
- @param {String|HTMLElement} [*selector* = d3.select("body").append("svg")]
1457
- @chainable
1458
- */ key: "select",
1380
+ key: "select",
1459
1381
  value: function select1(_) {
1460
1382
  return arguments.length ? (this._select = select(_), this) : this._select;
1461
1383
  }
1462
1384
  },
1463
1385
  {
1464
- /**
1465
- @memberof Axis
1466
- @desc If *value* is specified, sets the tick shape constructor and returns the current class instance.
1467
- @param {String} [*value* = "Line"]
1468
- @chainable
1469
- */ key: "shape",
1386
+ key: "shape",
1470
1387
  value: function shape(_) {
1471
1388
  return arguments.length ? (this._shape = _, this) : this._shape;
1472
1389
  }
1473
1390
  },
1474
1391
  {
1475
- /**
1476
- @memberof Axis
1477
- @desc If *value* is specified, sets the tick style of the axis and returns the current class instance.
1478
- @param {Object} [*value*]
1479
- @chainable
1480
- */ key: "shapeConfig",
1392
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1393
+ key: "shapeConfig",
1481
1394
  value: function shapeConfig(_) {
1482
1395
  return arguments.length ? (this._shapeConfig = assign(this._shapeConfig, _), this) : this._shapeConfig;
1483
1396
  }
1484
1397
  },
1485
1398
  {
1486
- /**
1487
- @memberof Axis
1488
- @desc If *value* is specified, sets the tick formatter and returns the current class instance.
1489
- @param {Function} [*value*]
1490
- @chainable
1491
- */ key: "tickFormat",
1399
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1400
+ key: "tickFormat",
1492
1401
  value: function tickFormat(_) {
1493
1402
  return arguments.length ? (this._tickFormat = _, this) : this._tickFormat;
1494
1403
  }
1495
1404
  },
1496
1405
  {
1497
- /**
1498
- @memberof Axis
1499
- @desc If *value* is specified, sets the tick values of the axis and returns the current class instance.
1500
- @param {Array} [*value*]
1501
- @chainable
1502
- */ key: "ticks",
1406
+ key: "ticks",
1503
1407
  value: function ticks(_) {
1504
1408
  return arguments.length ? (this._ticks = _, this) : this._ticks;
1505
1409
  }
1506
1410
  },
1507
1411
  {
1508
- /**
1509
- @memberof Axis
1510
- @desc If *value* is specified, sets the tick size of the axis and returns the current class instance.
1511
- @param {Number} [*value* = 5]
1512
- @chainable
1513
- */ key: "tickSize",
1412
+ key: "tickSize",
1514
1413
  value: function tickSize(_) {
1515
1414
  return arguments.length ? (this._tickSize = _, this) : this._tickSize;
1516
1415
  }
1517
1416
  },
1518
1417
  {
1519
- /**
1520
- @memberof Axis
1521
- @desc Sets the behavior of the abbreviations when you are using linear scale. This method accepts two options: "normal" (uses formatAbbreviate to determinate the abbreviation) and "smallest" (uses suffix from the smallest tick as reference in every tick).
1522
- @param {String} [*value* = "normal"]
1523
- @chainable
1524
- */ key: "tickSuffix",
1418
+ key: "tickSuffix",
1525
1419
  value: function tickSuffix(_) {
1526
1420
  return arguments.length ? (this._tickSuffix = _, this) : this._tickSuffix;
1527
1421
  }
1528
1422
  },
1529
1423
  {
1530
- /**
1531
- @memberof Axis
1532
- @desc Defines a custom locale object to be used in time scale. This object must include the following properties: dateTime, date, time, periods, days, shortDays, months, shortMonths. For more information, you can revise [d3p.d3-time-format](https://github.com/d3/d3-time-format/blob/master/README.md#timeFormatLocale).
1533
- @param {Object} [*value* = undefined]
1534
- @chainable
1535
- */ key: "timeLocale",
1424
+ key: "timeLocale",
1536
1425
  value: function timeLocale(_) {
1537
1426
  return arguments.length ? (this._timeLocale = _, this) : this._timeLocale;
1538
1427
  }
1539
1428
  },
1540
1429
  {
1541
- /**
1542
- @memberof Axis
1543
- @desc If *value* is specified, sets the title of the axis and returns the current class instance.
1544
- @param {String} [*value*]
1545
- @chainable
1546
- */ key: "title",
1430
+ key: "title",
1547
1431
  value: function title(_) {
1548
1432
  return arguments.length ? (this._title = _, this) : this._title;
1549
1433
  }
1550
1434
  },
1551
1435
  {
1552
- /**
1553
- @memberof Axis
1554
- @desc If *value* is specified, sets the title configuration of the axis and returns the current class instance.
1555
- @param {Object} [*value*]
1556
- @chainable
1557
- */ key: "titleConfig",
1436
+ key: "titleConfig",
1558
1437
  value: function titleConfig(_) {
1559
1438
  return arguments.length ? (this._titleConfig = Object.assign(this._titleConfig, _), this) : this._titleConfig;
1560
1439
  }
1561
1440
  },
1562
1441
  {
1563
- /**
1564
- @memberof Axis
1565
- @desc If *value* is specified, sets the overall width of the axis and returns the current class instance.
1566
- @param {Number} [*value* = 400]
1567
- @chainable
1568
- */ key: "width",
1442
+ key: "width",
1569
1443
  value: function width(_) {
1570
1444
  return arguments.length ? (this._width = _, this) : this._width;
1571
1445
  }
@@ -1574,7 +1448,5 @@ var Axis = /*#__PURE__*/ function(BaseClass) {
1574
1448
  return Axis;
1575
1449
  }(BaseClass);
1576
1450
  /**
1577
- @class Axis
1578
- @extends BaseClass
1579
- @desc Creates an SVG scale based on an array of data.
1451
+ Creates an SVG scale based on an array of data.
1580
1452
  */ export { Axis as default };