@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.
- package/LICENSE +21 -0
- package/README.md +88482 -2998
- package/es/index.js +1 -1
- package/es/src/charts/AreaPlot.js +1 -3
- package/es/src/charts/BarChart.js +1 -3
- package/es/src/charts/BoxWhisker.js +2 -4
- package/es/src/charts/BumpChart.js +4 -5
- package/es/src/charts/Donut.js +1 -3
- package/es/src/charts/Geomap.js +47 -88
- package/es/src/charts/LinePlot.js +1 -3
- package/es/src/charts/Matrix.js +27 -46
- package/es/src/charts/Network.js +87 -81
- package/es/src/charts/Pack.js +21 -34
- package/es/src/charts/Pie.js +12 -24
- package/es/src/charts/Plot.js +226 -321
- package/es/src/charts/Priestley.js +18 -36
- package/es/src/charts/Radar.js +100 -47
- package/es/src/charts/RadialMatrix.js +35 -47
- package/es/src/charts/Rings.js +99 -90
- package/es/src/charts/Sankey.js +85 -75
- package/es/src/charts/StackedArea.js +1 -3
- package/es/src/charts/Tree.js +27 -28
- package/es/src/charts/Treemap.js +117 -71
- package/es/src/charts/Viz.js +297 -493
- package/es/src/charts/drawSteps/drawAttribution.js +1 -1
- package/es/src/charts/drawSteps/drawBack.js +1 -2
- package/es/src/charts/drawSteps/drawColorScale.js +1 -2
- package/es/src/charts/drawSteps/drawLegend.js +8 -10
- package/es/src/charts/drawSteps/drawSubtitle.js +1 -3
- package/es/src/charts/drawSteps/drawTimeline.js +12 -9
- package/es/src/charts/drawSteps/drawTitle.js +1 -3
- package/es/src/charts/drawSteps/drawTotal.js +1 -3
- package/es/src/charts/drawSteps/zoomControls.js +19 -21
- package/es/src/charts/events/click.legend.js +2 -3
- package/es/src/charts/events/click.shape.js +2 -4
- package/es/src/charts/events/mouseenter.js +7 -8
- package/es/src/charts/events/mouseleave.js +1 -3
- package/es/src/charts/events/mousemove.legend.js +3 -4
- package/es/src/charts/events/mousemove.shape.js +2 -4
- package/es/src/charts/events/touchstart.body.js +1 -1
- package/es/src/charts/helpers/matrixData.js +11 -4
- package/es/src/charts/helpers/tileAttributions.js +2 -1
- package/es/src/charts/plotBuffers/Bar.js +55 -12
- package/es/src/charts/plotBuffers/Box.js +55 -12
- package/es/src/charts/plotBuffers/Circle.js +9 -11
- package/es/src/charts/plotBuffers/Line.js +4 -6
- package/es/src/charts/plotBuffers/Rect.js +10 -12
- package/es/src/charts/plotBuffers/discreteBuffer.js +4 -2
- package/es/src/charts/plotBuffers/numericBuffer.js +7 -6
- package/es/src/components/Axis.js +298 -426
- package/es/src/components/AxisBottom.js +1 -3
- package/es/src/components/AxisLeft.js +1 -3
- package/es/src/components/AxisRight.js +1 -3
- package/es/src/components/AxisTop.js +1 -3
- package/es/src/components/ColorScale.js +80 -197
- package/es/src/components/Legend.js +82 -135
- package/es/src/components/Message.js +27 -19
- package/es/src/components/TextBox.js +106 -262
- package/es/src/components/Timeline.js +88 -155
- package/es/src/components/Tooltip.js +301 -330
- package/es/src/shapes/Area.js +95 -74
- package/es/src/shapes/Bar.js +46 -86
- package/es/src/shapes/Box.js +104 -118
- package/es/src/shapes/Circle.js +29 -30
- package/es/src/shapes/Image.js +44 -102
- package/es/src/shapes/Line.js +74 -40
- package/es/src/shapes/Path.js +23 -25
- package/es/src/shapes/Rect.js +29 -41
- package/es/src/shapes/Shape.js +152 -369
- package/es/src/shapes/Whisker.js +89 -90
- package/es/src/utils/AccessorFn.js +4 -0
- package/es/src/utils/BaseClass.js +53 -82
- package/es/src/utils/D3plusConfig.js +1 -0
- package/es/src/utils/RESET.js +2 -4
- package/es/src/utils/accessor.js +4 -5
- package/es/src/utils/configPrep.js +13 -12
- package/es/src/utils/constant.js +2 -3
- package/es/src/utils/getProp.js +4 -4
- package/es/src/utils/index.js +0 -1
- package/package.json +29 -22
- package/types/index.d.ts +5 -0
- package/types/src/charts/AreaPlot.d.ts +16 -0
- package/types/src/charts/BarChart.d.ts +16 -0
- package/types/src/charts/BoxWhisker.d.ts +11 -0
- package/types/src/charts/BumpChart.d.ts +36 -0
- package/types/src/charts/Donut.d.ts +11 -0
- package/types/src/charts/Geomap.d.ts +120 -0
- package/types/src/charts/LinePlot.d.ts +15 -0
- package/types/src/charts/Matrix.d.ts +74 -0
- package/types/src/charts/Network.d.ts +78 -0
- package/types/src/charts/Pack.d.ts +47 -0
- package/types/src/charts/Pie.d.ts +44 -0
- package/types/src/charts/Plot.d.ts +199 -0
- package/types/src/charts/Priestley.d.ts +37 -0
- package/types/src/charts/Radar.d.ts +38 -0
- package/types/src/charts/RadialMatrix.d.ts +78 -0
- package/types/src/charts/Rings.d.ts +74 -0
- package/types/src/charts/Sankey.d.ts +81 -0
- package/types/src/charts/StackedArea.d.ts +14 -0
- package/types/src/charts/Tree.d.ts +33 -0
- package/types/src/charts/Treemap.d.ts +51 -0
- package/types/src/charts/Viz.d.ts +402 -0
- package/types/src/charts/drawSteps/drawAttribution.d.ts +7 -0
- package/types/src/charts/drawSteps/drawBack.d.ts +6 -0
- package/types/src/charts/drawSteps/drawColorScale.d.ts +6 -0
- package/types/src/charts/drawSteps/drawLegend.d.ts +12 -0
- package/types/src/charts/drawSteps/drawSubtitle.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTimeline.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTitle.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTotal.d.ts +7 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +7 -0
- package/types/src/charts/events/click.legend.d.ts +8 -0
- package/types/src/charts/events/click.shape.d.ts +8 -0
- package/types/src/charts/events/mouseenter.d.ts +8 -0
- package/types/src/charts/events/mouseleave.d.ts +8 -0
- package/types/src/charts/events/mousemove.legend.d.ts +9 -0
- package/types/src/charts/events/mousemove.shape.d.ts +9 -0
- package/types/src/charts/events/touchstart.body.d.ts +7 -0
- package/types/src/charts/helpers/matrixData.d.ts +11 -0
- package/types/src/charts/helpers/tileAttributions.d.ts +6 -0
- package/types/src/charts/index.d.ts +21 -0
- package/types/src/charts/plotBuffers/Bar.d.ts +16 -0
- package/types/src/charts/plotBuffers/Box.d.ts +16 -0
- package/types/src/charts/plotBuffers/Circle.d.ts +20 -0
- package/types/src/charts/plotBuffers/Line.d.ts +16 -0
- package/types/src/charts/plotBuffers/Rect.d.ts +19 -0
- package/types/src/charts/plotBuffers/discreteBuffer.d.ts +7 -0
- package/types/src/charts/plotBuffers/numericBuffer.d.ts +5 -0
- package/types/src/components/Axis.d.ts +309 -0
- package/types/src/components/AxisBottom.d.ts +11 -0
- package/types/src/components/AxisLeft.d.ts +11 -0
- package/types/src/components/AxisRight.d.ts +11 -0
- package/types/src/components/AxisTop.d.ts +11 -0
- package/types/src/components/ColorScale.d.ts +208 -0
- package/types/src/components/Legend.d.ts +157 -0
- package/types/src/components/Message.d.ts +40 -0
- package/types/src/components/TextBox.d.ts +278 -0
- package/types/src/components/Timeline.d.ts +157 -0
- package/types/src/components/Tooltip.d.ts +297 -0
- package/types/src/components/index.d.ts +11 -0
- package/types/src/shapes/Area.d.ts +81 -0
- package/types/src/shapes/Bar.d.ts +104 -0
- package/types/src/shapes/Box.d.ts +121 -0
- package/types/src/shapes/Circle.d.ts +44 -0
- package/types/src/shapes/Image.d.ts +124 -0
- package/types/src/shapes/Line.d.ts +48 -0
- package/types/src/shapes/Path.d.ts +38 -0
- package/types/src/shapes/Rect.d.ts +54 -0
- package/types/src/shapes/Shape.d.ts +378 -0
- package/types/src/shapes/Whisker.d.ts +96 -0
- package/types/src/shapes/index.d.ts +10 -0
- package/types/src/utils/AccessorFn.d.ts +6 -0
- package/types/src/utils/BaseClass.d.ts +76 -0
- package/types/src/utils/D3plusConfig.d.ts +164 -0
- package/types/src/utils/RESET.d.ts +3 -0
- package/types/src/utils/accessor.d.ts +13 -0
- package/types/src/utils/configPrep.d.ts +28 -0
- package/types/src/utils/constant.d.ts +11 -0
- package/types/src/utils/getProp.d.ts +9 -0
- package/types/src/utils/index.d.ts +8 -0
- package/umd/d3plus-core.full.js +20134 -18708
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +2922 -5396
- package/umd/d3plus-core.js +1927 -4081
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1607 -3939
- package/es/src/utils/uuid.js +0 -13
package/es/src/shapes/Box.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
1
9
|
function _assert_this_initialized(self) {
|
|
2
10
|
if (self === void 0) {
|
|
3
11
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -27,6 +35,19 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
27
35
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
28
36
|
return Constructor;
|
|
29
37
|
}
|
|
38
|
+
function _define_property(obj, key, value) {
|
|
39
|
+
if (key in obj) {
|
|
40
|
+
Object.defineProperty(obj, key, {
|
|
41
|
+
value: value,
|
|
42
|
+
enumerable: true,
|
|
43
|
+
configurable: true,
|
|
44
|
+
writable: true
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
obj[key] = value;
|
|
48
|
+
}
|
|
49
|
+
return obj;
|
|
50
|
+
}
|
|
30
51
|
function _get_prototype_of(o) {
|
|
31
52
|
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
32
53
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -47,12 +68,40 @@ function _inherits(subClass, superClass) {
|
|
|
47
68
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
48
69
|
}
|
|
49
70
|
function _instanceof(left, right) {
|
|
71
|
+
"@swc/helpers - instanceof";
|
|
50
72
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
51
73
|
return !!right[Symbol.hasInstance](left);
|
|
52
74
|
} else {
|
|
53
75
|
return left instanceof right;
|
|
54
76
|
}
|
|
55
77
|
}
|
|
78
|
+
function _iterable_to_array_limit(arr, i) {
|
|
79
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
80
|
+
if (_i == null) return;
|
|
81
|
+
var _arr = [];
|
|
82
|
+
var _n = true;
|
|
83
|
+
var _d = false;
|
|
84
|
+
var _s, _e;
|
|
85
|
+
try {
|
|
86
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
87
|
+
_arr.push(_s.value);
|
|
88
|
+
if (i && _arr.length === i) break;
|
|
89
|
+
}
|
|
90
|
+
} catch (err) {
|
|
91
|
+
_d = true;
|
|
92
|
+
_e = err;
|
|
93
|
+
} finally{
|
|
94
|
+
try {
|
|
95
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
96
|
+
} finally{
|
|
97
|
+
if (_d) throw _e;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return _arr;
|
|
101
|
+
}
|
|
102
|
+
function _non_iterable_rest() {
|
|
103
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
104
|
+
}
|
|
56
105
|
function _possible_constructor_return(self, call) {
|
|
57
106
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
58
107
|
return call;
|
|
@@ -66,10 +115,21 @@ function _set_prototype_of(o, p) {
|
|
|
66
115
|
};
|
|
67
116
|
return _set_prototype_of(o, p);
|
|
68
117
|
}
|
|
118
|
+
function _sliced_to_array(arr, i) {
|
|
119
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
120
|
+
}
|
|
69
121
|
function _type_of(obj) {
|
|
70
122
|
"@swc/helpers - typeof";
|
|
71
123
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
72
124
|
}
|
|
125
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
126
|
+
if (!o) return;
|
|
127
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
128
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
129
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
130
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
131
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
132
|
+
}
|
|
73
133
|
function _is_native_reflect_construct() {
|
|
74
134
|
try {
|
|
75
135
|
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
@@ -78,8 +138,7 @@ function _is_native_reflect_construct() {
|
|
|
78
138
|
return !!result;
|
|
79
139
|
})();
|
|
80
140
|
}
|
|
81
|
-
import { max, min, quantile } from "d3-array";
|
|
82
|
-
import { nest } from "d3-collection";
|
|
141
|
+
import { groups, max, min, quantile } from "d3-array";
|
|
83
142
|
import { select } from "d3-selection";
|
|
84
143
|
import { merge } from "@d3plus/data";
|
|
85
144
|
import { assign, elem } from "@d3plus/dom";
|
|
@@ -97,7 +156,7 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
97
156
|
function Box() {
|
|
98
157
|
_class_call_check(this, Box);
|
|
99
158
|
var _this;
|
|
100
|
-
_this = _call_super(this, Box);
|
|
159
|
+
_this = _call_super(this, Box), _define_property(_this, "_medianConfig", void 0), _define_property(_this, "_orient", void 0), _define_property(_this, "_outlier", void 0), _define_property(_this, "_outlierConfig", void 0), _define_property(_this, "_rectConfig", void 0), _define_property(_this, "_rectWidth", void 0), _define_property(_this, "_whiskerConfig", void 0), _define_property(_this, "_whiskerMode", void 0), _define_property(_this, "_x", void 0), _define_property(_this, "_y", void 0), _define_property(_this, "_data", void 0), _define_property(_this, "_select", void 0), _define_property(_this, "_box", void 0), _define_property(_this, "_median", void 0), _define_property(_this, "_whisker", void 0), _define_property(_this, "_whiskerEndpoint", void 0), _define_property(_this, "_duration", void 0);
|
|
101
160
|
_this._medianConfig = {
|
|
102
161
|
fill: constant("black")
|
|
103
162
|
};
|
|
@@ -108,10 +167,10 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
108
167
|
r: accessor("r", 5)
|
|
109
168
|
},
|
|
110
169
|
Rect: {
|
|
111
|
-
height: function(d, i) {
|
|
170
|
+
height: function height(d, i) {
|
|
112
171
|
return _this._orient(d, i) === "vertical" ? 5 : 20;
|
|
113
172
|
},
|
|
114
|
-
width: function(d, i) {
|
|
173
|
+
width: function width(d, i) {
|
|
115
174
|
return _this._orient(d, i) === "vertical" ? 20 : 5;
|
|
116
175
|
}
|
|
117
176
|
}
|
|
@@ -129,25 +188,28 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
129
188
|
];
|
|
130
189
|
_this._x = accessor("x", 250);
|
|
131
190
|
_this._y = accessor("y", 250);
|
|
191
|
+
_this._whiskerEndpoint = [];
|
|
132
192
|
return _this;
|
|
133
193
|
}
|
|
134
194
|
_create_class(Box, [
|
|
135
195
|
{
|
|
136
196
|
/**
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
@param {Function} [*callback*]
|
|
140
|
-
@chainable
|
|
141
|
-
*/ key: "render",
|
|
197
|
+
Draws the Box.
|
|
198
|
+
*/ key: "render",
|
|
142
199
|
value: function render() {
|
|
143
200
|
var _this = this;
|
|
144
201
|
if (this._select === void 0) {
|
|
145
202
|
this.select(select("body").append("svg").style("width", "".concat(window.innerWidth, "px")).style("height", "".concat(window.innerHeight, "px")).style("display", "block").node());
|
|
146
203
|
}
|
|
147
204
|
var outlierData = [];
|
|
148
|
-
var filteredData =
|
|
205
|
+
var filteredData = groups(this._data, function(d, i) {
|
|
149
206
|
return _this._orient(d, i) === "vertical" ? _this._x(d, i) : _this._y(d, i);
|
|
150
|
-
}).
|
|
207
|
+
}).map(function(param) {
|
|
208
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], groupData = _param[1];
|
|
209
|
+
var d = {
|
|
210
|
+
key: key,
|
|
211
|
+
values: groupData
|
|
212
|
+
};
|
|
151
213
|
d.data = merge(d.values);
|
|
152
214
|
d.i = _this._data.indexOf(d.values[0]);
|
|
153
215
|
d.orient = _this._orient(d.data, d.i);
|
|
@@ -156,7 +218,7 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
156
218
|
return a - b;
|
|
157
219
|
});
|
|
158
220
|
d.first = quantile(values, 0.25);
|
|
159
|
-
d.median = quantile(values, 0.
|
|
221
|
+
d.median = quantile(values, 0.5);
|
|
160
222
|
d.third = quantile(values, 0.75);
|
|
161
223
|
var mode = _this._whiskerMode;
|
|
162
224
|
if (mode[0] === "tukey") {
|
|
@@ -213,7 +275,8 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
213
275
|
return d.y;
|
|
214
276
|
}).select(elem("g.d3plus-Box", {
|
|
215
277
|
parent: this._select
|
|
216
|
-
}).node())
|
|
278
|
+
}).node())// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
279
|
+
.config(configPrep.bind(this)(this._rectConfig, "shape")).render();
|
|
217
280
|
// Draw median.
|
|
218
281
|
this._median = new Rect().data(filteredData).x(function(d) {
|
|
219
282
|
return d.orient === "vertical" ? d.x : d.median;
|
|
@@ -225,7 +288,8 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
225
288
|
return d.orient === "vertical" ? d.width : 1;
|
|
226
289
|
}).select(elem("g.d3plus-Box-Median", {
|
|
227
290
|
parent: this._select
|
|
228
|
-
}).node())
|
|
291
|
+
}).node())// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
292
|
+
.config(configPrep.bind(this)(this._medianConfig, "shape")).render();
|
|
229
293
|
// Draw 2 lines using Whisker class.
|
|
230
294
|
// Construct coordinates for whisker startpoints and push it to the whiskerData.
|
|
231
295
|
var whiskerData = [];
|
|
@@ -279,27 +343,26 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
279
343
|
// Draw whiskers.
|
|
280
344
|
this._whisker = new Whisker().data(whiskerData).select(elem("g.d3plus-Box-Whisker", {
|
|
281
345
|
parent: this._select
|
|
282
|
-
}).node())
|
|
346
|
+
}).node())// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
347
|
+
.config(configPrep.bind(this)(this._whiskerConfig, "shape")).render();
|
|
283
348
|
// Draw outliers.
|
|
284
349
|
this._whiskerEndpoint = [];
|
|
285
|
-
|
|
350
|
+
groups(outlierData, function(d) {
|
|
286
351
|
return d.outlier;
|
|
287
|
-
}).
|
|
288
|
-
var shapeName =
|
|
289
|
-
_this._whiskerEndpoint.push(new shapes[shapeName]().data(
|
|
352
|
+
}).forEach(function(param) {
|
|
353
|
+
var _param = _sliced_to_array(param, 2), shapeName = _param[0], values = _param[1];
|
|
354
|
+
_this._whiskerEndpoint.push(new shapes[shapeName]().data(values).select(elem("g.d3plus-Box-Outlier-".concat(shapeName), {
|
|
290
355
|
parent: _this._select
|
|
291
|
-
}).node())
|
|
356
|
+
}).node())// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
357
|
+
.config(configPrep.bind(_this)(_this._outlierConfig, "shape", shapeName)).render());
|
|
292
358
|
});
|
|
293
359
|
return this;
|
|
294
360
|
}
|
|
295
361
|
},
|
|
296
362
|
{
|
|
297
363
|
/**
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
@param {Function} [*value*]
|
|
301
|
-
@chainable
|
|
302
|
-
*/ key: "active",
|
|
364
|
+
The active highlight state for all sub-shapes in this Box.
|
|
365
|
+
*/ key: "active",
|
|
303
366
|
value: function active(_) {
|
|
304
367
|
if (this._box) this._box.active(_);
|
|
305
368
|
if (this._median) this._median.active(_);
|
|
@@ -310,23 +373,15 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
310
373
|
}
|
|
311
374
|
},
|
|
312
375
|
{
|
|
313
|
-
|
|
314
|
-
@memberof Box
|
|
315
|
-
@desc If *data* is specified, sets the data array to the specified array and returns the current class instance. If *data* is not specified, returns the current data array.
|
|
316
|
-
@param {Array} [*data* = []]
|
|
317
|
-
@chainable
|
|
318
|
-
*/ key: "data",
|
|
376
|
+
key: "data",
|
|
319
377
|
value: function data(_) {
|
|
320
378
|
return arguments.length ? (this._data = _, this) : this._data;
|
|
321
379
|
}
|
|
322
380
|
},
|
|
323
381
|
{
|
|
324
382
|
/**
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
@param {Function} [*value*]
|
|
328
|
-
@chainable
|
|
329
|
-
*/ key: "hover",
|
|
383
|
+
The hover highlight state for all sub-shapes in this Box.
|
|
384
|
+
*/ key: "hover",
|
|
330
385
|
value: function hover(_) {
|
|
331
386
|
if (this._box) this._box.hover(_);
|
|
332
387
|
if (this._median) this._median.hover(_);
|
|
@@ -337,104 +392,55 @@ var Box = /*#__PURE__*/ function(BaseClass) {
|
|
|
337
392
|
}
|
|
338
393
|
},
|
|
339
394
|
{
|
|
340
|
-
|
|
341
|
-
@memberof Box
|
|
342
|
-
@desc If *value* is specified, sets the config method for median and returns the current class instance.
|
|
343
|
-
@param {Object} [*value*]
|
|
344
|
-
@chainable
|
|
345
|
-
*/ key: "medianConfig",
|
|
395
|
+
key: "medianConfig",
|
|
346
396
|
value: function medianConfig(_) {
|
|
347
397
|
return arguments.length ? (this._medianConfig = assign(this._medianConfig, _), this) : this._medianConfig;
|
|
348
398
|
}
|
|
349
399
|
},
|
|
350
400
|
{
|
|
351
|
-
|
|
352
|
-
@memberof Box
|
|
353
|
-
@desc If *value* is specified, sets the orientation to the specified value. If *value* is not specified, returns the current orientation.
|
|
354
|
-
@param {Function|String} [*value* = "vertical"] Accepts "vertical" or "horizontal"
|
|
355
|
-
@chainable
|
|
356
|
-
*/ key: "orient",
|
|
401
|
+
key: "orient",
|
|
357
402
|
value: function orient(_) {
|
|
358
403
|
return arguments.length ? (this._orient = typeof _ === "function" ? _ : constant(_), this) : this._orient;
|
|
359
404
|
}
|
|
360
405
|
},
|
|
361
406
|
{
|
|
362
|
-
|
|
363
|
-
@memberof Box
|
|
364
|
-
@desc If *value* is specified, sets the outlier accessor to the specified function or string and returns the current class instance.
|
|
365
|
-
@param {Function|String}
|
|
366
|
-
@chainable
|
|
367
|
-
*/ key: "outlier",
|
|
407
|
+
key: "outlier",
|
|
368
408
|
value: function outlier(_) {
|
|
369
409
|
return arguments.length ? (this._outlier = typeof _ === "function" ? _ : constant(_), this) : this._outlier;
|
|
370
410
|
}
|
|
371
411
|
},
|
|
372
412
|
{
|
|
373
|
-
|
|
374
|
-
@memberof Box
|
|
375
|
-
@desc If *value* is specified, sets the config method for each outlier point and returns the current class instance.
|
|
376
|
-
@param {Object} [*value*]
|
|
377
|
-
@chainable
|
|
378
|
-
*/ key: "outlierConfig",
|
|
413
|
+
key: "outlierConfig",
|
|
379
414
|
value: function outlierConfig(_) {
|
|
380
415
|
return arguments.length ? (this._outlierConfig = assign(this._outlierConfig, _), this) : this._outlierConfig;
|
|
381
416
|
}
|
|
382
417
|
},
|
|
383
418
|
{
|
|
384
|
-
|
|
385
|
-
@memberof Box
|
|
386
|
-
@desc If *value* is specified, sets the config method for rect shape and returns the current class instance.
|
|
387
|
-
@param {Object} [*value*]
|
|
388
|
-
@chainable
|
|
389
|
-
*/ key: "rectConfig",
|
|
419
|
+
key: "rectConfig",
|
|
390
420
|
value: function rectConfig(_) {
|
|
391
421
|
return arguments.length ? (this._rectConfig = assign(this._rectConfig, _), this) : this._rectConfig;
|
|
392
422
|
}
|
|
393
423
|
},
|
|
394
424
|
{
|
|
395
|
-
|
|
396
|
-
@memberof Box
|
|
397
|
-
@desc If *value* is specified, sets the width accessor to the specified function or number and returns the current class instance.
|
|
398
|
-
@param {Function|Number} [*value*]
|
|
399
|
-
@chainable
|
|
400
|
-
@example
|
|
401
|
-
function(d) {
|
|
402
|
-
return d.width;
|
|
403
|
-
}
|
|
404
|
-
*/ key: "rectWidth",
|
|
425
|
+
key: "rectWidth",
|
|
405
426
|
value: function rectWidth(_) {
|
|
406
427
|
return arguments.length ? (this._rectWidth = typeof _ === "function" ? _ : constant(_), this) : this._rectWidth;
|
|
407
428
|
}
|
|
408
429
|
},
|
|
409
430
|
{
|
|
410
|
-
|
|
411
|
-
@memberof Box
|
|
412
|
-
@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.
|
|
413
|
-
@param {String|HTMLElement} [*selector* = d3.select("body").append("svg")]
|
|
414
|
-
@chainable
|
|
415
|
-
*/ key: "select",
|
|
431
|
+
key: "select",
|
|
416
432
|
value: function select1(_) {
|
|
417
433
|
return arguments.length ? (this._select = select(_), this) : this._select;
|
|
418
434
|
}
|
|
419
435
|
},
|
|
420
436
|
{
|
|
421
|
-
|
|
422
|
-
@memberof Box
|
|
423
|
-
@desc If *value* is specified, sets the config method for whisker and returns the current class instance.
|
|
424
|
-
@param {Object} [*value*]
|
|
425
|
-
@chainable
|
|
426
|
-
*/ key: "whiskerConfig",
|
|
437
|
+
key: "whiskerConfig",
|
|
427
438
|
value: function whiskerConfig(_) {
|
|
428
439
|
return arguments.length ? (this._whiskerConfig = assign(this._whiskerConfig, _), this) : this._whiskerConfig;
|
|
429
440
|
}
|
|
430
441
|
},
|
|
431
442
|
{
|
|
432
|
-
|
|
433
|
-
@memberof Box
|
|
434
|
-
@desc Determines the value used for each whisker. Can be passed a single value to apply for both whiskers, or an Array of 2 values for the lower and upper whiskers (in that order). Accepted values are `"tukey"`, `"extent"`, or a Number representing a quantile.
|
|
435
|
-
@param {String|Number|String[]|Number[]} [*value* = "tukey"]
|
|
436
|
-
@chainable
|
|
437
|
-
*/ key: "whiskerMode",
|
|
443
|
+
key: "whiskerMode",
|
|
438
444
|
value: function whiskerMode(_) {
|
|
439
445
|
return arguments.length ? (this._whiskerMode = _instanceof(_, Array) ? _ : [
|
|
440
446
|
_,
|
|
@@ -443,31 +449,13 @@ function(d) {
|
|
|
443
449
|
}
|
|
444
450
|
},
|
|
445
451
|
{
|
|
446
|
-
|
|
447
|
-
@memberof Box
|
|
448
|
-
@desc If *value* is specified, sets the x axis to the specified function or number and returns the current class instance.
|
|
449
|
-
@param {Function|Number} [*value*]
|
|
450
|
-
@chainable
|
|
451
|
-
@example
|
|
452
|
-
function(d) {
|
|
453
|
-
return d.x;
|
|
454
|
-
}
|
|
455
|
-
*/ key: "x",
|
|
452
|
+
key: "x",
|
|
456
453
|
value: function x(_) {
|
|
457
454
|
return arguments.length ? (this._x = typeof _ === "function" ? _ : accessor(_), this) : this._x;
|
|
458
455
|
}
|
|
459
456
|
},
|
|
460
457
|
{
|
|
461
|
-
|
|
462
|
-
@memberof Box
|
|
463
|
-
@desc If *value* is specified, sets the y axis to the specified function or number and returns the current class instance.
|
|
464
|
-
@param {Function|Number} [*value*]
|
|
465
|
-
@chainable
|
|
466
|
-
@example
|
|
467
|
-
function(d) {
|
|
468
|
-
return d.y;
|
|
469
|
-
}
|
|
470
|
-
*/ key: "y",
|
|
458
|
+
key: "y",
|
|
471
459
|
value: function y(_) {
|
|
472
460
|
return arguments.length ? (this._y = typeof _ === "function" ? _ : accessor(_), this) : this._y;
|
|
473
461
|
}
|
|
@@ -476,7 +464,5 @@ function(d) {
|
|
|
476
464
|
return Box;
|
|
477
465
|
}(BaseClass);
|
|
478
466
|
/**
|
|
479
|
-
|
|
480
|
-
@extends BaseClass
|
|
481
|
-
@desc Creates SVG box based on an array of data.
|
|
467
|
+
Creates SVG box based on an array of data.
|
|
482
468
|
*/ export { Box as default };
|
package/es/src/shapes/Circle.js
CHANGED
|
@@ -27,6 +27,19 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
27
27
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
28
28
|
return Constructor;
|
|
29
29
|
}
|
|
30
|
+
function _define_property(obj, key, value) {
|
|
31
|
+
if (key in obj) {
|
|
32
|
+
Object.defineProperty(obj, key, {
|
|
33
|
+
value: value,
|
|
34
|
+
enumerable: true,
|
|
35
|
+
configurable: true,
|
|
36
|
+
writable: true
|
|
37
|
+
});
|
|
38
|
+
} else {
|
|
39
|
+
obj[key] = value;
|
|
40
|
+
}
|
|
41
|
+
return obj;
|
|
42
|
+
}
|
|
30
43
|
function _get(target, property, receiver) {
|
|
31
44
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
32
45
|
_get = Reflect.get;
|
|
@@ -105,8 +118,8 @@ var Circle = /*#__PURE__*/ function(Shape) {
|
|
|
105
118
|
var _this;
|
|
106
119
|
_this = _call_super(this, Circle, [
|
|
107
120
|
"circle"
|
|
108
|
-
]);
|
|
109
|
-
_this._labelBounds = function(
|
|
121
|
+
]), _define_property(_this, "_r", void 0);
|
|
122
|
+
_this._labelBounds = function(_d, _i, s) {
|
|
110
123
|
return {
|
|
111
124
|
width: s.r * 1.5,
|
|
112
125
|
height: s.r * 1.5,
|
|
@@ -125,12 +138,12 @@ var Circle = /*#__PURE__*/ function(Shape) {
|
|
|
125
138
|
_create_class(Circle, [
|
|
126
139
|
{
|
|
127
140
|
/**
|
|
128
|
-
|
|
129
|
-
@desc Provides the default positioning to the <rect> elements.
|
|
141
|
+
Provides the default positioning to the <rect> elements.
|
|
130
142
|
@private
|
|
131
|
-
|
|
143
|
+
*/ key: "_applyPosition",
|
|
132
144
|
value: function _applyPosition(elem) {
|
|
133
145
|
var _this = this;
|
|
146
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
134
147
|
elem.attr("r", function(d, i) {
|
|
135
148
|
return _this._r(d, i);
|
|
136
149
|
}).attr("x", function(d, i) {
|
|
@@ -142,17 +155,16 @@ var Circle = /*#__PURE__*/ function(Shape) {
|
|
|
142
155
|
},
|
|
143
156
|
{
|
|
144
157
|
/**
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
@chainable
|
|
149
|
-
*/ key: "render",
|
|
158
|
+
Draws the circles.
|
|
159
|
+
@param callback Optional callback invoked after rendering completes.
|
|
160
|
+
*/ key: "render",
|
|
150
161
|
value: function render(callback) {
|
|
151
162
|
_get(_get_prototype_of(Circle.prototype), "render", this).call(this, callback);
|
|
152
163
|
var enter = this._enter.call(this._applyStyle.bind(this));
|
|
153
164
|
var update = this._update;
|
|
154
165
|
if (this._duration) {
|
|
155
|
-
enter.attr("r", 0).attr("x", 0).attr("y", 0).transition(this._transition)
|
|
166
|
+
enter.attr("r", 0).attr("x", 0).attr("y", 0).transition(this._transition)// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
167
|
+
.call(this._applyPosition.bind(this));
|
|
156
168
|
update = update.transition(this._transition);
|
|
157
169
|
this._exit.transition(this._transition).attr("r", 0).attr("x", 0).attr("y", 0);
|
|
158
170
|
} else {
|
|
@@ -164,12 +176,10 @@ var Circle = /*#__PURE__*/ function(Shape) {
|
|
|
164
176
|
},
|
|
165
177
|
{
|
|
166
178
|
/**
|
|
167
|
-
|
|
168
|
-
@
|
|
169
|
-
@param
|
|
170
|
-
|
|
171
|
-
@private
|
|
172
|
-
*/ key: "_aes",
|
|
179
|
+
Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
180
|
+
@param data point*
|
|
181
|
+
@param index @private
|
|
182
|
+
*/ key: "_aes",
|
|
173
183
|
value: function _aes(d, i) {
|
|
174
184
|
return {
|
|
175
185
|
r: this._r(d, i)
|
|
@@ -177,16 +187,7 @@ var Circle = /*#__PURE__*/ function(Shape) {
|
|
|
177
187
|
}
|
|
178
188
|
},
|
|
179
189
|
{
|
|
180
|
-
|
|
181
|
-
@memberof Circle
|
|
182
|
-
@desc If *value* is specified, sets the radius accessor to the specified function or number and returns the current class instance.
|
|
183
|
-
@param {Function|Number} [*value*]
|
|
184
|
-
@chainable
|
|
185
|
-
@example
|
|
186
|
-
function(d) {
|
|
187
|
-
return d.r;
|
|
188
|
-
}
|
|
189
|
-
*/ key: "r",
|
|
190
|
+
key: "r",
|
|
190
191
|
value: function r(_) {
|
|
191
192
|
return arguments.length ? (this._r = typeof _ === "function" ? _ : constant(_), this) : this._r;
|
|
192
193
|
}
|
|
@@ -195,7 +196,5 @@ function(d) {
|
|
|
195
196
|
return Circle;
|
|
196
197
|
}(Shape);
|
|
197
198
|
/**
|
|
198
|
-
|
|
199
|
-
@extends Shape
|
|
200
|
-
@desc Creates SVG circles based on an array of data.
|
|
199
|
+
Creates SVG circles based on an array of data.
|
|
201
200
|
*/ export { Circle as default };
|