@d3plus/core 3.0.0-alpha.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 (87) hide show
  1. package/README.md +6219 -0
  2. package/es/index.js +4 -0
  3. package/es/src/charts/AreaPlot.js +86 -0
  4. package/es/src/charts/BarChart.js +93 -0
  5. package/es/src/charts/BoxWhisker.js +97 -0
  6. package/es/src/charts/BumpChart.js +148 -0
  7. package/es/src/charts/Donut.js +84 -0
  8. package/es/src/charts/Geomap.js +833 -0
  9. package/es/src/charts/LinePlot.js +84 -0
  10. package/es/src/charts/Matrix.js +358 -0
  11. package/es/src/charts/Network.js +787 -0
  12. package/es/src/charts/Pack.js +318 -0
  13. package/es/src/charts/Pie.js +242 -0
  14. package/es/src/charts/Plot.js +2212 -0
  15. package/es/src/charts/Priestley.js +312 -0
  16. package/es/src/charts/Radar.js +365 -0
  17. package/es/src/charts/RadialMatrix.js +393 -0
  18. package/es/src/charts/Rings.js +777 -0
  19. package/es/src/charts/Sankey.js +413 -0
  20. package/es/src/charts/StackedArea.js +80 -0
  21. package/es/src/charts/Tree.js +312 -0
  22. package/es/src/charts/Treemap.js +406 -0
  23. package/es/src/charts/Viz.js +2017 -0
  24. package/es/src/charts/drawSteps/drawAttribution.js +14 -0
  25. package/es/src/charts/drawSteps/drawBack.js +23 -0
  26. package/es/src/charts/drawSteps/drawColorScale.js +69 -0
  27. package/es/src/charts/drawSteps/drawLegend.js +120 -0
  28. package/es/src/charts/drawSteps/drawSubtitle.js +31 -0
  29. package/es/src/charts/drawSteps/drawTimeline.js +80 -0
  30. package/es/src/charts/drawSteps/drawTitle.js +31 -0
  31. package/es/src/charts/drawSteps/drawTotal.js +32 -0
  32. package/es/src/charts/drawSteps/zoomControls.js +254 -0
  33. package/es/src/charts/events/click.legend.js +76 -0
  34. package/es/src/charts/events/click.shape.js +26 -0
  35. package/es/src/charts/events/mouseenter.js +31 -0
  36. package/es/src/charts/events/mouseleave.js +21 -0
  37. package/es/src/charts/events/mousemove.legend.js +64 -0
  38. package/es/src/charts/events/mousemove.shape.js +42 -0
  39. package/es/src/charts/events/touchstart.body.js +7 -0
  40. package/es/src/charts/helpers/matrixData.js +104 -0
  41. package/es/src/charts/helpers/tileAttributions.js +34 -0
  42. package/es/src/charts/index.js +21 -0
  43. package/es/src/charts/plotBuffers/Bar.js +65 -0
  44. package/es/src/charts/plotBuffers/Box.js +60 -0
  45. package/es/src/charts/plotBuffers/Circle.js +39 -0
  46. package/es/src/charts/plotBuffers/Line.js +30 -0
  47. package/es/src/charts/plotBuffers/Rect.js +40 -0
  48. package/es/src/charts/plotBuffers/discreteBuffer.js +24 -0
  49. package/es/src/charts/plotBuffers/numericBuffer.js +111 -0
  50. package/es/src/components/Axis.js +1567 -0
  51. package/es/src/components/AxisBottom.js +77 -0
  52. package/es/src/components/AxisLeft.js +77 -0
  53. package/es/src/components/AxisRight.js +77 -0
  54. package/es/src/components/AxisTop.js +77 -0
  55. package/es/src/components/ColorScale.js +958 -0
  56. package/es/src/components/Legend.js +673 -0
  57. package/es/src/components/Message.js +95 -0
  58. package/es/src/components/TextBox.js +752 -0
  59. package/es/src/components/Timeline.js +760 -0
  60. package/es/src/components/Tooltip.js +726 -0
  61. package/es/src/components/index.js +11 -0
  62. package/es/src/shapes/Area.js +361 -0
  63. package/es/src/shapes/Bar.js +342 -0
  64. package/es/src/shapes/Box.js +482 -0
  65. package/es/src/shapes/Circle.js +201 -0
  66. package/es/src/shapes/Image.js +255 -0
  67. package/es/src/shapes/Line.js +289 -0
  68. package/es/src/shapes/Path.js +186 -0
  69. package/es/src/shapes/Rect.js +215 -0
  70. package/es/src/shapes/Shape.js +1156 -0
  71. package/es/src/shapes/Whisker.js +330 -0
  72. package/es/src/shapes/index.js +10 -0
  73. package/es/src/utils/BaseClass.js +204 -0
  74. package/es/src/utils/RESET.js +4 -0
  75. package/es/src/utils/accessor.js +19 -0
  76. package/es/src/utils/configPrep.js +76 -0
  77. package/es/src/utils/constant.js +15 -0
  78. package/es/src/utils/getProp.js +9 -0
  79. package/es/src/utils/index.js +7 -0
  80. package/es/src/utils/uuid.js +13 -0
  81. package/package.json +68 -0
  82. package/umd/d3plus-core.full.js +56459 -0
  83. package/umd/d3plus-core.full.js.map +1 -0
  84. package/umd/d3plus-core.full.min.js +7241 -0
  85. package/umd/d3plus-core.js +14422 -0
  86. package/umd/d3plus-core.js.map +1 -0
  87. package/umd/d3plus-core.min.js +4564 -0
@@ -0,0 +1,726 @@
1
+ function _assert_this_initialized(self) {
2
+ if (self === void 0) {
3
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
4
+ }
5
+ return self;
6
+ }
7
+ function _call_super(_this, derived, args) {
8
+ derived = _get_prototype_of(derived);
9
+ return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
10
+ }
11
+ function _class_call_check(instance, Constructor) {
12
+ if (!(instance instanceof Constructor)) {
13
+ throw new TypeError("Cannot call a class as a function");
14
+ }
15
+ }
16
+ function _defineProperties(target, props) {
17
+ for(var i = 0; i < props.length; i++){
18
+ var descriptor = props[i];
19
+ descriptor.enumerable = descriptor.enumerable || false;
20
+ descriptor.configurable = true;
21
+ if ("value" in descriptor) descriptor.writable = true;
22
+ Object.defineProperty(target, descriptor.key, descriptor);
23
+ }
24
+ }
25
+ function _create_class(Constructor, protoProps, staticProps) {
26
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
27
+ if (staticProps) _defineProperties(Constructor, staticProps);
28
+ return Constructor;
29
+ }
30
+ function _get_prototype_of(o) {
31
+ _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
32
+ return o.__proto__ || Object.getPrototypeOf(o);
33
+ };
34
+ return _get_prototype_of(o);
35
+ }
36
+ function _inherits(subClass, superClass) {
37
+ if (typeof superClass !== "function" && superClass !== null) {
38
+ throw new TypeError("Super expression must either be null or a function");
39
+ }
40
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
41
+ constructor: {
42
+ value: subClass,
43
+ writable: true,
44
+ configurable: true
45
+ }
46
+ });
47
+ if (superClass) _set_prototype_of(subClass, superClass);
48
+ }
49
+ function _possible_constructor_return(self, call) {
50
+ if (call && (_type_of(call) === "object" || typeof call === "function")) {
51
+ return call;
52
+ }
53
+ return _assert_this_initialized(self);
54
+ }
55
+ function _set_prototype_of(o, p) {
56
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
57
+ o.__proto__ = p;
58
+ return o;
59
+ };
60
+ return _set_prototype_of(o, p);
61
+ }
62
+ function _type_of(obj) {
63
+ "@swc/helpers - typeof";
64
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
65
+ }
66
+ function _is_native_reflect_construct() {
67
+ try {
68
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
69
+ } catch (_) {}
70
+ return (_is_native_reflect_construct = function() {
71
+ return !!result;
72
+ })();
73
+ }
74
+ import { select } from "d3-selection";
75
+ import { createPopper } from '@popperjs/core';
76
+ import { colorDefaults } from "@d3plus/color";
77
+ import { elem, prefix, stylize } from "@d3plus/dom";
78
+ import { fontFamily, fontFamilyStringify } from "@d3plus/text";
79
+ import { accessor, BaseClass, constant } from "../utils/index.js";
80
+ /**
81
+ * Creates a reference element for popper.
82
+ * @param {Number[]} position
83
+ * @prrivate
84
+ */ function generateReference() {
85
+ var position = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [
86
+ 0,
87
+ 0
88
+ ];
89
+ return function() {
90
+ return {
91
+ width: 0,
92
+ height: 0,
93
+ top: position[1],
94
+ right: position[0],
95
+ bottom: position[1],
96
+ left: position[0]
97
+ };
98
+ };
99
+ }
100
+ var Tooltip = /*#__PURE__*/ function(BaseClass) {
101
+ "use strict";
102
+ _inherits(Tooltip, BaseClass);
103
+ function Tooltip() {
104
+ _class_call_check(this, Tooltip);
105
+ var _this;
106
+ _this = _call_super(this, Tooltip);
107
+ _this._arrow = accessor("arrow", "");
108
+ _this._arrowStyle = {
109
+ "content": "",
110
+ "background": "inherit",
111
+ "border": "inherit",
112
+ "border-width": "0 1px 1px 0",
113
+ "height": "10px",
114
+ "position": "absolute",
115
+ "transform": "rotate(45deg)",
116
+ "width": "10px",
117
+ "z-index": "-1"
118
+ };
119
+ _this._background = constant(colorDefaults.light);
120
+ _this._body = accessor("body", "");
121
+ _this._bodyStyle = {
122
+ "font-size": "12px",
123
+ "font-weight": "400",
124
+ "z-index": "1"
125
+ };
126
+ _this._border = constant("1px solid rgba(0, 0, 0, 0.25)");
127
+ _this._borderRadius = constant("4px");
128
+ _this._className = "d3plus-tooltip";
129
+ _this._data = [];
130
+ _this._footer = accessor("footer", "");
131
+ _this._footerStyle = {
132
+ "font-size": "9px",
133
+ "font-weight": "400",
134
+ "margin-top": "5px",
135
+ "z-index": "1"
136
+ };
137
+ _this._height = constant("auto");
138
+ _this._id = function(d, i) {
139
+ return "".concat(i);
140
+ };
141
+ _this._offset = constant(5);
142
+ _this._padding = constant("10px");
143
+ _this._pointerEvents = constant("auto");
144
+ _this._popperClasses = {};
145
+ _this._position = function(d) {
146
+ return [
147
+ d.x,
148
+ d.y
149
+ ];
150
+ };
151
+ _this._prefix = prefix();
152
+ _this._tableStyle = {
153
+ "border-collapse": "collapse",
154
+ "border-spacing": "0",
155
+ "width": "100%"
156
+ };
157
+ _this._tbody = [];
158
+ _this._tbodyStyle = {
159
+ "font-size": "12px",
160
+ "text-align": "center"
161
+ };
162
+ _this._thead = [];
163
+ _this._theadStyle = {
164
+ "font-size": "12px",
165
+ "font-weight": "600",
166
+ "text-align": "center"
167
+ };
168
+ _this._title = accessor("title", "");
169
+ _this._titleStyle = {
170
+ "font-size": "14px",
171
+ "font-weight": "600",
172
+ "margin-bottom": "5px"
173
+ };
174
+ _this._tooltipStyle = {
175
+ "box-shadow": "0 1px 5px rgba(0, 0, 0, 0.25)",
176
+ "color": colorDefaults.dark,
177
+ "font-family": fontFamilyStringify(fontFamily)
178
+ };
179
+ _this._trStyle = {
180
+ "border-top": function(d, i) {
181
+ return i ? "1px solid rgba(0, 0, 0, 0.1)" : "none";
182
+ }
183
+ };
184
+ _this._tdStyle = {};
185
+ _this._width = constant("150px");
186
+ return _this;
187
+ }
188
+ _create_class(Tooltip, [
189
+ {
190
+ /**
191
+ The inner return object and draw function that gets assigned the public methods.
192
+ @private
193
+ */ key: "render",
194
+ value: function render(callback) {
195
+ var _this = this;
196
+ var that = this;
197
+ var portal = elem("div#d3plus-portal");
198
+ var tooltips = portal.selectAll(".".concat(this._className)).data(this._data, this._id);
199
+ var enter = tooltips.enter().append("div").attr("class", this._className);
200
+ var update = tooltips.merge(enter);
201
+ stylize(update, this._tooltipStyle);
202
+ /**
203
+ Creates DIV elements with a unique class and styles.
204
+ @private
205
+ */ function divElement(cat) {
206
+ enter.append("div").attr("class", "d3plus-tooltip-".concat(cat)).attr("id", function(d, i) {
207
+ return "d3plus-tooltip-".concat(cat, "-").concat(d ? that._id(d, i) : "");
208
+ });
209
+ var div = update.select(".d3plus-tooltip-".concat(cat)).html(function(d, i) {
210
+ return that["_".concat(cat)](d, i);
211
+ }).style("display", function(d, i) {
212
+ var val = that["_".concat(cat)](d, i);
213
+ var visible = val !== false && val !== undefined && val !== null;
214
+ return visible ? "block" : "none";
215
+ });
216
+ stylize(div, that["_".concat(cat, "Style")]);
217
+ }
218
+ /**
219
+ Fetches table contents given functions or values.
220
+ @private
221
+ */ function cellContent(d) {
222
+ if (typeof d === "function") {
223
+ var datum = select(this.parentNode.parentNode).datum();
224
+ return d(datum, that._data.indexOf(datum));
225
+ } else return d;
226
+ }
227
+ /**
228
+ Sets styles for both enter and update.
229
+ @private
230
+ */ function boxStyles(box) {
231
+ box.style("background", that._background).style("".concat(that._prefix, "border-radius"), that._borderRadius).style("pointer-events", that._pointerEvents).style("padding", that._padding).style("width", that._width).style("height", that._height).style("border", that._border);
232
+ }
233
+ divElement("title");
234
+ divElement("body");
235
+ var tableEnter = enter.append("table").attr("class", "d3plus-tooltip-table");
236
+ var table = update.select(".d3plus-tooltip-table");
237
+ stylize(table, this._tableStyle);
238
+ tableEnter.append("thead").attr("class", "d3plus-tooltip-thead");
239
+ var tableHead = update.select(".d3plus-tooltip-thead");
240
+ stylize(tableHead, this._theadStyle);
241
+ var theadTr = tableHead.selectAll("tr").data([
242
+ 0
243
+ ]);
244
+ var theadTrEnter = theadTr.enter().append("tr");
245
+ theadTr.exit().remove();
246
+ var theadTrUpdate = theadTr.merge(theadTrEnter);
247
+ stylize(theadTrUpdate, this._trStyle);
248
+ var th = theadTrUpdate.selectAll("th").data(this._thead);
249
+ th.enter().append("th").merge(th).html(cellContent);
250
+ th.exit().remove();
251
+ tableEnter.append("tbody").attr("class", "d3plus-tooltip-tbody");
252
+ var tableBody = update.select(".d3plus-tooltip-tbody");
253
+ stylize(tableBody, this._tbodyStyle);
254
+ var tr = tableBody.selectAll("tr").data(this._tbody);
255
+ var trEnter = tr.enter().append("tr");
256
+ tr.exit().remove();
257
+ var trUpdate = tr.merge(trEnter);
258
+ stylize(trUpdate, this._trStyle);
259
+ var td = trUpdate.selectAll("td").data(function(d) {
260
+ return d;
261
+ });
262
+ td.enter().append("td").merge(td).html(cellContent);
263
+ stylize(td, this._tdStyle);
264
+ divElement("footer");
265
+ divElement("arrow");
266
+ enter.attr("id", function(d, i) {
267
+ return "d3plus-tooltip-".concat(d ? _this._id(d, i) : "");
268
+ }).call(boxStyles).each(function(d, i) {
269
+ var id = that._id(d, i);
270
+ var tooltip = document.getElementById("d3plus-tooltip-".concat(id));
271
+ var arrow = document.getElementById("d3plus-tooltip-arrow-".concat(id));
272
+ var arrowHeight = arrow.offsetHeight;
273
+ var arrowDistance = arrow.getBoundingClientRect().height / 2;
274
+ arrow.style.bottom = "-".concat(arrowHeight / 2, "px");
275
+ var position = that._position(d, i);
276
+ var referenceObject = Array.isArray(position) ? {
277
+ getBoundingClientRect: generateReference(position)
278
+ } : position;
279
+ _this._popperClasses[id] = createPopper(referenceObject, tooltip, {
280
+ placement: "top",
281
+ modifiers: [
282
+ {
283
+ name: "arrow",
284
+ options: {
285
+ element: arrow
286
+ }
287
+ },
288
+ {
289
+ name: "offset",
290
+ options: {
291
+ offset: [
292
+ 0,
293
+ that._offset(d, i) + arrowDistance
294
+ ]
295
+ }
296
+ },
297
+ {
298
+ name: "preventOverflow",
299
+ options: {
300
+ boundary: "scrollParent",
301
+ padding: 5
302
+ }
303
+ },
304
+ {
305
+ name: "flip",
306
+ options: {
307
+ behavior: "flip",
308
+ boundary: "viewport",
309
+ fallbackPlacements: [
310
+ "bottom"
311
+ ],
312
+ padding: 5
313
+ }
314
+ },
315
+ {
316
+ name: "update",
317
+ enabled: true,
318
+ phase: "afterWrite",
319
+ fn: function fn(x) {
320
+ var state = x.state;
321
+ var arrowElement = state.elements.arrow;
322
+ var arrowStyles = state.styles.arrow;
323
+ var flipped = state.modifiersData.flip._skip;
324
+ var border = parseFloat(arrowElement.style.borderRightWidth, 10);
325
+ if (flipped) {
326
+ arrowElement.style.transform = "".concat(arrowStyles.transform, "rotate(225deg)");
327
+ arrowElement.style.top = "-".concat(arrowHeight / 2 + border, "px");
328
+ } else {
329
+ arrowElement.style.transform = "".concat(arrowStyles.transform, "rotate(45deg)");
330
+ arrowElement.style.bottom = "-".concat(arrowHeight / 2 + border, "px");
331
+ }
332
+ }
333
+ }
334
+ ],
335
+ removeOnDestroy: true
336
+ });
337
+ });
338
+ update.each(function(d, i) {
339
+ var id = that._id(d, i);
340
+ var position = that._position(d, i);
341
+ var instance = _this._popperClasses[id];
342
+ if (instance) {
343
+ instance.state.elements.reference.getBoundingClientRect = Array.isArray(position) ? generateReference(position) : position;
344
+ instance.update();
345
+ }
346
+ }).call(boxStyles);
347
+ tooltips.exit().each(function(d, i) {
348
+ var id = that._id(d, i);
349
+ var instance = _this._popperClasses[id];
350
+ if (instance) {
351
+ instance.destroy();
352
+ delete _this._popperClasses[id];
353
+ }
354
+ }).remove();
355
+ if (callback) setTimeout(callback, 100);
356
+ return this;
357
+ }
358
+ },
359
+ {
360
+ /**
361
+ @memberof Tooltip
362
+ @desc Sets the inner HTML content of the arrow element, which by default is empty.
363
+ @param {Function|String} [*value*]
364
+ @example <caption>default accessor</caption>
365
+ function value(d) {
366
+ return d.arrow || "";
367
+ }
368
+ */ key: "arrow",
369
+ value: function arrow(_) {
370
+ return arguments.length ? (this._arrow = typeof _ === "function" ? _ : constant(_), this) : this._arrow;
371
+ }
372
+ },
373
+ {
374
+ /**
375
+ @memberof Tooltip
376
+ @desc If *value* is specified, sets the arrow styles to the specified values and returns this generator. If *value* is not specified, returns the current arrow styles.
377
+ @param {Object} [*value*]
378
+ @example <caption>default styles</caption>
379
+ {
380
+ "content": "",
381
+ "border-width": "10px",
382
+ "border-style": "solid",
383
+ "border-color": "rgba(255, 255, 255, 0.75) transparent transparent transparent",
384
+ "position": "absolute"
385
+ }
386
+ */ key: "arrowStyle",
387
+ value: function arrowStyle(_) {
388
+ return arguments.length ? (this._arrowStyle = Object.assign(this._arrowStyle, _), this) : this._arrowStyle;
389
+ }
390
+ },
391
+ {
392
+ /**
393
+ @memberof Tooltip
394
+ @desc If *value* is specified, sets the background accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current background accessor.
395
+ @param {Function|String} [*value* = "#f7f7f7"]
396
+ */ key: "background",
397
+ value: function background(_) {
398
+ return arguments.length ? (this._background = typeof _ === "function" ? _ : constant(_), this) : this._background;
399
+ }
400
+ },
401
+ {
402
+ /**
403
+ @memberof Tooltip
404
+ @desc If *value* is specified, sets the body accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current body accessor.
405
+ @param {Function|String} [*value*]
406
+ @example <caption>default accessor</caption>
407
+ function value(d) {
408
+ return d.body || "";
409
+ }
410
+ */ key: "body",
411
+ value: function body(_) {
412
+ return arguments.length ? (this._body = typeof _ === "function" ? _ : constant(_), this) : this._body;
413
+ }
414
+ },
415
+ {
416
+ /**
417
+ @memberof Tooltip
418
+ @desc If *value* is specified, sets the body styles to the specified values and returns this generator. If *value* is not specified, returns the current body styles.
419
+ @param {Object} [*value*]
420
+ @example <caption>default styles</caption>
421
+ {
422
+ "font-size": "12px",
423
+ "font-weight": "400"
424
+ }
425
+ */ key: "bodyStyle",
426
+ value: function bodyStyle(_) {
427
+ return arguments.length ? (this._bodyStyle = Object.assign(this._bodyStyle, _), this) : this._bodyStyle;
428
+ }
429
+ },
430
+ {
431
+ /**
432
+ @memberof Tooltip
433
+ @desc If *value* is specified, sets the border accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current border accessor.
434
+ @param {Function|String} [*value* = "1px solid rgba(0, 0, 0, 0.1)"]
435
+ */ key: "border",
436
+ value: function border(_) {
437
+ return arguments.length ? (this._border = typeof _ === "function" ? _ : constant(_), this) : this._border;
438
+ }
439
+ },
440
+ {
441
+ /**
442
+ @memberof Tooltip
443
+ @desc If *value* is specified, sets the border-radius accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current border-radius accessor.
444
+ @param {Function|String} [*value* = "2px"]
445
+ */ key: "borderRadius",
446
+ value: function borderRadius(_) {
447
+ return arguments.length ? (this._borderRadius = typeof _ === "function" ? _ : constant(_), this) : this._borderRadius;
448
+ }
449
+ },
450
+ {
451
+ /**
452
+ @memberof Tooltip
453
+ @desc If *value* is specified, sets the class name to the specified string and returns this generator. If *value* is not specified, returns the current class name.
454
+ @param {String} [*value* = "d3plus-tooltip"]
455
+ */ key: "className",
456
+ value: function className(_) {
457
+ return arguments.length ? (this._className = _, this) : this._className;
458
+ }
459
+ },
460
+ {
461
+ /**
462
+ @memberof Tooltip
463
+ @desc If *data* is specified, sets the data array to the specified array and returns this generator. If *data* is not specified, returns the current data array.
464
+ @param {Array} [*data* = []]
465
+ */ key: "data",
466
+ value: function data(_) {
467
+ return arguments.length ? (this._data = _, this) : this._data;
468
+ }
469
+ },
470
+ {
471
+ /**
472
+ @memberof Tooltip
473
+ @desc If *value* is specified, sets the footer accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current footer accessor.
474
+ @param {Function|String} [*value*]
475
+ @example <caption>default accessor</caption>
476
+ function value(d) {
477
+ return d.footer || "";
478
+ }
479
+ */ key: "footer",
480
+ value: function footer(_) {
481
+ return arguments.length ? (this._footer = typeof _ === "function" ? _ : constant(_), this) : this._footer;
482
+ }
483
+ },
484
+ {
485
+ /**
486
+ @memberof Tooltip
487
+ @desc If *value* is specified, sets the footer styles to the specified values and returns this generator. If *value* is not specified, returns the current footer styles.
488
+ @param {Object} [*value*]
489
+ @example <caption>default styles</caption>
490
+ {
491
+ "font-size": "12px",
492
+ "font-weight": "400"
493
+ }
494
+ */ key: "footerStyle",
495
+ value: function footerStyle(_) {
496
+ return arguments.length ? (this._footerStyle = Object.assign(this._footerStyle, _), this) : this._footerStyle;
497
+ }
498
+ },
499
+ {
500
+ /**
501
+ @memberof Tooltip
502
+ @desc If *value* is specified, sets the height accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current height accessor.
503
+ @param {Function|String} [*value* = "auto"]
504
+ */ key: "height",
505
+ value: function height(_) {
506
+ return arguments.length ? (this._height = typeof _ === "function" ? _ : constant(_), this) : this._height;
507
+ }
508
+ },
509
+ {
510
+ /**
511
+ @memberof Tooltip
512
+ @desc If *value* is specified, sets the id accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current id accessor.
513
+ @param {Function|String} [*value*]
514
+ @example <caption>default accessor</caption>
515
+ function value(d, i) {
516
+ return d.id || "" + i;
517
+ }
518
+ */ key: "id",
519
+ value: function id(_) {
520
+ return arguments.length ? (this._id = typeof _ === "function" ? _ : constant(_), this) : this._id;
521
+ }
522
+ },
523
+ {
524
+ /**
525
+ @memberof Tooltip
526
+ @desc If *value* is specified, sets the offset accessor to the specified function or number and returns this generator. If *value* is not specified, returns the current offset accessor.
527
+ @param {Function|Number} [*value* = 10]
528
+ */ key: "offset",
529
+ value: function offset(_) {
530
+ return arguments.length ? (this._offset = typeof _ === "function" ? _ : constant(_), this) : this._offset;
531
+ }
532
+ },
533
+ {
534
+ /**
535
+ @memberof Tooltip
536
+ @desc If *value* is specified, sets the padding accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current padding accessor.
537
+ @param {Function|String} [*value* = "5px"]
538
+ */ key: "padding",
539
+ value: function padding(_) {
540
+ return arguments.length ? (this._padding = typeof _ === "function" ? _ : constant(_), this) : this._padding;
541
+ }
542
+ },
543
+ {
544
+ /**
545
+ @memberof Tooltip
546
+ @desc If *value* is specified, sets the pointer-events accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current pointer-events accessor.
547
+ @param {Function|String} [*value* = "auto"]
548
+ */ key: "pointerEvents",
549
+ value: function pointerEvents(_) {
550
+ return arguments.length ? (this._pointerEvents = typeof _ === "function" ? _ : constant(_), this) : this._pointerEvents;
551
+ }
552
+ },
553
+ {
554
+ /**
555
+ @memberof Tooltip
556
+ @desc If *value* is specified, sets the position accessor to the specified function or array and returns this generator. If *value* is not specified, returns the current position accessor. If *value* is an HTMLElement, anchors the Tooltip to that HTMLElement. If *value* is a selection string, anchors the Tooltip to the HTMLElement selected by that string. Otherwise, coordinate points must be in reference to the client viewport, not the overall page.
557
+ @param {Function|Array|HTMLElement|String} [*value*]
558
+ @example <caption>default accessor</caption>
559
+ function value(d) {
560
+ return [d.x, d.y];
561
+ }
562
+ */ key: "position",
563
+ value: function position(_) {
564
+ return arguments.length ? (this._position = typeof _ === "string" ? constant(select(_).node() || [
565
+ 0,
566
+ 0
567
+ ]) : typeof _ === "function" ? _ : constant(_), this) : this._position;
568
+ }
569
+ },
570
+ {
571
+ /**
572
+ @memberof Tooltip
573
+ @desc If *value* is specified, sets the table styles to the specified values and returns this generator. If *value* is not specified, returns the current table styles.
574
+ @param {Object} [*value*]
575
+ @example <caption>default styles</caption>
576
+ {
577
+ "border-collapse": "collapse",
578
+ "border-spacing": "0",
579
+ "width": "100%"
580
+ }
581
+ */ key: "tableStyle",
582
+ value: function tableStyle(_) {
583
+ return arguments.length ? (this._tableStyle = Object.assign(this._tableStyle, _), this) : this._tableStyle;
584
+ }
585
+ },
586
+ {
587
+ /**
588
+ @memberof Tooltip
589
+ @desc If *value* is specified, sets the contents of the table body to the specified array of functions or strings and returns this generator. If *value* is not specified, returns the current table body data.
590
+ @param {Array} [*value* = []]
591
+ */ key: "tbody",
592
+ value: function tbody(_) {
593
+ return arguments.length ? (this._tbody = _, this) : this._tbody;
594
+ }
595
+ },
596
+ {
597
+ /**
598
+ @memberof Tooltip
599
+ @desc If *value* is specified, sets the table body styles to the specified values and returns this generator. If *value* is not specified, returns the current table body styles.
600
+ @param {Object} [*value*]
601
+ @example <caption>default styles</caption>
602
+ {
603
+ "font-size": "12px",
604
+ "font-weight": "600",
605
+ "text-align": "center"
606
+ }
607
+ */ key: "tbodyStyle",
608
+ value: function tbodyStyle(_) {
609
+ return arguments.length ? (this._tbodyStyle = Object.assign(this._tbodyStyle, _), this) : this._tbodyStyle;
610
+ }
611
+ },
612
+ {
613
+ /**
614
+ @memberof Tooltip
615
+ @desc If *value* is specified, sets the contents of the table head to the specified array of functions or strings and returns this generator. If *value* is not specified, returns the current table head data.
616
+ @param {Array} [*value* = []]
617
+ */ key: "thead",
618
+ value: function thead(_) {
619
+ return arguments.length ? (this._thead = _, this) : this._thead;
620
+ }
621
+ },
622
+ {
623
+ /**
624
+ @memberof Tooltip
625
+ @desc If *value* is specified, sets the table head styles to the specified values and returns this generator. If *value* is not specified, returns the current table head styles.
626
+ @param {Object} [*value*]
627
+ @example <caption>default styles</caption>
628
+ {
629
+ "font-size": "12px",
630
+ "font-weight": "600",
631
+ "text-align": "center"
632
+ }
633
+ */ key: "theadStyle",
634
+ value: function theadStyle(_) {
635
+ return arguments.length ? (this._theadStyle = Object.assign(this._theadStyle, _), this) : this._theadStyle;
636
+ }
637
+ },
638
+ {
639
+ /**
640
+ @memberof Tooltip
641
+ @desc If *value* is specified, sets the title accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current title accessor.
642
+ @param {Function|String} [*value*]
643
+ @example <caption>default accessor</caption>
644
+ function value(d) {
645
+ return d.title || "";
646
+ }
647
+ */ key: "title",
648
+ value: function title(_) {
649
+ return arguments.length ? (this._title = typeof _ === "function" ? _ : constant(_), this) : this._title;
650
+ }
651
+ },
652
+ {
653
+ /**
654
+ @memberof Tooltip
655
+ @desc If *value* is specified, sets the title styles to the specified values and returns this generator. If *value* is not specified, returns the current title styles.
656
+ @param {Object} [*value*]
657
+ @example <caption>default styles</caption>
658
+ {
659
+ "font-size": "14px",
660
+ "font-weight": "600",
661
+ "padding-bottom": "5px"
662
+ }
663
+ */ key: "titleStyle",
664
+ value: function titleStyle(_) {
665
+ return arguments.length ? (this._titleStyle = Object.assign(this._titleStyle, _), this) : this._titleStyle;
666
+ }
667
+ },
668
+ {
669
+ /**
670
+ @memberof Tooltip
671
+ @desc If *value* is specified, sets the overall tooltip styles to the specified values and returns this generator. If *value* is not specified, returns the current title styles.
672
+ @param {Object} [*value*]
673
+ @example <caption>default styles</caption>
674
+ {
675
+ "font-family": "'Inter', 'Helvetica Neue', 'HelveticaNeue', 'Helvetica', 'Arial', sans-serif",
676
+ "font-size": "14px",
677
+ "font-weight": "600",
678
+ "padding-bottom": "5px"
679
+ }
680
+ */ key: "tooltipStyle",
681
+ value: function tooltipStyle(_) {
682
+ return arguments.length ? (this._tooltipStyle = Object.assign(this._tooltipStyle, _), this) : this._tooltipStyle;
683
+ }
684
+ },
685
+ {
686
+ /**
687
+ @memberof Tooltip
688
+ @desc An object with CSS keys and values to be applied to all <tr> elements inside of each <tbody>.
689
+ @param {Object} [*value*]
690
+ @example <caption>default styles</caption>
691
+ {
692
+ "border-top": "1px solid rgba(0, 0, 0, 0.1)"
693
+ }
694
+ */ key: "trStyle",
695
+ value: function trStyle(_) {
696
+ return arguments.length ? (this._trStyle = Object.assign(this._trStyle, _), this) : this._trStyle;
697
+ }
698
+ },
699
+ {
700
+ /**
701
+ @memberof Tooltip
702
+ @desc An object with CSS keys and values to be applied to all <td> elements inside of each <tr>.
703
+ @param {Object} [*value*]
704
+ */ key: "tdStyle",
705
+ value: function tdStyle(_) {
706
+ return arguments.length ? (this._tdStyle = Object.assign(this._tdStyle, _), this) : this._tdStyle;
707
+ }
708
+ },
709
+ {
710
+ /**
711
+ @memberof Tooltip
712
+ @desc If *value* is specified, sets the width accessor to the specified function or string and returns this generator. If *value* is not specified, returns the current width accessor.
713
+ @param {Function|String} [*value* = "auto"]
714
+ */ key: "width",
715
+ value: function width(_) {
716
+ return arguments.length ? (this._width = typeof _ === "function" ? _ : constant(_), this) : this._width;
717
+ }
718
+ }
719
+ ]);
720
+ return Tooltip;
721
+ }(BaseClass);
722
+ /**
723
+ @class Tooltip
724
+ @extends BaseClass
725
+ @desc Creates HTML tooltips in the body of a webpage.
726
+ */ export { Tooltip as default };