@d3plus/core 3.0.15 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88482 -2998
- package/es/index.js +1 -1
- package/es/src/charts/AreaPlot.js +1 -3
- package/es/src/charts/BarChart.js +1 -3
- package/es/src/charts/BoxWhisker.js +2 -4
- package/es/src/charts/BumpChart.js +4 -5
- package/es/src/charts/Donut.js +1 -3
- package/es/src/charts/Geomap.js +47 -88
- package/es/src/charts/LinePlot.js +1 -3
- package/es/src/charts/Matrix.js +27 -46
- package/es/src/charts/Network.js +87 -81
- package/es/src/charts/Pack.js +21 -34
- package/es/src/charts/Pie.js +12 -24
- package/es/src/charts/Plot.js +226 -321
- package/es/src/charts/Priestley.js +18 -36
- package/es/src/charts/Radar.js +100 -47
- package/es/src/charts/RadialMatrix.js +35 -47
- package/es/src/charts/Rings.js +99 -90
- package/es/src/charts/Sankey.js +85 -75
- package/es/src/charts/StackedArea.js +1 -3
- package/es/src/charts/Tree.js +27 -28
- package/es/src/charts/Treemap.js +117 -71
- package/es/src/charts/Viz.js +297 -493
- package/es/src/charts/drawSteps/drawAttribution.js +1 -1
- package/es/src/charts/drawSteps/drawBack.js +1 -2
- package/es/src/charts/drawSteps/drawColorScale.js +1 -2
- package/es/src/charts/drawSteps/drawLegend.js +8 -10
- package/es/src/charts/drawSteps/drawSubtitle.js +1 -3
- package/es/src/charts/drawSteps/drawTimeline.js +12 -9
- package/es/src/charts/drawSteps/drawTitle.js +1 -3
- package/es/src/charts/drawSteps/drawTotal.js +1 -3
- package/es/src/charts/drawSteps/zoomControls.js +19 -21
- package/es/src/charts/events/click.legend.js +2 -3
- package/es/src/charts/events/click.shape.js +2 -4
- package/es/src/charts/events/mouseenter.js +7 -8
- package/es/src/charts/events/mouseleave.js +1 -3
- package/es/src/charts/events/mousemove.legend.js +3 -4
- package/es/src/charts/events/mousemove.shape.js +2 -4
- package/es/src/charts/events/touchstart.body.js +1 -1
- package/es/src/charts/helpers/matrixData.js +11 -4
- package/es/src/charts/helpers/tileAttributions.js +2 -1
- package/es/src/charts/plotBuffers/Bar.js +55 -12
- package/es/src/charts/plotBuffers/Box.js +55 -12
- package/es/src/charts/plotBuffers/Circle.js +9 -11
- package/es/src/charts/plotBuffers/Line.js +4 -6
- package/es/src/charts/plotBuffers/Rect.js +10 -12
- package/es/src/charts/plotBuffers/discreteBuffer.js +4 -2
- package/es/src/charts/plotBuffers/numericBuffer.js +7 -6
- package/es/src/components/Axis.js +298 -426
- package/es/src/components/AxisBottom.js +1 -3
- package/es/src/components/AxisLeft.js +1 -3
- package/es/src/components/AxisRight.js +1 -3
- package/es/src/components/AxisTop.js +1 -3
- package/es/src/components/ColorScale.js +80 -197
- package/es/src/components/Legend.js +82 -135
- package/es/src/components/Message.js +27 -19
- package/es/src/components/TextBox.js +106 -262
- package/es/src/components/Timeline.js +88 -155
- package/es/src/components/Tooltip.js +301 -330
- package/es/src/shapes/Area.js +95 -74
- package/es/src/shapes/Bar.js +46 -86
- package/es/src/shapes/Box.js +104 -118
- package/es/src/shapes/Circle.js +29 -30
- package/es/src/shapes/Image.js +44 -102
- package/es/src/shapes/Line.js +74 -40
- package/es/src/shapes/Path.js +23 -25
- package/es/src/shapes/Rect.js +29 -41
- package/es/src/shapes/Shape.js +152 -369
- package/es/src/shapes/Whisker.js +89 -90
- package/es/src/utils/AccessorFn.js +4 -0
- package/es/src/utils/BaseClass.js +53 -82
- package/es/src/utils/D3plusConfig.js +1 -0
- package/es/src/utils/RESET.js +2 -4
- package/es/src/utils/accessor.js +4 -5
- package/es/src/utils/configPrep.js +13 -12
- package/es/src/utils/constant.js +2 -3
- package/es/src/utils/getProp.js +4 -4
- package/es/src/utils/index.js +0 -1
- package/package.json +29 -22
- package/types/index.d.ts +5 -0
- package/types/src/charts/AreaPlot.d.ts +16 -0
- package/types/src/charts/BarChart.d.ts +16 -0
- package/types/src/charts/BoxWhisker.d.ts +11 -0
- package/types/src/charts/BumpChart.d.ts +36 -0
- package/types/src/charts/Donut.d.ts +11 -0
- package/types/src/charts/Geomap.d.ts +120 -0
- package/types/src/charts/LinePlot.d.ts +15 -0
- package/types/src/charts/Matrix.d.ts +74 -0
- package/types/src/charts/Network.d.ts +78 -0
- package/types/src/charts/Pack.d.ts +47 -0
- package/types/src/charts/Pie.d.ts +44 -0
- package/types/src/charts/Plot.d.ts +199 -0
- package/types/src/charts/Priestley.d.ts +37 -0
- package/types/src/charts/Radar.d.ts +38 -0
- package/types/src/charts/RadialMatrix.d.ts +78 -0
- package/types/src/charts/Rings.d.ts +74 -0
- package/types/src/charts/Sankey.d.ts +81 -0
- package/types/src/charts/StackedArea.d.ts +14 -0
- package/types/src/charts/Tree.d.ts +33 -0
- package/types/src/charts/Treemap.d.ts +51 -0
- package/types/src/charts/Viz.d.ts +402 -0
- package/types/src/charts/drawSteps/drawAttribution.d.ts +7 -0
- package/types/src/charts/drawSteps/drawBack.d.ts +6 -0
- package/types/src/charts/drawSteps/drawColorScale.d.ts +6 -0
- package/types/src/charts/drawSteps/drawLegend.d.ts +12 -0
- package/types/src/charts/drawSteps/drawSubtitle.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTimeline.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTitle.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTotal.d.ts +7 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +7 -0
- package/types/src/charts/events/click.legend.d.ts +8 -0
- package/types/src/charts/events/click.shape.d.ts +8 -0
- package/types/src/charts/events/mouseenter.d.ts +8 -0
- package/types/src/charts/events/mouseleave.d.ts +8 -0
- package/types/src/charts/events/mousemove.legend.d.ts +9 -0
- package/types/src/charts/events/mousemove.shape.d.ts +9 -0
- package/types/src/charts/events/touchstart.body.d.ts +7 -0
- package/types/src/charts/helpers/matrixData.d.ts +11 -0
- package/types/src/charts/helpers/tileAttributions.d.ts +6 -0
- package/types/src/charts/index.d.ts +21 -0
- package/types/src/charts/plotBuffers/Bar.d.ts +16 -0
- package/types/src/charts/plotBuffers/Box.d.ts +16 -0
- package/types/src/charts/plotBuffers/Circle.d.ts +20 -0
- package/types/src/charts/plotBuffers/Line.d.ts +16 -0
- package/types/src/charts/plotBuffers/Rect.d.ts +19 -0
- package/types/src/charts/plotBuffers/discreteBuffer.d.ts +7 -0
- package/types/src/charts/plotBuffers/numericBuffer.d.ts +5 -0
- package/types/src/components/Axis.d.ts +309 -0
- package/types/src/components/AxisBottom.d.ts +11 -0
- package/types/src/components/AxisLeft.d.ts +11 -0
- package/types/src/components/AxisRight.d.ts +11 -0
- package/types/src/components/AxisTop.d.ts +11 -0
- package/types/src/components/ColorScale.d.ts +208 -0
- package/types/src/components/Legend.d.ts +157 -0
- package/types/src/components/Message.d.ts +40 -0
- package/types/src/components/TextBox.d.ts +278 -0
- package/types/src/components/Timeline.d.ts +157 -0
- package/types/src/components/Tooltip.d.ts +297 -0
- package/types/src/components/index.d.ts +11 -0
- package/types/src/shapes/Area.d.ts +81 -0
- package/types/src/shapes/Bar.d.ts +104 -0
- package/types/src/shapes/Box.d.ts +121 -0
- package/types/src/shapes/Circle.d.ts +44 -0
- package/types/src/shapes/Image.d.ts +124 -0
- package/types/src/shapes/Line.d.ts +48 -0
- package/types/src/shapes/Path.d.ts +38 -0
- package/types/src/shapes/Rect.d.ts +54 -0
- package/types/src/shapes/Shape.d.ts +378 -0
- package/types/src/shapes/Whisker.d.ts +96 -0
- package/types/src/shapes/index.d.ts +10 -0
- package/types/src/utils/AccessorFn.d.ts +6 -0
- package/types/src/utils/BaseClass.d.ts +76 -0
- package/types/src/utils/D3plusConfig.d.ts +164 -0
- package/types/src/utils/RESET.d.ts +3 -0
- package/types/src/utils/accessor.d.ts +13 -0
- package/types/src/utils/configPrep.d.ts +28 -0
- package/types/src/utils/constant.d.ts +11 -0
- package/types/src/utils/getProp.d.ts +9 -0
- package/types/src/utils/index.d.ts +8 -0
- package/umd/d3plus-core.full.js +20134 -18708
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +2922 -5396
- package/umd/d3plus-core.js +1927 -4081
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1607 -3939
- package/es/src/utils/uuid.js +0 -13
package/es/src/charts/Rings.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
1
9
|
function _assert_this_initialized(self) {
|
|
2
10
|
if (self === void 0) {
|
|
3
11
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -63,12 +71,40 @@ function _inherits(subClass, superClass) {
|
|
|
63
71
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
64
72
|
}
|
|
65
73
|
function _instanceof(left, right) {
|
|
74
|
+
"@swc/helpers - instanceof";
|
|
66
75
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
67
76
|
return !!right[Symbol.hasInstance](left);
|
|
68
77
|
} else {
|
|
69
78
|
return left instanceof right;
|
|
70
79
|
}
|
|
71
80
|
}
|
|
81
|
+
function _iterable_to_array_limit(arr, i) {
|
|
82
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
83
|
+
if (_i == null) return;
|
|
84
|
+
var _arr = [];
|
|
85
|
+
var _n = true;
|
|
86
|
+
var _d = false;
|
|
87
|
+
var _s, _e;
|
|
88
|
+
try {
|
|
89
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
90
|
+
_arr.push(_s.value);
|
|
91
|
+
if (i && _arr.length === i) break;
|
|
92
|
+
}
|
|
93
|
+
} catch (err) {
|
|
94
|
+
_d = true;
|
|
95
|
+
_e = err;
|
|
96
|
+
} finally{
|
|
97
|
+
try {
|
|
98
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
99
|
+
} finally{
|
|
100
|
+
if (_d) throw _e;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return _arr;
|
|
104
|
+
}
|
|
105
|
+
function _non_iterable_rest() {
|
|
106
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
107
|
+
}
|
|
72
108
|
function _possible_constructor_return(self, call) {
|
|
73
109
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
74
110
|
return call;
|
|
@@ -82,6 +118,9 @@ function _set_prototype_of(o, p) {
|
|
|
82
118
|
};
|
|
83
119
|
return _set_prototype_of(o, p);
|
|
84
120
|
}
|
|
121
|
+
function _sliced_to_array(arr, i) {
|
|
122
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
123
|
+
}
|
|
85
124
|
function _super_prop_base(object, property) {
|
|
86
125
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
87
126
|
object = _get_prototype_of(object);
|
|
@@ -93,6 +132,14 @@ function _type_of(obj) {
|
|
|
93
132
|
"@swc/helpers - typeof";
|
|
94
133
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
95
134
|
}
|
|
135
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
136
|
+
if (!o) return;
|
|
137
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
138
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
139
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
140
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
141
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
142
|
+
}
|
|
96
143
|
function _is_native_reflect_construct() {
|
|
97
144
|
try {
|
|
98
145
|
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
@@ -101,11 +148,10 @@ function _is_native_reflect_construct() {
|
|
|
101
148
|
return !!result;
|
|
102
149
|
})();
|
|
103
150
|
}
|
|
104
|
-
import { extent, max, min } from "d3-array";
|
|
105
|
-
import { nest } from "d3-collection";
|
|
151
|
+
import { extent, groups, max, min } from "d3-array";
|
|
106
152
|
import * as scales from "d3-scale";
|
|
107
|
-
import { assign, elem } from "@d3plus/dom";
|
|
108
|
-
import {
|
|
153
|
+
import { assign, backgroundColor, elem } from "@d3plus/dom";
|
|
154
|
+
import { colorContrast } from "@d3plus/color";
|
|
109
155
|
import { addToQueue } from "@d3plus/data";
|
|
110
156
|
import * as shapes from "../shapes/index.js";
|
|
111
157
|
import { accessor, configPrep, constant } from "../utils/index.js";
|
|
@@ -182,7 +228,7 @@ var Rings = /*#__PURE__*/ function(Viz) {
|
|
|
182
228
|
_this._sizeScale = "sqrt";
|
|
183
229
|
_this._shape = constant("Circle");
|
|
184
230
|
_this._shapeConfig = assign(_this._shapeConfig, {
|
|
185
|
-
ariaLabel: function(d, i) {
|
|
231
|
+
ariaLabel: function ariaLabel(d, i) {
|
|
186
232
|
var validSize = _this._size ? ", ".concat(_this._size(d, i)) : "";
|
|
187
233
|
return "".concat(_this._drawLabel(d, i)).concat(validSize, ".");
|
|
188
234
|
},
|
|
@@ -208,7 +254,7 @@ var Rings = /*#__PURE__*/ function(Viz) {
|
|
|
208
254
|
/**
|
|
209
255
|
Extends the draw behavior of the abstract Viz class.
|
|
210
256
|
@private
|
|
211
|
-
|
|
257
|
+
*/ key: "_draw",
|
|
212
258
|
value: function _draw(callback) {
|
|
213
259
|
var _this = this;
|
|
214
260
|
_get(_get_prototype_of(Rings.prototype), "_draw", this).call(this, callback);
|
|
@@ -276,21 +322,21 @@ var Rings = /*#__PURE__*/ function(Viz) {
|
|
|
276
322
|
return map;
|
|
277
323
|
}, {});
|
|
278
324
|
var duration = this._duration, height = this._height - this._margin.top - this._margin.bottom, transform = "translate(".concat(this._margin.left, ", ").concat(this._margin.top, ")"), width = this._width - this._margin.left - this._margin.right;
|
|
279
|
-
var edges = [], radius = min([
|
|
325
|
+
var edges = [], radius = (min([
|
|
280
326
|
height,
|
|
281
327
|
width
|
|
282
|
-
]) / 2, ringWidth = radius / 3;
|
|
328
|
+
]) || 0) / 2, ringWidth = radius / 3;
|
|
283
329
|
var primaryRing = ringWidth, secondaryRing = ringWidth * 2;
|
|
284
330
|
var center = nodeLookup[this._center];
|
|
285
331
|
center.x = width / 2;
|
|
286
332
|
center.y = height / 2;
|
|
287
333
|
center.r = this._sizeMin ? max([
|
|
288
334
|
this._sizeMin,
|
|
289
|
-
primaryRing * .65
|
|
335
|
+
primaryRing * 0.65
|
|
290
336
|
]) : this._sizeMax ? min([
|
|
291
337
|
this._sizeMax,
|
|
292
|
-
primaryRing * .65
|
|
293
|
-
]) : primaryRing * .65;
|
|
338
|
+
primaryRing * 0.65
|
|
339
|
+
]) : primaryRing * 0.65;
|
|
294
340
|
var claimed = [
|
|
295
341
|
center
|
|
296
342
|
], primaries = [];
|
|
@@ -350,20 +396,20 @@ var Rings = /*#__PURE__*/ function(Viz) {
|
|
|
350
396
|
primaryMax = min([
|
|
351
397
|
primaryDistance / 2,
|
|
352
398
|
8
|
|
353
|
-
]);
|
|
399
|
+
]) || 0;
|
|
354
400
|
}
|
|
355
401
|
var secondaryMax = secondaryDistance / 2 - 4;
|
|
356
402
|
if (secondaryDistance / 2 - 4 < 4) {
|
|
357
403
|
secondaryMax = min([
|
|
358
404
|
secondaryDistance / 2,
|
|
359
405
|
4
|
|
360
|
-
]);
|
|
406
|
+
]) || 0;
|
|
361
407
|
}
|
|
362
408
|
if (secondaryMax > ringWidth / 10) {
|
|
363
409
|
secondaryMax = ringWidth / 10;
|
|
364
410
|
}
|
|
365
411
|
if (secondaryMax > primaryMax && secondaryMax > 10) {
|
|
366
|
-
secondaryMax = primaryMax * .75;
|
|
412
|
+
secondaryMax = primaryMax * 0.75;
|
|
367
413
|
}
|
|
368
414
|
if (primaryMax > secondaryMax * 1.5) {
|
|
369
415
|
primaryMax = secondaryMax * 1.5;
|
|
@@ -554,28 +600,28 @@ var Rings = /*#__PURE__*/ function(Viz) {
|
|
|
554
600
|
}).node()).render());
|
|
555
601
|
var that = this;
|
|
556
602
|
var shapeConfig = {
|
|
557
|
-
label: function(d) {
|
|
603
|
+
label: function label(d) {
|
|
558
604
|
return nodes.length <= _this._dataCutoff || _this._hover && _this._hover(d) || _this._active && _this._active(d) ? _this._drawLabel(d.data || d.node, d.i) : false;
|
|
559
605
|
},
|
|
560
|
-
labelBounds: function(d) {
|
|
606
|
+
labelBounds: function labelBounds(d) {
|
|
561
607
|
return d.labelBounds;
|
|
562
608
|
},
|
|
563
609
|
labelConfig: {
|
|
564
|
-
fontColor: function(d) {
|
|
565
|
-
return d.id === _this._center ? configPrep.bind(that)(that._shapeConfig, "shape", d.key).labelConfig.fontColor(d) :
|
|
610
|
+
fontColor: function fontColor(d) {
|
|
611
|
+
return d.id === _this._center ? configPrep.bind(that)(that._shapeConfig, "shape", d.key).labelConfig.fontColor(d) : colorContrast(_this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)");
|
|
566
612
|
},
|
|
567
|
-
fontResize: function(d) {
|
|
613
|
+
fontResize: function fontResize(d) {
|
|
568
614
|
return d.id === _this._center;
|
|
569
615
|
},
|
|
570
616
|
padding: 0,
|
|
571
|
-
textAnchor: function(d) {
|
|
617
|
+
textAnchor: function textAnchor(d) {
|
|
572
618
|
return nodeLookup[d.id].textAnchor || configPrep.bind(that)(that._shapeConfig, "shape", d.key).labelConfig.textAnchor;
|
|
573
619
|
},
|
|
574
|
-
verticalAlign: function(d) {
|
|
620
|
+
verticalAlign: function verticalAlign(d) {
|
|
575
621
|
return d.id === _this._center ? "middle" : "top";
|
|
576
622
|
}
|
|
577
623
|
},
|
|
578
|
-
rotate: function(d) {
|
|
624
|
+
rotate: function rotate(d) {
|
|
579
625
|
return nodeLookup[d.id].rotate || 0;
|
|
580
626
|
},
|
|
581
627
|
select: elem("g.d3plus-rings-nodes", {
|
|
@@ -589,32 +635,27 @@ var Rings = /*#__PURE__*/ function(Viz) {
|
|
|
589
635
|
}
|
|
590
636
|
}).node()
|
|
591
637
|
};
|
|
592
|
-
|
|
638
|
+
groups(nodes, function(d) {
|
|
593
639
|
return d.shape;
|
|
594
|
-
}).
|
|
595
|
-
|
|
640
|
+
}).forEach(function(param) {
|
|
641
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], values = _param[1];
|
|
642
|
+
_this._shapes.push(new shapes[key]().config(configPrep.bind(_this)(_this._shapeConfig, "shape", key)).config(shapeConfig).data(values).render());
|
|
596
643
|
});
|
|
597
644
|
return this;
|
|
598
645
|
}
|
|
599
646
|
},
|
|
600
647
|
{
|
|
601
648
|
/**
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
@param {String}
|
|
605
|
-
@chainable
|
|
606
|
-
*/ key: "center",
|
|
649
|
+
The center node, specified by id.
|
|
650
|
+
*/ key: "center",
|
|
607
651
|
value: function center(_) {
|
|
608
652
|
return arguments.length ? (this._center = _, this) : this._center;
|
|
609
653
|
}
|
|
610
654
|
},
|
|
611
655
|
{
|
|
612
656
|
/**
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
@param {Function} [*value*]
|
|
616
|
-
@chainable
|
|
617
|
-
*/ key: "hover",
|
|
657
|
+
The hover callback function for highlighting shapes on mouseover.
|
|
658
|
+
*/ key: "hover",
|
|
618
659
|
value: function hover(_) {
|
|
619
660
|
this._hover = _;
|
|
620
661
|
this._shapes.forEach(function(s) {
|
|
@@ -626,17 +667,14 @@ var Rings = /*#__PURE__*/ function(Viz) {
|
|
|
626
667
|
},
|
|
627
668
|
{
|
|
628
669
|
/**
|
|
629
|
-
|
|
630
|
-
@desc A predefined *Array* of edges that connect each object passed to the [node](#Rings.node) method. The `source` and `target` keys in each link need to map to the nodes in one of three ways:
|
|
670
|
+
A predefined *Array* of edges that connect each object passed to the [node](#Rings.node) method. The `source` and `target` keys in each link need to map to the nodes in one of three ways:
|
|
631
671
|
1. The index of the node in the nodes array (as in [this](http://d3plus.org/examples/d3plus-network/getting-started/) example).
|
|
632
672
|
2. The actual node *Object* itself.
|
|
633
673
|
3. A *String* value matching the `id` of the node.
|
|
634
674
|
|
|
635
675
|
The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded. An optional 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 links *Array*.
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
@chainable
|
|
639
|
-
*/ key: "links",
|
|
676
|
+
@param f Array of link objects or a URL to load links from.
|
|
677
|
+
*/ key: "links",
|
|
640
678
|
value: function links(_, f) {
|
|
641
679
|
if (arguments.length) {
|
|
642
680
|
addToQueue.bind(this)(_, f, "links");
|
|
@@ -647,44 +685,32 @@ The value passed should either be an *Array* of data or a *String* representing
|
|
|
647
685
|
},
|
|
648
686
|
{
|
|
649
687
|
/**
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
@param {Function|Name} [*value* = 1]
|
|
653
|
-
@chainable
|
|
654
|
-
*/ key: "linkSize",
|
|
688
|
+
Defines the thickness of the links connecting each node. The value provided can be either a pixel Number to be used for all links, or an accessor function that returns a specific data value to be used in an automatically calculated linear scale.
|
|
689
|
+
*/ key: "linkSize",
|
|
655
690
|
value: function linkSize(_) {
|
|
656
691
|
return arguments.length ? (this._linkSize = typeof _ === "function" ? _ : constant(_), this) : this._linkSize;
|
|
657
692
|
}
|
|
658
693
|
},
|
|
659
694
|
{
|
|
660
695
|
/**
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
@param {Number} [*value* = 2]
|
|
664
|
-
@chainable
|
|
665
|
-
*/ key: "linkSizeMin",
|
|
696
|
+
Defines the minimum pixel stroke width used in link sizing.
|
|
697
|
+
*/ key: "linkSizeMin",
|
|
666
698
|
value: function linkSizeMin(_) {
|
|
667
699
|
return arguments.length ? (this._linkSizeMin = _, this) : this._linkSizeMin;
|
|
668
700
|
}
|
|
669
701
|
},
|
|
670
702
|
{
|
|
671
703
|
/**
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
@param {String} [*value* = "sqrt"]
|
|
675
|
-
@chainable
|
|
676
|
-
*/ key: "linkSizeScale",
|
|
704
|
+
The type of [continuous d3-scale](https://github.com/d3/d3-scale#continuous-scales) used when calculating the pixel size of links in the network.
|
|
705
|
+
*/ key: "linkSizeScale",
|
|
677
706
|
value: function linkSizeScale(_) {
|
|
678
707
|
return arguments.length ? (this._linkSizeScale = _, this) : this._linkSizeScale;
|
|
679
708
|
}
|
|
680
709
|
},
|
|
681
710
|
{
|
|
682
711
|
/**
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
@param {String|Function|Array} [*value* = undefined]
|
|
686
|
-
@chainable
|
|
687
|
-
*/ key: "nodeGroupBy",
|
|
712
|
+
The node group accessor(s). This method overrides the default .groupBy() function from being used with the data passed to .nodes().
|
|
713
|
+
*/ key: "nodeGroupBy",
|
|
688
714
|
value: function nodeGroupBy(_) {
|
|
689
715
|
var _this = this;
|
|
690
716
|
if (!arguments.length) return this._nodeGroupBy;
|
|
@@ -707,14 +733,11 @@ The value passed should either be an *Array* of data or a *String* representing
|
|
|
707
733
|
},
|
|
708
734
|
{
|
|
709
735
|
/**
|
|
710
|
-
|
|
711
|
-
@desc The list of nodes to be used for drawing the rings network. The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded.
|
|
736
|
+
The list of nodes to be used for drawing the rings network. The value passed should either be an *Array* of data or a *String* representing a filepath or URL to be loaded.
|
|
712
737
|
|
|
713
738
|
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 node *Array*.
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
@chainable
|
|
717
|
-
*/ key: "nodes",
|
|
739
|
+
@param f Array of node objects or a URL to load nodes from.
|
|
740
|
+
*/ key: "nodes",
|
|
718
741
|
value: function nodes(_, f) {
|
|
719
742
|
if (arguments.length) {
|
|
720
743
|
addToQueue.bind(this)(_, f, "nodes");
|
|
@@ -725,44 +748,32 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
725
748
|
},
|
|
726
749
|
{
|
|
727
750
|
/**
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
@param {Function|String} [*value*]
|
|
731
|
-
@chainable
|
|
732
|
-
*/ key: "size",
|
|
751
|
+
The size accessor for each node in the rings layout.
|
|
752
|
+
*/ key: "size",
|
|
733
753
|
value: function size(_) {
|
|
734
754
|
return arguments.length ? (this._size = typeof _ === "function" || !_ ? _ : accessor(_), this) : this._size;
|
|
735
755
|
}
|
|
736
756
|
},
|
|
737
757
|
{
|
|
738
758
|
/**
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
@param {Number} [*value*]
|
|
742
|
-
@chainable
|
|
743
|
-
*/ key: "sizeMax",
|
|
759
|
+
The size scale maximum. By default, the maximum size is determined by half the distance of the two closest nodes.
|
|
760
|
+
*/ key: "sizeMax",
|
|
744
761
|
value: function sizeMax(_) {
|
|
745
762
|
return arguments.length ? (this._sizeMax = _, this) : this._sizeMax;
|
|
746
763
|
}
|
|
747
764
|
},
|
|
748
765
|
{
|
|
749
766
|
/**
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
@param {Number} [*value* = 5]
|
|
753
|
-
@chainable
|
|
754
|
-
*/ key: "sizeMin",
|
|
767
|
+
The size scale minimum.
|
|
768
|
+
*/ key: "sizeMin",
|
|
755
769
|
value: function sizeMin(_) {
|
|
756
770
|
return arguments.length ? (this._sizeMin = _, this) : this._sizeMin;
|
|
757
771
|
}
|
|
758
772
|
},
|
|
759
773
|
{
|
|
760
774
|
/**
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
@param {String} [*value* = "sqrt"]
|
|
764
|
-
@chainable
|
|
765
|
-
*/ key: "sizeScale",
|
|
775
|
+
The size scale.
|
|
776
|
+
*/ key: "sizeScale",
|
|
766
777
|
value: function sizeScale(_) {
|
|
767
778
|
return arguments.length ? (this._sizeScale = _, this) : this._sizeScale;
|
|
768
779
|
}
|
|
@@ -771,7 +782,5 @@ Additionally, a custom formatting function can be passed as a second argument to
|
|
|
771
782
|
return Rings;
|
|
772
783
|
}(Viz);
|
|
773
784
|
/**
|
|
774
|
-
|
|
775
|
-
@extends Viz
|
|
776
|
-
@desc Creates a ring visualization based on a defined set of nodes and edges. [Click here](http://d3plus.org/examples/d3plus-network/simple-rings/) for help getting started using the Rings class.
|
|
785
|
+
Creates a ring visualization based on a defined set of nodes and edges. [Click here](http://d3plus.org/examples/d3plus-network/simple-rings/) for help getting started using the Rings class.
|
|
777
786
|
*/ export { Rings as default };
|