@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,2017 @@
|
|
|
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
|
+
}
|
|
12
|
+
function _assert_this_initialized(self) {
|
|
13
|
+
if (self === void 0) {
|
|
14
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
15
|
+
}
|
|
16
|
+
return self;
|
|
17
|
+
}
|
|
18
|
+
function _call_super(_this, derived, args) {
|
|
19
|
+
derived = _get_prototype_of(derived);
|
|
20
|
+
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
21
|
+
}
|
|
22
|
+
function _class_call_check(instance, Constructor) {
|
|
23
|
+
if (!(instance instanceof Constructor)) {
|
|
24
|
+
throw new TypeError("Cannot call a class as a function");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function _defineProperties(target, props) {
|
|
28
|
+
for(var i = 0; i < props.length; i++){
|
|
29
|
+
var descriptor = props[i];
|
|
30
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
31
|
+
descriptor.configurable = true;
|
|
32
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
33
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
37
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
38
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
39
|
+
return Constructor;
|
|
40
|
+
}
|
|
41
|
+
function _define_property(obj, key, value) {
|
|
42
|
+
if (key in obj) {
|
|
43
|
+
Object.defineProperty(obj, key, {
|
|
44
|
+
value: value,
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true
|
|
48
|
+
});
|
|
49
|
+
} else {
|
|
50
|
+
obj[key] = value;
|
|
51
|
+
}
|
|
52
|
+
return obj;
|
|
53
|
+
}
|
|
54
|
+
function _get_prototype_of(o) {
|
|
55
|
+
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
56
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
57
|
+
};
|
|
58
|
+
return _get_prototype_of(o);
|
|
59
|
+
}
|
|
60
|
+
function _inherits(subClass, superClass) {
|
|
61
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
62
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
63
|
+
}
|
|
64
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
65
|
+
constructor: {
|
|
66
|
+
value: subClass,
|
|
67
|
+
writable: true,
|
|
68
|
+
configurable: true
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
if (superClass) _set_prototype_of(subClass, superClass);
|
|
72
|
+
}
|
|
73
|
+
function _instanceof(left, right) {
|
|
74
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
75
|
+
return !!right[Symbol.hasInstance](left);
|
|
76
|
+
} else {
|
|
77
|
+
return left instanceof right;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function _iterable_to_array(iter) {
|
|
81
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
82
|
+
}
|
|
83
|
+
function _iterable_to_array_limit(arr, i) {
|
|
84
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
85
|
+
if (_i == null) return;
|
|
86
|
+
var _arr = [];
|
|
87
|
+
var _n = true;
|
|
88
|
+
var _d = false;
|
|
89
|
+
var _s, _e;
|
|
90
|
+
try {
|
|
91
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
92
|
+
_arr.push(_s.value);
|
|
93
|
+
if (i && _arr.length === i) break;
|
|
94
|
+
}
|
|
95
|
+
} catch (err) {
|
|
96
|
+
_d = true;
|
|
97
|
+
_e = err;
|
|
98
|
+
} finally{
|
|
99
|
+
try {
|
|
100
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
101
|
+
} finally{
|
|
102
|
+
if (_d) throw _e;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return _arr;
|
|
106
|
+
}
|
|
107
|
+
function _non_iterable_rest() {
|
|
108
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
109
|
+
}
|
|
110
|
+
function _non_iterable_spread() {
|
|
111
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
112
|
+
}
|
|
113
|
+
function _object_spread(target) {
|
|
114
|
+
for(var i = 1; i < arguments.length; i++){
|
|
115
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
116
|
+
var ownKeys = Object.keys(source);
|
|
117
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
118
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
119
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
ownKeys.forEach(function(key) {
|
|
123
|
+
_define_property(target, key, source[key]);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
return target;
|
|
127
|
+
}
|
|
128
|
+
function ownKeys(object, enumerableOnly) {
|
|
129
|
+
var keys = Object.keys(object);
|
|
130
|
+
if (Object.getOwnPropertySymbols) {
|
|
131
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
132
|
+
if (enumerableOnly) {
|
|
133
|
+
symbols = symbols.filter(function(sym) {
|
|
134
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
keys.push.apply(keys, symbols);
|
|
138
|
+
}
|
|
139
|
+
return keys;
|
|
140
|
+
}
|
|
141
|
+
function _object_spread_props(target, source) {
|
|
142
|
+
source = source != null ? source : {};
|
|
143
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
144
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
145
|
+
} else {
|
|
146
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
147
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return target;
|
|
151
|
+
}
|
|
152
|
+
function _possible_constructor_return(self, call) {
|
|
153
|
+
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
154
|
+
return call;
|
|
155
|
+
}
|
|
156
|
+
return _assert_this_initialized(self);
|
|
157
|
+
}
|
|
158
|
+
function _set_prototype_of(o, p) {
|
|
159
|
+
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
160
|
+
o.__proto__ = p;
|
|
161
|
+
return o;
|
|
162
|
+
};
|
|
163
|
+
return _set_prototype_of(o, p);
|
|
164
|
+
}
|
|
165
|
+
function _sliced_to_array(arr, i) {
|
|
166
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
167
|
+
}
|
|
168
|
+
function _to_consumable_array(arr) {
|
|
169
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
170
|
+
}
|
|
171
|
+
function _type_of(obj) {
|
|
172
|
+
"@swc/helpers - typeof";
|
|
173
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
174
|
+
}
|
|
175
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
176
|
+
if (!o) return;
|
|
177
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
178
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
179
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
180
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
181
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
182
|
+
}
|
|
183
|
+
function _is_native_reflect_construct() {
|
|
184
|
+
try {
|
|
185
|
+
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
186
|
+
} catch (_) {}
|
|
187
|
+
return (_is_native_reflect_construct = function() {
|
|
188
|
+
return !!result;
|
|
189
|
+
})();
|
|
190
|
+
}
|
|
191
|
+
import { group, max, merge as arrayMerge, min, range, rollup } from "d3-array";
|
|
192
|
+
import { brush } from "d3-brush";
|
|
193
|
+
import { color } from "d3-color";
|
|
194
|
+
import { queue } from "d3-queue";
|
|
195
|
+
import { select } from "d3-selection";
|
|
196
|
+
import { scaleOrdinal } from "d3-scale";
|
|
197
|
+
import { zoom } from "d3-zoom";
|
|
198
|
+
import lrucache from "lrucache";
|
|
199
|
+
import { colorAssign, colorContrast, colorDefaults } from "@d3plus/color";
|
|
200
|
+
import { addToQueue, merge, unique } from "@d3plus/data";
|
|
201
|
+
import { assign, date, getSize, inViewport } from "@d3plus/dom";
|
|
202
|
+
import { formatAbbreviate } from "@d3plus/format";
|
|
203
|
+
import { fontFamily, fontFamilyStringify } from "@d3plus/text";
|
|
204
|
+
import { ColorScale, Legend, TextBox, Timeline, Tooltip } from "../components/index.js";
|
|
205
|
+
import { accessor, BaseClass, configPrep, constant } from "../utils/index.js";
|
|
206
|
+
// import {Rect} from "../shape/index.js";
|
|
207
|
+
import Message from "../components/Message.js";
|
|
208
|
+
import drawBack from "./drawSteps/drawBack.js";
|
|
209
|
+
import drawColorScale from "./drawSteps/drawColorScale.js";
|
|
210
|
+
import { default as drawLegend, legendLabel } from "./drawSteps/drawLegend.js";
|
|
211
|
+
import drawSubtitle from "./drawSteps/drawSubtitle.js";
|
|
212
|
+
import drawTimeline from "./drawSteps/drawTimeline.js";
|
|
213
|
+
import drawTitle from "./drawSteps/drawTitle.js";
|
|
214
|
+
import drawTotal from "./drawSteps/drawTotal.js";
|
|
215
|
+
import zoomControls from "./drawSteps/zoomControls.js";
|
|
216
|
+
import drawAttribution from "./drawSteps/drawAttribution.js";
|
|
217
|
+
import clickShape from "./events/click.shape.js";
|
|
218
|
+
import clickLegend from "./events/click.legend.js";
|
|
219
|
+
import mouseenter from "./events/mouseenter.js";
|
|
220
|
+
import mouseleave from "./events/mouseleave.js";
|
|
221
|
+
import mousemoveLegend from "./events/mousemove.legend.js";
|
|
222
|
+
import mousemoveShape from "./events/mousemove.shape.js";
|
|
223
|
+
import touchstartBody from "./events/touchstart.body.js";
|
|
224
|
+
/**
|
|
225
|
+
* Default padding logic that will return false if the screen is less than 600 pixels wide.
|
|
226
|
+
*/ function defaultPadding() {
|
|
227
|
+
return typeof window !== "undefined" ? window.innerWidth > 600 : true;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Turns an array of values into a list string.
|
|
231
|
+
*/ function listify(n) {
|
|
232
|
+
return n.reduce(function(str, item, i) {
|
|
233
|
+
if (!i) str += item;
|
|
234
|
+
else if (i === n.length - 1 && i === 1) str += " and ".concat(item);
|
|
235
|
+
else if (i === n.length - 1) str += ", and ".concat(item);
|
|
236
|
+
else str += ", ".concat(item);
|
|
237
|
+
return str;
|
|
238
|
+
}, "");
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* A function that introspects the `d` Data Object for internally nested
|
|
242
|
+
* d3plus data and indices, runs the accessor function on that user data.
|
|
243
|
+
* @param {Function} acc Accessor function to use.
|
|
244
|
+
* @param {Object} d Data Object
|
|
245
|
+
* @param {Number} i Index of Data Object in Array
|
|
246
|
+
* @private
|
|
247
|
+
*/ function accessorFetch(acc, d, i) {
|
|
248
|
+
while(d.__d3plus__ && d.data){
|
|
249
|
+
d = d.data;
|
|
250
|
+
i = d.i;
|
|
251
|
+
}
|
|
252
|
+
return acc(d, i);
|
|
253
|
+
}
|
|
254
|
+
var Viz = /*#__PURE__*/ function(BaseClass) {
|
|
255
|
+
"use strict";
|
|
256
|
+
_inherits(Viz, BaseClass);
|
|
257
|
+
function Viz() {
|
|
258
|
+
_class_call_check(this, Viz);
|
|
259
|
+
var _this;
|
|
260
|
+
_this = _call_super(this, Viz);
|
|
261
|
+
_this._aggs = {};
|
|
262
|
+
_this._ariaHidden = true;
|
|
263
|
+
_this._attribution = false;
|
|
264
|
+
_this._attributionStyle = {
|
|
265
|
+
background: "rgba(255, 255, 255, 0.75)",
|
|
266
|
+
border: "1px solid rgba(0, 0, 0, 0.25)",
|
|
267
|
+
color: "rgba(0, 0, 0, 0.75)",
|
|
268
|
+
display: "block",
|
|
269
|
+
font: "400 11px/11px ".concat(fontFamilyStringify(fontFamily)),
|
|
270
|
+
margin: "5px",
|
|
271
|
+
opacity: 0.75,
|
|
272
|
+
padding: "4px 6px 3px"
|
|
273
|
+
};
|
|
274
|
+
_this._backClass = new TextBox().on("click", function() {
|
|
275
|
+
if (_this._history.length) _this.config(_this._history.pop()).render();
|
|
276
|
+
else _this.depth(_this._drawDepth - 1).filter(false).render();
|
|
277
|
+
}).on("mousemove", function() {
|
|
278
|
+
return _this._backClass.select().style("cursor", "pointer");
|
|
279
|
+
});
|
|
280
|
+
_this._backConfig = {
|
|
281
|
+
fontSize: 10,
|
|
282
|
+
padding: 5,
|
|
283
|
+
resize: false
|
|
284
|
+
};
|
|
285
|
+
_this._cache = true;
|
|
286
|
+
_this._color = function(d, i) {
|
|
287
|
+
return _this._groupBy[0](d, i);
|
|
288
|
+
};
|
|
289
|
+
_this._colorDefaults = _object_spread_props(_object_spread({}, colorDefaults), {
|
|
290
|
+
scale: scaleOrdinal().range(colorDefaults.scale.range())
|
|
291
|
+
});
|
|
292
|
+
_this._colorScaleClass = new ColorScale();
|
|
293
|
+
_this._colorScaleConfig = {
|
|
294
|
+
axisConfig: {
|
|
295
|
+
rounding: "inside"
|
|
296
|
+
},
|
|
297
|
+
scale: "jenks"
|
|
298
|
+
};
|
|
299
|
+
_this._colorScalePadding = defaultPadding;
|
|
300
|
+
_this._colorScalePosition = function() {
|
|
301
|
+
return _this._width > _this._height * 1.5 ? "right" : "bottom";
|
|
302
|
+
};
|
|
303
|
+
_this._colorScaleMaxSize = 600;
|
|
304
|
+
_this._data = [];
|
|
305
|
+
_this._dataCutoff = 100;
|
|
306
|
+
_this._detectResize = true;
|
|
307
|
+
_this._detectResizeDelay = 400;
|
|
308
|
+
_this._detectVisible = true;
|
|
309
|
+
_this._detectVisibleInterval = 1000;
|
|
310
|
+
_this._downloadButton = false;
|
|
311
|
+
_this._downloadConfig = {
|
|
312
|
+
type: "png"
|
|
313
|
+
};
|
|
314
|
+
_this._downloadPosition = "top";
|
|
315
|
+
_this._duration = 600;
|
|
316
|
+
_this._fontFamily = fontFamily;
|
|
317
|
+
_this._hidden = [];
|
|
318
|
+
_this._hiddenColor = constant("#aaa");
|
|
319
|
+
_this._hiddenOpacity = constant(0.5);
|
|
320
|
+
_this._history = [];
|
|
321
|
+
_this._groupBy = [
|
|
322
|
+
accessor("id")
|
|
323
|
+
];
|
|
324
|
+
_this._legend = function(config, arr) {
|
|
325
|
+
var maxGrouped = max(arr, function(d, i) {
|
|
326
|
+
var id = _this._groupBy[_this._legendDepth].bind(_this)(d, i);
|
|
327
|
+
return _instanceof(id, Array) ? id.length : 1;
|
|
328
|
+
});
|
|
329
|
+
return arr.length > 1 && maxGrouped <= 2;
|
|
330
|
+
};
|
|
331
|
+
_this._legendClass = new Legend();
|
|
332
|
+
_this._legendConfig = {
|
|
333
|
+
label: legendLabel.bind(_this),
|
|
334
|
+
shapeConfig: {
|
|
335
|
+
ariaLabel: legendLabel.bind(_this),
|
|
336
|
+
labelConfig: {
|
|
337
|
+
fontColor: undefined,
|
|
338
|
+
fontResize: false,
|
|
339
|
+
padding: 0
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
_this._legendFilterInvert = constant(false);
|
|
344
|
+
_this._legendPadding = defaultPadding;
|
|
345
|
+
_this._legendPosition = function() {
|
|
346
|
+
return _this._width > _this._height * 1.5 ? "right" : "bottom";
|
|
347
|
+
};
|
|
348
|
+
_this._legendSort = function(a, b) {
|
|
349
|
+
return _this._drawLabel(a).localeCompare(_this._drawLabel(b));
|
|
350
|
+
};
|
|
351
|
+
_this._legendTooltip = {};
|
|
352
|
+
_this._loadingHTML = function() {
|
|
353
|
+
return '\n <div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">\n <strong>'.concat(_this._translate("Loading Visualization"), '</strong>\n <sub style="bottom: 0; display: block; line-height: 1; margin-top: 5px;"><a href="https://d3plus.org" target="_blank">').concat(_this._translate("Powered by D3plus"), "</a></sub>\n </div>");
|
|
354
|
+
};
|
|
355
|
+
_this._loadingMessage = true;
|
|
356
|
+
_this._lrucache = lrucache(10);
|
|
357
|
+
_this._messageClass = new Message();
|
|
358
|
+
_this._messageMask = "rgba(0, 0, 0, 0.05)";
|
|
359
|
+
_this._messageStyle = {
|
|
360
|
+
"bottom": "0",
|
|
361
|
+
"left": "0",
|
|
362
|
+
"position": "absolute",
|
|
363
|
+
"right": "0",
|
|
364
|
+
"text-align": "center",
|
|
365
|
+
"top": "0"
|
|
366
|
+
};
|
|
367
|
+
_this._noDataHTML = function() {
|
|
368
|
+
return '\n <div style="left: 50%; top: 50%; position: absolute; transform: translate(-50%, -50%);">\n <strong>'.concat(_this._translate("No Data Available"), "</strong>\n </div>");
|
|
369
|
+
};
|
|
370
|
+
_this._noDataMessage = true;
|
|
371
|
+
_this._on = {
|
|
372
|
+
"click.shape": clickShape.bind(_this),
|
|
373
|
+
"click.legend": clickLegend.bind(_this),
|
|
374
|
+
"mouseenter": mouseenter.bind(_this),
|
|
375
|
+
"mouseleave": mouseleave.bind(_this),
|
|
376
|
+
"mousemove.shape": mousemoveShape.bind(_this),
|
|
377
|
+
"mousemove.legend": mousemoveLegend.bind(_this)
|
|
378
|
+
};
|
|
379
|
+
_this._queue = [];
|
|
380
|
+
_this._resizeContainer = typeof window === "undefined" ? "" : window;
|
|
381
|
+
_this._scrollContainer = typeof window === "undefined" ? "" : window;
|
|
382
|
+
_this._shape = constant("Rect");
|
|
383
|
+
_this._shapes = [];
|
|
384
|
+
_this._shapeConfig = {
|
|
385
|
+
ariaLabel: function(d, i) {
|
|
386
|
+
return _this._drawLabel(d, i);
|
|
387
|
+
},
|
|
388
|
+
fill: function(d, i) {
|
|
389
|
+
while(d.__d3plus__ && d.data){
|
|
390
|
+
d = d.data;
|
|
391
|
+
i = d.i;
|
|
392
|
+
}
|
|
393
|
+
if (_this._colorScale) {
|
|
394
|
+
var c = _this._colorScale(d, i);
|
|
395
|
+
if (c !== undefined && c !== null) {
|
|
396
|
+
var scale = _this._colorScaleClass._colorScale;
|
|
397
|
+
var colors = _this._colorScaleClass.color();
|
|
398
|
+
if (!scale) return _instanceof(colors, Array) ? colors[colors.length - 1] : colors;
|
|
399
|
+
else if (!scale.domain().length) return scale.range()[scale.range().length - 1];
|
|
400
|
+
return scale(c);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
var c1 = _this._color(d, i);
|
|
404
|
+
if (color(c1)) return c1;
|
|
405
|
+
return colorAssign(typeof c1 === "string" ? c1 : JSON.stringify(c1), _this._colorDefaults);
|
|
406
|
+
},
|
|
407
|
+
labelConfig: {
|
|
408
|
+
fontColor: function(d, i) {
|
|
409
|
+
var c = typeof _this._shapeConfig.fill === "function" ? _this._shapeConfig.fill(d, i) : _this._shapeConfig.fill;
|
|
410
|
+
return colorContrast(c);
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
opacity: constant(1),
|
|
414
|
+
stroke: function(d, i) {
|
|
415
|
+
var c = typeof _this._shapeConfig.fill === "function" ? _this._shapeConfig.fill(d, i) : _this._shapeConfig.fill;
|
|
416
|
+
return color(c).darker(0.25);
|
|
417
|
+
},
|
|
418
|
+
role: "presentation",
|
|
419
|
+
strokeWidth: constant(0)
|
|
420
|
+
};
|
|
421
|
+
_this._solo = [];
|
|
422
|
+
_this._subtitleClass = new TextBox();
|
|
423
|
+
_this._subtitleConfig = {
|
|
424
|
+
ariaHidden: true,
|
|
425
|
+
fontSize: 12,
|
|
426
|
+
padding: 5,
|
|
427
|
+
resize: false,
|
|
428
|
+
textAnchor: "middle"
|
|
429
|
+
};
|
|
430
|
+
_this._subtitlePadding = defaultPadding;
|
|
431
|
+
_this._svgDesc = "";
|
|
432
|
+
_this._svgTitle = "";
|
|
433
|
+
_this._timeline = true;
|
|
434
|
+
_this._timelineClass = new Timeline().align("end");
|
|
435
|
+
_this._timelineConfig = {
|
|
436
|
+
brushing: false,
|
|
437
|
+
padding: 5
|
|
438
|
+
};
|
|
439
|
+
_this._timelinePadding = defaultPadding;
|
|
440
|
+
_this._threshold = constant(0.0001);
|
|
441
|
+
_this._thresholdKey = undefined;
|
|
442
|
+
_this._thresholdName = function() {
|
|
443
|
+
return _this._translate("Values");
|
|
444
|
+
};
|
|
445
|
+
_this._titleClass = new TextBox();
|
|
446
|
+
_this._titleConfig = {
|
|
447
|
+
ariaHidden: true,
|
|
448
|
+
fontSize: 16,
|
|
449
|
+
padding: 5,
|
|
450
|
+
resize: false,
|
|
451
|
+
textAnchor: "middle"
|
|
452
|
+
};
|
|
453
|
+
_this._titlePadding = defaultPadding;
|
|
454
|
+
_this._tooltip = constant(true);
|
|
455
|
+
_this._tooltipClass = new Tooltip();
|
|
456
|
+
_this._tooltipConfig = {
|
|
457
|
+
pointerEvents: "none",
|
|
458
|
+
titleStyle: {
|
|
459
|
+
"max-width": "200px"
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
_this._totalClass = new TextBox();
|
|
463
|
+
_this._totalConfig = {
|
|
464
|
+
fontSize: 10,
|
|
465
|
+
padding: 5,
|
|
466
|
+
resize: false,
|
|
467
|
+
textAnchor: "middle"
|
|
468
|
+
};
|
|
469
|
+
_this._totalFormat = function(d) {
|
|
470
|
+
return "".concat(_this._translate("Total"), ": ").concat(formatAbbreviate(d, _this._locale));
|
|
471
|
+
};
|
|
472
|
+
_this._totalPadding = defaultPadding;
|
|
473
|
+
_this._zoom = false;
|
|
474
|
+
_this._zoomBehavior = zoom();
|
|
475
|
+
_this._zoomBrush = brush();
|
|
476
|
+
_this._zoomBrushHandleSize = 1;
|
|
477
|
+
_this._zoomBrushHandleStyle = {
|
|
478
|
+
fill: "#444"
|
|
479
|
+
};
|
|
480
|
+
_this._zoomBrushSelectionStyle = {
|
|
481
|
+
"fill": "#777",
|
|
482
|
+
"stroke-width": 0
|
|
483
|
+
};
|
|
484
|
+
_this._zoomControlStyle = {
|
|
485
|
+
"background": "rgba(255, 255, 255, 0.75)",
|
|
486
|
+
"border": "1px solid rgba(0, 0, 0, 0.75)",
|
|
487
|
+
"color": "rgba(0, 0, 0, 0.75)",
|
|
488
|
+
"display": "block",
|
|
489
|
+
"font": "900 15px/21px ".concat(fontFamilyStringify(fontFamily)),
|
|
490
|
+
"height": "20px",
|
|
491
|
+
"margin": "5px",
|
|
492
|
+
"opacity": 0.75,
|
|
493
|
+
"padding": 0,
|
|
494
|
+
"text-align": "center",
|
|
495
|
+
"width": "20px"
|
|
496
|
+
};
|
|
497
|
+
_this._zoomControlStyleActive = {
|
|
498
|
+
background: "rgba(0, 0, 0, 0.75)",
|
|
499
|
+
color: "rgba(255, 255, 255, 0.75)",
|
|
500
|
+
opacity: 1
|
|
501
|
+
};
|
|
502
|
+
_this._zoomControlStyleHover = {
|
|
503
|
+
cursor: "pointer",
|
|
504
|
+
opacity: 1
|
|
505
|
+
};
|
|
506
|
+
_this._zoomFactor = 2;
|
|
507
|
+
_this._zoomMax = 16;
|
|
508
|
+
_this._zoomPadding = 20;
|
|
509
|
+
_this._zoomPan = true;
|
|
510
|
+
_this._zoomScroll = true;
|
|
511
|
+
return _this;
|
|
512
|
+
}
|
|
513
|
+
_create_class(Viz, [
|
|
514
|
+
{
|
|
515
|
+
/**
|
|
516
|
+
@memberof Viz
|
|
517
|
+
@desc Called by draw before anything is drawn. Formats the data and performs preparations for draw.
|
|
518
|
+
@private
|
|
519
|
+
*/ key: "_preDraw",
|
|
520
|
+
value: function _preDraw() {
|
|
521
|
+
var _this = this;
|
|
522
|
+
var _this1 = this;
|
|
523
|
+
var that = this;
|
|
524
|
+
// based on the groupBy, determine the draw depth and current depth id
|
|
525
|
+
this._drawDepth = this._depth !== void 0 ? min([
|
|
526
|
+
this._depth >= 0 ? this._depth : 0,
|
|
527
|
+
this._groupBy.length - 1
|
|
528
|
+
]) : this._groupBy.length - 1;
|
|
529
|
+
// Returns the current unique ID for a data point, coerced to a String.
|
|
530
|
+
this._id = function(d, i) {
|
|
531
|
+
var groupByDrawDepth = accessorFetch(_this._groupBy[_this._drawDepth], d, i);
|
|
532
|
+
return typeof groupByDrawDepth === "number" ? "".concat(groupByDrawDepth) : groupByDrawDepth;
|
|
533
|
+
};
|
|
534
|
+
// Returns an array of the current unique groupBy ID for a data point, coerced to Strings.
|
|
535
|
+
this._ids = function(d, i) {
|
|
536
|
+
return _this._groupBy.map(function(g) {
|
|
537
|
+
return "".concat(accessorFetch(g, d, i));
|
|
538
|
+
}).filter(Boolean);
|
|
539
|
+
};
|
|
540
|
+
this._drawLabel = function(d, i) {
|
|
541
|
+
var depth = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : _this1._drawDepth;
|
|
542
|
+
if (!d) return "";
|
|
543
|
+
while(d.__d3plus__ && d.data){
|
|
544
|
+
d = d.data;
|
|
545
|
+
i = d.i;
|
|
546
|
+
}
|
|
547
|
+
if (d._isAggregation) {
|
|
548
|
+
return "".concat(_this1._thresholdName(d, i), " < ").concat(formatAbbreviate(d._threshold * 100, _this1._locale), "%");
|
|
549
|
+
}
|
|
550
|
+
if (_this1._label && depth === _this1._drawDepth) return "".concat(_this1._label(d, i));
|
|
551
|
+
var l = that._ids(d, i).slice(0, depth + 1);
|
|
552
|
+
var n = l.reverse().find(function(ll) {
|
|
553
|
+
return !_instanceof(ll, Array);
|
|
554
|
+
}) || l[l.length - 1];
|
|
555
|
+
return _instanceof(n, Array) ? listify(n) : "".concat(n);
|
|
556
|
+
};
|
|
557
|
+
// set the default timeFilter if it has not been specified
|
|
558
|
+
if (this._time && !this._timeFilter && this._data.length) {
|
|
559
|
+
var dates = this._data.map(this._time).map(date);
|
|
560
|
+
var d = this._data[0], i = 0;
|
|
561
|
+
if (this._discrete && "_".concat(this._discrete) in this && this["_".concat(this._discrete)](d, i) === this._time(d, i)) {
|
|
562
|
+
this._timeFilter = function() {
|
|
563
|
+
return true;
|
|
564
|
+
};
|
|
565
|
+
} else {
|
|
566
|
+
var latestTime = +max(dates);
|
|
567
|
+
this._timeFilter = function(d, i) {
|
|
568
|
+
return +date(_this._time(d, i)) === latestTime;
|
|
569
|
+
};
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
this._filteredData = [];
|
|
573
|
+
this._legendData = [];
|
|
574
|
+
var flatData = [];
|
|
575
|
+
if (this._data.length) {
|
|
576
|
+
flatData = this._timeFilter ? this._data.filter(this._timeFilter) : this._data;
|
|
577
|
+
if (this._filter) flatData = flatData.filter(this._filter);
|
|
578
|
+
var nestKeys = [];
|
|
579
|
+
for(var i1 = 0; i1 <= this._drawDepth; i1++)nestKeys.push(this._groupBy[i1]);
|
|
580
|
+
if (this._discrete && "_".concat(this._discrete) in this) nestKeys.push(this["_".concat(this._discrete)]);
|
|
581
|
+
if (this._discrete && "_".concat(this._discrete, "2") in this) nestKeys.push(this["_".concat(this._discrete, "2")]);
|
|
582
|
+
var tree = rollup.apply(void 0, [
|
|
583
|
+
flatData,
|
|
584
|
+
function(leaves) {
|
|
585
|
+
var index = _this._data.indexOf(leaves[0]);
|
|
586
|
+
var shape = _this._shape(leaves[0], index);
|
|
587
|
+
var id = _this._id(leaves[0], index);
|
|
588
|
+
var d = merge(leaves, _this._aggs);
|
|
589
|
+
if (!_this._hidden.includes(id) && (!_this._solo.length || _this._solo.includes(id))) {
|
|
590
|
+
if (!_this._discrete && shape === "Line") _this._filteredData = _this._filteredData.concat(leaves);
|
|
591
|
+
else _this._filteredData.push(d);
|
|
592
|
+
}
|
|
593
|
+
_this._legendData.push(d);
|
|
594
|
+
}
|
|
595
|
+
].concat(_to_consumable_array(nestKeys)));
|
|
596
|
+
this._filteredData = this._thresholdFunction(this._filteredData, tree);
|
|
597
|
+
}
|
|
598
|
+
// overrides the hoverOpacity of shapes if data is larger than cutoff
|
|
599
|
+
var uniqueIds = group(this._filteredData, this._id).size;
|
|
600
|
+
if (uniqueIds > this._dataCutoff) {
|
|
601
|
+
if (this._userHover === undefined) this._userHover = this._shapeConfig.hoverOpacity || 0.5;
|
|
602
|
+
if (this._userDuration === undefined) this._userDuration = this._shapeConfig.duration || 600;
|
|
603
|
+
this._shapeConfig.hoverOpacity = 1;
|
|
604
|
+
this._shapeConfig.duration = 0;
|
|
605
|
+
} else if (this._userHover !== undefined) {
|
|
606
|
+
this._shapeConfig.hoverOpacity = this._userHover;
|
|
607
|
+
this._shapeConfig.duration = this._userDuration;
|
|
608
|
+
}
|
|
609
|
+
if (this._noDataMessage && !this._filteredData.length) {
|
|
610
|
+
this._messageClass.render({
|
|
611
|
+
container: this._select.node().parentNode,
|
|
612
|
+
html: this._noDataHTML(this),
|
|
613
|
+
mask: false,
|
|
614
|
+
style: this._messageStyle
|
|
615
|
+
});
|
|
616
|
+
this._select.transition().duration(this._duration).attr("opacity", 0);
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
/**
|
|
622
|
+
@memberof Viz
|
|
623
|
+
@desc Called by render once all checks are passed.
|
|
624
|
+
@private
|
|
625
|
+
*/ key: "_draw",
|
|
626
|
+
value: function _draw() {
|
|
627
|
+
// Sanitizes user input for legendPosition and colorScalePosition
|
|
628
|
+
var legendPosition = this._legendPosition.bind(this)(this.config());
|
|
629
|
+
if (![
|
|
630
|
+
false,
|
|
631
|
+
"top",
|
|
632
|
+
"bottom",
|
|
633
|
+
"left",
|
|
634
|
+
"right"
|
|
635
|
+
].includes(legendPosition)) legendPosition = "bottom";
|
|
636
|
+
var colorScalePosition = this._colorScalePosition.bind(this)(this.config());
|
|
637
|
+
if (![
|
|
638
|
+
false,
|
|
639
|
+
"top",
|
|
640
|
+
"bottom",
|
|
641
|
+
"left",
|
|
642
|
+
"right"
|
|
643
|
+
].includes(colorScalePosition)) colorScalePosition = "bottom";
|
|
644
|
+
// Draws legend and colorScale if they are positioned "left" or "right"
|
|
645
|
+
if (legendPosition === "left" || legendPosition === "right") drawLegend.bind(this)(this._legendData);
|
|
646
|
+
if (colorScalePosition === "left" || colorScalePosition === "right" || colorScalePosition === false) drawColorScale.bind(this)(this._filteredData);
|
|
647
|
+
// Draws all of the top/bottom UI elements
|
|
648
|
+
drawBack.bind(this)();
|
|
649
|
+
drawTitle.bind(this)(this._filteredData);
|
|
650
|
+
drawSubtitle.bind(this)(this._filteredData);
|
|
651
|
+
drawTotal.bind(this)(this._filteredData);
|
|
652
|
+
drawTimeline.bind(this)(this._filteredData);
|
|
653
|
+
// Draws legend and colorScale if they are positioned "top" or "bottom"
|
|
654
|
+
if (legendPosition === "top" || legendPosition === "bottom") drawLegend.bind(this)(this._legendData);
|
|
655
|
+
if (colorScalePosition === "top" || colorScalePosition === "bottom") drawColorScale.bind(this)(this._filteredData);
|
|
656
|
+
this._shapes = [];
|
|
657
|
+
// Draws a container and zoomGroup to test functionality.
|
|
658
|
+
// this._testGroup = this._select.selectAll("g.d3plus-viz-testGroup").data([0]);
|
|
659
|
+
// const enterTest = this._testGroup.enter().append("g").attr("class", "d3plus-viz-testGroup")
|
|
660
|
+
// .merge(this._testGroup);
|
|
661
|
+
// this._testGroup = enterTest.merge(this._testGroup);
|
|
662
|
+
// const bgHeight = this._height - this._margin.top - this._margin.bottom;
|
|
663
|
+
// const bgWidth = this._width - this._margin.left - this._margin.right;
|
|
664
|
+
// new Rect()
|
|
665
|
+
// .data([{id: "background"}])
|
|
666
|
+
// .select(this._testGroup.node())
|
|
667
|
+
// .x(bgWidth / 2 + this._margin.left)
|
|
668
|
+
// .y(bgHeight / 2 + this._margin.top)
|
|
669
|
+
// .width(bgWidth)
|
|
670
|
+
// .height(bgHeight)
|
|
671
|
+
// .fill("#ccc")
|
|
672
|
+
// .render();
|
|
673
|
+
// this._zoomGroup = this._select.selectAll("g.d3plus-viz-zoomGroup").data([0]);
|
|
674
|
+
// const enter = this._zoomGroup.enter().append("g").attr("class", "d3plus-viz-zoomGroup")
|
|
675
|
+
// .merge(this._zoomGroup);
|
|
676
|
+
// this._zoomGroup = enter.merge(this._zoomGroup);
|
|
677
|
+
// const testConfig = {
|
|
678
|
+
// on: {
|
|
679
|
+
// click: this._on["click.shape"],
|
|
680
|
+
// mouseenter: this._on.mouseenter,
|
|
681
|
+
// mouseleave: this._on.mouseleave,
|
|
682
|
+
// mousemove: this._on["mousemove.shape"]
|
|
683
|
+
// }
|
|
684
|
+
// };
|
|
685
|
+
// const testWidth = 50;
|
|
686
|
+
// this._shapes.push(new Rect()
|
|
687
|
+
// .config(this._shapeConfig)
|
|
688
|
+
// .config(configPrep.bind(this)(testConfig))
|
|
689
|
+
// .data(this._filteredData)
|
|
690
|
+
// .label("Test Label")
|
|
691
|
+
// .select(this._zoomGroup.node())
|
|
692
|
+
// .id(this._id)
|
|
693
|
+
// .x(d => {
|
|
694
|
+
// if (!d.x) d.x = Math.random() * bgWidth;
|
|
695
|
+
// return d.x;
|
|
696
|
+
// })
|
|
697
|
+
// .y(d => {
|
|
698
|
+
// if (!d.y) d.y = Math.random() * bgHeight;
|
|
699
|
+
// return d.y;
|
|
700
|
+
// })
|
|
701
|
+
// .width(testWidth)
|
|
702
|
+
// .height(testWidth)
|
|
703
|
+
// .render());
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
/**
|
|
708
|
+
* Applies the threshold algorithm according to the type of chart used.
|
|
709
|
+
* @param {Array} data The data to process.
|
|
710
|
+
*/ key: "_thresholdFunction",
|
|
711
|
+
value: function _thresholdFunction(data) {
|
|
712
|
+
return data;
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
/**
|
|
717
|
+
@memberof Viz
|
|
718
|
+
@desc Draws the visualization given the specified configuration.
|
|
719
|
+
@param {Function} [*callback*] An optional callback function that, if passed, will be called after animation is complete.
|
|
720
|
+
@chainable
|
|
721
|
+
*/ key: "render",
|
|
722
|
+
value: function render(callback) {
|
|
723
|
+
var _this = this;
|
|
724
|
+
// Resets margins and padding
|
|
725
|
+
this._margin = {
|
|
726
|
+
bottom: 0,
|
|
727
|
+
left: 0,
|
|
728
|
+
right: 0,
|
|
729
|
+
top: 0
|
|
730
|
+
};
|
|
731
|
+
this._padding = {
|
|
732
|
+
bottom: 0,
|
|
733
|
+
left: 0,
|
|
734
|
+
right: 0,
|
|
735
|
+
top: 0
|
|
736
|
+
};
|
|
737
|
+
// Appends a fullscreen SVG to the BODY if a container has not been provided through .select().
|
|
738
|
+
if (this._select === void 0 || this._select.node().tagName.toLowerCase() !== "svg") {
|
|
739
|
+
var parent = this._select === void 0 ? select("body").append("div") : this._select;
|
|
740
|
+
var svg = parent.select(".d3plus-viz").size() ? parent.select(".d3plus-viz") : parent.append("svg");
|
|
741
|
+
this.select(svg.node());
|
|
742
|
+
}
|
|
743
|
+
/** detects width and height and sets SVG properties */ function setSVGSize() {
|
|
744
|
+
var display = this._select.style("display");
|
|
745
|
+
this._select.style("display", "none");
|
|
746
|
+
var _getSize = _sliced_to_array(getSize(this._select.node().parentNode), 2), w = _getSize[0], h = _getSize[1];
|
|
747
|
+
w -= parseFloat(this._select.style("border-left-width"), 10);
|
|
748
|
+
w -= parseFloat(this._select.style("border-right-width"), 10);
|
|
749
|
+
h -= parseFloat(this._select.style("border-top-width"), 10);
|
|
750
|
+
h -= parseFloat(this._select.style("border-bottom-width"), 10);
|
|
751
|
+
this._select.style("display", display);
|
|
752
|
+
if (this._autoWidth) {
|
|
753
|
+
this.width(w);
|
|
754
|
+
this._select.style("width", "".concat(this._width, "px")).attr("width", "".concat(this._width, "px"));
|
|
755
|
+
}
|
|
756
|
+
if (this._autoHeight) {
|
|
757
|
+
this.height(h);
|
|
758
|
+
this._select.style("height", "".concat(this._height, "px")).attr("height", "".concat(this._height, "px"));
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
// Calculates the width and/or height of the Viz based on the this._select, if either has not been defined.
|
|
762
|
+
if ((!this._width || !this._height) && (!this._detectVisible || inViewport(this._select.node()))) {
|
|
763
|
+
this._autoWidth = this._width === undefined;
|
|
764
|
+
this._autoHeight = this._height === undefined;
|
|
765
|
+
setSVGSize.bind(this)();
|
|
766
|
+
}
|
|
767
|
+
this._select.attr("class", "d3plus-viz").attr("aria-hidden", this._ariaHidden).attr("aria-labelledby", "".concat(this._uuid, "-title ").concat(this._uuid, "-desc")).attr("role", "img").attr("xmlns", "http://www.w3.org/2000/svg").attr("xmlns:xlink", "http://www.w3.org/1999/xlink").transition().duration(this._duration).style("width", this._width !== undefined ? "".concat(this._width, "px") : undefined).style("height", this._height !== undefined ? "".concat(this._height, "px") : undefined).attr("width", this._width !== undefined ? "".concat(this._width, "px") : undefined).attr("height", this._height !== undefined ? "".concat(this._height, "px") : undefined);
|
|
768
|
+
// sets "position: relative" on the SVG parent if currently undefined
|
|
769
|
+
var parent1 = select(this._select.node().parentNode);
|
|
770
|
+
var position = parent1.style("position");
|
|
771
|
+
if (position === "static") parent1.style("position", "relative");
|
|
772
|
+
parent1.style("font-family", fontFamilyStringify(this._fontFamily));
|
|
773
|
+
// sets initial opacity to 1, if it has not already been set
|
|
774
|
+
if (this._select.attr("opacity") === null) this._select.attr("opacity", 1);
|
|
775
|
+
// Updates the <title> tag if already exists else creates a new <title> tag on this.select.
|
|
776
|
+
var svgTitle = this._select.selectAll("title").data([
|
|
777
|
+
0
|
|
778
|
+
]);
|
|
779
|
+
var svgTitleEnter = svgTitle.enter().append("title").attr("id", "".concat(this._uuid, "-title"));
|
|
780
|
+
svgTitle.merge(svgTitleEnter).text(this._svgTitle);
|
|
781
|
+
// Updates the <desc> tag if already exists else creates a new <desc> tag on this.select.
|
|
782
|
+
var svgDesc = this._select.selectAll("desc").data([
|
|
783
|
+
0
|
|
784
|
+
]);
|
|
785
|
+
var svgDescEnter = svgDesc.enter().append("desc").attr("id", "".concat(this._uuid, "-desc"));
|
|
786
|
+
svgDesc.merge(svgDescEnter).text(this._svgDesc);
|
|
787
|
+
this._visiblePoll = clearInterval(this._visiblePoll);
|
|
788
|
+
this._resizePoll = clearTimeout(this._resizePoll);
|
|
789
|
+
this._scrollPoll = clearTimeout(this._scrollPoll);
|
|
790
|
+
select(this._scrollContainer).on("scroll.".concat(this._uuid), null);
|
|
791
|
+
select(this._resizeContainer).on("resize.".concat(this._uuid), null);
|
|
792
|
+
if (this._detectVisible && this._select.style("visibility") === "hidden") {
|
|
793
|
+
this._visiblePoll = setInterval(function() {
|
|
794
|
+
if (_this._select.style("visibility") !== "hidden") {
|
|
795
|
+
_this._visiblePoll = clearInterval(_this._visiblePoll);
|
|
796
|
+
_this.render(callback);
|
|
797
|
+
}
|
|
798
|
+
}, this._detectVisibleInterval);
|
|
799
|
+
} else if (this._detectVisible && this._select.style("display") === "none") {
|
|
800
|
+
this._visiblePoll = setInterval(function() {
|
|
801
|
+
if (_this._select.style("display") !== "none") {
|
|
802
|
+
_this._visiblePoll = clearInterval(_this._visiblePoll);
|
|
803
|
+
_this.render(callback);
|
|
804
|
+
}
|
|
805
|
+
}, this._detectVisibleInterval);
|
|
806
|
+
} else if (this._detectVisible && !inViewport(this._select.node())) {
|
|
807
|
+
select(this._scrollContainer).on("scroll.".concat(this._uuid), function() {
|
|
808
|
+
if (!_this._scrollPoll) {
|
|
809
|
+
_this._scrollPoll = setTimeout(function() {
|
|
810
|
+
if (inViewport(_this._select.node())) {
|
|
811
|
+
select(_this._scrollContainer).on("scroll.".concat(_this._uuid), null);
|
|
812
|
+
_this.render(callback);
|
|
813
|
+
}
|
|
814
|
+
_this._scrollPoll = clearTimeout(_this._scrollPoll);
|
|
815
|
+
}, _this._detectVisibleInterval);
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
} else {
|
|
819
|
+
var q = queue();
|
|
820
|
+
this._queue.forEach(function(p) {
|
|
821
|
+
var _q;
|
|
822
|
+
var cache = _this._cache ? _this._lrucache.get("".concat(p[3], "_").concat(p[1])) : undefined;
|
|
823
|
+
if (!cache) (_q = q).defer.apply(_q, _to_consumable_array(p));
|
|
824
|
+
else _this["_".concat(p[3])] = p[2] ? p[2](cache) : cache;
|
|
825
|
+
});
|
|
826
|
+
this._queue = [];
|
|
827
|
+
if (this._loadingMessage && q._tasks.length) {
|
|
828
|
+
this._messageClass.render({
|
|
829
|
+
container: this._select.node().parentNode,
|
|
830
|
+
html: this._loadingHTML(this),
|
|
831
|
+
mask: this._filteredData ? this._messageMask : false,
|
|
832
|
+
style: this._messageStyle
|
|
833
|
+
});
|
|
834
|
+
}
|
|
835
|
+
q.awaitAll(function() {
|
|
836
|
+
// creates a data table as DOM elements inside of the SVG for accessibility
|
|
837
|
+
// only if this._ariaHidden is set to true
|
|
838
|
+
var columns = _instanceof(_this._data, Array) && _this._data.length > 0 ? Object.keys(_this._data[0]) : [];
|
|
839
|
+
var svgTable = _this._select.selectAll("g.data-table").data(!_this._ariaHidden && _instanceof(_this._data, Array) && _this._data.length ? [
|
|
840
|
+
0
|
|
841
|
+
] : []);
|
|
842
|
+
var svgTableEnter = svgTable.enter().append("g").attr("class", "data-table").attr("role", "table");
|
|
843
|
+
svgTable.exit().remove();
|
|
844
|
+
var rows = svgTable.merge(svgTableEnter).selectAll("text").data(_instanceof(_this._data, Array) ? range(0, _this._data.length + 1) : []);
|
|
845
|
+
rows.exit().remove();
|
|
846
|
+
var cells = rows.merge(rows.enter().append("text").attr("role", "row")).selectAll("tspan").data(function(d, i) {
|
|
847
|
+
return columns.map(function(c) {
|
|
848
|
+
return {
|
|
849
|
+
role: i ? "cell" : "columnheader",
|
|
850
|
+
text: i ? _this._data[i - 1][c] : c
|
|
851
|
+
};
|
|
852
|
+
});
|
|
853
|
+
});
|
|
854
|
+
cells.exit().remove();
|
|
855
|
+
cells.merge(cells.enter().append("tspan")).attr("role", function(d) {
|
|
856
|
+
return d.role;
|
|
857
|
+
}).attr("dy", "-1000px").html(function(d) {
|
|
858
|
+
return d.text;
|
|
859
|
+
});
|
|
860
|
+
// finishes the draw cycle
|
|
861
|
+
_this._preDraw();
|
|
862
|
+
_this._draw(callback);
|
|
863
|
+
zoomControls.bind(_this)();
|
|
864
|
+
drawAttribution.bind(_this)();
|
|
865
|
+
if (_this._messageClass._isVisible && (!_this._noDataMessage || _this._filteredData.length)) {
|
|
866
|
+
_this._messageClass.hide();
|
|
867
|
+
if (_this._select.attr("opacity") === "0") _this._select.transition().duration(_this._duration).attr("opacity", 1);
|
|
868
|
+
}
|
|
869
|
+
if (_this._detectResize && (_this._autoWidth || _this._autoHeight)) {
|
|
870
|
+
select(_this._resizeContainer).on("resize.".concat(_this._uuid), function() {
|
|
871
|
+
_this._resizePoll = clearTimeout(_this._resizePoll);
|
|
872
|
+
_this._resizePoll = setTimeout(function() {
|
|
873
|
+
_this._resizePoll = clearTimeout(_this._resizePoll);
|
|
874
|
+
setSVGSize.bind(_this)();
|
|
875
|
+
_this.render(callback);
|
|
876
|
+
}, _this._detectResizeDelay);
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
if (callback) setTimeout(callback, _this._duration + 100);
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
// Attaches touchstart event listener to the BODY to hide the tooltip when the user touches any element without data
|
|
883
|
+
select("body").on("touchstart.".concat(this._uuid), touchstartBody.bind(this));
|
|
884
|
+
return this;
|
|
885
|
+
}
|
|
886
|
+
},
|
|
887
|
+
{
|
|
888
|
+
/**
|
|
889
|
+
@memberof Viz
|
|
890
|
+
@desc If *value* is specified, sets the active method to the specified function and returns the current class instance.
|
|
891
|
+
@param {Function} [*value*]
|
|
892
|
+
@chainable
|
|
893
|
+
*/ key: "active",
|
|
894
|
+
value: function active(_) {
|
|
895
|
+
this._active = _;
|
|
896
|
+
if (this._shapeConfig.activeOpacity !== 1) {
|
|
897
|
+
this._shapes.forEach(function(s) {
|
|
898
|
+
return s.active(_);
|
|
899
|
+
});
|
|
900
|
+
if (this._legend) this._legendClass.active(_);
|
|
901
|
+
}
|
|
902
|
+
return this;
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
{
|
|
906
|
+
/**
|
|
907
|
+
@memberof Viz
|
|
908
|
+
@desc If *value* is specified, sets the aggregation method for each key in the object and returns the current class instance.
|
|
909
|
+
@param {Object} [*value*]
|
|
910
|
+
@chainable
|
|
911
|
+
*/ key: "aggs",
|
|
912
|
+
value: function aggs(_) {
|
|
913
|
+
return arguments.length ? (this._aggs = assign(this._aggs, _), this) : this._aggs;
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
{
|
|
917
|
+
/**
|
|
918
|
+
@memberof Viz
|
|
919
|
+
@desc Sets the "aria-hidden" attribute of the containing SVG element. The default value is "false", but it you need to hide the SVG from screen readers set this property to "true".
|
|
920
|
+
@param {Boolean} [*value* = true]
|
|
921
|
+
@chainable
|
|
922
|
+
*/ key: "ariaHidden",
|
|
923
|
+
value: function ariaHidden(_) {
|
|
924
|
+
return arguments.length ? (this._ariaHidden = _, this) : this._ariaHidden;
|
|
925
|
+
}
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
/**
|
|
929
|
+
@memberof Viz
|
|
930
|
+
@desc Sets text to be shown positioned absolute on top of the visualization in the bottom-right corner. This is most often used in Geomaps to display the copyright of map tiles. The text is rendered as HTML, so any valid HTML string will render as expected (eg. anchor links work).
|
|
931
|
+
@param {HTMLString|Boolean} *value* = false
|
|
932
|
+
@chainable
|
|
933
|
+
*/ key: "attribution",
|
|
934
|
+
value: function attribution(_) {
|
|
935
|
+
return arguments.length ? (this._attribution = _, this) : this._attribution;
|
|
936
|
+
}
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
/**
|
|
940
|
+
@memberof Viz
|
|
941
|
+
@desc If *value* is specified, sets the config method for the back button and returns the current class instance.
|
|
942
|
+
@param {Object} [*value*]
|
|
943
|
+
@chainable
|
|
944
|
+
*/ key: "attributionStyle",
|
|
945
|
+
value: function attributionStyle(_) {
|
|
946
|
+
return arguments.length ? (this._attributionStyle = assign(this._attributionStyle, _), this) : this._attributionStyle;
|
|
947
|
+
}
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
/**
|
|
951
|
+
@memberof Viz
|
|
952
|
+
@desc If *value* is specified, sets the config method for the back button and returns the current class instance.
|
|
953
|
+
@param {Object} [*value*]
|
|
954
|
+
@chainable
|
|
955
|
+
*/ key: "backConfig",
|
|
956
|
+
value: function backConfig(_) {
|
|
957
|
+
return arguments.length ? (this._backConfig = assign(this._backConfig, _), this) : this._backConfig;
|
|
958
|
+
}
|
|
959
|
+
},
|
|
960
|
+
{
|
|
961
|
+
/**
|
|
962
|
+
@memberof Viz
|
|
963
|
+
@desc Enables a lru cache that stores up to 5 previously loaded files/URLs. Helpful when constantly writing over the data array with a URL in the render function of a react component.
|
|
964
|
+
@param {Boolean} [*value* = false]
|
|
965
|
+
@chainable
|
|
966
|
+
*/ key: "cache",
|
|
967
|
+
value: function cache(_) {
|
|
968
|
+
return arguments.length ? (this._cache = _, this) : this._cache;
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
{
|
|
972
|
+
/**
|
|
973
|
+
@memberof Viz
|
|
974
|
+
@desc Defines the main color to be used for each data point in a visualization. Can be either an accessor function or a string key to reference in each data point. If a color value is returned, it will be used as is. If a string is returned, a unique color will be assigned based on the string.
|
|
975
|
+
@param {Function|String|False} [*value*]
|
|
976
|
+
@chainable
|
|
977
|
+
*/ key: "color",
|
|
978
|
+
value: function color(_) {
|
|
979
|
+
return arguments.length ? (this._color = !_ || typeof _ === "function" ? _ : accessor(_), this) : this._color;
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
/**
|
|
984
|
+
@memberof Viz
|
|
985
|
+
@desc Defines the value to be used for a color scale. Can be either an accessor function or a string key to reference in each data point.
|
|
986
|
+
@param {Function|String|False} [*value*]
|
|
987
|
+
@chainable
|
|
988
|
+
*/ key: "colorScale",
|
|
989
|
+
value: function colorScale(_) {
|
|
990
|
+
return arguments.length ? (this._colorScale = !_ || typeof _ === "function" ? _ : accessor(_), this) : this._colorScale;
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
/**
|
|
995
|
+
@memberof Viz
|
|
996
|
+
@desc A pass-through to the config method of ColorScale.
|
|
997
|
+
@param {Object} [*value*]
|
|
998
|
+
@chainable
|
|
999
|
+
*/ key: "colorScaleConfig",
|
|
1000
|
+
value: function colorScaleConfig(_) {
|
|
1001
|
+
return arguments.length ? (this._colorScaleConfig = assign(this._colorScaleConfig, _), this) : this._colorScaleConfig;
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
{
|
|
1005
|
+
/**
|
|
1006
|
+
@memberof Viz
|
|
1007
|
+
@desc Tells the colorScale whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the colorScale appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
1008
|
+
@param {Boolean|Function} [*value*]
|
|
1009
|
+
@chainable
|
|
1010
|
+
*/ key: "colorScalePadding",
|
|
1011
|
+
value: function colorScalePadding(_) {
|
|
1012
|
+
return arguments.length ? (this._colorScalePadding = typeof _ === "function" ? _ : constant(_), this) : this._colorScalePadding;
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
{
|
|
1016
|
+
/**
|
|
1017
|
+
@memberof Viz
|
|
1018
|
+
@desc Defines which side of the visualization to anchor the color scale. Acceptable values are `"top"`, `"bottom"`, `"left"`, `"right"`, and `false`. A `false` value will cause the color scale to not be displayed, but will still color shapes based on the scale.
|
|
1019
|
+
@param {Function|String|Boolean} [*value* = "bottom"]
|
|
1020
|
+
@chainable
|
|
1021
|
+
*/ key: "colorScalePosition",
|
|
1022
|
+
value: function colorScalePosition(_) {
|
|
1023
|
+
return arguments.length ? (this._colorScalePosition = typeof _ === "function" ? _ : constant(_), this) : this._colorScalePosition;
|
|
1024
|
+
}
|
|
1025
|
+
},
|
|
1026
|
+
{
|
|
1027
|
+
/**
|
|
1028
|
+
@memberof Viz
|
|
1029
|
+
@desc Sets the maximum pixel size for drawing the color scale: width for horizontal scales and height for vertical scales.
|
|
1030
|
+
@param {Number} [*value* = 600]
|
|
1031
|
+
@chainable
|
|
1032
|
+
*/ key: "colorScaleMaxSize",
|
|
1033
|
+
value: function colorScaleMaxSize(_) {
|
|
1034
|
+
return arguments.length ? (this._colorScaleMaxSize = _, this) : this._colorScaleMaxSize;
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
/**
|
|
1039
|
+
@memberof Viz
|
|
1040
|
+
@desc Sets the primary data array to be used when drawing the visualization. The value passed should be an *Array* of objects or a *String* representing a filepath or URL to be loaded. The following filetypes are supported: `csv`, `tsv`, `txt`, and `json`.
|
|
1041
|
+
|
|
1042
|
+
If your data URL needs specific headers to be set, an Object with "url" and "headers" keys may also be passed.
|
|
1043
|
+
|
|
1044
|
+
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 array of obejcts to be used as the primary data array. For example, some JSON APIs return the headers split from the data values to save bandwidth. These would need be joined using a custom formatter.
|
|
1045
|
+
|
|
1046
|
+
If you would like to specify certain configuration options based on the yet-to-be-loaded data, you can also return a full `config` object from the data formatter (including the new `data` array as a key in the object).
|
|
1047
|
+
|
|
1048
|
+
If *data* is not specified, this method returns the current primary data array, which defaults to an empty array (`[]`);
|
|
1049
|
+
@param {Array|String} *data* = []
|
|
1050
|
+
@param {Function} [*formatter*]
|
|
1051
|
+
@chainable
|
|
1052
|
+
*/ key: "data",
|
|
1053
|
+
value: function data(_, f) {
|
|
1054
|
+
if (arguments.length) {
|
|
1055
|
+
addToQueue.bind(this)(_, f, "data");
|
|
1056
|
+
this._hidden = [];
|
|
1057
|
+
this._solo = [];
|
|
1058
|
+
if (this._userData && JSON.stringify(_) !== JSON.stringify(this._userData)) {
|
|
1059
|
+
this._timeFilter = false;
|
|
1060
|
+
this._timelineSelection = false;
|
|
1061
|
+
}
|
|
1062
|
+
this._userData = _;
|
|
1063
|
+
return this;
|
|
1064
|
+
}
|
|
1065
|
+
return this._data;
|
|
1066
|
+
}
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
/**
|
|
1070
|
+
@memberof Viz
|
|
1071
|
+
@desc If the number of visible data points exceeds this number, the default hover behavior will be disabled (helpful for very large visualizations bogging down the DOM with opacity updates).
|
|
1072
|
+
@param {Number} [*value* = 100]
|
|
1073
|
+
@chainable
|
|
1074
|
+
*/ key: "dataCutoff",
|
|
1075
|
+
value: function dataCutoff(_) {
|
|
1076
|
+
return arguments.length ? (this._dataCutoff = _, this) : this._dataCutoff;
|
|
1077
|
+
}
|
|
1078
|
+
},
|
|
1079
|
+
{
|
|
1080
|
+
/**
|
|
1081
|
+
@memberof Viz
|
|
1082
|
+
@desc If *value* is specified, sets the depth to the specified number and returns the current class instance. The *value* should correspond with an index in the [groupBy](#groupBy) array.
|
|
1083
|
+
@param {Number} [*value*]
|
|
1084
|
+
@chainable
|
|
1085
|
+
*/ key: "depth",
|
|
1086
|
+
value: function depth(_) {
|
|
1087
|
+
return arguments.length ? (this._depth = _, this) : this._depth;
|
|
1088
|
+
}
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
/**
|
|
1092
|
+
@memberof Viz
|
|
1093
|
+
@desc If the width and/or height of a Viz is not user-defined, it is determined by the size of it's parent element. When this method is set to `true`, the Viz will listen for the `window.onresize` event and adjust it's dimensions accordingly.
|
|
1094
|
+
@param {Boolean} *value* = true
|
|
1095
|
+
@chainable
|
|
1096
|
+
*/ key: "detectResize",
|
|
1097
|
+
value: function detectResize(_) {
|
|
1098
|
+
return arguments.length ? (this._detectResize = _, this) : this._detectResize;
|
|
1099
|
+
}
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
/**
|
|
1103
|
+
@memberof Viz
|
|
1104
|
+
@desc When resizing the browser window, this is the millisecond delay to trigger the resize event.
|
|
1105
|
+
@param {Number} *value* = 400
|
|
1106
|
+
@chainable
|
|
1107
|
+
*/ key: "detectResizeDelay",
|
|
1108
|
+
value: function detectResizeDelay(_) {
|
|
1109
|
+
return arguments.length ? (this._detectResizeDelay = _, this) : this._detectResizeDelay;
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
{
|
|
1113
|
+
/**
|
|
1114
|
+
@memberof Viz
|
|
1115
|
+
@desc Toggles whether or not the Viz should try to detect if it visible in the current viewport. When this method is set to `true`, the Viz will only be rendered when it has entered the viewport either through scrolling or if it's display or visibility is changed.
|
|
1116
|
+
@param {Boolean} *value* = true
|
|
1117
|
+
@chainable
|
|
1118
|
+
*/ key: "detectVisible",
|
|
1119
|
+
value: function detectVisible(_) {
|
|
1120
|
+
return arguments.length ? (this._detectVisible = _, this) : this._detectVisible;
|
|
1121
|
+
}
|
|
1122
|
+
},
|
|
1123
|
+
{
|
|
1124
|
+
/**
|
|
1125
|
+
@memberof Viz
|
|
1126
|
+
@desc The interval, in milliseconds, for checking if the visualization is visible on the page.
|
|
1127
|
+
@param {Number} *value* = 1000
|
|
1128
|
+
@chainable
|
|
1129
|
+
*/ key: "detectVisibleInterval",
|
|
1130
|
+
value: function detectVisibleInterval(_) {
|
|
1131
|
+
return arguments.length ? (this._detectVisibleInterval = _, this) : this._detectVisibleInterval;
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
{
|
|
1135
|
+
/**
|
|
1136
|
+
@memberof Viz
|
|
1137
|
+
@desc If *value* is specified, sets the discrete accessor to the specified method name (usually an axis) and returns the current class instance.
|
|
1138
|
+
@param {String} [*value*]
|
|
1139
|
+
@chainable
|
|
1140
|
+
*/ key: "discrete",
|
|
1141
|
+
value: function discrete(_) {
|
|
1142
|
+
return arguments.length ? (this._discrete = _, this) : this._discrete;
|
|
1143
|
+
}
|
|
1144
|
+
},
|
|
1145
|
+
{
|
|
1146
|
+
/**
|
|
1147
|
+
@memberof Viz
|
|
1148
|
+
@desc Shows a button that allows for downloading the current visualization.
|
|
1149
|
+
@param {Boolean} [*value* = false]
|
|
1150
|
+
@chainable
|
|
1151
|
+
*/ key: "downloadButton",
|
|
1152
|
+
value: function downloadButton(_) {
|
|
1153
|
+
return arguments.length ? (this._downloadButton = _, this) : this._downloadButton;
|
|
1154
|
+
}
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
/**
|
|
1158
|
+
@memberof Viz
|
|
1159
|
+
@desc Sets specific options of the saveElement function used when downloading the visualization.
|
|
1160
|
+
@param {Object} [*value* = {type: "png"}]
|
|
1161
|
+
@chainable
|
|
1162
|
+
*/ key: "downloadConfig",
|
|
1163
|
+
value: function downloadConfig(_) {
|
|
1164
|
+
return arguments.length ? (this._downloadConfig = assign(this._downloadConfig, _), this) : this._downloadConfig;
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
/**
|
|
1169
|
+
@memberof Viz
|
|
1170
|
+
@desc Defines which control group to add the download button into.
|
|
1171
|
+
@param {String} [*value* = "top"]
|
|
1172
|
+
@chainable
|
|
1173
|
+
*/ key: "downloadPosition",
|
|
1174
|
+
value: function downloadPosition(_) {
|
|
1175
|
+
return arguments.length ? (this._downloadPosition = _, this) : this._downloadPosition;
|
|
1176
|
+
}
|
|
1177
|
+
},
|
|
1178
|
+
{
|
|
1179
|
+
/**
|
|
1180
|
+
@memberof Viz
|
|
1181
|
+
@desc If *ms* is specified, sets the animation duration to the specified number and returns the current class instance. If *ms* is not specified, returns the current animation duration.
|
|
1182
|
+
@param {Number} [*ms* = 600]
|
|
1183
|
+
@chainable
|
|
1184
|
+
*/ key: "duration",
|
|
1185
|
+
value: function duration(_) {
|
|
1186
|
+
return arguments.length ? (this._duration = _, this) : this._duration;
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
/**
|
|
1191
|
+
@memberof Viz
|
|
1192
|
+
@desc If *value* is specified, sets the filter to the specified function and returns the current class instance.
|
|
1193
|
+
@param {Function} [*value*]
|
|
1194
|
+
@chainable
|
|
1195
|
+
*/ key: "filter",
|
|
1196
|
+
value: function filter(_) {
|
|
1197
|
+
return arguments.length ? (this._filter = _, this) : this._filter;
|
|
1198
|
+
}
|
|
1199
|
+
},
|
|
1200
|
+
{
|
|
1201
|
+
/**
|
|
1202
|
+
@memberof Viz
|
|
1203
|
+
@desc If *value* is specified, sets the filter to the specified function and returns the current class instance.
|
|
1204
|
+
@param {Function} [*value*]
|
|
1205
|
+
@chainable
|
|
1206
|
+
*/ key: "fontFamily",
|
|
1207
|
+
value: function fontFamily(_) {
|
|
1208
|
+
var _this = this;
|
|
1209
|
+
if (arguments.length) {
|
|
1210
|
+
var labelConfig = {
|
|
1211
|
+
fontFamily: _
|
|
1212
|
+
};
|
|
1213
|
+
var axisConfig = {
|
|
1214
|
+
titleConfig: labelConfig,
|
|
1215
|
+
shapeConfig: {
|
|
1216
|
+
labelConfig: labelConfig
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
this.shapeConfig({
|
|
1220
|
+
labelConfig: labelConfig
|
|
1221
|
+
});
|
|
1222
|
+
this.colorScaleConfig({
|
|
1223
|
+
axisConfig: axisConfig
|
|
1224
|
+
});
|
|
1225
|
+
[
|
|
1226
|
+
"axis",
|
|
1227
|
+
"column",
|
|
1228
|
+
"row",
|
|
1229
|
+
"timeline",
|
|
1230
|
+
"x",
|
|
1231
|
+
"y",
|
|
1232
|
+
"x2",
|
|
1233
|
+
"y2"
|
|
1234
|
+
].forEach(function(axis) {
|
|
1235
|
+
var method = "".concat(axis, "Config");
|
|
1236
|
+
if (_this[method]) _this[method](axisConfig);
|
|
1237
|
+
});
|
|
1238
|
+
[
|
|
1239
|
+
"back",
|
|
1240
|
+
"title",
|
|
1241
|
+
"total",
|
|
1242
|
+
"subtitle"
|
|
1243
|
+
].forEach(function(label) {
|
|
1244
|
+
var method = "".concat(label, "Config");
|
|
1245
|
+
if (_this[method]) _this[method](labelConfig);
|
|
1246
|
+
});
|
|
1247
|
+
this.tooltipConfig({
|
|
1248
|
+
tooltipStyle: {
|
|
1249
|
+
"font-family": fontFamilyStringify(_)
|
|
1250
|
+
}
|
|
1251
|
+
});
|
|
1252
|
+
this._fontFamily = _;
|
|
1253
|
+
return this;
|
|
1254
|
+
}
|
|
1255
|
+
return this._fontFamily;
|
|
1256
|
+
}
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
/**
|
|
1260
|
+
@memberof Viz
|
|
1261
|
+
@desc If *value* is specified, sets the group accessor(s) to the specified string, function, or array of values and returns the current class instance.
|
|
1262
|
+
@param {String|Function|Array} [*value*]
|
|
1263
|
+
@chainable
|
|
1264
|
+
@example
|
|
1265
|
+
function value(d) {
|
|
1266
|
+
return d.id;
|
|
1267
|
+
}
|
|
1268
|
+
*/ key: "groupBy",
|
|
1269
|
+
value: function groupBy(_) {
|
|
1270
|
+
var _this = this;
|
|
1271
|
+
if (!arguments.length) return this._groupBy;
|
|
1272
|
+
this._groupByRaw = _;
|
|
1273
|
+
if (!_instanceof(_, Array)) _ = [
|
|
1274
|
+
_
|
|
1275
|
+
];
|
|
1276
|
+
return this._groupBy = _.map(function(k) {
|
|
1277
|
+
if (typeof k === "function") return k;
|
|
1278
|
+
else {
|
|
1279
|
+
if (!_this._aggs[k]) {
|
|
1280
|
+
_this._aggs[k] = function(a, c) {
|
|
1281
|
+
var v = unique(a.map(c).map(String));
|
|
1282
|
+
return v.length === 1 ? v[0] : v;
|
|
1283
|
+
};
|
|
1284
|
+
}
|
|
1285
|
+
return accessor(k);
|
|
1286
|
+
}
|
|
1287
|
+
}), this;
|
|
1288
|
+
}
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
/**
|
|
1292
|
+
@memberof Viz
|
|
1293
|
+
@desc If *value* is specified, sets the overall height to the specified number and returns the current class instance.
|
|
1294
|
+
@param {Number} [*value* = window.innerHeight]
|
|
1295
|
+
@chainable
|
|
1296
|
+
*/ key: "height",
|
|
1297
|
+
value: function height(_) {
|
|
1298
|
+
return arguments.length ? (this._height = _, this) : this._height;
|
|
1299
|
+
}
|
|
1300
|
+
},
|
|
1301
|
+
{
|
|
1302
|
+
/**
|
|
1303
|
+
@memberof Viz
|
|
1304
|
+
@desc Defines the color used for legend shapes when the corresponding grouping is hidden from display (by clicking on the legend).
|
|
1305
|
+
@param {Function|String} [*value* = "#aaa"]
|
|
1306
|
+
@chainable
|
|
1307
|
+
*/ key: "hiddenColor",
|
|
1308
|
+
value: function hiddenColor(_) {
|
|
1309
|
+
return arguments.length ? (this._hiddenColor = typeof _ === "function" ? _ : constant(_), this) : this._hiddenColor;
|
|
1310
|
+
}
|
|
1311
|
+
},
|
|
1312
|
+
{
|
|
1313
|
+
/**
|
|
1314
|
+
@memberof Viz
|
|
1315
|
+
@desc Defines the opacity used for legend labels when the corresponding grouping is hidden from display (by clicking on the legend).
|
|
1316
|
+
@param {Function|Number} [*value* = 0.5]
|
|
1317
|
+
@chainable
|
|
1318
|
+
*/ key: "hiddenOpacity",
|
|
1319
|
+
value: function hiddenOpacity(_) {
|
|
1320
|
+
return arguments.length ? (this._hiddenOpacity = typeof _ === "function" ? _ : constant(_), this) : this._hiddenOpacity;
|
|
1321
|
+
}
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
/**
|
|
1325
|
+
@memberof Viz
|
|
1326
|
+
@desc If *value* is specified, sets the hover method to the specified function and returns the current class instance.
|
|
1327
|
+
@param {Function} [*value*]
|
|
1328
|
+
@chainable
|
|
1329
|
+
*/ key: "hover",
|
|
1330
|
+
value: function hover(_) {
|
|
1331
|
+
var _this = this;
|
|
1332
|
+
var hoverFunction = this._hover = _;
|
|
1333
|
+
if (this._shapeConfig.hoverOpacity !== 1) {
|
|
1334
|
+
if (typeof _ === "function") {
|
|
1335
|
+
var shapeData = arrayMerge(this._shapes.map(function(s) {
|
|
1336
|
+
return s.data();
|
|
1337
|
+
}));
|
|
1338
|
+
shapeData = shapeData.concat(this._legendClass.data());
|
|
1339
|
+
var activeData = _ ? shapeData.filter(_) : [];
|
|
1340
|
+
var activeIds = [];
|
|
1341
|
+
activeData.map(this._ids).forEach(function(ids) {
|
|
1342
|
+
for(var x = 1; x <= ids.length; x++){
|
|
1343
|
+
activeIds.push(JSON.stringify(ids.slice(0, x)));
|
|
1344
|
+
}
|
|
1345
|
+
});
|
|
1346
|
+
activeIds = activeIds.filter(function(id, i) {
|
|
1347
|
+
return activeIds.indexOf(id) === i;
|
|
1348
|
+
});
|
|
1349
|
+
if (activeIds.length) hoverFunction = function(d, i) {
|
|
1350
|
+
return activeIds.includes(JSON.stringify(_this._ids(d, i)));
|
|
1351
|
+
};
|
|
1352
|
+
}
|
|
1353
|
+
this._shapes.forEach(function(s) {
|
|
1354
|
+
return s.hover(hoverFunction);
|
|
1355
|
+
});
|
|
1356
|
+
if (this._legend) this._legendClass.hover(hoverFunction);
|
|
1357
|
+
}
|
|
1358
|
+
return this;
|
|
1359
|
+
}
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
/**
|
|
1363
|
+
@memberof Viz
|
|
1364
|
+
@desc If *value* is specified, sets the label accessor to the specified function or string and returns the current class instance.
|
|
1365
|
+
@param {Function|String} [*value*]
|
|
1366
|
+
@chainable
|
|
1367
|
+
*/ key: "label",
|
|
1368
|
+
value: function label(_) {
|
|
1369
|
+
return arguments.length ? (this._label = typeof _ === "function" ? _ : constant(_), this) : this._label;
|
|
1370
|
+
}
|
|
1371
|
+
},
|
|
1372
|
+
{
|
|
1373
|
+
/**
|
|
1374
|
+
@memberof Viz
|
|
1375
|
+
@desc If *value* is specified, toggles the legend based on the specified boolean and returns the current class instance.
|
|
1376
|
+
@param {Boolean|Function} [*value* = true]
|
|
1377
|
+
@chainable
|
|
1378
|
+
*/ key: "legend",
|
|
1379
|
+
value: function legend(_) {
|
|
1380
|
+
return arguments.length ? (this._legend = typeof _ === "function" ? _ : constant(_), this) : this._legend;
|
|
1381
|
+
}
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
/**
|
|
1385
|
+
@memberof Viz
|
|
1386
|
+
@desc If *value* is specified, the object is passed to the legend's config method.
|
|
1387
|
+
@param {Object} [*value*]
|
|
1388
|
+
@chainable
|
|
1389
|
+
*/ key: "legendConfig",
|
|
1390
|
+
value: function legendConfig(_) {
|
|
1391
|
+
return arguments.length ? (this._legendConfig = assign(this._legendConfig, _), this) : this._legendConfig;
|
|
1392
|
+
}
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
/**
|
|
1396
|
+
@memberof Viz
|
|
1397
|
+
@desc Defines the click functionality of categorical legend squares. When set to false, clicking will hide that category and shift+clicking will solo that category. When set to true, clicking with solo that category and shift+clicking will hide that category.
|
|
1398
|
+
@param {Boolean|Function} [*value* = false]
|
|
1399
|
+
@chainable
|
|
1400
|
+
*/ key: "legendFilterInvert",
|
|
1401
|
+
value: function legendFilterInvert(_) {
|
|
1402
|
+
return arguments.length ? (this._legendFilterInvert = typeof _ === "function" ? _ : constant(_), this) : this._legendFilterInvert;
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
/**
|
|
1407
|
+
@memberof Viz
|
|
1408
|
+
@desc Tells the legend whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the legend appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
1409
|
+
@param {Boolean|Function} [*value*]
|
|
1410
|
+
@chainable
|
|
1411
|
+
*/ key: "legendPadding",
|
|
1412
|
+
value: function legendPadding(_) {
|
|
1413
|
+
return arguments.length ? (this._legendPadding = typeof _ === "function" ? _ : constant(_), this) : this._legendPadding;
|
|
1414
|
+
}
|
|
1415
|
+
},
|
|
1416
|
+
{
|
|
1417
|
+
/**
|
|
1418
|
+
@memberof Viz
|
|
1419
|
+
@desc Defines which side of the visualization to anchor the legend. Expected values are `"top"`, `"bottom"`, `"left"`, and `"right"`.
|
|
1420
|
+
@param {Function|String} [*value* = "bottom"]
|
|
1421
|
+
@chainable
|
|
1422
|
+
*/ key: "legendPosition",
|
|
1423
|
+
value: function legendPosition(_) {
|
|
1424
|
+
return arguments.length ? (this._legendPosition = typeof _ === "function" ? _ : constant(_), this) : this._legendPosition;
|
|
1425
|
+
}
|
|
1426
|
+
},
|
|
1427
|
+
{
|
|
1428
|
+
/**
|
|
1429
|
+
@memberof Viz
|
|
1430
|
+
@desc A JavaScript [sort comparator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) used to sort the legend.
|
|
1431
|
+
@param {Function} *value*
|
|
1432
|
+
@chainable
|
|
1433
|
+
*/ key: "legendSort",
|
|
1434
|
+
value: function legendSort(_) {
|
|
1435
|
+
return arguments.length ? (this._legendSort = _, this) : this._legendSort;
|
|
1436
|
+
}
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
/**
|
|
1440
|
+
@memberof Viz
|
|
1441
|
+
@desc If *value* is specified, sets the config method for the legend tooltip and returns the current class instance.
|
|
1442
|
+
@param {Object} [*value* = {}]
|
|
1443
|
+
@chainable
|
|
1444
|
+
*/ key: "legendTooltip",
|
|
1445
|
+
value: function legendTooltip(_) {
|
|
1446
|
+
return arguments.length ? (this._legendTooltip = assign(this._legendTooltip, _), this) : this._legendTooltip;
|
|
1447
|
+
}
|
|
1448
|
+
},
|
|
1449
|
+
{
|
|
1450
|
+
/**
|
|
1451
|
+
@memberof Viz
|
|
1452
|
+
@desc Sets the inner HTML of the status message that is displayed when loading AJAX requests and displaying errors. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.
|
|
1453
|
+
@param {Function|String} [*value*]
|
|
1454
|
+
@chainable
|
|
1455
|
+
*/ key: "loadingHTML",
|
|
1456
|
+
value: function loadingHTML(_) {
|
|
1457
|
+
return arguments.length ? (this._loadingHTML = typeof _ === "function" ? _ : constant(_), this) : this._loadingHTML;
|
|
1458
|
+
}
|
|
1459
|
+
},
|
|
1460
|
+
{
|
|
1461
|
+
/**
|
|
1462
|
+
@memberof Viz
|
|
1463
|
+
@desc Toggles the visibility of the status message that is displayed when loading AJAX requests and displaying errors.
|
|
1464
|
+
@param {Boolean} [*value* = true]
|
|
1465
|
+
@chainable
|
|
1466
|
+
*/ key: "loadingMessage",
|
|
1467
|
+
value: function loadingMessage(_) {
|
|
1468
|
+
return arguments.length ? (this._loadingMessage = _, this) : this._loadingMessage;
|
|
1469
|
+
}
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
/**
|
|
1473
|
+
@memberof Viz
|
|
1474
|
+
@desc Sets the color of the mask used underneath the status message that is displayed when loading AJAX requests and displaying errors. Additionally, `false` will turn off the mask completely.
|
|
1475
|
+
@param {Boolean|String} [*value* = "rgba(0, 0, 0, 0.1)"]
|
|
1476
|
+
@chainable
|
|
1477
|
+
*/ key: "messageMask",
|
|
1478
|
+
value: function messageMask(_) {
|
|
1479
|
+
return arguments.length ? (this._messageMask = _, this) : this._messageMask;
|
|
1480
|
+
}
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
/**
|
|
1484
|
+
@memberof Viz
|
|
1485
|
+
@desc Defines the CSS style properties for the status message that is displayed when loading AJAX requests and displaying errors.
|
|
1486
|
+
@param {Object} [*value*]
|
|
1487
|
+
@chainable
|
|
1488
|
+
*/ key: "messageStyle",
|
|
1489
|
+
value: function messageStyle(_) {
|
|
1490
|
+
return arguments.length ? (this._messageStyle = assign(this._messageStyle, _), this) : this._messageStyle;
|
|
1491
|
+
}
|
|
1492
|
+
},
|
|
1493
|
+
{
|
|
1494
|
+
/**
|
|
1495
|
+
@memberof Viz
|
|
1496
|
+
@desc Sets the inner HTML of the status message that is displayed when no data is supplied to the visualization. Must be a valid HTML string or a function that, when passed this Viz instance, returns a valid HTML string.
|
|
1497
|
+
@param {Function|String} [*value*]
|
|
1498
|
+
@chainable
|
|
1499
|
+
*/ key: "noDataHTML",
|
|
1500
|
+
value: function noDataHTML(_) {
|
|
1501
|
+
return arguments.length ? (this._noDataHTML = typeof _ === "function" ? _ : constant(_), this) : this._noDataHTML;
|
|
1502
|
+
}
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
/**
|
|
1506
|
+
@memberof Viz
|
|
1507
|
+
@desc Toggles the visibility of the status message that is displayed when no data is supplied to the visualization.
|
|
1508
|
+
@param {Boolean} [*value* = true]
|
|
1509
|
+
@chainable
|
|
1510
|
+
*/ key: "noDataMessage",
|
|
1511
|
+
value: function noDataMessage(_) {
|
|
1512
|
+
return arguments.length ? (this._noDataMessage = _, this) : this._noDataMessage;
|
|
1513
|
+
}
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
/**
|
|
1517
|
+
@memberof Viz
|
|
1518
|
+
@desc If using resize detection, this method allow a custom override of the element to which the resize detection function gets attached.
|
|
1519
|
+
@param {String|HTMLElement} *selector*
|
|
1520
|
+
@chainable
|
|
1521
|
+
*/ key: "resizeContainer",
|
|
1522
|
+
value: function resizeContainer(_) {
|
|
1523
|
+
return arguments.length ? (this._resizeContainer = _, this) : this._resizeContainer;
|
|
1524
|
+
}
|
|
1525
|
+
},
|
|
1526
|
+
{
|
|
1527
|
+
/**
|
|
1528
|
+
@memberof Viz
|
|
1529
|
+
@desc If using scroll or visibility detection, this method allow a custom override of the element to which the scroll detection function gets attached.
|
|
1530
|
+
@param {String|HTMLElement} *selector*
|
|
1531
|
+
@chainable
|
|
1532
|
+
*/ key: "scrollContainer",
|
|
1533
|
+
value: function scrollContainer(_) {
|
|
1534
|
+
return arguments.length ? (this._scrollContainer = _, this) : this._scrollContainer;
|
|
1535
|
+
}
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
/**
|
|
1539
|
+
@memberof Viz
|
|
1540
|
+
@desc If *selector* is specified, sets the SVG container element to the specified d3 selector or DOM element and returns the current class instance. If *selector* is not specified, returns the current SVG container element, which is `undefined` by default.
|
|
1541
|
+
@param {String|HTMLElement} [*selector*]
|
|
1542
|
+
@chainable
|
|
1543
|
+
*/ key: "select",
|
|
1544
|
+
value: function select1(_) {
|
|
1545
|
+
return arguments.length ? (this._select = select(_), this) : this._select;
|
|
1546
|
+
}
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
/**
|
|
1550
|
+
@memberof Viz
|
|
1551
|
+
@desc If *value* is specified, sets the shape accessor to the specified function or number and returns the current class instance.
|
|
1552
|
+
@param {Function|String} [*value*]
|
|
1553
|
+
@chainable
|
|
1554
|
+
*/ key: "shape",
|
|
1555
|
+
value: function shape(_) {
|
|
1556
|
+
return arguments.length ? (this._shape = typeof _ === "function" ? _ : constant(_), this) : this._shape;
|
|
1557
|
+
}
|
|
1558
|
+
},
|
|
1559
|
+
{
|
|
1560
|
+
/**
|
|
1561
|
+
@memberof Viz
|
|
1562
|
+
@desc If *value* is specified, sets the config method for each shape and returns the current class instance.
|
|
1563
|
+
@param {Object} [*value*]
|
|
1564
|
+
@chainable
|
|
1565
|
+
*/ key: "shapeConfig",
|
|
1566
|
+
value: function shapeConfig(_) {
|
|
1567
|
+
return arguments.length ? (this._shapeConfig = assign(this._shapeConfig, _), this) : this._shapeConfig;
|
|
1568
|
+
}
|
|
1569
|
+
},
|
|
1570
|
+
{
|
|
1571
|
+
/**
|
|
1572
|
+
@memberof Viz
|
|
1573
|
+
@desc If *value* is specified, sets the subtitle accessor to the specified function or string and returns the current class instance.
|
|
1574
|
+
@param {Function|String} [*value*]
|
|
1575
|
+
@chainable
|
|
1576
|
+
*/ key: "subtitle",
|
|
1577
|
+
value: function subtitle(_) {
|
|
1578
|
+
return arguments.length ? (this._subtitle = typeof _ === "function" ? _ : constant(_), this) : this._subtitle;
|
|
1579
|
+
}
|
|
1580
|
+
},
|
|
1581
|
+
{
|
|
1582
|
+
/**
|
|
1583
|
+
@memberof Viz
|
|
1584
|
+
@desc If *value* is specified, sets the config method for the subtitle and returns the current class instance.
|
|
1585
|
+
@param {Object} [*value*]
|
|
1586
|
+
@chainable
|
|
1587
|
+
*/ key: "subtitleConfig",
|
|
1588
|
+
value: function subtitleConfig(_) {
|
|
1589
|
+
return arguments.length ? (this._subtitleConfig = assign(this._subtitleConfig, _), this) : this._subtitleConfig;
|
|
1590
|
+
}
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
/**
|
|
1594
|
+
@memberof Viz
|
|
1595
|
+
@desc Tells the subtitle whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the subtitle appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
1596
|
+
@param {Boolean|Function} [*value*]
|
|
1597
|
+
@chainable
|
|
1598
|
+
*/ key: "subtitlePadding",
|
|
1599
|
+
value: function subtitlePadding(_) {
|
|
1600
|
+
return arguments.length ? (this._subtitlePadding = typeof _ === "function" ? _ : constant(_), this) : this._subtitlePadding;
|
|
1601
|
+
}
|
|
1602
|
+
},
|
|
1603
|
+
{
|
|
1604
|
+
/**
|
|
1605
|
+
@memberof Viz
|
|
1606
|
+
@desc If *value* is specified, sets the description accessor to the specified string and returns the current class instance.
|
|
1607
|
+
@param {String} [*value*]
|
|
1608
|
+
@chainable
|
|
1609
|
+
*/ key: "svgDesc",
|
|
1610
|
+
value: function svgDesc(_) {
|
|
1611
|
+
return arguments.length ? (this._svgDesc = _, this) : this._svgDesc;
|
|
1612
|
+
}
|
|
1613
|
+
},
|
|
1614
|
+
{
|
|
1615
|
+
/**
|
|
1616
|
+
@memberof Viz
|
|
1617
|
+
@desc If *value* is specified, sets the title accessor to the specified string and returns the current class instance.
|
|
1618
|
+
@param {String} [*value*]
|
|
1619
|
+
@chainable
|
|
1620
|
+
*/ key: "svgTitle",
|
|
1621
|
+
value: function svgTitle(_) {
|
|
1622
|
+
return arguments.length ? (this._svgTitle = _, this) : this._svgTitle;
|
|
1623
|
+
}
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
/**
|
|
1627
|
+
@memberof Viz
|
|
1628
|
+
@desc If *value* is specified, sets the threshold for buckets to the specified function or string, and returns the current class instance.
|
|
1629
|
+
@param {Function|Number} [value]
|
|
1630
|
+
@chainable
|
|
1631
|
+
*/ key: "threshold",
|
|
1632
|
+
value: function threshold(_) {
|
|
1633
|
+
if (arguments.length) {
|
|
1634
|
+
if (typeof _ === "function") {
|
|
1635
|
+
this._threshold = _;
|
|
1636
|
+
} else if (isFinite(_) && !isNaN(_)) {
|
|
1637
|
+
this._threshold = constant(_ * 1);
|
|
1638
|
+
}
|
|
1639
|
+
return this;
|
|
1640
|
+
} else return this._threshold;
|
|
1641
|
+
}
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
/**
|
|
1645
|
+
@memberof Viz
|
|
1646
|
+
@desc If *value* is specified, sets the accesor for the value used in the threshold algorithm, and returns the current class instance.
|
|
1647
|
+
@param {Function|Number} [value]
|
|
1648
|
+
@chainable
|
|
1649
|
+
*/ key: "thresholdKey",
|
|
1650
|
+
value: function thresholdKey(key) {
|
|
1651
|
+
if (arguments.length) {
|
|
1652
|
+
if (typeof key === "function") {
|
|
1653
|
+
this._thresholdKey = key;
|
|
1654
|
+
} else {
|
|
1655
|
+
this._thresholdKey = accessor(key);
|
|
1656
|
+
}
|
|
1657
|
+
return this;
|
|
1658
|
+
} else return this._thresholdKey;
|
|
1659
|
+
}
|
|
1660
|
+
},
|
|
1661
|
+
{
|
|
1662
|
+
/**
|
|
1663
|
+
@memberof Viz
|
|
1664
|
+
@desc If *value* is specified, sets the label for the bucket item, and returns the current class instance.
|
|
1665
|
+
@param {Function|String} [value]
|
|
1666
|
+
@chainable
|
|
1667
|
+
*/ key: "thresholdName",
|
|
1668
|
+
value: function thresholdName(_) {
|
|
1669
|
+
return arguments.length ? (this._thresholdName = typeof _ === "function" ? _ : constant(_), this) : this._thresholdName;
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
{
|
|
1673
|
+
/**
|
|
1674
|
+
@memberof Viz
|
|
1675
|
+
@desc If *value* is specified, sets the time accessor to the specified function or string and returns the current class instance.
|
|
1676
|
+
@param {Function|String} [*value*]
|
|
1677
|
+
@chainable
|
|
1678
|
+
*/ key: "time",
|
|
1679
|
+
value: function time(_) {
|
|
1680
|
+
if (arguments.length) {
|
|
1681
|
+
if (typeof _ === "function") {
|
|
1682
|
+
this._time = _;
|
|
1683
|
+
} else {
|
|
1684
|
+
this._time = accessor(_);
|
|
1685
|
+
if (!this._aggs[_]) {
|
|
1686
|
+
this._aggs[_] = function(a, c) {
|
|
1687
|
+
var v = unique(a.map(c));
|
|
1688
|
+
return v.length === 1 ? v[0] : v;
|
|
1689
|
+
};
|
|
1690
|
+
}
|
|
1691
|
+
if (this._userTime && JSON.stringify(_) !== JSON.stringify(this._userTime)) {
|
|
1692
|
+
this._timeFilter = false;
|
|
1693
|
+
this._timelineSelection = false;
|
|
1694
|
+
}
|
|
1695
|
+
this._userTime = _;
|
|
1696
|
+
}
|
|
1697
|
+
return this;
|
|
1698
|
+
} else return this._time;
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
/**
|
|
1703
|
+
@memberof Viz
|
|
1704
|
+
@desc If *value* is specified, sets the time filter to the specified function and returns the current class instance.
|
|
1705
|
+
@param {Function} [*value*]
|
|
1706
|
+
@chainable
|
|
1707
|
+
*/ key: "timeFilter",
|
|
1708
|
+
value: function timeFilter(_) {
|
|
1709
|
+
return arguments.length ? (this._timeFilter = _, this) : this._timeFilter;
|
|
1710
|
+
}
|
|
1711
|
+
},
|
|
1712
|
+
{
|
|
1713
|
+
/**
|
|
1714
|
+
@memberof Viz
|
|
1715
|
+
@desc If *value* is specified, toggles the timeline based on the specified boolean and returns the current class instance.
|
|
1716
|
+
@param {Boolean} [*value* = true]
|
|
1717
|
+
@chainable
|
|
1718
|
+
*/ key: "timeline",
|
|
1719
|
+
value: function timeline(_) {
|
|
1720
|
+
return arguments.length ? (this._timeline = _, this) : this._timeline;
|
|
1721
|
+
}
|
|
1722
|
+
},
|
|
1723
|
+
{
|
|
1724
|
+
/**
|
|
1725
|
+
@memberof Viz
|
|
1726
|
+
@desc If *value* is specified, sets the config method for the timeline and returns the current class instance.
|
|
1727
|
+
@param {Object} [*value*]
|
|
1728
|
+
@chainable
|
|
1729
|
+
*/ key: "timelineConfig",
|
|
1730
|
+
value: function timelineConfig(_) {
|
|
1731
|
+
return arguments.length ? (this._timelineConfig = assign(this._timelineConfig, _), this) : this._timelineConfig;
|
|
1732
|
+
}
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
/**
|
|
1736
|
+
@memberof Viz
|
|
1737
|
+
@desc Sets the starting time or range for the timeline. The value provided can either be a single Date/String, or an Array of 2 values representing the min and max.
|
|
1738
|
+
@param {Date|String|Array} [*value*]
|
|
1739
|
+
@chainable
|
|
1740
|
+
*/ key: "timelineDefault",
|
|
1741
|
+
value: function timelineDefault(_) {
|
|
1742
|
+
if (arguments.length) {
|
|
1743
|
+
if (!_instanceof(_, Array)) _ = [
|
|
1744
|
+
_,
|
|
1745
|
+
_
|
|
1746
|
+
];
|
|
1747
|
+
this._timelineDefault = _.map(date);
|
|
1748
|
+
return this;
|
|
1749
|
+
} else return this._timelineDefault;
|
|
1750
|
+
}
|
|
1751
|
+
},
|
|
1752
|
+
{
|
|
1753
|
+
/**
|
|
1754
|
+
@memberof Viz
|
|
1755
|
+
@desc Tells the timeline whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the timeline appears centered underneath the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
1756
|
+
@param {Boolean|Function} [*value*]
|
|
1757
|
+
@chainable
|
|
1758
|
+
*/ key: "timelinePadding",
|
|
1759
|
+
value: function timelinePadding(_) {
|
|
1760
|
+
return arguments.length ? (this._timelinePadding = typeof _ === "function" ? _ : constant(_), this) : this._timelinePadding;
|
|
1761
|
+
}
|
|
1762
|
+
},
|
|
1763
|
+
{
|
|
1764
|
+
/**
|
|
1765
|
+
@memberof Viz
|
|
1766
|
+
@desc If *value* is specified, sets the title accessor to the specified function or string and returns the current class instance.
|
|
1767
|
+
@param {Function|String} [*value*]
|
|
1768
|
+
@chainable
|
|
1769
|
+
*/ key: "title",
|
|
1770
|
+
value: function title(_) {
|
|
1771
|
+
return arguments.length ? (this._title = typeof _ === "function" ? _ : constant(_), this) : this._title;
|
|
1772
|
+
}
|
|
1773
|
+
},
|
|
1774
|
+
{
|
|
1775
|
+
/**
|
|
1776
|
+
@memberof Viz
|
|
1777
|
+
@desc If *value* is specified, sets the config method for the title and returns the current class instance.
|
|
1778
|
+
@param {Object} [*value*]
|
|
1779
|
+
@chainable
|
|
1780
|
+
*/ key: "titleConfig",
|
|
1781
|
+
value: function titleConfig(_) {
|
|
1782
|
+
return arguments.length ? (this._titleConfig = assign(this._titleConfig, _), this) : this._titleConfig;
|
|
1783
|
+
}
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
/**
|
|
1787
|
+
@memberof Viz
|
|
1788
|
+
@desc Tells the title whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the title appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
1789
|
+
@param {Boolean|Function} [*value*]
|
|
1790
|
+
@chainable
|
|
1791
|
+
*/ key: "titlePadding",
|
|
1792
|
+
value: function titlePadding(_) {
|
|
1793
|
+
return arguments.length ? (this._titlePadding = typeof _ === "function" ? _ : constant(_), this) : this._titlePadding;
|
|
1794
|
+
}
|
|
1795
|
+
},
|
|
1796
|
+
{
|
|
1797
|
+
/**
|
|
1798
|
+
@memberof Viz
|
|
1799
|
+
@desc If *value* is specified, toggles the tooltip based on the specified boolean and returns the current class instance.
|
|
1800
|
+
@param {Boolean|Function} [*value* = true]
|
|
1801
|
+
@chainable
|
|
1802
|
+
*/ key: "tooltip",
|
|
1803
|
+
value: function tooltip(_) {
|
|
1804
|
+
return arguments.length ? (this._tooltip = typeof _ === "function" ? _ : constant(_), this) : this._tooltip;
|
|
1805
|
+
}
|
|
1806
|
+
},
|
|
1807
|
+
{
|
|
1808
|
+
/**
|
|
1809
|
+
@memberof Viz
|
|
1810
|
+
@desc If *value* is specified, sets the config method for the tooltip and returns the current class instance.
|
|
1811
|
+
@param {Object} [*value*]
|
|
1812
|
+
@chainable
|
|
1813
|
+
*/ key: "tooltipConfig",
|
|
1814
|
+
value: function tooltipConfig(_) {
|
|
1815
|
+
return arguments.length ? (this._tooltipConfig = assign(this._tooltipConfig, _), this) : this._tooltipConfig;
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
{
|
|
1819
|
+
/**
|
|
1820
|
+
@memberof Viz
|
|
1821
|
+
@desc If *value* is specified, sets the total accessor to the specified function or string and returns the current class instance.
|
|
1822
|
+
@param {Boolean|Function|String} [*value*]
|
|
1823
|
+
@chainable
|
|
1824
|
+
*/ key: "total",
|
|
1825
|
+
value: function total(_) {
|
|
1826
|
+
if (arguments.length) {
|
|
1827
|
+
if (typeof _ === "function") this._total = _;
|
|
1828
|
+
else if (_) this._total = accessor(_);
|
|
1829
|
+
else this._total = false;
|
|
1830
|
+
return this;
|
|
1831
|
+
} else return this._total;
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
/**
|
|
1836
|
+
@memberof Viz
|
|
1837
|
+
@desc If *value* is specified, sets the config method for the total and returns the current class instance.
|
|
1838
|
+
@param {Object} [*value*]
|
|
1839
|
+
@chainable
|
|
1840
|
+
*/ key: "totalConfig",
|
|
1841
|
+
value: function totalConfig(_) {
|
|
1842
|
+
return arguments.length ? (this._totalConfig = assign(this._totalConfig, _), this) : this._totalConfig;
|
|
1843
|
+
}
|
|
1844
|
+
},
|
|
1845
|
+
{
|
|
1846
|
+
/**
|
|
1847
|
+
@memberof Viz
|
|
1848
|
+
@desc Formatter function for the value in the total bar.
|
|
1849
|
+
@param {Function} *value*
|
|
1850
|
+
@chainable
|
|
1851
|
+
*/ key: "totalFormat",
|
|
1852
|
+
value: function totalFormat(_) {
|
|
1853
|
+
return arguments.length ? (this._totalFormat = _, this) : this._totalFormat;
|
|
1854
|
+
}
|
|
1855
|
+
},
|
|
1856
|
+
{
|
|
1857
|
+
/**
|
|
1858
|
+
@memberof Viz
|
|
1859
|
+
@desc Tells the total whether or not to use the internal padding defined by the visualization in it's positioning. For example, d3plus-plot will add padding on the left so that the total appears centered above the x-axis. By default, this padding is only applied on screens larger than 600 pixels wide.
|
|
1860
|
+
@param {Boolean|Function} [*value*]
|
|
1861
|
+
@chainable
|
|
1862
|
+
*/ key: "totalPadding",
|
|
1863
|
+
value: function totalPadding(_) {
|
|
1864
|
+
return arguments.length ? (this._totalPadding = typeof _ === "function" ? _ : constant(_), this) : this._totalPadding;
|
|
1865
|
+
}
|
|
1866
|
+
},
|
|
1867
|
+
{
|
|
1868
|
+
/**
|
|
1869
|
+
@memberof Viz
|
|
1870
|
+
@desc If *value* is specified, sets the overallwidth to the specified number and returns the current class instance.
|
|
1871
|
+
@param {Number} [*value* = window.innerWidth]
|
|
1872
|
+
@chainable
|
|
1873
|
+
*/ key: "width",
|
|
1874
|
+
value: function width(_) {
|
|
1875
|
+
return arguments.length ? (this._width = _, this) : this._width;
|
|
1876
|
+
}
|
|
1877
|
+
},
|
|
1878
|
+
{
|
|
1879
|
+
/**
|
|
1880
|
+
@memberof Viz
|
|
1881
|
+
@desc Toggles the ability to zoom/pan the visualization. Certain parameters for zooming are required to be hooked up on a visualization by visualization basis.
|
|
1882
|
+
@param {Boolean} *value* = false
|
|
1883
|
+
@chainable
|
|
1884
|
+
*/ key: "zoom",
|
|
1885
|
+
value: function zoom(_) {
|
|
1886
|
+
return arguments.length ? (this._zoom = _, this) : this._zoom;
|
|
1887
|
+
}
|
|
1888
|
+
},
|
|
1889
|
+
{
|
|
1890
|
+
/**
|
|
1891
|
+
@memberof Viz
|
|
1892
|
+
@desc The pixel stroke-width of the zoom brush area.
|
|
1893
|
+
@param {Number} *value* = 1
|
|
1894
|
+
@chainable
|
|
1895
|
+
*/ key: "zoomBrushHandleSize",
|
|
1896
|
+
value: function zoomBrushHandleSize(_) {
|
|
1897
|
+
return arguments.length ? (this._zoomBrushHandleSize = _, this) : this._zoomBrushHandleSize;
|
|
1898
|
+
}
|
|
1899
|
+
},
|
|
1900
|
+
{
|
|
1901
|
+
/**
|
|
1902
|
+
@memberof Viz
|
|
1903
|
+
@desc An object containing CSS key/value pairs that is used to style the outer handle area of the zoom brush. Passing `false` will remove all default styling.
|
|
1904
|
+
@param {Object|Boolean} *value*
|
|
1905
|
+
@chainable
|
|
1906
|
+
*/ key: "zoomBrushHandleStyle",
|
|
1907
|
+
value: function zoomBrushHandleStyle(_) {
|
|
1908
|
+
return arguments.length ? (this._zoomBrushHandleStyle = _, this) : this._zoomBrushHandleStyle;
|
|
1909
|
+
}
|
|
1910
|
+
},
|
|
1911
|
+
{
|
|
1912
|
+
/**
|
|
1913
|
+
@memberof Viz
|
|
1914
|
+
@desc An object containing CSS key/value pairs that is used to style the inner selection area of the zoom brush. Passing `false` will remove all default styling.
|
|
1915
|
+
@param {Object|Boolean} *value*
|
|
1916
|
+
@chainable
|
|
1917
|
+
*/ key: "zoomBrushSelectionStyle",
|
|
1918
|
+
value: function zoomBrushSelectionStyle(_) {
|
|
1919
|
+
return arguments.length ? (this._zoomBrushSelectionStyle = _, this) : this._zoomBrushSelectionStyle;
|
|
1920
|
+
}
|
|
1921
|
+
},
|
|
1922
|
+
{
|
|
1923
|
+
/**
|
|
1924
|
+
@memberof Viz
|
|
1925
|
+
@desc An object containing CSS key/value pairs that is used to style each zoom control button (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.
|
|
1926
|
+
@param {Object|Boolean} *value*
|
|
1927
|
+
@chainable
|
|
1928
|
+
*/ key: "zoomControlStyle",
|
|
1929
|
+
value: function zoomControlStyle(_) {
|
|
1930
|
+
return arguments.length ? (this._zoomControlStyle = _, this) : this._zoomControlStyle;
|
|
1931
|
+
}
|
|
1932
|
+
},
|
|
1933
|
+
{
|
|
1934
|
+
/**
|
|
1935
|
+
@memberof Viz
|
|
1936
|
+
@desc An object containing CSS key/value pairs that is used to style each zoom control button when active (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.
|
|
1937
|
+
@param {Object|Boolean} *value*
|
|
1938
|
+
@chainable
|
|
1939
|
+
*/ key: "zoomControlStyleActive",
|
|
1940
|
+
value: function zoomControlStyleActive(_) {
|
|
1941
|
+
return arguments.length ? (this._zoomControlStyleActive = _, this) : this._zoomControlStyleActive;
|
|
1942
|
+
}
|
|
1943
|
+
},
|
|
1944
|
+
{
|
|
1945
|
+
/**
|
|
1946
|
+
@memberof Viz
|
|
1947
|
+
@desc An object containing CSS key/value pairs that is used to style each zoom control button on hover (`.zoom-in`, `.zoom-out`, `.zoom-reset`, and `.zoom-brush`). Passing `false` will remove all default styling.
|
|
1948
|
+
@param {Object|Boolean} *value*
|
|
1949
|
+
@chainable
|
|
1950
|
+
*/ key: "zoomControlStyleHover",
|
|
1951
|
+
value: function zoomControlStyleHover(_) {
|
|
1952
|
+
return arguments.length ? (this._zoomControlStyleHover = _, this) : this._zoomControlStyleHover;
|
|
1953
|
+
}
|
|
1954
|
+
},
|
|
1955
|
+
{
|
|
1956
|
+
/**
|
|
1957
|
+
@memberof Viz
|
|
1958
|
+
@desc The multiplier that is used in with the control buttons when zooming in and out.
|
|
1959
|
+
@param {Number} *value* = 2
|
|
1960
|
+
@chainable
|
|
1961
|
+
*/ key: "zoomFactor",
|
|
1962
|
+
value: function zoomFactor(_) {
|
|
1963
|
+
return arguments.length ? (this._zoomFactor = _, this) : this._zoomFactor;
|
|
1964
|
+
}
|
|
1965
|
+
},
|
|
1966
|
+
{
|
|
1967
|
+
/**
|
|
1968
|
+
@memberof Viz
|
|
1969
|
+
@desc If *value* is specified, sets the max zoom scale to the specified number and returns the current class instance. If *value* is not specified, returns the current max zoom scale.
|
|
1970
|
+
@param {Number} *value* = 16
|
|
1971
|
+
@chainable
|
|
1972
|
+
*/ key: "zoomMax",
|
|
1973
|
+
value: function zoomMax(_) {
|
|
1974
|
+
return arguments.length ? (this._zoomMax = _, this) : this._zoomMax;
|
|
1975
|
+
}
|
|
1976
|
+
},
|
|
1977
|
+
{
|
|
1978
|
+
/**
|
|
1979
|
+
@memberof Viz
|
|
1980
|
+
@desc If *value* is specified, toggles panning to the specified boolean and returns the current class instance. If *value* is not specified, returns the current panning value.
|
|
1981
|
+
@param {Boolean} *value* = true
|
|
1982
|
+
@chainable
|
|
1983
|
+
*/ key: "zoomPan",
|
|
1984
|
+
value: function zoomPan(_) {
|
|
1985
|
+
return arguments.length ? (this._zoomPan = _, this) : this._zoomPan;
|
|
1986
|
+
}
|
|
1987
|
+
},
|
|
1988
|
+
{
|
|
1989
|
+
/**
|
|
1990
|
+
@memberof Viz
|
|
1991
|
+
@desc A pixel value to be used to pad all sides of a zoomed area.
|
|
1992
|
+
@param {Number} *value* = 20
|
|
1993
|
+
@chainable
|
|
1994
|
+
*/ key: "zoomPadding",
|
|
1995
|
+
value: function zoomPadding(_) {
|
|
1996
|
+
return arguments.length ? (this._zoomPadding = _, this) : this._zoomPadding;
|
|
1997
|
+
}
|
|
1998
|
+
},
|
|
1999
|
+
{
|
|
2000
|
+
/**
|
|
2001
|
+
@memberof Viz
|
|
2002
|
+
@desc If *value* is specified, toggles scroll zooming to the specified boolean and returns the current class instance. If *value* is not specified, returns the current scroll zooming value.
|
|
2003
|
+
@param {Boolean} [*value* = true]
|
|
2004
|
+
@chainable
|
|
2005
|
+
*/ key: "zoomScroll",
|
|
2006
|
+
value: function zoomScroll(_) {
|
|
2007
|
+
return arguments.length ? (this._zoomScroll = _, this) : this._zoomScroll;
|
|
2008
|
+
}
|
|
2009
|
+
}
|
|
2010
|
+
]);
|
|
2011
|
+
return Viz;
|
|
2012
|
+
}(BaseClass);
|
|
2013
|
+
/**
|
|
2014
|
+
@class Viz
|
|
2015
|
+
@extends BaseClass
|
|
2016
|
+
@desc Creates an x/y plot based on an array of data. If *data* is specified, immediately draws the tree map based on the specified array and returns the current class instance. If *data* is not specified on instantiation, it can be passed/updated after instantiation using the [data](#treemap.data) method. See [this example](https://d3plus.org/examples/d3plus-treemap/getting-started/) for help getting started using the treemap generator.
|
|
2017
|
+
*/ export { Viz as default };
|