@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
|
@@ -2,7 +2,7 @@ import { select } from "d3-selection";
|
|
|
2
2
|
import { stylize } from "@d3plus/dom";
|
|
3
3
|
/**
|
|
4
4
|
@name _drawAttribution
|
|
5
|
-
|
|
5
|
+
Draws absolute positioned attribution text.
|
|
6
6
|
@private
|
|
7
7
|
*/ export default function() {
|
|
8
8
|
var attr = select(this._select.node().parentNode).selectAll("div.d3plus-attribution").data(this._attribution ? [
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { elem } from "@d3plus/dom";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
@desc Draws a back button if there are states in this._history.
|
|
3
|
+
Draws a back button if there are states in this._history.
|
|
5
4
|
@private
|
|
6
5
|
*/ export default function() {
|
|
7
6
|
var visible = this._history.length;
|
|
@@ -2,8 +2,7 @@ import { min, rollup } from "d3-array";
|
|
|
2
2
|
import { merge } from "@d3plus/data";
|
|
3
3
|
import { elem } from "@d3plus/dom";
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
@desc Renders the color scale if this._colorScale is not falsey.
|
|
5
|
+
Renders the color scale if this._colorScale is not falsey.
|
|
7
6
|
@private
|
|
8
7
|
*/ export default function() {
|
|
9
8
|
var _this = this;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
function _instanceof(left, right) {
|
|
2
|
+
"@swc/helpers - instanceof";
|
|
2
3
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3
4
|
return !!right[Symbol.hasInstance](left);
|
|
4
5
|
} else {
|
|
@@ -15,16 +16,13 @@ var legendAttrs = [
|
|
|
15
16
|
"texture"
|
|
16
17
|
];
|
|
17
18
|
/**
|
|
18
|
-
|
|
19
|
-
@desc Default label function for the legend.
|
|
19
|
+
Default label function for the legend.
|
|
20
20
|
@private
|
|
21
21
|
*/ export function legendLabel(d, i) {
|
|
22
22
|
return this._drawLabel(d, i, this._legendDepth);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
|
|
26
|
-
@desc Renders the legend if this._legend is not falsy.
|
|
27
|
-
@param {Array} data The filtered data array to be displayed.
|
|
25
|
+
Renders the legend if this._legend is not falsy.
|
|
28
26
|
@private
|
|
29
27
|
*/ export default function() {
|
|
30
28
|
var _this, _loop = function(x) {
|
|
@@ -41,13 +39,13 @@ var legendAttrs = [
|
|
|
41
39
|
var _this1 = this;
|
|
42
40
|
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
43
41
|
var legendData = [];
|
|
44
|
-
var getAttr = function(d, i, attr) {
|
|
42
|
+
var getAttr = function getAttr(d, i, attr) {
|
|
45
43
|
var shape = _this1._shape(d, i);
|
|
46
44
|
if (attr === "fill" && shape === "Line") attr = "stroke";
|
|
47
45
|
var value = _this1._shapeConfig[shape] && _this1._shapeConfig[shape][attr] ? _this1._shapeConfig[shape][attr] : _this1._shapeConfig[attr];
|
|
48
46
|
return typeof value === "function" ? value.bind(_this1)(d, i) : value;
|
|
49
47
|
};
|
|
50
|
-
var fill = function(d, i) {
|
|
48
|
+
var fill = function fill(d, i) {
|
|
51
49
|
return legendAttrs.map(function(a) {
|
|
52
50
|
return getAttr(d, i, a);
|
|
53
51
|
}).join("_");
|
|
@@ -67,7 +65,7 @@ var legendAttrs = [
|
|
|
67
65
|
var _ret = (_this = this, _loop(x));
|
|
68
66
|
if (_ret === "break") break;
|
|
69
67
|
}
|
|
70
|
-
var hidden = function(d, i) {
|
|
68
|
+
var hidden = function hidden(d, i) {
|
|
71
69
|
var id = _this1._id(d, i);
|
|
72
70
|
if (_instanceof(id, Array)) id = id[0];
|
|
73
71
|
return _this1._hidden.includes(id) || _this1._solo.length && !_this1._solo.includes(id);
|
|
@@ -106,11 +104,11 @@ var legendAttrs = [
|
|
|
106
104
|
this._legendClass.id(fill).align(wide ? "center" : position).direction(wide ? "row" : "column").duration(this._duration).data(visible ? legendData : []).height(wide ? this._height - (this._margin.bottom + this._margin.top) : this._height - (this._margin.bottom + this._margin.top + padding.bottom + padding.top)).locale(this._locale).parent(this).select(legendGroup).shape(function(d, i) {
|
|
107
105
|
return _this1._shape(d, i) === "Circle" ? "Circle" : "Rect";
|
|
108
106
|
}).verticalAlign(!wide ? "middle" : position).width(wide ? this._width - (this._margin.left + this._margin.right + padding.left + padding.right) : this._width - (this._margin.left + this._margin.right)).shapeConfig(configPrep.bind(this)(this._shapeConfig, "legend")).shapeConfig({
|
|
109
|
-
fill: function(d, i) {
|
|
107
|
+
fill: function fill(d, i) {
|
|
110
108
|
return hidden(d, i) ? _this1._hiddenColor(d, i) : getAttr(d, i, "fill");
|
|
111
109
|
},
|
|
112
110
|
labelConfig: {
|
|
113
|
-
fontOpacity: function(d, i) {
|
|
111
|
+
fontOpacity: function fontOpacity(d, i) {
|
|
114
112
|
return hidden(d, i) ? _this1._hiddenOpacity(d, i) : 1;
|
|
115
113
|
}
|
|
116
114
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { elem } from "@d3plus/dom";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
@desc Draws a subtitle if this._subtitle is defined.
|
|
5
|
-
@param {Array} [*data*] The currently filtered dataset.
|
|
3
|
+
Draws a subtitle if this._subtitle is defined.
|
|
6
4
|
@private
|
|
7
5
|
*/ export default function() {
|
|
8
6
|
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
function _instanceof(left, right) {
|
|
2
|
+
"@swc/helpers - instanceof";
|
|
2
3
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3
4
|
return !!right[Symbol.hasInstance](left);
|
|
4
5
|
} else {
|
|
@@ -9,9 +10,8 @@ import { extent } from "d3-array";
|
|
|
9
10
|
import { unique } from "@d3plus/data";
|
|
10
11
|
import { date, elem } from "@d3plus/dom";
|
|
11
12
|
/**
|
|
12
|
-
|
|
13
|
-
@
|
|
14
|
-
@param {Array|Date} The timeline selection given from the d3 brush.
|
|
13
|
+
Determines whether or not to update the timeFilter method of the Viz.
|
|
14
|
+
@param The timeline selection given from the d3 brush.
|
|
15
15
|
@private
|
|
16
16
|
*/ function setTimeFilter(s) {
|
|
17
17
|
var _this = this;
|
|
@@ -22,22 +22,23 @@ import { date, elem } from "@d3plus/dom";
|
|
|
22
22
|
if (JSON.stringify(s) !== JSON.stringify(this._timelineSelection)) {
|
|
23
23
|
this._timelineSelection = s;
|
|
24
24
|
s = s.map(Number);
|
|
25
|
+
var sNums = s;
|
|
25
26
|
this.timeFilter(function(d) {
|
|
26
27
|
var ms = date(_this._time(d)).getTime();
|
|
27
|
-
return ms >=
|
|
28
|
+
return ms >= sNums[0] && ms <= sNums[1];
|
|
28
29
|
}).render();
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
|
-
|
|
33
|
-
@desc Renders the timeline if this._time and this._timeline are not falsy and there are more than 1 tick available.
|
|
34
|
-
@param {Array} data The filtered data array to be displayed.
|
|
33
|
+
Renders the timeline if this._time and this._timeline are not falsy and there are more than 1 tick available.
|
|
35
34
|
@private
|
|
36
35
|
*/ export default function() {
|
|
37
36
|
var _this = this;
|
|
38
37
|
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
39
38
|
var timelinePossible = this._time && this._timeline;
|
|
40
|
-
var ticks = timelinePossible ? unique(this._data.map(this._time)).map(
|
|
39
|
+
var ticks = timelinePossible ? unique(this._data.map(this._time)).map(function(d) {
|
|
40
|
+
return date(d);
|
|
41
|
+
}) : [];
|
|
41
42
|
timelinePossible = timelinePossible && ticks.length > 1;
|
|
42
43
|
var padding = this._timelinePadding() ? this._padding : {
|
|
43
44
|
top: 0,
|
|
@@ -59,7 +60,9 @@ import { date, elem } from "@d3plus/dom";
|
|
|
59
60
|
var timeline = this._timelineClass.domain(extent(ticks)).duration(this._duration).height(this._height - this._margin.bottom).locale(this._locale).select(timelineGroup).ticks(ticks.sort(function(a, b) {
|
|
60
61
|
return +a - +b;
|
|
61
62
|
})).width(this._width - (this._margin.left + this._margin.right + padding.left + padding.right));
|
|
62
|
-
var dataExtent = extent(data.map(this._time).map(
|
|
63
|
+
var dataExtent = extent(data.map(this._time).map(function(d) {
|
|
64
|
+
return date(d);
|
|
65
|
+
}));
|
|
63
66
|
if (!this._timelineSelection) {
|
|
64
67
|
this._timelineSelection = this._timelineDefault || dataExtent;
|
|
65
68
|
} else {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { elem } from "@d3plus/dom";
|
|
2
2
|
/**
|
|
3
|
-
|
|
4
|
-
@desc Draws a title if this._title is defined.
|
|
5
|
-
@param {Array} [*data*] The currently filtered dataset.
|
|
3
|
+
Draws a title if this._title is defined.
|
|
6
4
|
@private
|
|
7
5
|
*/ export default function() {
|
|
8
6
|
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { sum } from "d3-array";
|
|
2
2
|
import { elem } from "@d3plus/dom";
|
|
3
3
|
/**
|
|
4
|
-
|
|
5
|
-
@desc Draws a total title if this._total is defined.
|
|
6
|
-
@param {Array} [*data*] The currently filtered dataset.
|
|
4
|
+
Draws a total title if this._total is defined.
|
|
7
5
|
@private
|
|
8
6
|
*/ export default function() {
|
|
9
7
|
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [];
|
|
@@ -50,7 +50,7 @@ import { attrize, stylize } from "@d3plus/dom";
|
|
|
50
50
|
var brushing = false;
|
|
51
51
|
/**
|
|
52
52
|
@name zoomControls
|
|
53
|
-
|
|
53
|
+
Sets up initial zoom events and controls.
|
|
54
54
|
@private
|
|
55
55
|
*/ export default function() {
|
|
56
56
|
var _this = this;
|
|
@@ -94,14 +94,15 @@ var brushing = false;
|
|
|
94
94
|
controlEnter.append("div").attr("class", "zoom-control zoom-reset");
|
|
95
95
|
control.select(".zoom-reset").on("click", zoomMath.bind(this, 0)).html("↺");
|
|
96
96
|
controlEnter.append("div").attr("class", "zoom-control zoom-brush");
|
|
97
|
-
control.select(".zoom-brush").on("click", function() {
|
|
98
|
-
select(
|
|
97
|
+
control.select(".zoom-brush").on("click", function(_event) {
|
|
98
|
+
select(_event.currentTarget).classed("active", !brushing).call(stylize, brushing ? that._zoomControlStyle || {} : that._zoomControlStyleActive || {});
|
|
99
99
|
zoomEvents.bind(that)(!brushing);
|
|
100
100
|
}).html("¤");
|
|
101
|
-
control.selectAll(".zoom-control").call(stylize, that._zoomControlStyle).on("mouseenter", function() {
|
|
102
|
-
select(
|
|
103
|
-
}).on("mouseleave", function() {
|
|
104
|
-
|
|
101
|
+
control.selectAll(".zoom-control").call(stylize, that._zoomControlStyle).on("mouseenter", function(_event) {
|
|
102
|
+
select(_event.currentTarget).call(stylize, that._zoomControlStyleHover || {});
|
|
103
|
+
}).on("mouseleave", function(_event) {
|
|
104
|
+
var el = select(_event.currentTarget);
|
|
105
|
+
el.call(stylize, el.classed("active") ? that._zoomControlStyleActive || {} : that._zoomControlStyle || {});
|
|
105
106
|
});
|
|
106
107
|
this._zoomBrush.extent([
|
|
107
108
|
[
|
|
@@ -124,7 +125,7 @@ var brushing = false;
|
|
|
124
125
|
}
|
|
125
126
|
/**
|
|
126
127
|
@name zoomEvents
|
|
127
|
-
|
|
128
|
+
Handles adding/removing zoom event listeners.
|
|
128
129
|
@private
|
|
129
130
|
*/ function zoomEvents() {
|
|
130
131
|
var brush = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
@@ -145,9 +146,8 @@ var brushing = false;
|
|
|
145
146
|
}
|
|
146
147
|
/**
|
|
147
148
|
@name zoomed
|
|
148
|
-
|
|
149
|
-
@param
|
|
150
|
-
@param {Number} [*duration* = 0]
|
|
149
|
+
Handles events dispatched from this._zoomBehavior
|
|
150
|
+
@param transform
|
|
151
151
|
@private
|
|
152
152
|
*/ function zoomed() {
|
|
153
153
|
var transform = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false, duration = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
|
|
@@ -159,9 +159,8 @@ var brushing = false;
|
|
|
159
159
|
}
|
|
160
160
|
/**
|
|
161
161
|
@name zoomMath
|
|
162
|
-
|
|
163
|
-
@param
|
|
164
|
-
@private
|
|
162
|
+
Zooms in or out based on the provided multiplier.
|
|
163
|
+
@param factor @private
|
|
165
164
|
*/ function zoomMath() {
|
|
166
165
|
var factor = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
167
166
|
if (!this._container) return;
|
|
@@ -191,9 +190,8 @@ var brushing = false;
|
|
|
191
190
|
}
|
|
192
191
|
/**
|
|
193
192
|
@name zoomToBounds
|
|
194
|
-
|
|
195
|
-
@param
|
|
196
|
-
@param {Number} [*duration* = 0]
|
|
193
|
+
Zooms to given bounds.
|
|
194
|
+
@param bounds
|
|
197
195
|
@private
|
|
198
196
|
*/ function zoomToBounds(bounds) {
|
|
199
197
|
var duration = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this._duration;
|
|
@@ -226,13 +224,13 @@ var brushing = false;
|
|
|
226
224
|
zoomed.bind(this)(t, duration);
|
|
227
225
|
}
|
|
228
226
|
/**
|
|
229
|
-
|
|
227
|
+
Triggered on brush "brush".
|
|
230
228
|
@private
|
|
231
229
|
*/ function brushBrush() {
|
|
232
230
|
brushStyle.bind(this)();
|
|
233
231
|
}
|
|
234
232
|
/**
|
|
235
|
-
|
|
233
|
+
Triggered on brush "end".
|
|
236
234
|
@private
|
|
237
235
|
*/ function brushEnd(event) {
|
|
238
236
|
if (!event.selection) return; // Only transition after input.
|
|
@@ -240,13 +238,13 @@ var brushing = false;
|
|
|
240
238
|
zoomToBounds.bind(this)(event.selection);
|
|
241
239
|
}
|
|
242
240
|
/**
|
|
243
|
-
|
|
241
|
+
Triggered on brush "start".
|
|
244
242
|
@private
|
|
245
243
|
*/ function brushStart() {
|
|
246
244
|
brushStyle.bind(this)();
|
|
247
245
|
}
|
|
248
246
|
/**
|
|
249
|
-
|
|
247
|
+
Overrides the default brush styles.
|
|
250
248
|
@private
|
|
251
249
|
*/ function brushStyle() {
|
|
252
250
|
this._brushGroup.selectAll(".selection").call(attrize, this._zoomBrushSelectionStyle || {});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
function _instanceof(left, right) {
|
|
2
|
+
"@swc/helpers - instanceof";
|
|
2
3
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3
4
|
return !!right[Symbol.hasInstance](left);
|
|
4
5
|
} else {
|
|
@@ -8,9 +9,7 @@ function _instanceof(left, right) {
|
|
|
8
9
|
import { merge } from "d3-array";
|
|
9
10
|
/**
|
|
10
11
|
@module clickLegend
|
|
11
|
-
|
|
12
|
-
@param {Object} *d* The data object being interacted with.
|
|
13
|
-
@param {Number} *i* The index of the data object being interacted with.
|
|
12
|
+
On click event for all legend shapes in a Viz.
|
|
14
13
|
@private
|
|
15
14
|
*/ export default function(d, i, x, event) {
|
|
16
15
|
var _this = this;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@module clickShape
|
|
3
|
-
|
|
4
|
-
@param {Object} *d* The data object being interacted with.
|
|
5
|
-
@param {Number} *i* The index of the data object being interacted with.
|
|
3
|
+
On click event for all shapes in a Viz.
|
|
6
4
|
@private
|
|
7
5
|
*/ export default function(d, i, x, event) {
|
|
8
6
|
event.stopPropagation();
|
|
@@ -18,7 +16,7 @@
|
|
|
18
16
|
});
|
|
19
17
|
this.config({
|
|
20
18
|
depth: this._drawDepth + 1,
|
|
21
|
-
filter: function(f, x) {
|
|
19
|
+
filter: function filter(f, x) {
|
|
22
20
|
return (!oldFilter || oldFilter(f, x)) && filterGroup(f, x) === filterId;
|
|
23
21
|
}
|
|
24
22
|
}).render();
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
@
|
|
3
|
-
@desc On mouseenter event for all shapes in a Viz.
|
|
4
|
-
@param {Object} *d* The data object being interacted with.
|
|
5
|
-
@param {Number} *i* The index of the data object being interacted with.
|
|
6
|
-
@private
|
|
7
|
-
*/ function _instanceof(left, right) {
|
|
1
|
+
function _instanceof(left, right) {
|
|
2
|
+
"@swc/helpers - instanceof";
|
|
8
3
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
9
4
|
return !!right[Symbol.hasInstance](left);
|
|
10
5
|
} else {
|
|
11
6
|
return left instanceof right;
|
|
12
7
|
}
|
|
13
8
|
}
|
|
14
|
-
|
|
9
|
+
/**
|
|
10
|
+
@module mouseEnter
|
|
11
|
+
On mouseenter event for all shapes in a Viz.
|
|
12
|
+
@private
|
|
13
|
+
*/ export default function(d, i) {
|
|
15
14
|
var _this = this;
|
|
16
15
|
if (this._shapeConfig.hoverOpacity !== 1) {
|
|
17
16
|
var filterIds = this._id(d, i);
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
@module mouseLeave
|
|
3
|
-
|
|
4
|
-
@param {Object} *d* The data object being interacted with.
|
|
5
|
-
@param {Number} *i* The index of the data object being interacted with.
|
|
3
|
+
On mouseleave event for all shapes in a Viz.
|
|
6
4
|
@private
|
|
7
5
|
*/ export default function(d, i) {
|
|
8
6
|
var _this = this;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
function _instanceof(left, right) {
|
|
2
|
+
"@swc/helpers - instanceof";
|
|
2
3
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
3
4
|
return !!right[Symbol.hasInstance](left);
|
|
4
5
|
} else {
|
|
@@ -11,10 +12,8 @@ import { legendLabel } from "../drawSteps/drawLegend.js";
|
|
|
11
12
|
import { configPrep } from "../../utils/index.js";
|
|
12
13
|
/**
|
|
13
14
|
@module mouseMoveLegend
|
|
14
|
-
|
|
15
|
-
@param
|
|
16
|
-
@param {Number} *i* The index of the data object being interacted with.
|
|
17
|
-
@param {Object} [*config*] Optional configuration methods for the Tooltip class.
|
|
15
|
+
Tooltip logic for a specified data point.
|
|
16
|
+
@param config Optional configuration methods for the Tooltip class.
|
|
18
17
|
@private
|
|
19
18
|
*/ export default function(d, i, x, event) {
|
|
20
19
|
var _this = this;
|
|
@@ -2,10 +2,8 @@ import { configPrep } from "../../utils/index.js";
|
|
|
2
2
|
import clickShape from "./click.shape.js";
|
|
3
3
|
/**
|
|
4
4
|
@module mouseMoveShape
|
|
5
|
-
|
|
6
|
-
@param
|
|
7
|
-
@param {Number} *i* The index of the data object being interacted with.
|
|
8
|
-
@param {Object} [*config*] Optional configuration methods for the Tooltip class.
|
|
5
|
+
Tooltip logic for a specified data point.
|
|
6
|
+
@param config Optional configuration methods for the Tooltip class.
|
|
9
7
|
@private
|
|
10
8
|
*/ export default function(d, i, x, event) {
|
|
11
9
|
var _this = this;
|
|
@@ -58,22 +58,29 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
58
58
|
}
|
|
59
59
|
var _instance;
|
|
60
60
|
import { unique } from "@d3plus/data";
|
|
61
|
-
var cartesian = function(a, b) {
|
|
61
|
+
var cartesian = function cartesian(a, b) {
|
|
62
62
|
return (_instance = []).concat.apply(_instance, _to_consumable_array(a.map(function(d) {
|
|
63
63
|
return b.map(function(e) {
|
|
64
|
-
return [
|
|
64
|
+
return [
|
|
65
|
+
d,
|
|
66
|
+
e
|
|
67
|
+
];
|
|
65
68
|
});
|
|
66
69
|
})));
|
|
67
70
|
};
|
|
68
71
|
/**
|
|
69
72
|
@module matrixData
|
|
70
73
|
@private
|
|
71
|
-
*/ export default function() {
|
|
74
|
+
*/ export default function(_data) {
|
|
72
75
|
var _this = this;
|
|
73
76
|
var data = this._filteredData;
|
|
74
77
|
var rowValues = (this._rowList || unique(data.map(this._row))).sort(this._rowSort);
|
|
75
78
|
var columnValues = (this._columnList || unique(data.map(this._column))).sort(this._columnSort);
|
|
76
|
-
if (!rowValues.length || !columnValues.length) return
|
|
79
|
+
if (!rowValues.length || !columnValues.length) return {
|
|
80
|
+
rowValues: [],
|
|
81
|
+
columnValues: [],
|
|
82
|
+
shapeData: []
|
|
83
|
+
};
|
|
77
84
|
var shapeData = cartesian(rowValues, columnValues).map(function(param) {
|
|
78
85
|
var _param = _sliced_to_array(param, 2), rowValue = _param[0], columnValue = _param[1];
|
|
79
86
|
var dataObj = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var tileAttributions = [
|
|
2
2
|
{
|
|
3
3
|
matches: [
|
|
4
4
|
"cartodb",
|
|
@@ -32,3 +32,4 @@ export default [
|
|
|
32
32
|
text: "Map tiles by <a href='http://stamen.com' target='_blank'>Stamen Design</a>, under <a href='http://creativecommons.org/licenses/by/3.0' target='_blank'>CC BY 3.0</a>. Data by <a href='http://openstreetmap.org' target='_blank'>OpenStreetMap</a>, under <a href='http://creativecommons.org/licenses/by-sa/3.0' target='_blank'>CC BY SA</a>."
|
|
33
33
|
}
|
|
34
34
|
];
|
|
35
|
+
export default tileAttributions;
|
|
@@ -1,14 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
}
|
|
9
|
+
function _iterable_to_array_limit(arr, i) {
|
|
10
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11
|
+
if (_i == null) return;
|
|
12
|
+
var _arr = [];
|
|
13
|
+
var _n = true;
|
|
14
|
+
var _d = false;
|
|
15
|
+
var _s, _e;
|
|
16
|
+
try {
|
|
17
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
18
|
+
_arr.push(_s.value);
|
|
19
|
+
if (i && _arr.length === i) break;
|
|
20
|
+
}
|
|
21
|
+
} catch (err) {
|
|
22
|
+
_d = true;
|
|
23
|
+
_e = err;
|
|
24
|
+
} finally{
|
|
25
|
+
try {
|
|
26
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
27
|
+
} finally{
|
|
28
|
+
if (_d) throw _e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return _arr;
|
|
32
|
+
}
|
|
33
|
+
function _non_iterable_rest() {
|
|
34
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
35
|
+
}
|
|
36
|
+
function _sliced_to_array(arr, i) {
|
|
37
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
38
|
+
}
|
|
39
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
40
|
+
if (!o) return;
|
|
41
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
42
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
43
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
44
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
45
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
46
|
+
}
|
|
47
|
+
import { groups, max, min, sum } from "d3-array";
|
|
3
48
|
/**
|
|
4
49
|
@module barBuffer
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@param
|
|
9
|
-
@param {Object} [config]
|
|
10
|
-
@param {Number} [buffer = 10]
|
|
11
|
-
@private
|
|
50
|
+
Adds a buffer to either side of the non-discrete axis.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@param buffer @private
|
|
12
54
|
*/ export default function(param) {
|
|
13
55
|
var _this = this;
|
|
14
56
|
var data = param.data, x = param.x, y = param.y, x2 = param.x2, y2 = param.y2, _param_buffer = param.buffer, buffer = _param_buffer === void 0 ? 10 : _param_buffer;
|
|
@@ -20,10 +62,11 @@ import { nest } from "d3-collection";
|
|
|
20
62
|
if (isDiscreteX) oppDomain.reverse();
|
|
21
63
|
var negVals, posVals;
|
|
22
64
|
if (this._stacked) {
|
|
23
|
-
var groupedData =
|
|
65
|
+
var groupedData = groups(data, function(d) {
|
|
24
66
|
return "".concat(d[_this._discrete], "_").concat(d.group);
|
|
25
|
-
}).
|
|
26
|
-
|
|
67
|
+
}).map(function(param) {
|
|
68
|
+
var _param = _sliced_to_array(param, 2), values = _param[1];
|
|
69
|
+
return values.map(function(x) {
|
|
27
70
|
return x[isDiscreteX ? yKey : xKey];
|
|
28
71
|
});
|
|
29
72
|
});
|
|
@@ -1,14 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
+
}
|
|
9
|
+
function _iterable_to_array_limit(arr, i) {
|
|
10
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11
|
+
if (_i == null) return;
|
|
12
|
+
var _arr = [];
|
|
13
|
+
var _n = true;
|
|
14
|
+
var _d = false;
|
|
15
|
+
var _s, _e;
|
|
16
|
+
try {
|
|
17
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
18
|
+
_arr.push(_s.value);
|
|
19
|
+
if (i && _arr.length === i) break;
|
|
20
|
+
}
|
|
21
|
+
} catch (err) {
|
|
22
|
+
_d = true;
|
|
23
|
+
_e = err;
|
|
24
|
+
} finally{
|
|
25
|
+
try {
|
|
26
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
27
|
+
} finally{
|
|
28
|
+
if (_d) throw _e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return _arr;
|
|
32
|
+
}
|
|
33
|
+
function _non_iterable_rest() {
|
|
34
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
35
|
+
}
|
|
36
|
+
function _sliced_to_array(arr, i) {
|
|
37
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
38
|
+
}
|
|
39
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
40
|
+
if (!o) return;
|
|
41
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
42
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
43
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
44
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
45
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
46
|
+
}
|
|
47
|
+
import { groups, max, min, sum } from "d3-array";
|
|
3
48
|
/**
|
|
4
49
|
@module boxBuffer
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@param
|
|
9
|
-
@param {Object} [config]
|
|
10
|
-
@param {Number} [buffer = 10]
|
|
11
|
-
@private
|
|
50
|
+
Adds a buffer to either side of the non-discrete axis.
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@param buffer @private
|
|
12
54
|
*/ export default function(param) {
|
|
13
55
|
var _this = this;
|
|
14
56
|
var data = param.data, x = param.x, y = param.y, x2 = param.x2, y2 = param.y2, _param_buffer = param.buffer, buffer = _param_buffer === void 0 ? 10 : _param_buffer;
|
|
@@ -20,10 +62,11 @@ import { nest } from "d3-collection";
|
|
|
20
62
|
if (isDiscreteX) oppDomain.reverse();
|
|
21
63
|
var negVals, posVals;
|
|
22
64
|
if (this._stacked) {
|
|
23
|
-
var groupedData =
|
|
65
|
+
var groupedData = groups(data, function(d) {
|
|
24
66
|
return d[_this._discrete];
|
|
25
|
-
}).
|
|
26
|
-
|
|
67
|
+
}).map(function(param) {
|
|
68
|
+
var _param = _sliced_to_array(param, 2), values = _param[1];
|
|
69
|
+
return values.map(function(x) {
|
|
27
70
|
return x[isDiscreteX ? yKey : xKey];
|
|
28
71
|
});
|
|
29
72
|
});
|
|
@@ -2,12 +2,10 @@ import discreteBuffer from "./discreteBuffer.js";
|
|
|
2
2
|
import numericBuffer from "./numericBuffer.js";
|
|
3
3
|
/**
|
|
4
4
|
@module circleBuffer
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@param
|
|
9
|
-
@param {Object} [config]
|
|
10
|
-
@param {Number} [buffer] Defaults to the radius of the largest Circle.
|
|
5
|
+
Adds a buffer to either side of the non-discrete axis.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@param buffer Defaults to the radius of the largest Circle.
|
|
11
9
|
@private
|
|
12
10
|
*/ export default function(param) {
|
|
13
11
|
var data = param.data, x = param.x, y = param.y, x2 = param.x2, y2 = param.y2, yScale = param.yScale, xScale = param.xScale, config = param.config, buffer = param.buffer;
|
|
@@ -21,14 +19,14 @@ import numericBuffer from "./numericBuffer.js";
|
|
|
21
19
|
if (!y.invert && y.padding) discreteBuffer(y, data, this._discrete);
|
|
22
20
|
if (x.invert || y.invert) {
|
|
23
21
|
data.forEach(function(d) {
|
|
24
|
-
var s = buffer ? buffer : config.r(d.data, d.i) * 2;
|
|
22
|
+
var s = buffer ? buffer : (config === null || config === void 0 ? void 0 : config.r)(d.data, d.i) * 2;
|
|
25
23
|
if (x.invert) {
|
|
26
|
-
xD = numericBuffer(x, xScale, d[xKey], s, xR, xD, 0, false);
|
|
27
|
-
xD = numericBuffer(x, xScale, d[xKey], s, xR, xD, 1, false);
|
|
24
|
+
xD = numericBuffer(x, xScale !== null && xScale !== void 0 ? xScale : "linear", d[xKey], s, xR, xD, 0, false);
|
|
25
|
+
xD = numericBuffer(x, xScale !== null && xScale !== void 0 ? xScale : "linear", d[xKey], s, xR, xD, 1, false);
|
|
28
26
|
}
|
|
29
27
|
if (y.invert) {
|
|
30
|
-
yD = numericBuffer(y, yScale, d[yKey], s, yR, yD, 0, true);
|
|
31
|
-
yD = numericBuffer(y, yScale, d[yKey], s, yR, yD, 1, true);
|
|
28
|
+
yD = numericBuffer(y, yScale !== null && yScale !== void 0 ? yScale : "linear", d[yKey], s, yR, yD, 0, true);
|
|
29
|
+
yD = numericBuffer(y, yScale !== null && yScale !== void 0 ? yScale : "linear", d[yKey], s, yR, yD, 1, true);
|
|
32
30
|
}
|
|
33
31
|
});
|
|
34
32
|
}
|