@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,84 @@
|
|
|
1
|
+
function _assert_this_initialized(self) {
|
|
2
|
+
if (self === void 0) {
|
|
3
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
+
}
|
|
5
|
+
return self;
|
|
6
|
+
}
|
|
7
|
+
function _call_super(_this, derived, args) {
|
|
8
|
+
derived = _get_prototype_of(derived);
|
|
9
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
10
|
+
}
|
|
11
|
+
function _class_call_check(instance, Constructor) {
|
|
12
|
+
if (!(instance instanceof Constructor)) {
|
|
13
|
+
throw new TypeError("Cannot call a class as a function");
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function _get_prototype_of(o) {
|
|
17
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
18
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
19
|
+
};
|
|
20
|
+
return _get_prototype_of(o);
|
|
21
|
+
}
|
|
22
|
+
function _inherits(subClass, superClass) {
|
|
23
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
24
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
25
|
+
}
|
|
26
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
27
|
+
constructor: {
|
|
28
|
+
value: subClass,
|
|
29
|
+
writable: true,
|
|
30
|
+
configurable: true
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
34
|
+
}
|
|
35
|
+
function _possible_constructor_return(self, call) {
|
|
36
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
37
|
+
return call;
|
|
38
|
+
}
|
|
39
|
+
return _assert_this_initialized(self);
|
|
40
|
+
}
|
|
41
|
+
function _set_prototype_of(o, p) {
|
|
42
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
43
|
+
o.__proto__ = p;
|
|
44
|
+
return o;
|
|
45
|
+
};
|
|
46
|
+
return _set_prototype_of(o, p);
|
|
47
|
+
}
|
|
48
|
+
function _type_of(obj) {
|
|
49
|
+
"@swc/helpers - typeof";
|
|
50
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
51
|
+
}
|
|
52
|
+
function _is_native_reflect_construct() {
|
|
53
|
+
try {
|
|
54
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
55
|
+
} catch (_) {}
|
|
56
|
+
return (_is_native_reflect_construct = function() {
|
|
57
|
+
return !!result;
|
|
58
|
+
})();
|
|
59
|
+
}
|
|
60
|
+
import { constant } from "../utils/index.js";
|
|
61
|
+
import { default as Plot } from "./Plot.js";
|
|
62
|
+
var LinePlot = /*#__PURE__*/ function(Plot) {
|
|
63
|
+
"use strict";
|
|
64
|
+
_inherits(LinePlot, Plot);
|
|
65
|
+
function LinePlot() {
|
|
66
|
+
_class_call_check(this, LinePlot);
|
|
67
|
+
var _this;
|
|
68
|
+
_this = _call_super(this, LinePlot);
|
|
69
|
+
_this._discrete = "x";
|
|
70
|
+
_this._shape = constant("Line");
|
|
71
|
+
_this.x("x");
|
|
72
|
+
return _this;
|
|
73
|
+
}
|
|
74
|
+
return LinePlot;
|
|
75
|
+
}(Plot);
|
|
76
|
+
/**
|
|
77
|
+
@class LinePlot
|
|
78
|
+
@extends Plot
|
|
79
|
+
@desc Creates a line plot based on an array of data.
|
|
80
|
+
@example <caption>the equivalent of calling:</caption>
|
|
81
|
+
new d3plus.Plot()
|
|
82
|
+
.discrete("x")
|
|
83
|
+
.shape("Line")
|
|
84
|
+
*/ export { LinePlot as default };
|
|
@@ -0,0 +1,358 @@
|
|
|
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 _possible_constructor_return(self, call) {
|
|
66
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
67
|
+
return call;
|
|
68
|
+
}
|
|
69
|
+
return _assert_this_initialized(self);
|
|
70
|
+
}
|
|
71
|
+
function _set_prototype_of(o, p) {
|
|
72
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
73
|
+
o.__proto__ = p;
|
|
74
|
+
return o;
|
|
75
|
+
};
|
|
76
|
+
return _set_prototype_of(o, p);
|
|
77
|
+
}
|
|
78
|
+
function _super_prop_base(object, property) {
|
|
79
|
+
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
80
|
+
object = _get_prototype_of(object);
|
|
81
|
+
if (object === null) break;
|
|
82
|
+
}
|
|
83
|
+
return object;
|
|
84
|
+
}
|
|
85
|
+
function _type_of(obj) {
|
|
86
|
+
"@swc/helpers - typeof";
|
|
87
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
88
|
+
}
|
|
89
|
+
function _is_native_reflect_construct() {
|
|
90
|
+
try {
|
|
91
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
92
|
+
} catch (_) {}
|
|
93
|
+
return (_is_native_reflect_construct = function() {
|
|
94
|
+
return !!result;
|
|
95
|
+
})();
|
|
96
|
+
}
|
|
97
|
+
import { Axis } from "../components/index.js";
|
|
98
|
+
import { assign, elem } from "@d3plus/dom";
|
|
99
|
+
import { Rect } from "../shapes/index.js";
|
|
100
|
+
import { accessor, configPrep, getProp } from "../utils/index.js";
|
|
101
|
+
import Viz from "./Viz.js";
|
|
102
|
+
import prepData from "./helpers/matrixData.js";
|
|
103
|
+
var defaultAxisConfig = {
|
|
104
|
+
align: "start",
|
|
105
|
+
barConfig: {
|
|
106
|
+
stroke: 0
|
|
107
|
+
},
|
|
108
|
+
gridSize: 0,
|
|
109
|
+
padding: 5,
|
|
110
|
+
paddingInner: 0,
|
|
111
|
+
paddingOuter: 0,
|
|
112
|
+
scale: "band",
|
|
113
|
+
tickSize: 0
|
|
114
|
+
};
|
|
115
|
+
var Matrix = /*#__PURE__*/ function(Viz) {
|
|
116
|
+
"use strict";
|
|
117
|
+
_inherits(Matrix, Viz);
|
|
118
|
+
function Matrix() {
|
|
119
|
+
_class_call_check(this, Matrix);
|
|
120
|
+
var _this;
|
|
121
|
+
_this = _call_super(this, Matrix);
|
|
122
|
+
_this._cellPadding = 2;
|
|
123
|
+
_this._column = accessor("column");
|
|
124
|
+
_this._columnAxis = new Axis();
|
|
125
|
+
_this._columnConfig = assign({
|
|
126
|
+
orient: "top"
|
|
127
|
+
}, defaultAxisConfig);
|
|
128
|
+
_this._columnSort = function(a, b) {
|
|
129
|
+
return "".concat(a).localeCompare("".concat(b));
|
|
130
|
+
};
|
|
131
|
+
_this._label = function(d, i) {
|
|
132
|
+
return "".concat(getProp.bind(_this)("row", d, i), " / ").concat(getProp.bind(_this)("column", d, i));
|
|
133
|
+
};
|
|
134
|
+
var defaultMouseMoveShape = _this._on["mousemove.shape"];
|
|
135
|
+
_this._on["mousemove.shape"] = function(d, i, x, event) {
|
|
136
|
+
defaultMouseMoveShape(d, i, x, event);
|
|
137
|
+
var row = getProp.bind(_this)("row", d, i);
|
|
138
|
+
var column = getProp.bind(_this)("column", d, i);
|
|
139
|
+
_this.hover(function(h, ii) {
|
|
140
|
+
return getProp.bind(_this)("row", h, ii) === row || getProp.bind(_this)("column", h, ii) === column;
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
_this._row = accessor("row");
|
|
144
|
+
_this._rowAxis = new Axis();
|
|
145
|
+
_this._rowConfig = assign({
|
|
146
|
+
orient: "left"
|
|
147
|
+
}, defaultAxisConfig);
|
|
148
|
+
_this._rowSort = function(a, b) {
|
|
149
|
+
return "".concat(a).localeCompare("".concat(b));
|
|
150
|
+
};
|
|
151
|
+
return _this;
|
|
152
|
+
}
|
|
153
|
+
_create_class(Matrix, [
|
|
154
|
+
{
|
|
155
|
+
/**
|
|
156
|
+
@memberof Matrix
|
|
157
|
+
@desc Extends the draw behavior of the abstract Viz class.
|
|
158
|
+
@private
|
|
159
|
+
*/ key: "_draw",
|
|
160
|
+
value: function _draw(callback) {
|
|
161
|
+
var _prepData_bind = prepData.bind(this)(this._filteredData), rowValues = _prepData_bind.rowValues, columnValues = _prepData_bind.columnValues, shapeData = _prepData_bind.shapeData;
|
|
162
|
+
if (!rowValues.length || !columnValues.length) return this;
|
|
163
|
+
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;
|
|
164
|
+
var hidden = {
|
|
165
|
+
opacity: 0
|
|
166
|
+
};
|
|
167
|
+
var visible = {
|
|
168
|
+
opacity: 1
|
|
169
|
+
};
|
|
170
|
+
var columnRotation = width / columnValues.length < 120;
|
|
171
|
+
var selectElem = function(name, opts) {
|
|
172
|
+
return elem("g.d3plus-Matrix-".concat(name), Object.assign({
|
|
173
|
+
parent: parent,
|
|
174
|
+
transition: transition
|
|
175
|
+
}, opts)).node();
|
|
176
|
+
};
|
|
177
|
+
this._rowAxis.select(selectElem("row", {
|
|
178
|
+
enter: hidden,
|
|
179
|
+
update: hidden
|
|
180
|
+
})).domain(rowValues).height(height - this._margin.top - this._margin.bottom - this._padding.bottom - this._padding.top).maxSize(width / 4).width(width).config(this._rowConfig).render();
|
|
181
|
+
var rowPadding = this._rowAxis.outerBounds().width;
|
|
182
|
+
this._padding.left += rowPadding;
|
|
183
|
+
var columnTransform = "translate(0, ".concat(this._margin.top, ")");
|
|
184
|
+
var hiddenTransform = Object.assign({
|
|
185
|
+
transform: columnTransform
|
|
186
|
+
}, hidden);
|
|
187
|
+
this._columnAxis.select(selectElem("column", {
|
|
188
|
+
enter: hiddenTransform,
|
|
189
|
+
update: hiddenTransform
|
|
190
|
+
})).domain(columnValues).range([
|
|
191
|
+
this._margin.left + this._padding.left,
|
|
192
|
+
width - this._margin.right + this._padding.right
|
|
193
|
+
]).height(height).maxSize(height / 4).width(width).labelRotation(columnRotation).config(this._columnConfig).render();
|
|
194
|
+
var columnPadding = this._columnAxis.outerBounds().height;
|
|
195
|
+
this._padding.top += columnPadding;
|
|
196
|
+
_get(_get_prototype_of(Matrix.prototype), "_draw", this).call(this, callback);
|
|
197
|
+
var rowTransform = "translate(".concat(this._margin.left, ", ").concat(this._margin.top, ")");
|
|
198
|
+
columnTransform = "translate(0, ".concat(this._margin.top, ")");
|
|
199
|
+
var visibleTransform = Object.assign({
|
|
200
|
+
transform: columnTransform
|
|
201
|
+
}, visible);
|
|
202
|
+
this._rowAxis.select(selectElem("row", {
|
|
203
|
+
update: Object.assign({
|
|
204
|
+
transform: rowTransform
|
|
205
|
+
}, visible)
|
|
206
|
+
})).height(height - this._margin.top - this._margin.bottom - this._padding.bottom).maxSize(rowPadding).range([
|
|
207
|
+
columnPadding + this._columnAxis.padding(),
|
|
208
|
+
undefined
|
|
209
|
+
]).render();
|
|
210
|
+
this._columnAxis.select(selectElem("column", {
|
|
211
|
+
update: visibleTransform
|
|
212
|
+
})).range([
|
|
213
|
+
this._margin.left + this._padding.left + this._rowAxis.padding(),
|
|
214
|
+
width - this._margin.right + this._padding.right
|
|
215
|
+
]).maxSize(columnPadding).render();
|
|
216
|
+
var rowScale = this._rowAxis._getPosition.bind(this._rowAxis);
|
|
217
|
+
var columnScale = this._columnAxis._getPosition.bind(this._columnAxis);
|
|
218
|
+
var cellHeight = rowValues.length > 1 ? rowScale(rowValues[1]) - rowScale(rowValues[0]) : this._rowAxis.height();
|
|
219
|
+
var cellWidth = columnValues.length > 1 ? columnScale(columnValues[1]) - columnScale(columnValues[0]) : this._columnAxis.width();
|
|
220
|
+
var transform = "translate(0, ".concat(this._margin.top, ")");
|
|
221
|
+
var rectConfig = configPrep.bind(this)(this._shapeConfig, "shape", "Rect");
|
|
222
|
+
this._shapes.push(new Rect().data(shapeData).select(elem("g.d3plus-Matrix-cells", {
|
|
223
|
+
parent: this._select,
|
|
224
|
+
enter: {
|
|
225
|
+
transform: transform
|
|
226
|
+
},
|
|
227
|
+
update: {
|
|
228
|
+
transform: transform
|
|
229
|
+
}
|
|
230
|
+
}).node()).config({
|
|
231
|
+
height: cellHeight - this._cellPadding,
|
|
232
|
+
width: cellWidth - this._cellPadding,
|
|
233
|
+
x: function(d) {
|
|
234
|
+
return columnScale(d.column) + cellWidth / 2;
|
|
235
|
+
},
|
|
236
|
+
y: function(d) {
|
|
237
|
+
return rowScale(d.row) + cellHeight / 2;
|
|
238
|
+
}
|
|
239
|
+
}).config(rectConfig).render());
|
|
240
|
+
return this;
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
/**
|
|
245
|
+
@memberof Matrix
|
|
246
|
+
@desc The pixel padding in between each cell.
|
|
247
|
+
@param {Number} [*value* = 2]
|
|
248
|
+
*/ key: "cellPadding",
|
|
249
|
+
value: function cellPadding(_) {
|
|
250
|
+
return arguments.length ? (this._cellPadding = _, this) : this._cellPadding;
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
/**
|
|
255
|
+
@memberof Matrix
|
|
256
|
+
@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.
|
|
257
|
+
@param {String|Function} [*value*]
|
|
258
|
+
@example
|
|
259
|
+
function column(d) {
|
|
260
|
+
return d.name;
|
|
261
|
+
}
|
|
262
|
+
*/ key: "column",
|
|
263
|
+
value: function column(_) {
|
|
264
|
+
return arguments.length ? (this._column = typeof _ === "function" ? _ : accessor(_), this) : this._column;
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
/**
|
|
269
|
+
@memberof Matrix
|
|
270
|
+
@desc A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the column labels.
|
|
271
|
+
@param {Object} *value*
|
|
272
|
+
@chainable
|
|
273
|
+
*/ key: "columnConfig",
|
|
274
|
+
value: function columnConfig(_) {
|
|
275
|
+
return arguments.length ? (this._columnConfig = assign(this._columnConfig, _), this) : this._columnConfig;
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
/**
|
|
280
|
+
@memberof Matrix
|
|
281
|
+
@desc A manual list of IDs to be used for columns.
|
|
282
|
+
@param {Array} [*value*]
|
|
283
|
+
*/ key: "columnList",
|
|
284
|
+
value: function columnList(_) {
|
|
285
|
+
return arguments.length ? (this._columnList = _, this) : this._columnList;
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
/**
|
|
290
|
+
@memberof Matrix
|
|
291
|
+
@desc A sort comparator function that is run on the unique set of column values.
|
|
292
|
+
@param {Function} [*value*]
|
|
293
|
+
@example
|
|
294
|
+
function column(a, b) {
|
|
295
|
+
return a.localeCompare(b);
|
|
296
|
+
}
|
|
297
|
+
*/ key: "columnSort",
|
|
298
|
+
value: function columnSort(_) {
|
|
299
|
+
return arguments.length ? (this._columnSort = _, this) : this._columnSort;
|
|
300
|
+
}
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
/**
|
|
304
|
+
@memberof Matrix
|
|
305
|
+
@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.
|
|
306
|
+
@param {String|Function} [*value*]
|
|
307
|
+
@example
|
|
308
|
+
function row(d) {
|
|
309
|
+
return d.name;
|
|
310
|
+
}
|
|
311
|
+
*/ key: "row",
|
|
312
|
+
value: function row(_) {
|
|
313
|
+
return arguments.length ? (this._row = typeof _ === "function" ? _ : accessor(_), this) : this._row;
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
/**
|
|
318
|
+
@memberof Matrix
|
|
319
|
+
@desc A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the row labels.
|
|
320
|
+
@param {Object} *value*
|
|
321
|
+
@chainable
|
|
322
|
+
*/ key: "rowConfig",
|
|
323
|
+
value: function rowConfig(_) {
|
|
324
|
+
return arguments.length ? (this._rowConfig = assign(this._rowConfig, _), this) : this._rowConfig;
|
|
325
|
+
}
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
/**
|
|
329
|
+
@memberof Matrix
|
|
330
|
+
@desc A manual list of IDs to be used for rows.
|
|
331
|
+
@param {Array} [*value*]
|
|
332
|
+
*/ key: "rowList",
|
|
333
|
+
value: function rowList(_) {
|
|
334
|
+
return arguments.length ? (this._rowList = _, this) : this._rowList;
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
/**
|
|
339
|
+
@memberof Matrix
|
|
340
|
+
@desc A sort comparator function that is run on the unique set of row values.
|
|
341
|
+
@param {Function} [*value*]
|
|
342
|
+
@example
|
|
343
|
+
function row(a, b) {
|
|
344
|
+
return a.localeCompare(b);
|
|
345
|
+
}
|
|
346
|
+
*/ key: "rowSort",
|
|
347
|
+
value: function rowSort(_) {
|
|
348
|
+
return arguments.length ? (this._rowSort = _, this) : this._rowSort;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
]);
|
|
352
|
+
return Matrix;
|
|
353
|
+
}(Viz);
|
|
354
|
+
/**
|
|
355
|
+
@class Matrix
|
|
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.
|
|
358
|
+
*/ export { Matrix as default };
|