@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/src/charts/Treemap.js
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
|
+
}
|
|
1
12
|
function _assert_this_initialized(self) {
|
|
2
13
|
if (self === void 0) {
|
|
3
14
|
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -62,6 +73,39 @@ function _inherits(subClass, superClass) {
|
|
|
62
73
|
});
|
|
63
74
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
64
75
|
}
|
|
76
|
+
function _iterable_to_array(iter) {
|
|
77
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
78
|
+
}
|
|
79
|
+
function _iterable_to_array_limit(arr, i) {
|
|
80
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
81
|
+
if (_i == null) return;
|
|
82
|
+
var _arr = [];
|
|
83
|
+
var _n = true;
|
|
84
|
+
var _d = false;
|
|
85
|
+
var _s, _e;
|
|
86
|
+
try {
|
|
87
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
88
|
+
_arr.push(_s.value);
|
|
89
|
+
if (i && _arr.length === i) break;
|
|
90
|
+
}
|
|
91
|
+
} catch (err) {
|
|
92
|
+
_d = true;
|
|
93
|
+
_e = err;
|
|
94
|
+
} finally{
|
|
95
|
+
try {
|
|
96
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
97
|
+
} finally{
|
|
98
|
+
if (_d) throw _e;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return _arr;
|
|
102
|
+
}
|
|
103
|
+
function _non_iterable_rest() {
|
|
104
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
105
|
+
}
|
|
106
|
+
function _non_iterable_spread() {
|
|
107
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
108
|
+
}
|
|
65
109
|
function _possible_constructor_return(self, call) {
|
|
66
110
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
67
111
|
return call;
|
|
@@ -75,6 +119,9 @@ function _set_prototype_of(o, p) {
|
|
|
75
119
|
};
|
|
76
120
|
return _set_prototype_of(o, p);
|
|
77
121
|
}
|
|
122
|
+
function _sliced_to_array(arr, i) {
|
|
123
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
124
|
+
}
|
|
78
125
|
function _super_prop_base(object, property) {
|
|
79
126
|
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
80
127
|
object = _get_prototype_of(object);
|
|
@@ -82,10 +129,21 @@ function _super_prop_base(object, property) {
|
|
|
82
129
|
}
|
|
83
130
|
return object;
|
|
84
131
|
}
|
|
132
|
+
function _to_consumable_array(arr) {
|
|
133
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
134
|
+
}
|
|
85
135
|
function _type_of(obj) {
|
|
86
136
|
"@swc/helpers - typeof";
|
|
87
137
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
88
138
|
}
|
|
139
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
140
|
+
if (!o) return;
|
|
141
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
142
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
143
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
144
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
145
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
146
|
+
}
|
|
89
147
|
function _is_native_reflect_construct() {
|
|
90
148
|
try {
|
|
91
149
|
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
@@ -94,8 +152,7 @@ function _is_native_reflect_construct() {
|
|
|
94
152
|
return !!result;
|
|
95
153
|
})();
|
|
96
154
|
}
|
|
97
|
-
import { sum } from "d3-array";
|
|
98
|
-
import { nest } from "d3-collection";
|
|
155
|
+
import { group, sum } from "d3-array";
|
|
99
156
|
import { hierarchy, treemap } from "d3-hierarchy";
|
|
100
157
|
import { treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, treemapResquarify } from "d3-hierarchy";
|
|
101
158
|
var tileMethods = {
|
|
@@ -106,7 +163,7 @@ var tileMethods = {
|
|
|
106
163
|
treemapSquarify: treemapSquarify,
|
|
107
164
|
treemapResquarify: treemapResquarify
|
|
108
165
|
};
|
|
109
|
-
import { merge } from "@d3plus/data";
|
|
166
|
+
import { merge, nestGroups } from "@d3plus/data";
|
|
110
167
|
import { assign, elem } from "@d3plus/dom";
|
|
111
168
|
import { formatAbbreviate } from "@d3plus/format";
|
|
112
169
|
import { Rect } from "../shapes/index.js";
|
|
@@ -132,7 +189,7 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
132
189
|
tbody: []
|
|
133
190
|
});
|
|
134
191
|
_this._shapeConfig = assign({}, _this._shapeConfig, {
|
|
135
|
-
ariaLabel: function(d, i) {
|
|
192
|
+
ariaLabel: function ariaLabel(d, i) {
|
|
136
193
|
var rank = _this._rankData ? "".concat(_this._rankData.indexOf(d) + 1, ". ") : "";
|
|
137
194
|
return "".concat(rank).concat(_this._drawLabel(d, i), ", ").concat(_this._sum(d, i), ".");
|
|
138
195
|
},
|
|
@@ -164,24 +221,21 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
164
221
|
]
|
|
165
222
|
});
|
|
166
223
|
_this._treemap = treemap().round(true);
|
|
167
|
-
var isAggregated = function(leaf) {
|
|
224
|
+
var isAggregated = function isAggregated(leaf) {
|
|
168
225
|
return leaf.children && leaf.children.length === 1 && leaf.children[0].data._isAggregation;
|
|
169
226
|
};
|
|
170
227
|
return _this;
|
|
171
228
|
}
|
|
172
229
|
_create_class(Treemap, [
|
|
173
230
|
{
|
|
174
|
-
/**
|
|
175
|
-
|
|
176
|
-
@
|
|
177
|
-
|
|
178
|
-
*/ key: "_draw",
|
|
231
|
+
/**
|
|
232
|
+
Extends the draw behavior of the abstract Viz class.
|
|
233
|
+
@private
|
|
234
|
+
*/ key: "_draw",
|
|
179
235
|
value: function _draw(callback) {
|
|
180
236
|
var _this = this;
|
|
181
237
|
_get(_get_prototype_of(Treemap.prototype), "_draw", this).call(this, callback);
|
|
182
|
-
var nestedData =
|
|
183
|
-
for(var i = 0; i <= this._drawDepth; i++)nestedData.key(this._groupBy[i]);
|
|
184
|
-
nestedData = nestedData.entries(this._filteredData);
|
|
238
|
+
var nestedData = nestGroups(this._filteredData, this._groupBy.slice(0, this._drawDepth + 1));
|
|
185
239
|
var tmapData = this._treemap.padding(this._layoutPadding).size([
|
|
186
240
|
this._width - this._margin.left - this._margin.right,
|
|
187
241
|
this._height - this._margin.top - this._margin.bottom
|
|
@@ -191,11 +245,10 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
191
245
|
return d.values;
|
|
192
246
|
}).sum(this._sum).sort(this._sort));
|
|
193
247
|
var shapeData = [], that = this;
|
|
194
|
-
/**
|
|
195
|
-
|
|
196
|
-
@
|
|
197
|
-
|
|
198
|
-
*/ function extractLayout(children) {
|
|
248
|
+
/**
|
|
249
|
+
Flattens and merges treemap data.
|
|
250
|
+
@private
|
|
251
|
+
*/ function extractLayout(children) {
|
|
199
252
|
for(var i = 0; i < children.length; i++){
|
|
200
253
|
var node = children[i];
|
|
201
254
|
if (node.depth <= that._drawDepth) extractLayout(node.children);
|
|
@@ -238,10 +291,10 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
238
291
|
transform: transform
|
|
239
292
|
}
|
|
240
293
|
}).node()).config({
|
|
241
|
-
height: function(d) {
|
|
294
|
+
height: function height(d) {
|
|
242
295
|
return d.y1 - d.y0;
|
|
243
296
|
},
|
|
244
|
-
labelBounds: function(d, i, s) {
|
|
297
|
+
labelBounds: function labelBounds(d, i, s) {
|
|
245
298
|
var h = s.height;
|
|
246
299
|
var sh = Math.min(fontMax, (h - padding * 2) * 0.5);
|
|
247
300
|
if (sh < fontMin) sh = 0;
|
|
@@ -261,7 +314,7 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
261
314
|
];
|
|
262
315
|
},
|
|
263
316
|
labelConfig: {
|
|
264
|
-
textAnchor: function(d, i, x) {
|
|
317
|
+
textAnchor: function textAnchor(d, i, x) {
|
|
265
318
|
var line, parent = x;
|
|
266
319
|
while(typeof line === "undefined" && parent){
|
|
267
320
|
if (typeof parent.l !== "undefined") line = parent.l;
|
|
@@ -269,7 +322,7 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
269
322
|
}
|
|
270
323
|
return line ? "middle" : "start";
|
|
271
324
|
},
|
|
272
|
-
verticalAlign: function(d, i, x) {
|
|
325
|
+
verticalAlign: function verticalAlign(d, i, x) {
|
|
273
326
|
var line, parent = x;
|
|
274
327
|
while(typeof line === "undefined" && parent){
|
|
275
328
|
if (typeof parent.l !== "undefined") line = parent.l;
|
|
@@ -278,7 +331,7 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
278
331
|
return line ? "bottom" : "top";
|
|
279
332
|
}
|
|
280
333
|
},
|
|
281
|
-
width: function(d) {
|
|
334
|
+
width: function width(d) {
|
|
282
335
|
return d.x1 - d.x0;
|
|
283
336
|
}
|
|
284
337
|
}).config(rectConfig).render());
|
|
@@ -286,11 +339,11 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
286
339
|
}
|
|
287
340
|
},
|
|
288
341
|
{
|
|
289
|
-
/**
|
|
290
|
-
* Applies the threshold algorithm for Treemaps.
|
|
291
|
-
* @param {Array} data The data to process.
|
|
292
|
-
* @private
|
|
293
|
-
|
|
342
|
+
/**
|
|
343
|
+
* Applies the threshold algorithm for Treemaps.
|
|
344
|
+
* @param {Array} data The data to process.
|
|
345
|
+
* @private
|
|
346
|
+
*/ key: "_thresholdFunction",
|
|
294
347
|
value: function _thresholdFunction(data) {
|
|
295
348
|
var aggs = this._aggs;
|
|
296
349
|
var drawDepth = this._drawDepth;
|
|
@@ -301,16 +354,17 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
301
354
|
if (threshold && thresholdKey) {
|
|
302
355
|
return thresholdByDepth(data, 0);
|
|
303
356
|
}
|
|
304
|
-
/**
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
*/ function thresholdByDepth(branchData, depth) {
|
|
357
|
+
/**
|
|
358
|
+
Explores the data tree recursively and merges elements under the indicated threshold.
|
|
359
|
+
@param branchData The current subset of the dataset to work on.
|
|
360
|
+
@param depth The depth of the current branch.
|
|
361
|
+
@private
|
|
362
|
+
*/ function thresholdByDepth(branchData, depth) {
|
|
311
363
|
if (depth < drawDepth) {
|
|
312
|
-
return
|
|
313
|
-
var
|
|
364
|
+
return _to_consumable_array(group(branchData, groupBy[depth])).reduce(function(bulk, param) {
|
|
365
|
+
var _param = _sliced_to_array(param, 2), values = _param[1];
|
|
366
|
+
var _thresholdByDepth;
|
|
367
|
+
var subBranchData = (_thresholdByDepth = thresholdByDepth(values, depth + 1)) !== null && _thresholdByDepth !== void 0 ? _thresholdByDepth : [];
|
|
314
368
|
return bulk.concat(subBranchData);
|
|
315
369
|
}, []);
|
|
316
370
|
}
|
|
@@ -343,39 +397,35 @@ var Treemap = /*#__PURE__*/ function(Viz) {
|
|
|
343
397
|
}
|
|
344
398
|
},
|
|
345
399
|
{
|
|
346
|
-
/**
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
@param {Function|Number} [*value*]
|
|
350
|
-
*/ key: "layoutPadding",
|
|
400
|
+
/**
|
|
401
|
+
The inner and outer padding.
|
|
402
|
+
*/ key: "layoutPadding",
|
|
351
403
|
value: function layoutPadding(_) {
|
|
352
404
|
return arguments.length ? (this._layoutPadding = typeof _ === "function" ? _ : constant(_), this) : this._layoutPadding;
|
|
353
405
|
}
|
|
354
406
|
},
|
|
355
407
|
{
|
|
356
|
-
/**
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
*/ key: "sort",
|
|
408
|
+
/**
|
|
409
|
+
Sort comparator function for the treemap layout. Defaults to descending order by the associated input data's numeric value attribute.
|
|
410
|
+
|
|
411
|
+
@example
|
|
412
|
+
function comparator(a, b) {
|
|
413
|
+
return b.value - a.value;
|
|
414
|
+
}
|
|
415
|
+
*/ key: "sort",
|
|
365
416
|
value: function sort(_) {
|
|
366
417
|
return arguments.length ? (this._sort = _, this) : this._sort;
|
|
367
418
|
}
|
|
368
419
|
},
|
|
369
420
|
{
|
|
370
|
-
/**
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
*/ key: "sum",
|
|
421
|
+
/**
|
|
422
|
+
The sum accessor used for sizing each rectangle in the treemap.
|
|
423
|
+
|
|
424
|
+
@example
|
|
425
|
+
function sum(d) {
|
|
426
|
+
return d.sum;
|
|
427
|
+
}
|
|
428
|
+
*/ key: "sum",
|
|
379
429
|
value: function sum(_) {
|
|
380
430
|
if (arguments.length) {
|
|
381
431
|
this._sum = typeof _ === "function" ? _ : accessor(_);
|
|
@@ -385,13 +435,11 @@ function sum(d) {
|
|
|
385
435
|
}
|
|
386
436
|
},
|
|
387
437
|
{
|
|
388
|
-
/**
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
@param {String|Function} [*value* = "squarify"]
|
|
394
|
-
*/ key: "tile",
|
|
438
|
+
/**
|
|
439
|
+
The tiling method used when calculating the size and position of the rectangles.
|
|
440
|
+
|
|
441
|
+
Can either be a string referring to a d3-hierarchy [tiling method](https://github.com/d3/d3-hierarchy#treemap-tiling), or a custom function in the same format.
|
|
442
|
+
*/ key: "tile",
|
|
395
443
|
value: function tile(_) {
|
|
396
444
|
return arguments.length ? (this._tile = typeof _ === "string" ? tileMethods["treemap".concat(_.charAt(0).toUpperCase()).concat(_.slice(1))] || treemapSquarify : _, this) : this._tile;
|
|
397
445
|
}
|
|
@@ -399,8 +447,6 @@ Can either be a string referring to a d3-hierarchy [tiling method](https://githu
|
|
|
399
447
|
]);
|
|
400
448
|
return Treemap;
|
|
401
449
|
}(Viz);
|
|
402
|
-
/**
|
|
403
|
-
|
|
404
|
-
@extends Viz
|
|
405
|
-
@desc Uses the [d3 treemap layout](https://github.com/mbostock/d3/wiki/Treemap-Layout) to creates SVG rectangles based on an array of data. See [this example](https://d3plus.org/examples/d3plus-hierarchy/getting-started/) for help getting started using the treemap generator.
|
|
450
|
+
/**
|
|
451
|
+
Uses the [d3 treemap layout](https://github.com/mbostock/d3/wiki/Treemap-Layout) to creates SVG rectangles based on an array of data. See [this example](https://d3plus.org/examples/d3plus-hierarchy/getting-started/) for help getting started using the treemap generator.
|
|
406
452
|
*/ export { Treemap as default };
|