@d3plus/core 3.0.16 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88485 -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 +296 -492
- 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 +146 -363
- 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 +30 -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 +20127 -18701
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +2920 -5394
- package/umd/d3plus-core.js +1920 -4074
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1605 -3937
- package/es/src/utils/uuid.js +0 -13
package/es/src/shapes/Area.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(target, property, receiver) {
|
|
31
52
|
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
32
53
|
_get = Reflect.get;
|
|
@@ -62,6 +83,33 @@ function _inherits(subClass, superClass) {
|
|
|
62
83
|
});
|
|
63
84
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
64
85
|
}
|
|
86
|
+
function _iterable_to_array_limit(arr, i) {
|
|
87
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
88
|
+
if (_i == null) return;
|
|
89
|
+
var _arr = [];
|
|
90
|
+
var _n = true;
|
|
91
|
+
var _d = false;
|
|
92
|
+
var _s, _e;
|
|
93
|
+
try {
|
|
94
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
95
|
+
_arr.push(_s.value);
|
|
96
|
+
if (i && _arr.length === i) break;
|
|
97
|
+
}
|
|
98
|
+
} catch (err) {
|
|
99
|
+
_d = true;
|
|
100
|
+
_e = err;
|
|
101
|
+
} finally{
|
|
102
|
+
try {
|
|
103
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
104
|
+
} finally{
|
|
105
|
+
if (_d) throw _e;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return _arr;
|
|
109
|
+
}
|
|
110
|
+
function _non_iterable_rest() {
|
|
111
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
112
|
+
}
|
|
65
113
|
function _possible_constructor_return(self, call) {
|
|
66
114
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
67
115
|
return call;
|
|
@@ -75,6 +123,9 @@ function _set_prototype_of(o, p) {
|
|
|
75
123
|
};
|
|
76
124
|
return _set_prototype_of(o, p);
|
|
77
125
|
}
|
|
126
|
+
function _sliced_to_array(arr, i) {
|
|
127
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
128
|
+
}
|
|
78
129
|
function _super_prop_base(object, property) {
|
|
79
130
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
80
131
|
object = _get_prototype_of(object);
|
|
@@ -86,6 +137,14 @@ function _type_of(obj) {
|
|
|
86
137
|
"@swc/helpers - typeof";
|
|
87
138
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
88
139
|
}
|
|
140
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
141
|
+
if (!o) return;
|
|
142
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
143
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
144
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
145
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
146
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
147
|
+
}
|
|
89
148
|
function _is_native_reflect_construct() {
|
|
90
149
|
try {
|
|
91
150
|
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
@@ -94,8 +153,7 @@ function _is_native_reflect_construct() {
|
|
|
94
153
|
return !!result;
|
|
95
154
|
})();
|
|
96
155
|
}
|
|
97
|
-
import { extent } from "d3-array";
|
|
98
|
-
import { nest } from "d3-collection";
|
|
156
|
+
import { extent, groups } from "d3-array";
|
|
99
157
|
import { interpolatePath } from "d3-interpolate-path";
|
|
100
158
|
import { select } from "d3-selection";
|
|
101
159
|
import * as paths from "d3-shape";
|
|
@@ -109,7 +167,7 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
109
167
|
function Area() {
|
|
110
168
|
_class_call_check(this, Area);
|
|
111
169
|
var _this;
|
|
112
|
-
_this = _call_super(this, Area);
|
|
170
|
+
_this = _call_super(this, Area), _define_property(_this, "_curve", void 0), _define_property(_this, "_defined", void 0), _define_property(_this, "_x0", void 0), _define_property(_this, "_x1", void 0), _define_property(_this, "_y0", void 0), _define_property(_this, "_y1", void 0);
|
|
113
171
|
_this._curve = constant("linear");
|
|
114
172
|
_this._defined = function() {
|
|
115
173
|
return true;
|
|
@@ -141,12 +199,10 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
141
199
|
_create_class(Area, [
|
|
142
200
|
{
|
|
143
201
|
/**
|
|
144
|
-
|
|
145
|
-
@
|
|
146
|
-
@param
|
|
147
|
-
|
|
148
|
-
@private
|
|
149
|
-
*/ key: "_aes",
|
|
202
|
+
Given a specific data point and index, returns the aesthetic properties of the shape.
|
|
203
|
+
@param data point*
|
|
204
|
+
@param index @private
|
|
205
|
+
*/ key: "_aes",
|
|
150
206
|
value: function _aes(d) {
|
|
151
207
|
var _this = this;
|
|
152
208
|
var values = d.values.slice().sort(function(a, b) {
|
|
@@ -177,14 +233,17 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
177
233
|
},
|
|
178
234
|
{
|
|
179
235
|
/**
|
|
180
|
-
|
|
181
|
-
@
|
|
182
|
-
|
|
183
|
-
@private
|
|
184
|
-
*/ key: "_dataFilter",
|
|
236
|
+
Filters/manipulates the data array before binding each point to an SVG group.
|
|
237
|
+
@param data @private
|
|
238
|
+
*/ key: "_dataFilter",
|
|
185
239
|
value: function _dataFilter(data) {
|
|
186
240
|
var _this = this;
|
|
187
|
-
var areas =
|
|
241
|
+
var areas = groups(data, this._id).map(function(param) {
|
|
242
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], values = _param[1];
|
|
243
|
+
var d = {
|
|
244
|
+
key: key,
|
|
245
|
+
values: values
|
|
246
|
+
};
|
|
188
247
|
d.data = merge(d.values);
|
|
189
248
|
d.i = data.indexOf(d.values[0]);
|
|
190
249
|
var x = extent(d.values.map(_this._x).concat(d.values.map(_this._x0)).concat(_this._x1 ? d.values.map(_this._x1) : []));
|
|
@@ -211,17 +270,17 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
211
270
|
},
|
|
212
271
|
{
|
|
213
272
|
/**
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
@chainable
|
|
218
|
-
*/ key: "render",
|
|
273
|
+
Draws the area polygons.
|
|
274
|
+
@param callback Optional callback invoked after rendering completes.
|
|
275
|
+
*/ key: "render",
|
|
219
276
|
value: function render(callback) {
|
|
220
277
|
var _this = this;
|
|
221
278
|
_get(_get_prototype_of(Area.prototype), "render", this).call(this, callback);
|
|
222
279
|
var userCurve = this._curve.bind(this)(this.config());
|
|
223
280
|
var curve = paths["curve".concat(userCurve.charAt(0).toUpperCase()).concat(userCurve.slice(1))];
|
|
281
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
224
282
|
var path = this._path = paths.area().defined(this._defined).curve(curve).x(this._x).x0(this._x0).x1(this._x1).y(this._y).y0(this._y0).y1(this._y1);
|
|
283
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
225
284
|
var exitPath = paths.area().defined(function(d) {
|
|
226
285
|
return d;
|
|
227
286
|
}).curve(curve).x(this._x).y(this._y).x0(function(d, i) {
|
|
@@ -233,6 +292,7 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
233
292
|
}).y1(function(d, i) {
|
|
234
293
|
return _this._y1 ? _this._y0(d, i) + (_this._y1(d, i) - _this._y0(d, i)) / 2 : _this._y0(d, i);
|
|
235
294
|
});
|
|
295
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
236
296
|
this._enter.append("path").attr("transform", function(d) {
|
|
237
297
|
return "translate(".concat(-d.xR[0] - d.width / 2, ", ").concat(-d.yR[0] - d.height / 2, ")");
|
|
238
298
|
}).attr("d", function(d) {
|
|
@@ -240,11 +300,14 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
240
300
|
}).call(this._applyStyle.bind(this)).transition(this._transition).attrTween("d", function(d) {
|
|
241
301
|
return interpolatePath(select(this).attr("d"), path(d.values));
|
|
242
302
|
});
|
|
303
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
243
304
|
this._update.select("path").transition(this._transition).attr("transform", function(d) {
|
|
244
305
|
return "translate(".concat(-d.xR[0] - d.width / 2, ", ").concat(-d.yR[0] - d.height / 2, ")");
|
|
245
306
|
}).attrTween("d", function(d) {
|
|
246
307
|
return interpolatePath(select(this).attr("d"), path(d.values));
|
|
247
|
-
})
|
|
308
|
+
})// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
309
|
+
.call(this._applyStyle.bind(this));
|
|
310
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
248
311
|
this._exit.select("path").transition(this._transition).attrTween("d", function(d) {
|
|
249
312
|
return interpolatePath(select(this).attr("d"), exitPath(d.values));
|
|
250
313
|
});
|
|
@@ -252,34 +315,19 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
252
315
|
}
|
|
253
316
|
},
|
|
254
317
|
{
|
|
255
|
-
|
|
256
|
-
@memberof Area
|
|
257
|
-
@desc If *value* is specified, sets the area curve to the specified string and returns the current class instance. If *value* is not specified, returns the current area curve.
|
|
258
|
-
@param {Function|String} [*value* = "linear"]
|
|
259
|
-
@chainable
|
|
260
|
-
*/ key: "curve",
|
|
318
|
+
key: "curve",
|
|
261
319
|
value: function curve(_) {
|
|
262
320
|
return arguments.length ? (this._curve = typeof _ === "function" ? _ : constant(_), this) : this._curve;
|
|
263
321
|
}
|
|
264
322
|
},
|
|
265
323
|
{
|
|
266
|
-
|
|
267
|
-
@memberof Area
|
|
268
|
-
@desc If *value* is specified, sets the defined accessor to the specified function and returns the current class instance. If *value* is not specified, returns the current defined accessor.
|
|
269
|
-
@param {Function} [*value*]
|
|
270
|
-
@chainable
|
|
271
|
-
*/ key: "defined",
|
|
324
|
+
key: "defined",
|
|
272
325
|
value: function defined(_) {
|
|
273
326
|
return arguments.length ? (this._defined = _, this) : this._defined;
|
|
274
327
|
}
|
|
275
328
|
},
|
|
276
329
|
{
|
|
277
|
-
|
|
278
|
-
@memberof Area
|
|
279
|
-
@desc If *value* is specified, sets the x accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current x accessor.
|
|
280
|
-
@param {Function|Number} [*value*]
|
|
281
|
-
@chainable
|
|
282
|
-
*/ key: "x",
|
|
330
|
+
key: "x",
|
|
283
331
|
value: function x(_) {
|
|
284
332
|
if (!arguments.length) return this._x;
|
|
285
333
|
this._x = typeof _ === "function" ? _ : constant(_);
|
|
@@ -288,12 +336,7 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
288
336
|
}
|
|
289
337
|
},
|
|
290
338
|
{
|
|
291
|
-
|
|
292
|
-
@memberof Area
|
|
293
|
-
@desc If *value* is specified, sets the x0 accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current x0 accessor.
|
|
294
|
-
@param {Function|Number} [*value*]
|
|
295
|
-
@chainable
|
|
296
|
-
*/ key: "x0",
|
|
339
|
+
key: "x0",
|
|
297
340
|
value: function x0(_) {
|
|
298
341
|
if (!arguments.length) return this._x0;
|
|
299
342
|
this._x0 = typeof _ === "function" ? _ : constant(_);
|
|
@@ -302,23 +345,13 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
302
345
|
}
|
|
303
346
|
},
|
|
304
347
|
{
|
|
305
|
-
|
|
306
|
-
@memberof Area
|
|
307
|
-
@desc If *value* is specified, sets the x1 accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current x1 accessor.
|
|
308
|
-
@param {Function|Number|null} [*value*]
|
|
309
|
-
@chainable
|
|
310
|
-
*/ key: "x1",
|
|
348
|
+
key: "x1",
|
|
311
349
|
value: function x1(_) {
|
|
312
|
-
return arguments.length ? (this._x1 = typeof _ === "function"
|
|
350
|
+
return arguments.length ? (this._x1 = typeof _ === "function" ? _ : _ === null ? null : constant(_), this) : this._x1;
|
|
313
351
|
}
|
|
314
352
|
},
|
|
315
353
|
{
|
|
316
|
-
|
|
317
|
-
@memberof Area
|
|
318
|
-
@desc If *value* is specified, sets the y accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current y accessor.
|
|
319
|
-
@param {Function|Number} [*value*]
|
|
320
|
-
@chainable
|
|
321
|
-
*/ key: "y",
|
|
354
|
+
key: "y",
|
|
322
355
|
value: function y(_) {
|
|
323
356
|
if (!arguments.length) return this._y;
|
|
324
357
|
this._y = typeof _ === "function" ? _ : constant(_);
|
|
@@ -327,12 +360,7 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
327
360
|
}
|
|
328
361
|
},
|
|
329
362
|
{
|
|
330
|
-
|
|
331
|
-
@memberof Area
|
|
332
|
-
@desc If *value* is specified, sets the y0 accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current y0 accessor.
|
|
333
|
-
@param {Function|Number} [*value*]
|
|
334
|
-
@chainable
|
|
335
|
-
*/ key: "y0",
|
|
363
|
+
key: "y0",
|
|
336
364
|
value: function y0(_) {
|
|
337
365
|
if (!arguments.length) return this._y0;
|
|
338
366
|
this._y0 = typeof _ === "function" ? _ : constant(_);
|
|
@@ -341,21 +369,14 @@ var Area = /*#__PURE__*/ function(Shape) {
|
|
|
341
369
|
}
|
|
342
370
|
},
|
|
343
371
|
{
|
|
344
|
-
|
|
345
|
-
@memberof Area
|
|
346
|
-
@desc If *value* is specified, sets the y1 accessor to the specified function or number and returns the current class instance. If *value* is not specified, returns the current y1 accessor.
|
|
347
|
-
@param {Function|Number|null} [*value*]
|
|
348
|
-
@chainable
|
|
349
|
-
*/ key: "y1",
|
|
372
|
+
key: "y1",
|
|
350
373
|
value: function y1(_) {
|
|
351
|
-
return arguments.length ? (this._y1 = typeof _ === "function"
|
|
374
|
+
return arguments.length ? (this._y1 = typeof _ === "function" ? _ : _ === null ? null : constant(_), this) : this._y1;
|
|
352
375
|
}
|
|
353
376
|
}
|
|
354
377
|
]);
|
|
355
378
|
return Area;
|
|
356
379
|
}(Shape);
|
|
357
380
|
/**
|
|
358
|
-
|
|
359
|
-
@extends Shape
|
|
360
|
-
@desc Creates SVG areas based on an array of data.
|
|
381
|
+
Creates SVG areas based on an array of data.
|
|
361
382
|
*/ export { Area as default };
|
package/es/src/shapes/Bar.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;
|
|
@@ -104,7 +117,7 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
104
117
|
var _this;
|
|
105
118
|
_this = _call_super(this, Bar, [
|
|
106
119
|
"rect"
|
|
107
|
-
]);
|
|
120
|
+
]), _define_property(_this, "_height", void 0), _define_property(_this, "_width", void 0), _define_property(_this, "_x0", void 0), _define_property(_this, "_x1", void 0), _define_property(_this, "_y0", void 0), _define_property(_this, "_y1", void 0);
|
|
108
121
|
_this._name = "Bar";
|
|
109
122
|
_this._height = constant(10);
|
|
110
123
|
_this._labelBounds = function(d, i, s) {
|
|
@@ -127,11 +140,9 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
127
140
|
_create_class(Bar, [
|
|
128
141
|
{
|
|
129
142
|
/**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
@chainable
|
|
134
|
-
*/ key: "render",
|
|
143
|
+
Draws the bars.
|
|
144
|
+
@param callback Optional callback invoked after rendering completes.
|
|
145
|
+
*/ key: "render",
|
|
135
146
|
value: function render(callback) {
|
|
136
147
|
var _this = this;
|
|
137
148
|
_get(_get_prototype_of(Bar.prototype), "render", this).call(this, callback);
|
|
@@ -165,12 +176,10 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
165
176
|
},
|
|
166
177
|
{
|
|
167
178
|
/**
|
|
168
|
-
|
|
169
|
-
@
|
|
170
|
-
@param
|
|
171
|
-
|
|
172
|
-
@private
|
|
173
|
-
*/ 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",
|
|
174
183
|
value: function _aes(d, i) {
|
|
175
184
|
return {
|
|
176
185
|
height: this._getHeight(d, i),
|
|
@@ -180,13 +189,12 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
180
189
|
},
|
|
181
190
|
{
|
|
182
191
|
/**
|
|
183
|
-
|
|
184
|
-
@
|
|
185
|
-
|
|
186
|
-
@private
|
|
187
|
-
*/ key: "_applyPosition",
|
|
192
|
+
Provides the default positioning to the <rect> elements.
|
|
193
|
+
@param elem @private
|
|
194
|
+
*/ key: "_applyPosition",
|
|
188
195
|
value: function _applyPosition(elem) {
|
|
189
196
|
var _this = this;
|
|
197
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
190
198
|
elem.attr("width", function(d, i) {
|
|
191
199
|
return _this._getWidth(d, i);
|
|
192
200
|
}).attr("height", function(d, i) {
|
|
@@ -200,12 +208,10 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
200
208
|
},
|
|
201
209
|
{
|
|
202
210
|
/**
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
@param {Object} *d*
|
|
206
|
-
@param {Number} *i*
|
|
211
|
+
Calculates the height of the <rect> by assessing the x and y properties.
|
|
212
|
+
|
|
207
213
|
@private
|
|
208
|
-
|
|
214
|
+
*/ key: "_getHeight",
|
|
209
215
|
value: function _getHeight(d, i) {
|
|
210
216
|
if (this._x1 !== null) return this._height(d, i);
|
|
211
217
|
return Math.abs(this._y1(d, i) - this._y(d, i));
|
|
@@ -213,12 +219,10 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
213
219
|
},
|
|
214
220
|
{
|
|
215
221
|
/**
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
@param {Object} *d*
|
|
219
|
-
@param {Number} *i*
|
|
222
|
+
Calculates the width of the <rect> by assessing the x and y properties.
|
|
223
|
+
|
|
220
224
|
@private
|
|
221
|
-
|
|
225
|
+
*/ key: "_getWidth",
|
|
222
226
|
value: function _getWidth(d, i) {
|
|
223
227
|
if (this._x1 === null) return this._width(d, i);
|
|
224
228
|
return Math.abs(this._x1(d, i) - this._x(d, i));
|
|
@@ -226,12 +230,10 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
226
230
|
},
|
|
227
231
|
{
|
|
228
232
|
/**
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
@param {Object} *d*
|
|
232
|
-
@param {Number} *i*
|
|
233
|
+
Calculates the x of the <rect> by assessing the x and width properties.
|
|
234
|
+
|
|
233
235
|
@private
|
|
234
|
-
|
|
236
|
+
*/ key: "_getX",
|
|
235
237
|
value: function _getX(d, i) {
|
|
236
238
|
var w = this._x1 === null ? this._x(d, i) : this._x1(d, i) - this._x(d, i);
|
|
237
239
|
if (w < 0) return w;
|
|
@@ -240,12 +242,10 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
240
242
|
},
|
|
241
243
|
{
|
|
242
244
|
/**
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
@param {Object} *d*
|
|
246
|
-
@param {Number} *i*
|
|
245
|
+
Calculates the y of the <rect> by assessing the y and height properties.
|
|
246
|
+
|
|
247
247
|
@private
|
|
248
|
-
|
|
248
|
+
*/ key: "_getY",
|
|
249
249
|
value: function _getY(d, i) {
|
|
250
250
|
var h = this._x1 !== null ? this._y(d, i) : this._y1(d, i) - this._y(d, i);
|
|
251
251
|
if (h < 0) return h;
|
|
@@ -253,42 +253,19 @@ var Bar = /*#__PURE__*/ function(Shape) {
|
|
|
253
253
|
}
|
|
254
254
|
},
|
|
255
255
|
{
|
|
256
|
-
|
|
257
|
-
@memberof Bar
|
|
258
|
-
@desc If *value* is specified, sets the height accessor to the specified function or number and returns the current class instance.
|
|
259
|
-
@param {Function|Number} [*value*]
|
|
260
|
-
@chainable
|
|
261
|
-
@example
|
|
262
|
-
function(d) {
|
|
263
|
-
return d.height;
|
|
264
|
-
}
|
|
265
|
-
*/ key: "height",
|
|
256
|
+
key: "height",
|
|
266
257
|
value: function height(_) {
|
|
267
258
|
return arguments.length ? (this._height = typeof _ === "function" ? _ : constant(_), this) : this._height;
|
|
268
259
|
}
|
|
269
260
|
},
|
|
270
261
|
{
|
|
271
|
-
|
|
272
|
-
@memberof Bar
|
|
273
|
-
@desc If *value* is specified, sets the width accessor to the specified function or number and returns the current class instance.
|
|
274
|
-
@param {Function|Number} [*value*]
|
|
275
|
-
@chainable
|
|
276
|
-
@example
|
|
277
|
-
function(d) {
|
|
278
|
-
return d.width;
|
|
279
|
-
}
|
|
280
|
-
*/ key: "width",
|
|
262
|
+
key: "width",
|
|
281
263
|
value: function width(_) {
|
|
282
264
|
return arguments.length ? (this._width = typeof _ === "function" ? _ : constant(_), this) : this._width;
|
|
283
265
|
}
|
|
284
266
|
},
|
|
285
267
|
{
|
|
286
|
-
|
|
287
|
-
@memberof Bar
|
|
288
|
-
@desc If *value* is specified, sets the x0 accessor to the specified function or number and returns the current class instance.
|
|
289
|
-
@param {Function|Number} [*value*]
|
|
290
|
-
@chainable
|
|
291
|
-
*/ key: "x0",
|
|
268
|
+
key: "x0",
|
|
292
269
|
value: function x0(_) {
|
|
293
270
|
if (!arguments.length) return this._x0;
|
|
294
271
|
this._x0 = typeof _ === "function" ? _ : constant(_);
|
|
@@ -297,23 +274,13 @@ function(d) {
|
|
|
297
274
|
}
|
|
298
275
|
},
|
|
299
276
|
{
|
|
300
|
-
|
|
301
|
-
@memberof Bar
|
|
302
|
-
@desc If *value* is specified, sets the x1 accessor to the specified function or number and returns the current class instance.
|
|
303
|
-
@param {Function|Number|null} [*value*]
|
|
304
|
-
@chainable
|
|
305
|
-
*/ key: "x1",
|
|
277
|
+
key: "x1",
|
|
306
278
|
value: function x1(_) {
|
|
307
|
-
return arguments.length ? (this._x1 = typeof _ === "function"
|
|
279
|
+
return arguments.length ? (this._x1 = typeof _ === "function" ? _ : _ === null ? null : constant(_), this) : this._x1;
|
|
308
280
|
}
|
|
309
281
|
},
|
|
310
282
|
{
|
|
311
|
-
|
|
312
|
-
@memberof Bar
|
|
313
|
-
@desc If *value* is specified, sets the y0 accessor to the specified function or number and returns the current class instance.
|
|
314
|
-
@param {Function|Number} [*value*]
|
|
315
|
-
@chainable
|
|
316
|
-
*/ key: "y0",
|
|
283
|
+
key: "y0",
|
|
317
284
|
value: function y0(_) {
|
|
318
285
|
if (!arguments.length) return this._y0;
|
|
319
286
|
this._y0 = typeof _ === "function" ? _ : constant(_);
|
|
@@ -322,21 +289,14 @@ function(d) {
|
|
|
322
289
|
}
|
|
323
290
|
},
|
|
324
291
|
{
|
|
325
|
-
|
|
326
|
-
@memberof Bar
|
|
327
|
-
@desc If *value* is specified, sets the y1 accessor to the specified function or number and returns the current class instance.
|
|
328
|
-
@param {Function|Number|null} [*value*]
|
|
329
|
-
@chainable
|
|
330
|
-
*/ key: "y1",
|
|
292
|
+
key: "y1",
|
|
331
293
|
value: function y1(_) {
|
|
332
|
-
return arguments.length ? (this._y1 = typeof _ === "function"
|
|
294
|
+
return arguments.length ? (this._y1 = typeof _ === "function" ? _ : _ === null ? null : constant(_), this) : this._y1;
|
|
333
295
|
}
|
|
334
296
|
}
|
|
335
297
|
]);
|
|
336
298
|
return Bar;
|
|
337
299
|
}(Shape);
|
|
338
300
|
/**
|
|
339
|
-
|
|
340
|
-
@extends Shape
|
|
341
|
-
@desc Creates SVG areas based on an array of data.
|
|
301
|
+
Creates SVG areas based on an array of data.
|
|
342
302
|
*/ export { Bar as default };
|