@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/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
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
2
|
export { Axis, AxisBottom, AxisLeft, AxisRight, AxisTop, ColorScale, Legend, Message, TextBox, Timeline, Tooltip } from "./src/components/index.js";
|
|
3
3
|
export { Area, Bar, Box, Circle, Image, Line, Path, Rect, Shape, Whisker } from "./src/shapes/index.js";
|
|
4
|
-
export { accessor, BaseClass, configPrep, constant, RESET
|
|
4
|
+
export { accessor, BaseClass, configPrep, constant, RESET } from "./src/utils/index.js";
|
|
@@ -74,9 +74,7 @@ var AreaPlot = /*#__PURE__*/ function(Plot) {
|
|
|
74
74
|
return AreaPlot;
|
|
75
75
|
}(Plot);
|
|
76
76
|
/**
|
|
77
|
-
|
|
78
|
-
@extends Plot
|
|
79
|
-
@desc Creates an area plot based on an array of data.
|
|
77
|
+
Creates an area plot based on an array of data.
|
|
80
78
|
@example <caption>the equivalent of calling:</caption>
|
|
81
79
|
new d3plus.Plot()
|
|
82
80
|
.baseline(0)
|
|
@@ -81,9 +81,7 @@ var BarChart = /*#__PURE__*/ function(Plot) {
|
|
|
81
81
|
return BarChart;
|
|
82
82
|
}(Plot);
|
|
83
83
|
/**
|
|
84
|
-
|
|
85
|
-
@extends Plot
|
|
86
|
-
@desc Creates a bar chart based on an array of data.
|
|
84
|
+
Creates a bar chart based on an array of data.
|
|
87
85
|
@example <caption>the equivalent of calling:</caption>
|
|
88
86
|
new d3plus.Plot()
|
|
89
87
|
.baseline(0)
|
|
@@ -70,7 +70,7 @@ var BoxWhisker = /*#__PURE__*/ function(Plot) {
|
|
|
70
70
|
_this._discrete = "x";
|
|
71
71
|
_this._shape = constant("Box");
|
|
72
72
|
_this._tooltipConfig = assign(_this._tooltipConfig, {
|
|
73
|
-
title: function(d, i) {
|
|
73
|
+
title: function title(d, i) {
|
|
74
74
|
if (!d) return "";
|
|
75
75
|
while(d.__d3plus__ && d.data){
|
|
76
76
|
d = d.data;
|
|
@@ -86,7 +86,5 @@ var BoxWhisker = /*#__PURE__*/ function(Plot) {
|
|
|
86
86
|
return BoxWhisker;
|
|
87
87
|
}(Plot);
|
|
88
88
|
/**
|
|
89
|
-
|
|
90
|
-
@extends Plot
|
|
91
|
-
@desc Creates a simple box and whisker based on an array of data.
|
|
89
|
+
Creates a simple box and whisker based on an array of data.
|
|
92
90
|
*/ export { BoxWhisker as default };
|
|
@@ -33,6 +33,7 @@ function _inherits(subClass, superClass) {
|
|
|
33
33
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
34
34
|
}
|
|
35
35
|
function _instanceof(left, right) {
|
|
36
|
+
"@swc/helpers - instanceof";
|
|
36
37
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
37
38
|
return !!right[Symbol.hasInstance](left);
|
|
38
39
|
} else {
|
|
@@ -79,7 +80,7 @@ var BumpChart = /*#__PURE__*/ function(Plot) {
|
|
|
79
80
|
return _this._y(d);
|
|
80
81
|
});
|
|
81
82
|
_this.yConfig({
|
|
82
|
-
tickFormat: function(val) {
|
|
83
|
+
tickFormat: function tickFormat(val) {
|
|
83
84
|
var data = _this._formattedData;
|
|
84
85
|
var xMin = _instanceof(data[0].x, Date) ? data[0].x.getTime() : data[0].x;
|
|
85
86
|
var startData = data.filter(function(d) {
|
|
@@ -92,7 +93,7 @@ var BumpChart = /*#__PURE__*/ function(Plot) {
|
|
|
92
93
|
}
|
|
93
94
|
});
|
|
94
95
|
_this.y2Config({
|
|
95
|
-
tickFormat: function(val) {
|
|
96
|
+
tickFormat: function tickFormat(val) {
|
|
96
97
|
var data = _this._formattedData;
|
|
97
98
|
var xMax = _instanceof(data[data.length - 1].x, Date) ? data[data.length - 1].x.getTime() : data[data.length - 1].x;
|
|
98
99
|
var endData = data.filter(function(d) {
|
|
@@ -115,9 +116,7 @@ var BumpChart = /*#__PURE__*/ function(Plot) {
|
|
|
115
116
|
return BumpChart;
|
|
116
117
|
}(Plot);
|
|
117
118
|
/**
|
|
118
|
-
|
|
119
|
-
@extends Plot
|
|
120
|
-
@desc Creates a bump chart based on an array of data.
|
|
119
|
+
Creates a bump chart based on an array of data.
|
|
121
120
|
@example <caption>the equivalent of calling:</caption>
|
|
122
121
|
new d3plus.Plot()
|
|
123
122
|
.discrete("x")
|
package/es/src/charts/Donut.js
CHANGED
|
@@ -78,7 +78,5 @@ var Donut = /*#__PURE__*/ function(Pie) {
|
|
|
78
78
|
return Donut;
|
|
79
79
|
}(Pie);
|
|
80
80
|
/**
|
|
81
|
-
|
|
82
|
-
@extends Pie
|
|
83
|
-
@desc Extends the Pie visualization to create a donut chart.
|
|
81
|
+
Extends the Pie visualization to create a donut chart.
|
|
84
82
|
*/ export { Donut as default };
|
package/es/src/charts/Geomap.js
CHANGED
|
@@ -71,6 +71,7 @@ function _inherits(subClass, superClass) {
|
|
|
71
71
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
72
72
|
}
|
|
73
73
|
function _instanceof(left, right) {
|
|
74
|
+
"@swc/helpers - instanceof";
|
|
74
75
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
75
76
|
return !!right[Symbol.hasInstance](left);
|
|
76
77
|
} else {
|
|
@@ -178,9 +179,9 @@ import attributions from "./helpers/tileAttributions.js";
|
|
|
178
179
|
}
|
|
179
180
|
/**
|
|
180
181
|
@name topo2feature
|
|
181
|
-
|
|
182
|
-
@param
|
|
183
|
-
@param
|
|
182
|
+
Converts a specific topojson object key into a feature ready for projection.
|
|
183
|
+
@param topo A valid topojson json object.
|
|
184
|
+
@param key The topojson object key to be used. If undefined, the first key available will be used.
|
|
184
185
|
@private
|
|
185
186
|
*/ function topo2feature(topo, key) {
|
|
186
187
|
var k = key && topo.objects[key] ? key : Object.keys(topo.objects)[0];
|
|
@@ -205,16 +206,16 @@ var Geomap = /*#__PURE__*/ function(Viz) {
|
|
|
205
206
|
_this._projectionPadding = parseSides(20);
|
|
206
207
|
_this._shape = constant("Circle");
|
|
207
208
|
_this._shapeConfig = assign(_this._shapeConfig, {
|
|
208
|
-
ariaLabel: function(d, i) {
|
|
209
|
+
ariaLabel: function ariaLabel(d, i) {
|
|
209
210
|
return "".concat(_this._drawLabel(d, i), ", ").concat(_this._pointSize(d, i));
|
|
210
211
|
},
|
|
211
212
|
hoverOpacity: 1,
|
|
212
213
|
Path: {
|
|
213
|
-
ariaLabel: function(d, i) {
|
|
214
|
+
ariaLabel: function ariaLabel(d, i) {
|
|
214
215
|
var validColorScale = _this._colorScale ? ", ".concat(_this._colorScale(d, i)) : "";
|
|
215
216
|
return "".concat(_this._drawLabel(d, i)).concat(validColorScale, ".");
|
|
216
217
|
},
|
|
217
|
-
fill: function(d, i) {
|
|
218
|
+
fill: function fill(d, i) {
|
|
218
219
|
if (_this._colorScale && !_this._coordData.features.includes(d)) {
|
|
219
220
|
var c = _this._colorScale(d);
|
|
220
221
|
if (c !== undefined && c !== null) {
|
|
@@ -230,17 +231,17 @@ var Geomap = /*#__PURE__*/ function(Viz) {
|
|
|
230
231
|
return _this._topojsonFill(d, i);
|
|
231
232
|
},
|
|
232
233
|
on: {
|
|
233
|
-
mouseenter: function(d, i, x, event) {
|
|
234
|
+
mouseenter: function mouseenter(d, i, x, event) {
|
|
234
235
|
return !_this._coordData.features.includes(d) ? _this._on.mouseenter.bind(_this)(d, i, x, event) : null;
|
|
235
236
|
},
|
|
236
237
|
"mousemove.shape": function(d, i, x, event) {
|
|
237
238
|
return !_this._coordData.features.includes(d) ? _this._on["mousemove.shape"].bind(_this)(d, i, x, event) : null;
|
|
238
239
|
},
|
|
239
|
-
mouseleave: function(d, i, x, event) {
|
|
240
|
+
mouseleave: function mouseleave(d, i, x, event) {
|
|
240
241
|
return !_this._coordData.features.includes(d) ? _this._on.mouseleave.bind(_this)(d, i, x, event) : null;
|
|
241
242
|
}
|
|
242
243
|
},
|
|
243
|
-
stroke: function(d, i) {
|
|
244
|
+
stroke: function stroke(d, i) {
|
|
244
245
|
var c = typeof _this._shapeConfig.Path.fill === "function" ? _this._shapeConfig.Path.fill(d, i) : _this._shapeConfig.Path.fill;
|
|
245
246
|
return color(c).darker();
|
|
246
247
|
},
|
|
@@ -290,7 +291,7 @@ var Geomap = /*#__PURE__*/ function(Viz) {
|
|
|
290
291
|
"a",
|
|
291
292
|
"b",
|
|
292
293
|
"c"
|
|
293
|
-
][Math.random() * 3 | 0]).replace("{z}", z).replace("{x}", x).replace("{y}", y);
|
|
294
|
+
][Math.random() * 3 | 0]).replace("{z}", "".concat(z)).replace("{x}", "".concat(x)).replace("{y}", "".concat(y));
|
|
294
295
|
}).attr("x", function(param) {
|
|
295
296
|
var _param = _sliced_to_array(param, 1), x = _param[0];
|
|
296
297
|
return x * scale + tileData.translate[0] * scale - transform.x / transform.k;
|
|
@@ -355,7 +356,9 @@ var Geomap = /*#__PURE__*/ function(Viz) {
|
|
|
355
356
|
});
|
|
356
357
|
return arr;
|
|
357
358
|
}, []);
|
|
358
|
-
var
|
|
359
|
+
var scaleName = "scale".concat(this._pointSizeScale.charAt(0).toUpperCase()).concat(this._pointSizeScale.slice(1));
|
|
360
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
361
|
+
var r = scales[scaleName]().domain(extent(pointData, function(d, i) {
|
|
359
362
|
return _this._pointSize(d, i);
|
|
360
363
|
})).range([
|
|
361
364
|
this._pointSizeMin,
|
|
@@ -526,12 +529,9 @@ var Geomap = /*#__PURE__*/ function(Viz) {
|
|
|
526
529
|
},
|
|
527
530
|
{
|
|
528
531
|
/**
|
|
529
|
-
|
|
530
|
-
@desc Topojson files sometimes include small geographies that negatively impact how the library determines the default zoom level (for example, a small island or territory far off the coast that is barely visible to the eye). The fitFilter method can be used to remove specific geographies from the logic used to determine the zooming.
|
|
532
|
+
Topojson files sometimes include small geographies that negatively impact how the library determines the default zoom level (for example, a small island or territory far off the coast that is barely visible to the eye). The fitFilter method can be used to remove specific geographies from the logic used to determine the zooming.
|
|
531
533
|
|
|
532
534
|
The *value* passed can be a single id to remove, an array of ids, or a filter function. Take a look at the [Choropleth Example](http://d3plus.org/examples/d3plus-geomap/getting-started/) to see it in action.
|
|
533
|
-
@param {Number|String|Array|Function} [*value*]
|
|
534
|
-
@chainable
|
|
535
535
|
*/ key: "fitFilter",
|
|
536
536
|
value: function fitFilter(_) {
|
|
537
537
|
if (arguments.length) {
|
|
@@ -549,12 +549,9 @@ The *value* passed can be a single id to remove, an array of ids, or a filter fu
|
|
|
549
549
|
},
|
|
550
550
|
{
|
|
551
551
|
/**
|
|
552
|
-
|
|
553
|
-
@desc If the topojson being used to determine the zoom fit (either the main [topojson](#Geomap.topojson) object or the [fitObject](#Geomap.fitObject)) contains multiple geographical sets (for example, a file containing state and county boundaries), use this method to indentify which set to use for the zoom fit.
|
|
552
|
+
If the topojson being used to determine the zoom fit (either the main [topojson](#Geomap.topojson) object or the [fitObject](#Geomap.fitObject)) contains multiple geographical sets (for example, a file containing state and county boundaries), use this method to indentify which set to use for the zoom fit.
|
|
554
553
|
|
|
555
554
|
If not specified, the first key in the *Array* returned from using `Object.keys` on the topojson will be used.
|
|
556
|
-
@param {String} *value*
|
|
557
|
-
@chainable
|
|
558
555
|
*/ key: "fitKey",
|
|
559
556
|
value: function fitKey(_) {
|
|
560
557
|
if (arguments.length) {
|
|
@@ -567,13 +564,11 @@ If not specified, the first key in the *Array* returned from using `Object.keys`
|
|
|
567
564
|
},
|
|
568
565
|
{
|
|
569
566
|
/**
|
|
570
|
-
|
|
571
|
-
@desc The topojson to be used for the initial projection [fit extent](https://github.com/d3/d3-geo#projection_fitExtent). The value passed should either be a valid Topojson *Object* or a *String* representing a filepath or URL to be loaded.
|
|
567
|
+
The topojson to be used for the initial projection [fit extent](https://github.com/d3/d3-geo#projection_fitExtent). The value passed should either be a valid Topojson *Object* or a *String* representing a filepath or URL to be loaded.
|
|
572
568
|
|
|
573
569
|
Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function needs to return the final Topojson *Object*.
|
|
574
|
-
@param
|
|
575
|
-
@param
|
|
576
|
-
@chainable
|
|
570
|
+
@param _ `undefined`
|
|
571
|
+
@param f Topojson data or a URL to load.
|
|
577
572
|
*/ key: "fitObject",
|
|
578
573
|
value: function fitObject(_, f) {
|
|
579
574
|
if (arguments.length) {
|
|
@@ -586,10 +581,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
586
581
|
},
|
|
587
582
|
{
|
|
588
583
|
/**
|
|
589
|
-
|
|
590
|
-
@
|
|
591
|
-
@param {String} [*value* = "#d4dadc"]
|
|
592
|
-
@chainable
|
|
584
|
+
The color visible behind any shapes drawn on the map projection. By default, a color value matching the color used in the map tiles is used to help mask the loading time needed to render the tiles. Any value CSS color value may be used, including hexidecimal, rgb, rgba, and color strings like `"blue"` and `"transparent"`.
|
|
585
|
+
@param _ "#d4dadc"]
|
|
593
586
|
*/ key: "ocean",
|
|
594
587
|
value: function ocean(_) {
|
|
595
588
|
return arguments.length ? (this._ocean = _, this) : this._ocean;
|
|
@@ -597,10 +590,7 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
597
590
|
},
|
|
598
591
|
{
|
|
599
592
|
/**
|
|
600
|
-
|
|
601
|
-
@desc The accessor to be used when detecting coordinate points in the objects passed to the [data](https://d3plus.org/docs/#Viz.data) method. Values are expected to be in the format `[longitude, latitude]`, which is in-line with d3's expected coordinate mapping.
|
|
602
|
-
@param {Function|Array} [*value*]
|
|
603
|
-
@chainable
|
|
593
|
+
The accessor to be used when detecting coordinate points in the objects passed to the [data](https://d3plus.org/docs/#Viz.data) method. Values are expected to be in the format `[longitude, latitude]`, which is in-line with d3's expected coordinate mapping.
|
|
604
594
|
*/ key: "point",
|
|
605
595
|
value: function point(_) {
|
|
606
596
|
return arguments.length ? (this._point = typeof _ === "function" ? _ : constant(_), this) : this._point;
|
|
@@ -608,10 +598,7 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
608
598
|
},
|
|
609
599
|
{
|
|
610
600
|
/**
|
|
611
|
-
|
|
612
|
-
@desc The accessor or static value to be used for sizing coordinate points.
|
|
613
|
-
@param {Function|Number} [*value*]
|
|
614
|
-
@chainable
|
|
601
|
+
The accessor or static value to be used for sizing coordinate points.
|
|
615
602
|
*/ key: "pointSize",
|
|
616
603
|
value: function pointSize(_) {
|
|
617
604
|
return arguments.length ? (this._pointSize = typeof _ === "function" ? _ : constant(_), this) : this._pointSize;
|
|
@@ -619,10 +606,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
619
606
|
},
|
|
620
607
|
{
|
|
621
608
|
/**
|
|
622
|
-
|
|
623
|
-
@
|
|
624
|
-
@param {Number} [*value* = 10]
|
|
625
|
-
@chainable
|
|
609
|
+
The maximum pixel radius used in the scale for sizing coordinate points.
|
|
610
|
+
@param _ 10]
|
|
626
611
|
*/ key: "pointSizeMax",
|
|
627
612
|
value: function pointSizeMax(_) {
|
|
628
613
|
return arguments.length ? (this._pointSizeMax = _, this) : this._pointSizeMax;
|
|
@@ -630,10 +615,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
630
615
|
},
|
|
631
616
|
{
|
|
632
617
|
/**
|
|
633
|
-
|
|
634
|
-
@
|
|
635
|
-
@param {Number} [*value* = 5]
|
|
636
|
-
@chainable
|
|
618
|
+
The minimum pixel radius used in the scale for sizing coordinate points.
|
|
619
|
+
@param _ 5]
|
|
637
620
|
*/ key: "pointSizeMin",
|
|
638
621
|
value: function pointSizeMin(_) {
|
|
639
622
|
return arguments.length ? (this._pointSizeMin = _, this) : this._pointSizeMin;
|
|
@@ -641,10 +624,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
641
624
|
},
|
|
642
625
|
{
|
|
643
626
|
/**
|
|
644
|
-
|
|
645
|
-
@
|
|
646
|
-
@param {Function|String} *projection* = "geoMercator"
|
|
647
|
-
@chainable
|
|
627
|
+
The map projection used when displaying topojson and coordinate points. All projections from [d3-geo](https://github.com/d3/d3-geo#projections), [d3-geo-projection](https://github.com/d3/d3-geo-projection#api-reference), and [d3-composite-projections](http://geoexamples.com/d3-composite-projections/) are accepted, either as the string name (ie. "geoMercator") or the generator function itself. Map tiles are only usable when the projection is set to Mercator (the default).
|
|
628
|
+
@param _ "geoMercator"
|
|
648
629
|
*/ key: "projection",
|
|
649
630
|
value: function projection(_) {
|
|
650
631
|
if (arguments.length && _ !== "geoMercator") this.tiles(false);
|
|
@@ -653,10 +634,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
653
634
|
},
|
|
654
635
|
{
|
|
655
636
|
/**
|
|
656
|
-
|
|
657
|
-
@
|
|
658
|
-
@param {Number|String} [*value* = 20]
|
|
659
|
-
@chainable
|
|
637
|
+
The outer padding between the edge of the visualization and the shapes drawn. The value passed can be either a single number to be used on all sides, or a CSS string pattern (ie. `"20px 0 10px"`).
|
|
638
|
+
@param _ 20]
|
|
660
639
|
*/ key: "projectionPadding",
|
|
661
640
|
value: function projectionPadding(_) {
|
|
662
641
|
return arguments.length ? (this._projectionPadding = parseSides(_), this) : this._projectionPadding;
|
|
@@ -664,10 +643,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
664
643
|
},
|
|
665
644
|
{
|
|
666
645
|
/**
|
|
667
|
-
|
|
668
|
-
@
|
|
669
|
-
@param {Array} [*value* = [0, 0]]
|
|
670
|
-
@chainable
|
|
646
|
+
An array that corresponds to the value passed to the projection's [rotate](https://github.com/d3/d3-geo#projection_rotate) function. Use this method to shift the centerpoint of a map.
|
|
647
|
+
@param _ [0, 0]]
|
|
671
648
|
*/ key: "projectionRotate",
|
|
672
649
|
value: function projectionRotate(_) {
|
|
673
650
|
if (arguments.length) {
|
|
@@ -682,10 +659,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
682
659
|
},
|
|
683
660
|
{
|
|
684
661
|
/**
|
|
685
|
-
|
|
686
|
-
@
|
|
687
|
-
@param {Boolean} [*value* = true]
|
|
688
|
-
@chainable
|
|
662
|
+
Toggles the visibility of the map tiles.
|
|
663
|
+
@param _ true]
|
|
689
664
|
*/ key: "tiles",
|
|
690
665
|
value: function tiles(_) {
|
|
691
666
|
if (arguments.length) {
|
|
@@ -700,10 +675,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
700
675
|
},
|
|
701
676
|
{
|
|
702
677
|
/**
|
|
703
|
-
|
|
704
|
-
@
|
|
705
|
-
@param {String} [url="https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"]
|
|
706
|
-
@chainable
|
|
678
|
+
By default, d3plus uses the `light_all` style provided by [CARTO](https://carto.com/location-data-services/basemaps/) for it's map tiles. The [tileUrl](https://d3plus.org/docs/#Geomap.tileUrl) method changes the base URL used for fetching the tiles, as long as the string passed contains `{x}`, `{y}`, and `{z}` variables enclosed in curly brackets for the zoom logic to load the correct tiles.
|
|
679
|
+
@param _ "https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"]
|
|
707
680
|
*/ key: "tileUrl",
|
|
708
681
|
value: function tileUrl(_) {
|
|
709
682
|
if (arguments.length) {
|
|
@@ -717,13 +690,11 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
717
690
|
},
|
|
718
691
|
{
|
|
719
692
|
/**
|
|
720
|
-
|
|
721
|
-
@desc The topojson to be used for drawing geographical paths. The value passed should either be a valid Topojson *Object* or a *String* representing a filepath or URL to be loaded.
|
|
693
|
+
The topojson to be used for drawing geographical paths. The value passed should either be a valid Topojson *Object* or a *String* representing a filepath or URL to be loaded.
|
|
722
694
|
|
|
723
695
|
Additionally, a custom formatting function can be passed as a second argument to this method. This custom function will be passed the data that has been loaded, as long as there are no errors. This function should return the final Topojson *Obejct*.
|
|
724
|
-
@param
|
|
725
|
-
@param
|
|
726
|
-
@chainable
|
|
696
|
+
@param _ []
|
|
697
|
+
@param f Topojson data or a URL to load.
|
|
727
698
|
*/ key: "topojson",
|
|
728
699
|
value: function topojson(_, f) {
|
|
729
700
|
if (arguments.length) {
|
|
@@ -736,10 +707,8 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
736
707
|
},
|
|
737
708
|
{
|
|
738
709
|
/**
|
|
739
|
-
|
|
740
|
-
@
|
|
741
|
-
@param {String|Function} *value* = string
|
|
742
|
-
@chainable
|
|
710
|
+
The function is used to set default color of the map.
|
|
711
|
+
@param _ string
|
|
743
712
|
*/ key: "topojsonFill",
|
|
744
713
|
value: function topojsonFill(_) {
|
|
745
714
|
return arguments.length ? (this._topojsonFill = typeof _ === "function" ? _ : constant(_), this, this) : this._topojsonFill;
|
|
@@ -747,10 +716,7 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
747
716
|
},
|
|
748
717
|
{
|
|
749
718
|
/**
|
|
750
|
-
|
|
751
|
-
@desc If the [topojson](#Geomap.topojson) being used contains boundaries that should not be shown, this method can be used to filter them out of the final output. The *value* passed can be a single id to remove, an array of ids, or a filter function.
|
|
752
|
-
@param {Number|String|Array|Function} [*value*]
|
|
753
|
-
@chainable
|
|
719
|
+
If the [topojson](#Geomap.topojson) being used contains boundaries that should not be shown, this method can be used to filter them out of the final output. The *value* passed can be a single id to remove, an array of ids, or a filter function.
|
|
754
720
|
*/ key: "topojsonFilter",
|
|
755
721
|
value: function topojsonFilter(_) {
|
|
756
722
|
if (arguments.length) {
|
|
@@ -768,12 +734,9 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
768
734
|
},
|
|
769
735
|
{
|
|
770
736
|
/**
|
|
771
|
-
|
|
772
|
-
@desc If the [topojson](#Geomap.topojson) contains multiple geographical sets (for example, a file containing state and county boundaries), use this method to indentify which set to use.
|
|
737
|
+
If the [topojson](#Geomap.topojson) contains multiple geographical sets (for example, a file containing state and county boundaries), use this method to indentify which set to use.
|
|
773
738
|
|
|
774
739
|
If not specified, the first key in the *Array* returned from using `Object.keys` on the topojson will be used.
|
|
775
|
-
@param {String} *value*
|
|
776
|
-
@chainable
|
|
777
740
|
*/ key: "topojsonKey",
|
|
778
741
|
value: function topojsonKey(_) {
|
|
779
742
|
if (arguments.length) {
|
|
@@ -786,10 +749,8 @@ If not specified, the first key in the *Array* returned from using `Object.keys`
|
|
|
786
749
|
},
|
|
787
750
|
{
|
|
788
751
|
/**
|
|
789
|
-
|
|
790
|
-
@
|
|
791
|
-
@param {String|Function} *value* = "id"
|
|
792
|
-
@chainable
|
|
752
|
+
The accessor used to map each topojson geometry to it's corresponding [data](https://d3plus.org/docs/#Viz.data) point.
|
|
753
|
+
@param _ "id"
|
|
793
754
|
*/ key: "topojsonId",
|
|
794
755
|
value: function topojsonId(_) {
|
|
795
756
|
return arguments.length ? (this._topojsonId = typeof _ === "function" ? _ : accessor(_), this, this) : this._topojsonId;
|
|
@@ -799,7 +760,5 @@ If not specified, the first key in the *Array* returned from using `Object.keys`
|
|
|
799
760
|
return Geomap;
|
|
800
761
|
}(Viz);
|
|
801
762
|
/**
|
|
802
|
-
|
|
803
|
-
@extends Viz
|
|
804
|
-
@desc Creates a geographical map with zooming, panning, image tiles, and the ability to layer choropleth paths and coordinate points. See [this example](https://d3plus.org/examples/d3plus-geomap/getting-started/) for help getting started.
|
|
763
|
+
Creates a geographical map with zooming, panning, image tiles, and the ability to layer choropleth paths and coordinate points. See [this example](https://d3plus.org/examples/d3plus-geomap/getting-started/) for help getting started.
|
|
805
764
|
*/ export { Geomap as default };
|
|
@@ -73,9 +73,7 @@ var LinePlot = /*#__PURE__*/ function(Plot) {
|
|
|
73
73
|
return LinePlot;
|
|
74
74
|
}(Plot);
|
|
75
75
|
/**
|
|
76
|
-
|
|
77
|
-
@extends Plot
|
|
78
|
-
@desc Creates a line plot based on an array of data.
|
|
76
|
+
Creates a line plot based on an array of data.
|
|
79
77
|
@example <caption>the equivalent of calling:</caption>
|
|
80
78
|
new d3plus.Plot()
|
|
81
79
|
.discrete("x")
|
package/es/src/charts/Matrix.js
CHANGED
|
@@ -153,8 +153,7 @@ var Matrix = /*#__PURE__*/ function(Viz) {
|
|
|
153
153
|
_create_class(Matrix, [
|
|
154
154
|
{
|
|
155
155
|
/**
|
|
156
|
-
|
|
157
|
-
@desc Extends the draw behavior of the abstract Viz class.
|
|
156
|
+
Extends the draw behavior of the abstract Viz class.
|
|
158
157
|
@private
|
|
159
158
|
*/ key: "_draw",
|
|
160
159
|
value: function _draw(callback) {
|
|
@@ -168,7 +167,7 @@ var Matrix = /*#__PURE__*/ function(Viz) {
|
|
|
168
167
|
opacity: 1
|
|
169
168
|
};
|
|
170
169
|
var columnRotation = width / columnValues.length < 120;
|
|
171
|
-
var selectElem = function(name, opts) {
|
|
170
|
+
var selectElem = function selectElem(name, opts) {
|
|
172
171
|
return elem("g.d3plus-Matrix-".concat(name), Object.assign({
|
|
173
172
|
parent: parent,
|
|
174
173
|
transition: transition
|
|
@@ -230,10 +229,10 @@ var Matrix = /*#__PURE__*/ function(Viz) {
|
|
|
230
229
|
}).node()).config({
|
|
231
230
|
height: cellHeight - this._cellPadding,
|
|
232
231
|
width: cellWidth - this._cellPadding,
|
|
233
|
-
x: function(d) {
|
|
232
|
+
x: function x(d) {
|
|
234
233
|
return columnScale(d.column) + cellWidth / 2;
|
|
235
234
|
},
|
|
236
|
-
y: function(d) {
|
|
235
|
+
y: function y(d) {
|
|
237
236
|
return rowScale(d.row) + cellHeight / 2;
|
|
238
237
|
}
|
|
239
238
|
}).config(rectConfig).render());
|
|
@@ -242,20 +241,17 @@ var Matrix = /*#__PURE__*/ function(Viz) {
|
|
|
242
241
|
},
|
|
243
242
|
{
|
|
244
243
|
/**
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
@param {Number} [*value* = 2]
|
|
248
|
-
*/ key: "cellPadding",
|
|
244
|
+
The pixel padding in between each cell.
|
|
245
|
+
*/ key: "cellPadding",
|
|
249
246
|
value: function cellPadding(_) {
|
|
250
247
|
return arguments.length ? (this._cellPadding = _, this) : this._cellPadding;
|
|
251
248
|
}
|
|
252
249
|
},
|
|
253
250
|
{
|
|
254
251
|
/**
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
@example
|
|
252
|
+
Determines which key in your data should be used for each column in the matrix. Can be either a String that matches a key used in every data point, or an accessor function that receives a data point and it's index in the data array, and is expected to return it's column value.
|
|
253
|
+
|
|
254
|
+
@example
|
|
259
255
|
function column(d) {
|
|
260
256
|
return d.name;
|
|
261
257
|
}
|
|
@@ -266,31 +262,25 @@ function column(d) {
|
|
|
266
262
|
},
|
|
267
263
|
{
|
|
268
264
|
/**
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
@param {Object} *value*
|
|
272
|
-
@chainable
|
|
273
|
-
*/ key: "columnConfig",
|
|
265
|
+
A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the column labels.
|
|
266
|
+
*/ key: "columnConfig",
|
|
274
267
|
value: function columnConfig(_) {
|
|
275
268
|
return arguments.length ? (this._columnConfig = assign(this._columnConfig, _), this) : this._columnConfig;
|
|
276
269
|
}
|
|
277
270
|
},
|
|
278
271
|
{
|
|
279
272
|
/**
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
@param {Array} [*value*]
|
|
283
|
-
*/ key: "columnList",
|
|
273
|
+
A manual list of IDs to be used for columns.
|
|
274
|
+
*/ key: "columnList",
|
|
284
275
|
value: function columnList(_) {
|
|
285
276
|
return arguments.length ? (this._columnList = _, this) : this._columnList;
|
|
286
277
|
}
|
|
287
278
|
},
|
|
288
279
|
{
|
|
289
280
|
/**
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
@example
|
|
281
|
+
A sort comparator function that is run on the unique set of column values.
|
|
282
|
+
|
|
283
|
+
@example
|
|
294
284
|
function column(a, b) {
|
|
295
285
|
return a.localeCompare(b);
|
|
296
286
|
}
|
|
@@ -301,10 +291,9 @@ function column(a, b) {
|
|
|
301
291
|
},
|
|
302
292
|
{
|
|
303
293
|
/**
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
@example
|
|
294
|
+
Determines which key in your data should be used for each row in the matrix. Can be either a String that matches a key used in every data point, or an accessor function that receives a data point and it's index in the data array, and is expected to return it's row value.
|
|
295
|
+
|
|
296
|
+
@example
|
|
308
297
|
function row(d) {
|
|
309
298
|
return d.name;
|
|
310
299
|
}
|
|
@@ -315,31 +304,25 @@ function row(d) {
|
|
|
315
304
|
},
|
|
316
305
|
{
|
|
317
306
|
/**
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
@param {Object} *value*
|
|
321
|
-
@chainable
|
|
322
|
-
*/ key: "rowConfig",
|
|
307
|
+
A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the row labels.
|
|
308
|
+
*/ key: "rowConfig",
|
|
323
309
|
value: function rowConfig(_) {
|
|
324
310
|
return arguments.length ? (this._rowConfig = assign(this._rowConfig, _), this) : this._rowConfig;
|
|
325
311
|
}
|
|
326
312
|
},
|
|
327
313
|
{
|
|
328
314
|
/**
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
@param {Array} [*value*]
|
|
332
|
-
*/ key: "rowList",
|
|
315
|
+
A manual list of IDs to be used for rows.
|
|
316
|
+
*/ key: "rowList",
|
|
333
317
|
value: function rowList(_) {
|
|
334
318
|
return arguments.length ? (this._rowList = _, this) : this._rowList;
|
|
335
319
|
}
|
|
336
320
|
},
|
|
337
321
|
{
|
|
338
322
|
/**
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
@example
|
|
323
|
+
A sort comparator function that is run on the unique set of row values.
|
|
324
|
+
|
|
325
|
+
@example
|
|
343
326
|
function row(a, b) {
|
|
344
327
|
return a.localeCompare(b);
|
|
345
328
|
}
|
|
@@ -352,7 +335,5 @@ function row(a, b) {
|
|
|
352
335
|
return Matrix;
|
|
353
336
|
}(Viz);
|
|
354
337
|
/**
|
|
355
|
-
|
|
356
|
-
@extends Viz
|
|
357
|
-
@desc Creates a simple rows/columns Matrix view of any dataset. See [this example](https://d3plus.org/examples/d3plus-matrix/getting-started/) for help getting started using the Matrix class.
|
|
338
|
+
Creates a simple rows/columns Matrix view of any dataset. See [this example](https://d3plus.org/examples/d3plus-matrix/getting-started/) for help getting started using the Matrix class.
|
|
358
339
|
*/ export { Matrix as default };
|