@d3plus/core 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6219 -0
- package/es/index.js +4 -0
- package/es/src/charts/AreaPlot.js +86 -0
- package/es/src/charts/BarChart.js +93 -0
- package/es/src/charts/BoxWhisker.js +97 -0
- package/es/src/charts/BumpChart.js +148 -0
- package/es/src/charts/Donut.js +84 -0
- package/es/src/charts/Geomap.js +833 -0
- package/es/src/charts/LinePlot.js +84 -0
- package/es/src/charts/Matrix.js +358 -0
- package/es/src/charts/Network.js +787 -0
- package/es/src/charts/Pack.js +318 -0
- package/es/src/charts/Pie.js +242 -0
- package/es/src/charts/Plot.js +2212 -0
- package/es/src/charts/Priestley.js +312 -0
- package/es/src/charts/Radar.js +365 -0
- package/es/src/charts/RadialMatrix.js +393 -0
- package/es/src/charts/Rings.js +777 -0
- package/es/src/charts/Sankey.js +413 -0
- package/es/src/charts/StackedArea.js +80 -0
- package/es/src/charts/Tree.js +312 -0
- package/es/src/charts/Treemap.js +406 -0
- package/es/src/charts/Viz.js +2017 -0
- package/es/src/charts/drawSteps/drawAttribution.js +14 -0
- package/es/src/charts/drawSteps/drawBack.js +23 -0
- package/es/src/charts/drawSteps/drawColorScale.js +69 -0
- package/es/src/charts/drawSteps/drawLegend.js +120 -0
- package/es/src/charts/drawSteps/drawSubtitle.js +31 -0
- package/es/src/charts/drawSteps/drawTimeline.js +80 -0
- package/es/src/charts/drawSteps/drawTitle.js +31 -0
- package/es/src/charts/drawSteps/drawTotal.js +32 -0
- package/es/src/charts/drawSteps/zoomControls.js +254 -0
- package/es/src/charts/events/click.legend.js +76 -0
- package/es/src/charts/events/click.shape.js +26 -0
- package/es/src/charts/events/mouseenter.js +31 -0
- package/es/src/charts/events/mouseleave.js +21 -0
- package/es/src/charts/events/mousemove.legend.js +64 -0
- package/es/src/charts/events/mousemove.shape.js +42 -0
- package/es/src/charts/events/touchstart.body.js +7 -0
- package/es/src/charts/helpers/matrixData.js +104 -0
- package/es/src/charts/helpers/tileAttributions.js +34 -0
- package/es/src/charts/index.js +21 -0
- package/es/src/charts/plotBuffers/Bar.js +65 -0
- package/es/src/charts/plotBuffers/Box.js +60 -0
- package/es/src/charts/plotBuffers/Circle.js +39 -0
- package/es/src/charts/plotBuffers/Line.js +30 -0
- package/es/src/charts/plotBuffers/Rect.js +40 -0
- package/es/src/charts/plotBuffers/discreteBuffer.js +24 -0
- package/es/src/charts/plotBuffers/numericBuffer.js +111 -0
- package/es/src/components/Axis.js +1567 -0
- package/es/src/components/AxisBottom.js +77 -0
- package/es/src/components/AxisLeft.js +77 -0
- package/es/src/components/AxisRight.js +77 -0
- package/es/src/components/AxisTop.js +77 -0
- package/es/src/components/ColorScale.js +958 -0
- package/es/src/components/Legend.js +673 -0
- package/es/src/components/Message.js +95 -0
- package/es/src/components/TextBox.js +752 -0
- package/es/src/components/Timeline.js +760 -0
- package/es/src/components/Tooltip.js +726 -0
- package/es/src/components/index.js +11 -0
- package/es/src/shapes/Area.js +361 -0
- package/es/src/shapes/Bar.js +342 -0
- package/es/src/shapes/Box.js +482 -0
- package/es/src/shapes/Circle.js +201 -0
- package/es/src/shapes/Image.js +255 -0
- package/es/src/shapes/Line.js +289 -0
- package/es/src/shapes/Path.js +186 -0
- package/es/src/shapes/Rect.js +215 -0
- package/es/src/shapes/Shape.js +1156 -0
- package/es/src/shapes/Whisker.js +330 -0
- package/es/src/shapes/index.js +10 -0
- package/es/src/utils/BaseClass.js +204 -0
- package/es/src/utils/RESET.js +4 -0
- package/es/src/utils/accessor.js +19 -0
- package/es/src/utils/configPrep.js +76 -0
- package/es/src/utils/constant.js +15 -0
- package/es/src/utils/getProp.js +9 -0
- package/es/src/utils/index.js +7 -0
- package/es/src/utils/uuid.js +13 -0
- package/package.json +68 -0
- package/umd/d3plus-core.full.js +56459 -0
- package/umd/d3plus-core.full.js.map +1 -0
- package/umd/d3plus-core.full.min.js +7241 -0
- package/umd/d3plus-core.js +14422 -0
- package/umd/d3plus-core.js.map +1 -0
- package/umd/d3plus-core.min.js +4564 -0
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
function _assert_this_initialized(self) {
|
|
2
|
+
if (self === void 0) {
|
|
3
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
+
}
|
|
5
|
+
return self;
|
|
6
|
+
}
|
|
7
|
+
function _call_super(_this, derived, args) {
|
|
8
|
+
derived = _get_prototype_of(derived);
|
|
9
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
|
+
}
|
|
11
|
+
function _class_call_check(instance, Constructor) {
|
|
12
|
+
if (!(instance instanceof Constructor)) {
|
|
13
|
+
throw new TypeError("Cannot call a class as a function");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _defineProperties(target, props) {
|
|
17
|
+
for(var i = 0; i < props.length; i++){
|
|
18
|
+
var descriptor = props[i];
|
|
19
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
20
|
+
descriptor.configurable = true;
|
|
21
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
22
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
26
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
27
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
28
|
+
return Constructor;
|
|
29
|
+
}
|
|
30
|
+
function _get(target, property, receiver) {
|
|
31
|
+
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
32
|
+
_get = Reflect.get;
|
|
33
|
+
} else {
|
|
34
|
+
_get = function get(target, property, receiver) {
|
|
35
|
+
var base = _super_prop_base(target, property);
|
|
36
|
+
if (!base) return;
|
|
37
|
+
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
38
|
+
if (desc.get) {
|
|
39
|
+
return desc.get.call(receiver || target);
|
|
40
|
+
}
|
|
41
|
+
return desc.value;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
return _get(target, property, receiver || target);
|
|
45
|
+
}
|
|
46
|
+
function _get_prototype_of(o) {
|
|
47
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
48
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
49
|
+
};
|
|
50
|
+
return _get_prototype_of(o);
|
|
51
|
+
}
|
|
52
|
+
function _inherits(subClass, superClass) {
|
|
53
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
54
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
55
|
+
}
|
|
56
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
57
|
+
constructor: {
|
|
58
|
+
value: subClass,
|
|
59
|
+
writable: true,
|
|
60
|
+
configurable: true
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
64
|
+
}
|
|
65
|
+
function _instanceof(left, right) {
|
|
66
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
67
|
+
return !!right[Symbol.hasInstance](left);
|
|
68
|
+
} else {
|
|
69
|
+
return left instanceof right;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function _possible_constructor_return(self, call) {
|
|
73
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
74
|
+
return call;
|
|
75
|
+
}
|
|
76
|
+
return _assert_this_initialized(self);
|
|
77
|
+
}
|
|
78
|
+
function _set_prototype_of(o, p) {
|
|
79
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
80
|
+
o.__proto__ = p;
|
|
81
|
+
return o;
|
|
82
|
+
};
|
|
83
|
+
return _set_prototype_of(o, p);
|
|
84
|
+
}
|
|
85
|
+
function _super_prop_base(object, property) {
|
|
86
|
+
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
87
|
+
object = _get_prototype_of(object);
|
|
88
|
+
if (object === null) break;
|
|
89
|
+
}
|
|
90
|
+
return object;
|
|
91
|
+
}
|
|
92
|
+
function _type_of(obj) {
|
|
93
|
+
"@swc/helpers - typeof";
|
|
94
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
95
|
+
}
|
|
96
|
+
function _is_native_reflect_construct() {
|
|
97
|
+
try {
|
|
98
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
99
|
+
} catch (_) {}
|
|
100
|
+
return (_is_native_reflect_construct = function() {
|
|
101
|
+
return !!result;
|
|
102
|
+
})();
|
|
103
|
+
}
|
|
104
|
+
import { min } from "d3-array";
|
|
105
|
+
import { arc } from "d3-shape";
|
|
106
|
+
import { assign, elem } from "@d3plus/dom";
|
|
107
|
+
import { Path } from "../shapes/index.js";
|
|
108
|
+
import { TextBox } from "../components/index.js";
|
|
109
|
+
import { accessor, configPrep, constant, getProp } from "../utils/index.js";
|
|
110
|
+
import Viz from "./Viz.js";
|
|
111
|
+
import prepData from "./helpers/matrixData.js";
|
|
112
|
+
var tau = Math.PI * 2;
|
|
113
|
+
var RadialMatrix = /*#__PURE__*/ function(Viz) {
|
|
114
|
+
"use strict";
|
|
115
|
+
_inherits(RadialMatrix, Viz);
|
|
116
|
+
function RadialMatrix() {
|
|
117
|
+
_class_call_check(this, RadialMatrix);
|
|
118
|
+
var _this;
|
|
119
|
+
_this = _call_super(this, RadialMatrix);
|
|
120
|
+
_this._cellPadding = 2;
|
|
121
|
+
_this._column = accessor("column");
|
|
122
|
+
_this._columnConfig = {
|
|
123
|
+
shapeConfig: {
|
|
124
|
+
labelConfig: {
|
|
125
|
+
fontColor: "#000",
|
|
126
|
+
padding: 5,
|
|
127
|
+
textAnchor: function(d) {
|
|
128
|
+
return [
|
|
129
|
+
0,
|
|
130
|
+
180
|
|
131
|
+
].includes(d.angle) ? "middle" : [
|
|
132
|
+
2,
|
|
133
|
+
3
|
|
134
|
+
].includes(d.quadrant) ? "end" : "start";
|
|
135
|
+
},
|
|
136
|
+
verticalAlign: function(d) {
|
|
137
|
+
return [
|
|
138
|
+
90,
|
|
139
|
+
270
|
|
140
|
+
].includes(d.angle) ? "middle" : [
|
|
141
|
+
2,
|
|
142
|
+
1
|
|
143
|
+
].includes(d.quadrant) ? "bottom" : "top";
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
_this._columnSort = function(a, b) {
|
|
149
|
+
return "".concat(a).localeCompare("".concat(b));
|
|
150
|
+
};
|
|
151
|
+
_this._innerRadius = function(radius) {
|
|
152
|
+
return radius / 5;
|
|
153
|
+
};
|
|
154
|
+
_this._label = function(d, i) {
|
|
155
|
+
return "".concat(getProp.bind(_this)("row", d, i), " / ").concat(getProp.bind(_this)("column", d, i));
|
|
156
|
+
};
|
|
157
|
+
var defaultMouseMoveShape = _this._on["mousemove.shape"];
|
|
158
|
+
_this._on["mousemove.shape"] = function(d, i, x, event) {
|
|
159
|
+
defaultMouseMoveShape(d, i, x, event);
|
|
160
|
+
var row = getProp.bind(_this)("row", d, i);
|
|
161
|
+
var column = getProp.bind(_this)("column", d, i);
|
|
162
|
+
_this.hover(function(h, ii) {
|
|
163
|
+
return getProp.bind(_this)("row", h, ii) === row || getProp.bind(_this)("column", h, ii) === column;
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
_this._row = accessor("row");
|
|
167
|
+
_this._rowSort = function(a, b) {
|
|
168
|
+
return "".concat(a).localeCompare("".concat(b));
|
|
169
|
+
};
|
|
170
|
+
_this._columnLabels = new TextBox();
|
|
171
|
+
return _this;
|
|
172
|
+
}
|
|
173
|
+
_create_class(RadialMatrix, [
|
|
174
|
+
{
|
|
175
|
+
/**
|
|
176
|
+
@memberof RadialMatrix
|
|
177
|
+
@desc Extends the draw behavior of the abstract Viz class.
|
|
178
|
+
@private
|
|
179
|
+
*/ key: "_draw",
|
|
180
|
+
value: function _draw(callback) {
|
|
181
|
+
var _this = this;
|
|
182
|
+
var _prepData_bind = prepData.bind(this)(this._filteredData), rowValues = _prepData_bind.rowValues, columnValues = _prepData_bind.columnValues, shapeData = _prepData_bind.shapeData;
|
|
183
|
+
if (!rowValues.length || !columnValues.length) return this;
|
|
184
|
+
_get(_get_prototype_of(RadialMatrix.prototype), "_draw", this).call(this, callback);
|
|
185
|
+
var height = this._height - this._margin.top - this._margin.bottom, parent = this._select, transition = this._transition, width = this._width - this._margin.left - this._margin.right;
|
|
186
|
+
var labelHeight = 50, labelWidth = 100;
|
|
187
|
+
var radius = min([
|
|
188
|
+
height - labelHeight * 2,
|
|
189
|
+
width - labelWidth * 2
|
|
190
|
+
]) / 2, transform = "translate(".concat(width / 2 + this._margin.left, ", ").concat(height / 2 + this._margin.top, ")");
|
|
191
|
+
var flippedColumns = columnValues.slice().reverse();
|
|
192
|
+
flippedColumns.unshift(flippedColumns.pop());
|
|
193
|
+
var total = flippedColumns.length;
|
|
194
|
+
var labelData = flippedColumns.map(function(key, i) {
|
|
195
|
+
var radians = i / total * tau;
|
|
196
|
+
var angle = Math.round(radians * 180 / Math.PI);
|
|
197
|
+
var quadrant = Math.floor((angle + 90) / 90 % 4 + 1);
|
|
198
|
+
var xMod = [
|
|
199
|
+
0,
|
|
200
|
+
180
|
|
201
|
+
].includes(angle) ? -labelWidth / 2 : [
|
|
202
|
+
2,
|
|
203
|
+
3
|
|
204
|
+
].includes(quadrant) ? -labelWidth : 0;
|
|
205
|
+
var yMod = [
|
|
206
|
+
90,
|
|
207
|
+
270
|
|
208
|
+
].includes(angle) ? -labelHeight / 2 : [
|
|
209
|
+
2,
|
|
210
|
+
1
|
|
211
|
+
].includes(quadrant) ? -labelHeight : 0;
|
|
212
|
+
return {
|
|
213
|
+
key: key,
|
|
214
|
+
angle: angle,
|
|
215
|
+
quadrant: quadrant,
|
|
216
|
+
radians: radians,
|
|
217
|
+
x: radius * Math.sin(radians + Math.PI) + xMod,
|
|
218
|
+
y: radius * Math.cos(radians + Math.PI) + yMod
|
|
219
|
+
};
|
|
220
|
+
});
|
|
221
|
+
/**
|
|
222
|
+
* Extracts the axis config "labels" Array, if it exists, it filters
|
|
223
|
+
* the column labels by the values included in the Array.
|
|
224
|
+
*/ var displayLabels = _instanceof(this._columnConfig.labels, Array) ? labelData.filter(function(d) {
|
|
225
|
+
return _this._columnConfig.labels.includes(d.key);
|
|
226
|
+
}) : labelData;
|
|
227
|
+
this._columnLabels.data(displayLabels).x(function(d) {
|
|
228
|
+
return d.x;
|
|
229
|
+
}).y(function(d) {
|
|
230
|
+
return d.y;
|
|
231
|
+
}).text(function(d) {
|
|
232
|
+
return d.key;
|
|
233
|
+
}).width(labelWidth).height(labelHeight).config(this._columnConfig.shapeConfig.labelConfig).select(elem("g.d3plus-RadialMatrix-columns", {
|
|
234
|
+
parent: parent,
|
|
235
|
+
transition: transition,
|
|
236
|
+
enter: {
|
|
237
|
+
transform: transform
|
|
238
|
+
},
|
|
239
|
+
update: {
|
|
240
|
+
transform: transform
|
|
241
|
+
}
|
|
242
|
+
}).node()).render();
|
|
243
|
+
var innerRadius = this._innerRadius(radius);
|
|
244
|
+
var rowHeight = (radius - innerRadius) / rowValues.length;
|
|
245
|
+
var columnWidth = labelData.length > 1 ? labelData[1].radians - labelData[0].radians : tau;
|
|
246
|
+
var flippedRows = rowValues.slice().reverse();
|
|
247
|
+
var arcData = arc().padAngle(this._cellPadding / radius).innerRadius(function(d) {
|
|
248
|
+
return innerRadius + flippedRows.indexOf(d.row) * rowHeight + _this._cellPadding / 2;
|
|
249
|
+
}).outerRadius(function(d) {
|
|
250
|
+
return innerRadius + (flippedRows.indexOf(d.row) + 1) * rowHeight - _this._cellPadding / 2;
|
|
251
|
+
}).startAngle(function(d) {
|
|
252
|
+
return labelData[columnValues.indexOf(d.column)].radians - columnWidth / 2;
|
|
253
|
+
}).endAngle(function(d) {
|
|
254
|
+
return labelData[columnValues.indexOf(d.column)].radians + columnWidth / 2;
|
|
255
|
+
});
|
|
256
|
+
this._shapes.push(new Path().data(shapeData).d(arcData).select(elem("g.d3plus-RadialMatrix-arcs", {
|
|
257
|
+
parent: parent,
|
|
258
|
+
transition: transition,
|
|
259
|
+
enter: {
|
|
260
|
+
transform: transform
|
|
261
|
+
},
|
|
262
|
+
update: {
|
|
263
|
+
transform: transform
|
|
264
|
+
}
|
|
265
|
+
}).node()).config({
|
|
266
|
+
id: function(d) {
|
|
267
|
+
return _this._ids(d).join("-");
|
|
268
|
+
},
|
|
269
|
+
x: 0,
|
|
270
|
+
y: 0
|
|
271
|
+
}).config(configPrep.bind(this)(this._shapeConfig, "shape", "Path")).render());
|
|
272
|
+
return this;
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
/**
|
|
277
|
+
@memberof RadialMatrix
|
|
278
|
+
@desc The pixel padding in between each cell.
|
|
279
|
+
@param {Number} [*value* = 2]
|
|
280
|
+
*/ key: "cellPadding",
|
|
281
|
+
value: function cellPadding(_) {
|
|
282
|
+
return arguments.length ? (this._cellPadding = _, this) : this._cellPadding;
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
/**
|
|
287
|
+
@memberof RadialMatrix
|
|
288
|
+
@desc 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.
|
|
289
|
+
@param {String|Function} [*value*]
|
|
290
|
+
@example
|
|
291
|
+
function column(d) {
|
|
292
|
+
return d.name;
|
|
293
|
+
}
|
|
294
|
+
*/ key: "column",
|
|
295
|
+
value: function column(_) {
|
|
296
|
+
return arguments.length ? (this._column = typeof _ === "function" ? _ : accessor(_), this) : this._column;
|
|
297
|
+
}
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
/**
|
|
301
|
+
@memberof RadialMatrix
|
|
302
|
+
@desc A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the column labels.
|
|
303
|
+
@param {Object} *value*
|
|
304
|
+
@chainable
|
|
305
|
+
*/ key: "columnConfig",
|
|
306
|
+
value: function columnConfig(_) {
|
|
307
|
+
return arguments.length ? (this._columnConfig = assign(this._columnConfig, _), this) : this._columnConfig;
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
/**
|
|
312
|
+
@memberof RadialMatrix
|
|
313
|
+
@desc A manual list of IDs to be used for columns.
|
|
314
|
+
@param {Array} [*value*]
|
|
315
|
+
*/ key: "columnList",
|
|
316
|
+
value: function columnList(_) {
|
|
317
|
+
return arguments.length ? (this._columnList = _, this) : this._columnList;
|
|
318
|
+
}
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
/**
|
|
322
|
+
@memberof RadialMatrix
|
|
323
|
+
@desc A sort comparator function that is run on the unique set of column values.
|
|
324
|
+
@param {Function} [*value*]
|
|
325
|
+
@example
|
|
326
|
+
function column(a, b) {
|
|
327
|
+
return a.localeCompare(b);
|
|
328
|
+
}
|
|
329
|
+
*/ key: "columnSort",
|
|
330
|
+
value: function columnSort(_) {
|
|
331
|
+
return arguments.length ? (this._columnSort = _, this) : this._columnSort;
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
/**
|
|
336
|
+
@memberof RadialMatrix
|
|
337
|
+
@desc The radius (in pixels) for the inner donut hole of the diagram. Can either be a static Number, or an accessor function that receives the outer radius as it's only argument.
|
|
338
|
+
@param {Function|Number} [*value*]
|
|
339
|
+
@example
|
|
340
|
+
function(outerRadius) {
|
|
341
|
+
return outerRadius / 5;
|
|
342
|
+
}
|
|
343
|
+
*/ key: "innerRadius",
|
|
344
|
+
value: function innerRadius(_) {
|
|
345
|
+
return arguments.length ? (this._innerRadius = typeof _ === "function" ? _ : constant(_), this) : this._innerRadius;
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
/**
|
|
350
|
+
@memberof RadialMatrix
|
|
351
|
+
@desc 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.
|
|
352
|
+
@param {String|Function} [*value*]
|
|
353
|
+
@example
|
|
354
|
+
function row(d) {
|
|
355
|
+
return d.name;
|
|
356
|
+
}
|
|
357
|
+
*/ key: "row",
|
|
358
|
+
value: function row(_) {
|
|
359
|
+
return arguments.length ? (this._row = typeof _ === "function" ? _ : accessor(_), this) : this._row;
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
/**
|
|
364
|
+
@memberof RadialMatrix
|
|
365
|
+
@desc A manual list of IDs to be used for rows.
|
|
366
|
+
@param {Array} [*value*]
|
|
367
|
+
*/ key: "rowList",
|
|
368
|
+
value: function rowList(_) {
|
|
369
|
+
return arguments.length ? (this._rowList = _, this) : this._rowList;
|
|
370
|
+
}
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
/**
|
|
374
|
+
@memberof RadialMatrix
|
|
375
|
+
@desc A sort comparator function that is run on the unique set of row values.
|
|
376
|
+
@param {Function} [*value*]
|
|
377
|
+
@example
|
|
378
|
+
function row(a, b) {
|
|
379
|
+
return a.localeCompare(b);
|
|
380
|
+
}
|
|
381
|
+
*/ key: "rowSort",
|
|
382
|
+
value: function rowSort(_) {
|
|
383
|
+
return arguments.length ? (this._rowSort = _, this) : this._rowSort;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
]);
|
|
387
|
+
return RadialMatrix;
|
|
388
|
+
}(Viz);
|
|
389
|
+
/**
|
|
390
|
+
@class RadialMatrix
|
|
391
|
+
@extends Viz
|
|
392
|
+
@desc Creates a radial layout of a rows/columns Matrix of any dataset. See [this example](https://d3plus.org/examples/d3plus-matrix/radial-matrix/) for help getting started using the Matrix class.
|
|
393
|
+
*/ export { RadialMatrix as default };
|