@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.
- package/README.md +6219 -0
- package/es/index.js +4 -0
- package/es/src/charts/AreaPlot.js +86 -0
- package/es/src/charts/BarChart.js +93 -0
- package/es/src/charts/BoxWhisker.js +97 -0
- package/es/src/charts/BumpChart.js +148 -0
- package/es/src/charts/Donut.js +84 -0
- package/es/src/charts/Geomap.js +833 -0
- package/es/src/charts/LinePlot.js +84 -0
- package/es/src/charts/Matrix.js +358 -0
- package/es/src/charts/Network.js +787 -0
- package/es/src/charts/Pack.js +318 -0
- package/es/src/charts/Pie.js +242 -0
- package/es/src/charts/Plot.js +2212 -0
- package/es/src/charts/Priestley.js +312 -0
- package/es/src/charts/Radar.js +365 -0
- package/es/src/charts/RadialMatrix.js +393 -0
- package/es/src/charts/Rings.js +777 -0
- package/es/src/charts/Sankey.js +413 -0
- package/es/src/charts/StackedArea.js +80 -0
- package/es/src/charts/Tree.js +312 -0
- package/es/src/charts/Treemap.js +406 -0
- package/es/src/charts/Viz.js +2017 -0
- package/es/src/charts/drawSteps/drawAttribution.js +14 -0
- package/es/src/charts/drawSteps/drawBack.js +23 -0
- package/es/src/charts/drawSteps/drawColorScale.js +69 -0
- package/es/src/charts/drawSteps/drawLegend.js +120 -0
- package/es/src/charts/drawSteps/drawSubtitle.js +31 -0
- package/es/src/charts/drawSteps/drawTimeline.js +80 -0
- package/es/src/charts/drawSteps/drawTitle.js +31 -0
- package/es/src/charts/drawSteps/drawTotal.js +32 -0
- package/es/src/charts/drawSteps/zoomControls.js +254 -0
- package/es/src/charts/events/click.legend.js +76 -0
- package/es/src/charts/events/click.shape.js +26 -0
- package/es/src/charts/events/mouseenter.js +31 -0
- package/es/src/charts/events/mouseleave.js +21 -0
- package/es/src/charts/events/mousemove.legend.js +64 -0
- package/es/src/charts/events/mousemove.shape.js +42 -0
- package/es/src/charts/events/touchstart.body.js +7 -0
- package/es/src/charts/helpers/matrixData.js +104 -0
- package/es/src/charts/helpers/tileAttributions.js +34 -0
- package/es/src/charts/index.js +21 -0
- package/es/src/charts/plotBuffers/Bar.js +65 -0
- package/es/src/charts/plotBuffers/Box.js +60 -0
- package/es/src/charts/plotBuffers/Circle.js +39 -0
- package/es/src/charts/plotBuffers/Line.js +30 -0
- package/es/src/charts/plotBuffers/Rect.js +40 -0
- package/es/src/charts/plotBuffers/discreteBuffer.js +24 -0
- package/es/src/charts/plotBuffers/numericBuffer.js +111 -0
- package/es/src/components/Axis.js +1567 -0
- package/es/src/components/AxisBottom.js +77 -0
- package/es/src/components/AxisLeft.js +77 -0
- package/es/src/components/AxisRight.js +77 -0
- package/es/src/components/AxisTop.js +77 -0
- package/es/src/components/ColorScale.js +958 -0
- package/es/src/components/Legend.js +673 -0
- package/es/src/components/Message.js +95 -0
- package/es/src/components/TextBox.js +752 -0
- package/es/src/components/Timeline.js +760 -0
- package/es/src/components/Tooltip.js +726 -0
- package/es/src/components/index.js +11 -0
- package/es/src/shapes/Area.js +361 -0
- package/es/src/shapes/Bar.js +342 -0
- package/es/src/shapes/Box.js +482 -0
- package/es/src/shapes/Circle.js +201 -0
- package/es/src/shapes/Image.js +255 -0
- package/es/src/shapes/Line.js +289 -0
- package/es/src/shapes/Path.js +186 -0
- package/es/src/shapes/Rect.js +215 -0
- package/es/src/shapes/Shape.js +1156 -0
- package/es/src/shapes/Whisker.js +330 -0
- package/es/src/shapes/index.js +10 -0
- package/es/src/utils/BaseClass.js +204 -0
- package/es/src/utils/RESET.js +4 -0
- package/es/src/utils/accessor.js +19 -0
- package/es/src/utils/configPrep.js +76 -0
- package/es/src/utils/constant.js +15 -0
- package/es/src/utils/getProp.js +9 -0
- package/es/src/utils/index.js +7 -0
- package/es/src/utils/uuid.js +13 -0
- package/package.json +68 -0
- package/umd/d3plus-core.full.js +56459 -0
- package/umd/d3plus-core.full.js.map +1 -0
- package/umd/d3plus-core.full.min.js +7241 -0
- package/umd/d3plus-core.js +14422 -0
- package/umd/d3plus-core.js.map +1 -0
- package/umd/d3plus-core.min.js +4564 -0
package/es/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AreaPlot, BarChart, BoxWhisker, BumpChart, Donut, Geomap, LinePlot, Matrix, Network, Pack, Pie, Plot, Priestley, Radar, RadialMatrix, Rings, Sankey, StackedArea, Tree, Treemap, Viz } from "./src/charts/index.js";
|
|
2
|
+
export { Axis, AxisBottom, AxisLeft, AxisRight, AxisTop, ColorScale, Legend, Message, TextBox, Timeline, Tooltip } from "./src/components/index.js";
|
|
3
|
+
export { Area, Bar, Box, Circle, Image, Line, Path, Rect, Shape, Whisker } from "./src/shapes/index.js";
|
|
4
|
+
export { accessor, BaseClass, configPrep, constant, RESET, uuid } from "./src/utils/index.js";
|
|
@@ -0,0 +1,86 @@
|
|
|
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 _get_prototype_of(o) {
|
|
17
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
18
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
19
|
+
};
|
|
20
|
+
return _get_prototype_of(o);
|
|
21
|
+
}
|
|
22
|
+
function _inherits(subClass, superClass) {
|
|
23
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
24
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
25
|
+
}
|
|
26
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
27
|
+
constructor: {
|
|
28
|
+
value: subClass,
|
|
29
|
+
writable: true,
|
|
30
|
+
configurable: true
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
34
|
+
}
|
|
35
|
+
function _possible_constructor_return(self, call) {
|
|
36
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
37
|
+
return call;
|
|
38
|
+
}
|
|
39
|
+
return _assert_this_initialized(self);
|
|
40
|
+
}
|
|
41
|
+
function _set_prototype_of(o, p) {
|
|
42
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
43
|
+
o.__proto__ = p;
|
|
44
|
+
return o;
|
|
45
|
+
};
|
|
46
|
+
return _set_prototype_of(o, p);
|
|
47
|
+
}
|
|
48
|
+
function _type_of(obj) {
|
|
49
|
+
"@swc/helpers - typeof";
|
|
50
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
51
|
+
}
|
|
52
|
+
function _is_native_reflect_construct() {
|
|
53
|
+
try {
|
|
54
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
55
|
+
} catch (_) {}
|
|
56
|
+
return (_is_native_reflect_construct = function() {
|
|
57
|
+
return !!result;
|
|
58
|
+
})();
|
|
59
|
+
}
|
|
60
|
+
import { constant } from "../utils/index.js";
|
|
61
|
+
import { default as Plot } from "./Plot.js";
|
|
62
|
+
var AreaPlot = /*#__PURE__*/ function(Plot) {
|
|
63
|
+
"use strict";
|
|
64
|
+
_inherits(AreaPlot, Plot);
|
|
65
|
+
function AreaPlot() {
|
|
66
|
+
_class_call_check(this, AreaPlot);
|
|
67
|
+
var _this;
|
|
68
|
+
_this = _call_super(this, AreaPlot);
|
|
69
|
+
_this._baseline = 0;
|
|
70
|
+
_this._discrete = "x";
|
|
71
|
+
_this._shape = constant("Area");
|
|
72
|
+
_this.x("x");
|
|
73
|
+
return _this;
|
|
74
|
+
}
|
|
75
|
+
return AreaPlot;
|
|
76
|
+
}(Plot);
|
|
77
|
+
/**
|
|
78
|
+
@class AreaPlot
|
|
79
|
+
@extends Plot
|
|
80
|
+
@desc Creates an area plot based on an array of data.
|
|
81
|
+
@example <caption>the equivalent of calling:</caption>
|
|
82
|
+
new d3plus.Plot()
|
|
83
|
+
.baseline(0)
|
|
84
|
+
.discrete("x")
|
|
85
|
+
.shape("Area")
|
|
86
|
+
*/ export { AreaPlot as default };
|
|
@@ -0,0 +1,93 @@
|
|
|
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 _get_prototype_of(o) {
|
|
17
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
18
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
19
|
+
};
|
|
20
|
+
return _get_prototype_of(o);
|
|
21
|
+
}
|
|
22
|
+
function _inherits(subClass, superClass) {
|
|
23
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
24
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
25
|
+
}
|
|
26
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
27
|
+
constructor: {
|
|
28
|
+
value: subClass,
|
|
29
|
+
writable: true,
|
|
30
|
+
configurable: true
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
34
|
+
}
|
|
35
|
+
function _possible_constructor_return(self, call) {
|
|
36
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
37
|
+
return call;
|
|
38
|
+
}
|
|
39
|
+
return _assert_this_initialized(self);
|
|
40
|
+
}
|
|
41
|
+
function _set_prototype_of(o, p) {
|
|
42
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
43
|
+
o.__proto__ = p;
|
|
44
|
+
return o;
|
|
45
|
+
};
|
|
46
|
+
return _set_prototype_of(o, p);
|
|
47
|
+
}
|
|
48
|
+
function _type_of(obj) {
|
|
49
|
+
"@swc/helpers - typeof";
|
|
50
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
51
|
+
}
|
|
52
|
+
function _is_native_reflect_construct() {
|
|
53
|
+
try {
|
|
54
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
55
|
+
} catch (_) {}
|
|
56
|
+
return (_is_native_reflect_construct = function() {
|
|
57
|
+
return !!result;
|
|
58
|
+
})();
|
|
59
|
+
}
|
|
60
|
+
import { constant } from "../utils/index.js";
|
|
61
|
+
import { default as Plot } from "./Plot.js";
|
|
62
|
+
var BarChart = /*#__PURE__*/ function(Plot) {
|
|
63
|
+
"use strict";
|
|
64
|
+
_inherits(BarChart, Plot);
|
|
65
|
+
function BarChart() {
|
|
66
|
+
_class_call_check(this, BarChart);
|
|
67
|
+
var _this;
|
|
68
|
+
_this = _call_super(this, BarChart);
|
|
69
|
+
_this._baseline = 0;
|
|
70
|
+
_this._discrete = "x";
|
|
71
|
+
var defaultLegend = _this._legend;
|
|
72
|
+
_this._legend = function(config, arr) {
|
|
73
|
+
var legendIds = arr.map(_this._groupBy[_this._legendDepth].bind(_this)).sort().join();
|
|
74
|
+
var barIds = _this._filteredData.map(_this._groupBy[_this._legendDepth].bind(_this)).sort().join();
|
|
75
|
+
if (legendIds === barIds) return false;
|
|
76
|
+
return defaultLegend.bind(_this)(config, arr);
|
|
77
|
+
};
|
|
78
|
+
_this._shape = constant("Bar");
|
|
79
|
+
_this.x("x");
|
|
80
|
+
return _this;
|
|
81
|
+
}
|
|
82
|
+
return BarChart;
|
|
83
|
+
}(Plot);
|
|
84
|
+
/**
|
|
85
|
+
@class BarChart
|
|
86
|
+
@extends Plot
|
|
87
|
+
@desc Creates a bar chart based on an array of data.
|
|
88
|
+
@example <caption>the equivalent of calling:</caption>
|
|
89
|
+
new d3plus.Plot()
|
|
90
|
+
.baseline(0)
|
|
91
|
+
.discrete("x")
|
|
92
|
+
.shape("Bar")
|
|
93
|
+
*/ export { BarChart as default };
|
|
@@ -0,0 +1,97 @@
|
|
|
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 _get_prototype_of(o) {
|
|
17
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
18
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
19
|
+
};
|
|
20
|
+
return _get_prototype_of(o);
|
|
21
|
+
}
|
|
22
|
+
function _inherits(subClass, superClass) {
|
|
23
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
24
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
25
|
+
}
|
|
26
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
27
|
+
constructor: {
|
|
28
|
+
value: subClass,
|
|
29
|
+
writable: true,
|
|
30
|
+
configurable: true
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
34
|
+
}
|
|
35
|
+
function _possible_constructor_return(self, call) {
|
|
36
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
37
|
+
return call;
|
|
38
|
+
}
|
|
39
|
+
return _assert_this_initialized(self);
|
|
40
|
+
}
|
|
41
|
+
function _set_prototype_of(o, p) {
|
|
42
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
43
|
+
o.__proto__ = p;
|
|
44
|
+
return o;
|
|
45
|
+
};
|
|
46
|
+
return _set_prototype_of(o, p);
|
|
47
|
+
}
|
|
48
|
+
function _type_of(obj) {
|
|
49
|
+
"@swc/helpers - typeof";
|
|
50
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
51
|
+
}
|
|
52
|
+
function _is_native_reflect_construct() {
|
|
53
|
+
try {
|
|
54
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
55
|
+
} catch (_) {}
|
|
56
|
+
return (_is_native_reflect_construct = function() {
|
|
57
|
+
return !!result;
|
|
58
|
+
})();
|
|
59
|
+
}
|
|
60
|
+
import { assign } from "@d3plus/dom";
|
|
61
|
+
import { constant } from "../utils/index.js";
|
|
62
|
+
import { default as Plot } from "./Plot.js";
|
|
63
|
+
var BoxWhisker = /*#__PURE__*/ function(Plot) {
|
|
64
|
+
"use strict";
|
|
65
|
+
_inherits(BoxWhisker, Plot);
|
|
66
|
+
function BoxWhisker() {
|
|
67
|
+
_class_call_check(this, BoxWhisker);
|
|
68
|
+
var _this;
|
|
69
|
+
_this = _call_super(this, BoxWhisker);
|
|
70
|
+
_this._discrete = "x";
|
|
71
|
+
_this._shape = constant("Box");
|
|
72
|
+
_this.x("x");
|
|
73
|
+
_this._tooltipConfig = assign(_this._tooltipConfig, {
|
|
74
|
+
title: function(d, i) {
|
|
75
|
+
if (!d) return "";
|
|
76
|
+
while(d.__d3plus__ && d.data){
|
|
77
|
+
d = d.data;
|
|
78
|
+
i = d.i;
|
|
79
|
+
}
|
|
80
|
+
if (_this._label) return _this._label(d, i);
|
|
81
|
+
var l = _this._ids(d, i).slice(0, _this._drawDepth);
|
|
82
|
+
return l[l.length - 1];
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
return _this;
|
|
86
|
+
}
|
|
87
|
+
return BoxWhisker;
|
|
88
|
+
}(Plot);
|
|
89
|
+
/**
|
|
90
|
+
@class BoxWhisker
|
|
91
|
+
@extends Plot
|
|
92
|
+
@desc Creates a simple box and whisker based on an array of data.
|
|
93
|
+
@example <caption>the equivalent of calling:</caption>
|
|
94
|
+
new d3plus.Plot()
|
|
95
|
+
.discrete("x")
|
|
96
|
+
.shape("Box")
|
|
97
|
+
*/ export { BoxWhisker as default };
|
|
@@ -0,0 +1,148 @@
|
|
|
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 _get_prototype_of(o) {
|
|
17
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
18
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
19
|
+
};
|
|
20
|
+
return _get_prototype_of(o);
|
|
21
|
+
}
|
|
22
|
+
function _inherits(subClass, superClass) {
|
|
23
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
24
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
25
|
+
}
|
|
26
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
27
|
+
constructor: {
|
|
28
|
+
value: subClass,
|
|
29
|
+
writable: true,
|
|
30
|
+
configurable: true
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
34
|
+
}
|
|
35
|
+
function _instanceof(left, right) {
|
|
36
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
37
|
+
return !!right[Symbol.hasInstance](left);
|
|
38
|
+
} else {
|
|
39
|
+
return left instanceof right;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function _possible_constructor_return(self, call) {
|
|
43
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
44
|
+
return call;
|
|
45
|
+
}
|
|
46
|
+
return _assert_this_initialized(self);
|
|
47
|
+
}
|
|
48
|
+
function _set_prototype_of(o, p) {
|
|
49
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
50
|
+
o.__proto__ = p;
|
|
51
|
+
return o;
|
|
52
|
+
};
|
|
53
|
+
return _set_prototype_of(o, p);
|
|
54
|
+
}
|
|
55
|
+
function _type_of(obj) {
|
|
56
|
+
"@swc/helpers - typeof";
|
|
57
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
58
|
+
}
|
|
59
|
+
function _is_native_reflect_construct() {
|
|
60
|
+
try {
|
|
61
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
62
|
+
} catch (_) {}
|
|
63
|
+
return (_is_native_reflect_construct = function() {
|
|
64
|
+
return !!result;
|
|
65
|
+
})();
|
|
66
|
+
}
|
|
67
|
+
import { constant } from "../utils/index.js";
|
|
68
|
+
import { default as Plot } from "./Plot.js";
|
|
69
|
+
var BumpChart = /*#__PURE__*/ function(Plot) {
|
|
70
|
+
"use strict";
|
|
71
|
+
_inherits(BumpChart, Plot);
|
|
72
|
+
function BumpChart() {
|
|
73
|
+
_class_call_check(this, BumpChart);
|
|
74
|
+
var _this;
|
|
75
|
+
_this = _call_super(this, BumpChart);
|
|
76
|
+
_this._discrete = "x";
|
|
77
|
+
_this._shape = constant("Line");
|
|
78
|
+
_this.x("x");
|
|
79
|
+
_this.y2(function(d) {
|
|
80
|
+
return _this._y(d);
|
|
81
|
+
});
|
|
82
|
+
_this.yConfig({
|
|
83
|
+
tickFormat: function(val) {
|
|
84
|
+
var data = _this._formattedData;
|
|
85
|
+
var xMin = _instanceof(data[0].x, Date) ? data[0].x.getTime() : data[0].x;
|
|
86
|
+
var startData = data.filter(function(d) {
|
|
87
|
+
return (_instanceof(d.x, Date) ? d.x.getTime() : d.x) === xMin;
|
|
88
|
+
});
|
|
89
|
+
var d = startData.find(function(d) {
|
|
90
|
+
return d.y === val;
|
|
91
|
+
});
|
|
92
|
+
return d ? _this._drawLabel(d, d.i) : "";
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
_this.y2Config({
|
|
96
|
+
tickFormat: function(val) {
|
|
97
|
+
var data = _this._formattedData;
|
|
98
|
+
var xMax = _instanceof(data[data.length - 1].x, Date) ? data[data.length - 1].x.getTime() : data[data.length - 1].x;
|
|
99
|
+
var endData = data.filter(function(d) {
|
|
100
|
+
return (_instanceof(d.x, Date) ? d.x.getTime() : d.x) === xMax;
|
|
101
|
+
});
|
|
102
|
+
var d = endData.find(function(d) {
|
|
103
|
+
return d.y === val;
|
|
104
|
+
});
|
|
105
|
+
return d ? _this._drawLabel(d, d.i) : "";
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
_this.ySort(function(a, b) {
|
|
109
|
+
return _this._y(b) - _this._y(a);
|
|
110
|
+
});
|
|
111
|
+
_this.y2Sort(function(a, b) {
|
|
112
|
+
return _this._y(b) - _this._y(a);
|
|
113
|
+
});
|
|
114
|
+
return _this;
|
|
115
|
+
}
|
|
116
|
+
return BumpChart;
|
|
117
|
+
}(Plot);
|
|
118
|
+
/**
|
|
119
|
+
@class BumpChart
|
|
120
|
+
@extends Plot
|
|
121
|
+
@desc Creates a bump chart based on an array of data.
|
|
122
|
+
@example <caption>the equivalent of calling:</caption>
|
|
123
|
+
new d3plus.Plot()
|
|
124
|
+
.discrete("x")
|
|
125
|
+
.shape("Line")
|
|
126
|
+
.x("x")
|
|
127
|
+
.y2(d => this._y(d))
|
|
128
|
+
.yConfig({
|
|
129
|
+
tickFormat: val => {
|
|
130
|
+
const data = this._formattedData;
|
|
131
|
+
const xDomain = this._xDomain;
|
|
132
|
+
const startData = data.filter(d => d.x === xDomain[0]);
|
|
133
|
+
const d = startData.find(d => d.y === val);
|
|
134
|
+
return this._drawLabel(d, d.i);
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
.y2Config({
|
|
138
|
+
tickFormat: val => {
|
|
139
|
+
const data = this._formattedData;
|
|
140
|
+
const xDomain = this._xDomain;
|
|
141
|
+
const endData = data.filter(d => d.x === xDomain[xDomain.length - 1]);
|
|
142
|
+
const d = endData.find(d => d.y === val);
|
|
143
|
+
return this._drawLabel(d, d.i);
|
|
144
|
+
}
|
|
145
|
+
})
|
|
146
|
+
.ySort((a, b) => b.y - a.y)
|
|
147
|
+
.y2Sort((a, b) => b.y - a.y)
|
|
148
|
+
*/ export { BumpChart as default };
|
|
@@ -0,0 +1,84 @@
|
|
|
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 _get_prototype_of(o) {
|
|
17
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
18
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
19
|
+
};
|
|
20
|
+
return _get_prototype_of(o);
|
|
21
|
+
}
|
|
22
|
+
function _inherits(subClass, superClass) {
|
|
23
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
24
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
25
|
+
}
|
|
26
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
27
|
+
constructor: {
|
|
28
|
+
value: subClass,
|
|
29
|
+
writable: true,
|
|
30
|
+
configurable: true
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
34
|
+
}
|
|
35
|
+
function _possible_constructor_return(self, call) {
|
|
36
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
37
|
+
return call;
|
|
38
|
+
}
|
|
39
|
+
return _assert_this_initialized(self);
|
|
40
|
+
}
|
|
41
|
+
function _set_prototype_of(o, p) {
|
|
42
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
43
|
+
o.__proto__ = p;
|
|
44
|
+
return o;
|
|
45
|
+
};
|
|
46
|
+
return _set_prototype_of(o, p);
|
|
47
|
+
}
|
|
48
|
+
function _type_of(obj) {
|
|
49
|
+
"@swc/helpers - typeof";
|
|
50
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
51
|
+
}
|
|
52
|
+
function _is_native_reflect_construct() {
|
|
53
|
+
try {
|
|
54
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
55
|
+
} catch (_) {}
|
|
56
|
+
return (_is_native_reflect_construct = function() {
|
|
57
|
+
return !!result;
|
|
58
|
+
})();
|
|
59
|
+
}
|
|
60
|
+
import { min } from "d3-array";
|
|
61
|
+
import { default as Pie } from "./Pie.js";
|
|
62
|
+
var Donut = /*#__PURE__*/ function(Pie) {
|
|
63
|
+
"use strict";
|
|
64
|
+
_inherits(Donut, Pie);
|
|
65
|
+
function Donut() {
|
|
66
|
+
_class_call_check(this, Donut);
|
|
67
|
+
var _this;
|
|
68
|
+
_this = _call_super(this, Donut);
|
|
69
|
+
_this._innerRadius = function() {
|
|
70
|
+
return min([
|
|
71
|
+
_this._width - _this._margin.left - _this._margin.right,
|
|
72
|
+
_this._height - _this._margin.top - _this._margin.bottom
|
|
73
|
+
]) / 4;
|
|
74
|
+
};
|
|
75
|
+
_this._padPixel = 2;
|
|
76
|
+
return _this;
|
|
77
|
+
}
|
|
78
|
+
return Donut;
|
|
79
|
+
}(Pie);
|
|
80
|
+
/**
|
|
81
|
+
@class Donut
|
|
82
|
+
@extends Pie
|
|
83
|
+
@desc Extends the Pie visualization to create a donut chart.
|
|
84
|
+
*/ export { Donut as default };
|