@d3plus/core 3.0.16 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +88482 -2998
- package/es/index.js +1 -1
- package/es/src/charts/AreaPlot.js +1 -3
- package/es/src/charts/BarChart.js +1 -3
- package/es/src/charts/BoxWhisker.js +2 -4
- package/es/src/charts/BumpChart.js +4 -5
- package/es/src/charts/Donut.js +1 -3
- package/es/src/charts/Geomap.js +47 -88
- package/es/src/charts/LinePlot.js +1 -3
- package/es/src/charts/Matrix.js +27 -46
- package/es/src/charts/Network.js +87 -81
- package/es/src/charts/Pack.js +21 -34
- package/es/src/charts/Pie.js +12 -24
- package/es/src/charts/Plot.js +226 -321
- package/es/src/charts/Priestley.js +18 -36
- package/es/src/charts/Radar.js +100 -47
- package/es/src/charts/RadialMatrix.js +35 -47
- package/es/src/charts/Rings.js +99 -90
- package/es/src/charts/Sankey.js +85 -75
- package/es/src/charts/StackedArea.js +1 -3
- package/es/src/charts/Tree.js +27 -28
- package/es/src/charts/Treemap.js +117 -71
- package/es/src/charts/Viz.js +296 -492
- package/es/src/charts/drawSteps/drawAttribution.js +1 -1
- package/es/src/charts/drawSteps/drawBack.js +1 -2
- package/es/src/charts/drawSteps/drawColorScale.js +1 -2
- package/es/src/charts/drawSteps/drawLegend.js +8 -10
- package/es/src/charts/drawSteps/drawSubtitle.js +1 -3
- package/es/src/charts/drawSteps/drawTimeline.js +12 -9
- package/es/src/charts/drawSteps/drawTitle.js +1 -3
- package/es/src/charts/drawSteps/drawTotal.js +1 -3
- package/es/src/charts/drawSteps/zoomControls.js +19 -21
- package/es/src/charts/events/click.legend.js +2 -3
- package/es/src/charts/events/click.shape.js +2 -4
- package/es/src/charts/events/mouseenter.js +7 -8
- package/es/src/charts/events/mouseleave.js +1 -3
- package/es/src/charts/events/mousemove.legend.js +3 -4
- package/es/src/charts/events/mousemove.shape.js +2 -4
- package/es/src/charts/events/touchstart.body.js +1 -1
- package/es/src/charts/helpers/matrixData.js +11 -4
- package/es/src/charts/helpers/tileAttributions.js +2 -1
- package/es/src/charts/plotBuffers/Bar.js +55 -12
- package/es/src/charts/plotBuffers/Box.js +55 -12
- package/es/src/charts/plotBuffers/Circle.js +9 -11
- package/es/src/charts/plotBuffers/Line.js +4 -6
- package/es/src/charts/plotBuffers/Rect.js +10 -12
- package/es/src/charts/plotBuffers/discreteBuffer.js +4 -2
- package/es/src/charts/plotBuffers/numericBuffer.js +7 -6
- package/es/src/components/Axis.js +298 -426
- package/es/src/components/AxisBottom.js +1 -3
- package/es/src/components/AxisLeft.js +1 -3
- package/es/src/components/AxisRight.js +1 -3
- package/es/src/components/AxisTop.js +1 -3
- package/es/src/components/ColorScale.js +80 -197
- package/es/src/components/Legend.js +82 -135
- package/es/src/components/Message.js +27 -19
- package/es/src/components/TextBox.js +106 -262
- package/es/src/components/Timeline.js +88 -155
- package/es/src/components/Tooltip.js +301 -330
- package/es/src/shapes/Area.js +95 -74
- package/es/src/shapes/Bar.js +46 -86
- package/es/src/shapes/Box.js +104 -118
- package/es/src/shapes/Circle.js +29 -30
- package/es/src/shapes/Image.js +44 -102
- package/es/src/shapes/Line.js +74 -40
- package/es/src/shapes/Path.js +23 -25
- package/es/src/shapes/Rect.js +29 -41
- package/es/src/shapes/Shape.js +146 -363
- package/es/src/shapes/Whisker.js +89 -90
- package/es/src/utils/AccessorFn.js +4 -0
- package/es/src/utils/BaseClass.js +53 -82
- package/es/src/utils/D3plusConfig.js +1 -0
- package/es/src/utils/RESET.js +2 -4
- package/es/src/utils/accessor.js +4 -5
- package/es/src/utils/configPrep.js +13 -12
- package/es/src/utils/constant.js +2 -3
- package/es/src/utils/getProp.js +4 -4
- package/es/src/utils/index.js +0 -1
- package/package.json +29 -22
- package/types/index.d.ts +5 -0
- package/types/src/charts/AreaPlot.d.ts +16 -0
- package/types/src/charts/BarChart.d.ts +16 -0
- package/types/src/charts/BoxWhisker.d.ts +11 -0
- package/types/src/charts/BumpChart.d.ts +36 -0
- package/types/src/charts/Donut.d.ts +11 -0
- package/types/src/charts/Geomap.d.ts +120 -0
- package/types/src/charts/LinePlot.d.ts +15 -0
- package/types/src/charts/Matrix.d.ts +74 -0
- package/types/src/charts/Network.d.ts +78 -0
- package/types/src/charts/Pack.d.ts +47 -0
- package/types/src/charts/Pie.d.ts +44 -0
- package/types/src/charts/Plot.d.ts +199 -0
- package/types/src/charts/Priestley.d.ts +37 -0
- package/types/src/charts/Radar.d.ts +38 -0
- package/types/src/charts/RadialMatrix.d.ts +78 -0
- package/types/src/charts/Rings.d.ts +74 -0
- package/types/src/charts/Sankey.d.ts +81 -0
- package/types/src/charts/StackedArea.d.ts +14 -0
- package/types/src/charts/Tree.d.ts +33 -0
- package/types/src/charts/Treemap.d.ts +51 -0
- package/types/src/charts/Viz.d.ts +402 -0
- package/types/src/charts/drawSteps/drawAttribution.d.ts +7 -0
- package/types/src/charts/drawSteps/drawBack.d.ts +6 -0
- package/types/src/charts/drawSteps/drawColorScale.d.ts +6 -0
- package/types/src/charts/drawSteps/drawLegend.d.ts +12 -0
- package/types/src/charts/drawSteps/drawSubtitle.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTimeline.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTitle.d.ts +7 -0
- package/types/src/charts/drawSteps/drawTotal.d.ts +7 -0
- package/types/src/charts/drawSteps/zoomControls.d.ts +7 -0
- package/types/src/charts/events/click.legend.d.ts +8 -0
- package/types/src/charts/events/click.shape.d.ts +8 -0
- package/types/src/charts/events/mouseenter.d.ts +8 -0
- package/types/src/charts/events/mouseleave.d.ts +8 -0
- package/types/src/charts/events/mousemove.legend.d.ts +9 -0
- package/types/src/charts/events/mousemove.shape.d.ts +9 -0
- package/types/src/charts/events/touchstart.body.d.ts +7 -0
- package/types/src/charts/helpers/matrixData.d.ts +11 -0
- package/types/src/charts/helpers/tileAttributions.d.ts +6 -0
- package/types/src/charts/index.d.ts +21 -0
- package/types/src/charts/plotBuffers/Bar.d.ts +16 -0
- package/types/src/charts/plotBuffers/Box.d.ts +16 -0
- package/types/src/charts/plotBuffers/Circle.d.ts +20 -0
- package/types/src/charts/plotBuffers/Line.d.ts +16 -0
- package/types/src/charts/plotBuffers/Rect.d.ts +19 -0
- package/types/src/charts/plotBuffers/discreteBuffer.d.ts +7 -0
- package/types/src/charts/plotBuffers/numericBuffer.d.ts +5 -0
- package/types/src/components/Axis.d.ts +309 -0
- package/types/src/components/AxisBottom.d.ts +11 -0
- package/types/src/components/AxisLeft.d.ts +11 -0
- package/types/src/components/AxisRight.d.ts +11 -0
- package/types/src/components/AxisTop.d.ts +11 -0
- package/types/src/components/ColorScale.d.ts +208 -0
- package/types/src/components/Legend.d.ts +157 -0
- package/types/src/components/Message.d.ts +40 -0
- package/types/src/components/TextBox.d.ts +278 -0
- package/types/src/components/Timeline.d.ts +157 -0
- package/types/src/components/Tooltip.d.ts +297 -0
- package/types/src/components/index.d.ts +11 -0
- package/types/src/shapes/Area.d.ts +81 -0
- package/types/src/shapes/Bar.d.ts +104 -0
- package/types/src/shapes/Box.d.ts +121 -0
- package/types/src/shapes/Circle.d.ts +44 -0
- package/types/src/shapes/Image.d.ts +124 -0
- package/types/src/shapes/Line.d.ts +48 -0
- package/types/src/shapes/Path.d.ts +38 -0
- package/types/src/shapes/Rect.d.ts +54 -0
- package/types/src/shapes/Shape.d.ts +378 -0
- package/types/src/shapes/Whisker.d.ts +96 -0
- package/types/src/shapes/index.d.ts +10 -0
- package/types/src/utils/AccessorFn.d.ts +6 -0
- package/types/src/utils/BaseClass.d.ts +76 -0
- package/types/src/utils/D3plusConfig.d.ts +164 -0
- package/types/src/utils/RESET.d.ts +3 -0
- package/types/src/utils/accessor.d.ts +13 -0
- package/types/src/utils/configPrep.d.ts +28 -0
- package/types/src/utils/constant.d.ts +11 -0
- package/types/src/utils/getProp.d.ts +9 -0
- package/types/src/utils/index.d.ts +8 -0
- package/umd/d3plus-core.full.js +20126 -18700
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +2919 -5393
- package/umd/d3plus-core.js +1919 -4073
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +1604 -3936
- package/es/src/utils/uuid.js +0 -13
package/es/src/charts/Plot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
@@ -84,6 +84,7 @@ function _inherits(subClass, superClass) {
|
|
|
84
84
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
85
85
|
}
|
|
86
86
|
function _instanceof(left, right) {
|
|
87
|
+
"@swc/helpers - instanceof";
|
|
87
88
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
88
89
|
return !!right[Symbol.hasInstance](left);
|
|
89
90
|
} else {
|
|
@@ -160,15 +161,15 @@ function _is_native_reflect_construct() {
|
|
|
160
161
|
return !!result;
|
|
161
162
|
})();
|
|
162
163
|
}
|
|
163
|
-
import { deviation, extent, max, mean, merge, min, range, sum } from "d3-array";
|
|
164
|
-
import { nest } from "d3-collection";
|
|
164
|
+
/* eslint no-cond-assign: 0*/ import { deviation, extent, groups, max, mean, merge, min, range, rollups, sum } from "d3-array";
|
|
165
165
|
import * as scales from "d3-scale";
|
|
166
166
|
import * as d3Shape from "d3-shape";
|
|
167
|
+
// @ts-ignore
|
|
167
168
|
import pkg from "open-color/open-color.js";
|
|
168
169
|
var openColor = pkg.theme;
|
|
169
170
|
import { colorAssign, colorContrast, colorDefaults, colorLegible } from "@d3plus/color";
|
|
170
171
|
import { merge as d3plusMerge, unique } from "@d3plus/data";
|
|
171
|
-
import { assign, date, elem, rtl, textWidth } from "@d3plus/dom";
|
|
172
|
+
import { assign, backgroundColor, date, elem, rtl, textWidth } from "@d3plus/dom";
|
|
172
173
|
import { largestRect } from "@d3plus/math";
|
|
173
174
|
import { formatAbbreviate } from "@d3plus/format";
|
|
174
175
|
import { AxisBottom, AxisLeft, AxisRight, AxisTop, TextBox } from "../components/index.js";
|
|
@@ -191,13 +192,13 @@ var defaultBuffers = {
|
|
|
191
192
|
Rect: RectBuffer
|
|
192
193
|
};
|
|
193
194
|
/**
|
|
194
|
-
|
|
195
|
+
Logic for determining default sizes of shapes using the sizeScaleD3 internal function.
|
|
195
196
|
@private
|
|
196
197
|
*/ function defaultSize(d) {
|
|
197
198
|
return this._sizeScaleD3(this._size ? this._size(d) : null);
|
|
198
199
|
}
|
|
199
200
|
/**
|
|
200
|
-
|
|
201
|
+
Logic for determining stackOrder ascending using groups.
|
|
201
202
|
@private
|
|
202
203
|
*/ function stackOrderAscending(series) {
|
|
203
204
|
var sums = series.map(stackSum);
|
|
@@ -209,13 +210,13 @@ var defaultBuffers = {
|
|
|
209
210
|
});
|
|
210
211
|
}
|
|
211
212
|
/**
|
|
212
|
-
|
|
213
|
+
Logic for determining stackOrder descending using groups.
|
|
213
214
|
@private
|
|
214
215
|
*/ function stackOrderDescending(series) {
|
|
215
216
|
return stackOrderAscending(series).reverse();
|
|
216
217
|
}
|
|
217
218
|
/**
|
|
218
|
-
|
|
219
|
+
Logic for determining default sum of shapes using the stackSum function used in d3Shape.
|
|
219
220
|
@private
|
|
220
221
|
*/ function stackSum(series) {
|
|
221
222
|
var i = -1, s = 0, v;
|
|
@@ -224,7 +225,7 @@ var defaultBuffers = {
|
|
|
224
225
|
return s;
|
|
225
226
|
}
|
|
226
227
|
/**
|
|
227
|
-
|
|
228
|
+
Logic for determining default sum of shapes using the stackSum function used in d3Shape.
|
|
228
229
|
@private
|
|
229
230
|
*/ function stackOffsetDiverging(series, order) {
|
|
230
231
|
var n;
|
|
@@ -286,7 +287,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
286
287
|
Line: false
|
|
287
288
|
});
|
|
288
289
|
_this._confidenceConfig = {
|
|
289
|
-
fill: function(d, i) {
|
|
290
|
+
fill: function fill(d, i) {
|
|
290
291
|
var c = typeof _this._shapeConfig.Line.stroke === "function" ? _this._shapeConfig.Line.stroke(d, i) : _this._shapeConfig.Line.stroke;
|
|
291
292
|
return c;
|
|
292
293
|
},
|
|
@@ -299,7 +300,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
299
300
|
};
|
|
300
301
|
_this._labelPosition = constant("auto");
|
|
301
302
|
_this._lineMarkerConfig = {
|
|
302
|
-
fill: function(d, i) {
|
|
303
|
+
fill: function fill(d, i) {
|
|
303
304
|
return colorAssign(_this._id(d, i));
|
|
304
305
|
},
|
|
305
306
|
r: constant(3)
|
|
@@ -313,10 +314,10 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
313
314
|
_this._shape = constant("Circle");
|
|
314
315
|
_this._shapeConfig = assign(_this._shapeConfig, {
|
|
315
316
|
Area: {
|
|
316
|
-
label: function(d, i) {
|
|
317
|
+
label: function label(d, i) {
|
|
317
318
|
return _this._stacked ? _this._drawLabel(d, i) : false;
|
|
318
319
|
},
|
|
319
|
-
labelBounds: function(d, i, aes) {
|
|
320
|
+
labelBounds: function labelBounds(d, i, aes) {
|
|
320
321
|
var r = largestRect(aes.points, {
|
|
321
322
|
angle: range(-20, 20, 5)
|
|
322
323
|
});
|
|
@@ -346,7 +347,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
346
347
|
padding: 10
|
|
347
348
|
}
|
|
348
349
|
},
|
|
349
|
-
ariaLabel: function(d, i) {
|
|
350
|
+
ariaLabel: function ariaLabel(d, i) {
|
|
350
351
|
var ariaLabelStr = "";
|
|
351
352
|
if (d.nested) ariaLabelStr = "".concat(_this._drawLabel(d.data, d.i));
|
|
352
353
|
else {
|
|
@@ -381,10 +382,18 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
381
382
|
fontMin: 6,
|
|
382
383
|
fontResize: true,
|
|
383
384
|
fontColor: function fontColor(d, i) {
|
|
384
|
-
|
|
385
|
+
if (outside.bind(this)(d, i)) {
|
|
386
|
+
var bg = this._backgroundConfig.fill === "transparent" ? backgroundColor(this._select.node()) : this._backgroundConfig.fill;
|
|
387
|
+
return colorContrast(bg);
|
|
388
|
+
}
|
|
389
|
+
return colorContrast(typeof this._shapeConfig.fill === "function" ? this._shapeConfig.fill(d, i) : this._shapeConfig.fill);
|
|
385
390
|
},
|
|
386
391
|
fontStroke: function fontStroke(d, i) {
|
|
387
|
-
|
|
392
|
+
if (outside.bind(this)(d, i)) {
|
|
393
|
+
var bg = this._backgroundConfig.fill === "transparent" ? backgroundColor(this._select.node()) : this._backgroundConfig.fill;
|
|
394
|
+
return colorContrast(bg);
|
|
395
|
+
}
|
|
396
|
+
return "transparent";
|
|
388
397
|
},
|
|
389
398
|
fontStrokeWidth: function fontStrokeWidth(d, i) {
|
|
390
399
|
return outside.bind(this)(d, i) ? 0.1 : 0;
|
|
@@ -411,12 +420,12 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
411
420
|
r: defaultSize.bind(_this)
|
|
412
421
|
},
|
|
413
422
|
Line: {
|
|
414
|
-
curve: function() {
|
|
423
|
+
curve: function curve() {
|
|
415
424
|
return _this._discrete ? "monotone".concat(_this._discrete.charAt(0).toUpperCase()) : "linear";
|
|
416
425
|
},
|
|
417
426
|
fill: constant("none"),
|
|
418
427
|
labelConfig: {
|
|
419
|
-
fontColor: function(d, i) {
|
|
428
|
+
fontColor: function fontColor(d, i) {
|
|
420
429
|
var c = typeof _this._shapeConfig.Line.stroke === "function" ? _this._shapeConfig.Line.stroke(d, i) : _this._shapeConfig.Line.stroke;
|
|
421
430
|
return colorLegible(c);
|
|
422
431
|
},
|
|
@@ -428,10 +437,10 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
428
437
|
strokeWidth: constant(2)
|
|
429
438
|
},
|
|
430
439
|
Rect: {
|
|
431
|
-
height: function(d) {
|
|
440
|
+
height: function height(d) {
|
|
432
441
|
return defaultSize.bind(_this)(d) * 2;
|
|
433
442
|
},
|
|
434
|
-
width: function(d) {
|
|
443
|
+
width: function width(d) {
|
|
435
444
|
return defaultSize.bind(_this)(d) * 2;
|
|
436
445
|
}
|
|
437
446
|
}
|
|
@@ -454,7 +463,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
454
463
|
_this._stackOffset = stackOffsetDiverging;
|
|
455
464
|
_this._stackOrder = stackOrderDescending;
|
|
456
465
|
_this._timelineConfig = assign(_this._timelineConfig, {
|
|
457
|
-
brushMin: function() {
|
|
466
|
+
brushMin: function brushMin() {
|
|
458
467
|
return _this._xTime || _this._yTime || _this._x2Time || _this._y2Time ? 2 : 1;
|
|
459
468
|
}
|
|
460
469
|
});
|
|
@@ -464,11 +473,14 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
464
473
|
_this._xTest = new AxisBottom().align("end").gridSize(0);
|
|
465
474
|
_this._xConfig = {
|
|
466
475
|
gridConfig: {
|
|
467
|
-
stroke: function(d) {
|
|
476
|
+
stroke: function stroke(d) {
|
|
468
477
|
if (_this._discrete && _this._discrete.charAt(0) === "x") return "transparent";
|
|
469
478
|
var range = _this._xAxis.range();
|
|
470
|
-
|
|
471
|
-
|
|
479
|
+
var position = _this._xAxis._getPosition.bind(_this._xAxis)(d.id);
|
|
480
|
+
if (range[0] === position) return "transparent";
|
|
481
|
+
var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
|
|
482
|
+
var contrast = colorContrast(bg);
|
|
483
|
+
return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
|
|
472
484
|
}
|
|
473
485
|
}
|
|
474
486
|
};
|
|
@@ -485,11 +497,14 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
485
497
|
_this._yTest = new AxisLeft().align("start").gridSize(0);
|
|
486
498
|
_this._yConfig = {
|
|
487
499
|
gridConfig: {
|
|
488
|
-
stroke: function(d) {
|
|
500
|
+
stroke: function stroke(d) {
|
|
489
501
|
if (_this._discrete && _this._discrete.charAt(0) === "y") return "transparent";
|
|
490
502
|
var range = _this._yAxis.range();
|
|
491
|
-
|
|
492
|
-
|
|
503
|
+
var position = _this._yAxis._getPosition.bind(_this._yAxis)(d.id);
|
|
504
|
+
if (range[range.length - 1] === position) return "transparent";
|
|
505
|
+
var bg = _this._select ? backgroundColor(_this._select.node()) : "rgb(255, 255, 255)";
|
|
506
|
+
var contrast = colorContrast(bg);
|
|
507
|
+
return contrast === colorDefaults.dark ? openColor.colors.gray[200] : openColor.colors.gray[600];
|
|
493
508
|
}
|
|
494
509
|
}
|
|
495
510
|
};
|
|
@@ -506,7 +521,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
506
521
|
/**
|
|
507
522
|
Extends the preDraw behavior of the abstract Viz class.
|
|
508
523
|
@private
|
|
509
|
-
|
|
524
|
+
*/ key: "_preDraw",
|
|
510
525
|
value: function _preDraw() {
|
|
511
526
|
var _this = this;
|
|
512
527
|
// logic repeated for each axis
|
|
@@ -540,17 +555,17 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
540
555
|
/**
|
|
541
556
|
Extends the draw behavior of the abstract Viz class.
|
|
542
557
|
@private
|
|
543
|
-
|
|
558
|
+
*/ key: "_draw",
|
|
544
559
|
value: function _draw(callback) {
|
|
545
560
|
var _this = this;
|
|
546
561
|
if (!this._filteredData.length && !this._annotations.length) return this;
|
|
547
|
-
/* Determines whether or not any of the x or y axes are a "time" axis
|
|
562
|
+
/* Determines whether or not any of the x or y axes are a "time" axis.*/ var firstElemTime = this._time ? this._time(this._filteredData[0], 0) : false;
|
|
548
563
|
var x2Time = this._x2Time = firstElemTime && this._x2(this._filteredData[0], 0) === firstElemTime, xTime = this._xTime = firstElemTime && this._x(this._filteredData[0], 0) === firstElemTime, y2Time = this._y2Time = firstElemTime && this._y2(this._filteredData[0], 0) === firstElemTime, yTime = this._yTime = firstElemTime && this._y(this._filteredData[0], 0) === firstElemTime;
|
|
549
564
|
var timeAxis = xTime || x2Time || yTime || y2Time;
|
|
550
|
-
var stackGroup = function(d, i) {
|
|
565
|
+
var stackGroup = function stackGroup(d, i) {
|
|
551
566
|
return "".concat(!timeAxis && _this._time ? _this._time(d, i) : "time", "_").concat(_this._stacked ? "".concat(_this._groupBy.length > 1 ? _this._ids(d, i).slice(0, -1).join("_") : "group") : "".concat(_this._ids(d, i).join("_")));
|
|
552
567
|
};
|
|
553
|
-
var prepData = function(d, i) {
|
|
568
|
+
var prepData = function prepData(d, i) {
|
|
554
569
|
var newD = {
|
|
555
570
|
__d3plus__: true,
|
|
556
571
|
data: d,
|
|
@@ -599,11 +614,10 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
599
614
|
return d;
|
|
600
615
|
}), parent = this._select, transition = this._transition, width = this._width - this._margin.left - this._margin.right;
|
|
601
616
|
/**
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
*/ function getAxisValues(axis) {
|
|
617
|
+
Returns all unique values for a given axis.
|
|
618
|
+
@param axis Which axis to return values for, "x" or "y".
|
|
619
|
+
@private
|
|
620
|
+
*/ function getAxisValues(axis) {
|
|
607
621
|
var _this = this;
|
|
608
622
|
var timeData = this["_".concat(axis, "Time")];
|
|
609
623
|
var localData = timeData ? data : axisData;
|
|
@@ -616,19 +630,20 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
616
630
|
});
|
|
617
631
|
if (!filteredData.length) return [];
|
|
618
632
|
var numericValue = typeof filteredData[0][axis] === "number";
|
|
619
|
-
var myData = this._discrete === axis ?
|
|
620
|
-
return d[axis];
|
|
621
|
-
}).rollup(function(leaves) {
|
|
633
|
+
var myData = this._discrete === axis ? rollups(filteredData, function(leaves) {
|
|
622
634
|
return leaves.length === 1 ? leaves[0].data : d3plusMerge(leaves.map(function(d) {
|
|
623
635
|
return d.data;
|
|
624
636
|
}), _this._aggs);
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
637
|
+
}, function(d) {
|
|
638
|
+
return d[axis];
|
|
639
|
+
}).sort(function(a, b) {
|
|
640
|
+
if (_this["_".concat(axis, "Sort")]) return _this["_".concat(axis, "Sort")](a[1], b[1]);
|
|
641
|
+
var aKey = timeData || numericValue ? parseFloat(a[0]) : a[0];
|
|
642
|
+
var bKey = timeData || numericValue ? parseFloat(b[0]) : b[0];
|
|
629
643
|
return aKey - bKey;
|
|
630
|
-
}).map(function(
|
|
631
|
-
|
|
644
|
+
}).map(function(param) {
|
|
645
|
+
var _param = _sliced_to_array(param, 1), key = _param[0];
|
|
646
|
+
return timeData ? date(key) : numericValue ? parseFloat(key) : key;
|
|
632
647
|
}) : unique(filteredData.sort(function(a, b) {
|
|
633
648
|
return _this["_".concat(axis, "Sort")] ? _this["_".concat(axis, "Sort")](a.data, b.data) : a[axis] - b[axis];
|
|
634
649
|
}).map(function(d) {
|
|
@@ -658,11 +673,12 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
658
673
|
"Bar"
|
|
659
674
|
].includes(d.shape);
|
|
660
675
|
});
|
|
661
|
-
var groupValues =
|
|
676
|
+
var groupValues = groups(stackedData, function(d) {
|
|
662
677
|
return d.group;
|
|
663
|
-
}).
|
|
664
|
-
|
|
665
|
-
obj[
|
|
678
|
+
}).reduce(function(obj, param) {
|
|
679
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], values = _param[1];
|
|
680
|
+
if (!obj[key]) obj[key] = 0;
|
|
681
|
+
obj[key] += sum(values, function(dd) {
|
|
666
682
|
return dd[opp];
|
|
667
683
|
});
|
|
668
684
|
return obj;
|
|
@@ -680,10 +696,11 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
680
696
|
stackKeys = Array.from(new Set(axisData.map(function(d) {
|
|
681
697
|
return d.id;
|
|
682
698
|
})));
|
|
683
|
-
stackData =
|
|
699
|
+
stackData = groups(axisData, function(d) {
|
|
684
700
|
return d.discrete;
|
|
685
|
-
}).
|
|
686
|
-
|
|
701
|
+
}).map(function(param) {
|
|
702
|
+
var _param = _sliced_to_array(param, 2), values = _param[1];
|
|
703
|
+
return values;
|
|
687
704
|
});
|
|
688
705
|
stackData.forEach(function(g) {
|
|
689
706
|
var ids = Array.from(new Set(g.map(function(d) {
|
|
@@ -789,7 +806,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
789
806
|
}
|
|
790
807
|
var _domainScaleSetup_bind = _sliced_to_array(domainScaleSetup.bind(this)("x"), 4), xAutoDomain = _domainScaleSetup_bind[0], xScale = _domainScaleSetup_bind[1], x2AutoDomain = _domainScaleSetup_bind[2], x2Scale = _domainScaleSetup_bind[3];
|
|
791
808
|
var _domainScaleSetup_bind1 = _sliced_to_array(domainScaleSetup.bind(this)("y"), 4), yAutoDomain = _domainScaleSetup_bind1[0], yScale = _domainScaleSetup_bind1[1], y2AutoDomain = _domainScaleSetup_bind1[2], y2Scale = _domainScaleSetup_bind1[3];
|
|
792
|
-
var autoScale = function(axis, fallback) {
|
|
809
|
+
var autoScale = function autoScale(axis, fallback) {
|
|
793
810
|
var userScale = _this["_".concat(axis, "Config")].scale;
|
|
794
811
|
if (userScale === "auto") {
|
|
795
812
|
if (_this._discrete === axis) return fallback;
|
|
@@ -844,43 +861,45 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
844
861
|
}
|
|
845
862
|
});
|
|
846
863
|
var x = scales["scale".concat(xScale)]().domain(domains.x).range(range(0, width + 1, width / (domains.x.length - 1))), x2 = scales["scale".concat(x2Scale)]().domain(domains.x2).range(range(0, width + 1, width / (domains.x2.length - 1))), y = scales["scale".concat(yScale)]().domain(domains.y.reverse()).range(range(0, height + 1, height / (domains.y.length - 1))), y2 = scales["scale".concat(y2Scale)]().domain(domains.y2.reverse()).range(range(0, height + 1, height / (domains.y2.length - 1)));
|
|
847
|
-
var shapeData =
|
|
864
|
+
var shapeData = groups(data, function(d) {
|
|
848
865
|
return d.shape;
|
|
849
|
-
}).
|
|
850
|
-
|
|
866
|
+
}).sort(function(param, param1) {
|
|
867
|
+
var _param = _sliced_to_array(param, 1), a = _param[0], _param1 = _sliced_to_array(param1, 1), b = _param1[0];
|
|
868
|
+
return _this._shapeSort(a, b);
|
|
851
869
|
});
|
|
852
870
|
var oppScale = this._discrete === "x" ? yScale : xScale;
|
|
853
871
|
if (oppScale !== "Point") {
|
|
854
|
-
var allShapeData =
|
|
872
|
+
var allShapeData = groups(axisData, function(d) {
|
|
855
873
|
return d.shape;
|
|
856
|
-
})
|
|
857
|
-
allShapeData.forEach(function(
|
|
874
|
+
});
|
|
875
|
+
allShapeData.forEach(function(param) {
|
|
876
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], values = _param[1];
|
|
858
877
|
if ([
|
|
859
878
|
"Bar",
|
|
860
879
|
"Box"
|
|
861
|
-
].includes(
|
|
880
|
+
].includes(key)) {
|
|
862
881
|
discreteBuffer(_this._discrete === "x" ? x : y, data, _this._discrete);
|
|
863
882
|
}
|
|
864
|
-
if (_this._buffer[
|
|
865
|
-
var res = _this._buffer[
|
|
866
|
-
data:
|
|
883
|
+
if (_this._buffer[key]) {
|
|
884
|
+
var res = _this._buffer[key].bind(_this)({
|
|
885
|
+
data: values,
|
|
867
886
|
x: x,
|
|
868
887
|
y: y,
|
|
869
888
|
yScale: yConfigScale,
|
|
870
889
|
xScale: xConfigScale,
|
|
871
|
-
config: _this._shapeConfig[
|
|
890
|
+
config: _this._shapeConfig[key]
|
|
872
891
|
});
|
|
873
892
|
x = res[0];
|
|
874
893
|
y = res[1];
|
|
875
|
-
var res2 = _this._buffer[
|
|
876
|
-
data:
|
|
894
|
+
var res2 = _this._buffer[key].bind(_this)({
|
|
895
|
+
data: values,
|
|
877
896
|
x: x2,
|
|
878
897
|
y: y2,
|
|
879
898
|
yScale: y2ConfigScale,
|
|
880
899
|
xScale: x2ConfigScale,
|
|
881
900
|
x2: true,
|
|
882
901
|
y2: true,
|
|
883
|
-
config: _this._shapeConfig[
|
|
902
|
+
config: _this._shapeConfig[key]
|
|
884
903
|
});
|
|
885
904
|
x2 = res2[0];
|
|
886
905
|
y2 = res2[1];
|
|
@@ -920,7 +939,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
920
939
|
};
|
|
921
940
|
yC.tickSize = 0;
|
|
922
941
|
yC.shapeConfig = {
|
|
923
|
-
labelBounds: function(d, i) {
|
|
942
|
+
labelBounds: function labelBounds(d, i) {
|
|
924
943
|
var _d_labelBounds = d.labelBounds, width = _d_labelBounds.width, y = _d_labelBounds.y;
|
|
925
944
|
var height = _this._height / 2;
|
|
926
945
|
var x = i ? -height : 0;
|
|
@@ -1010,7 +1029,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1010
1029
|
};
|
|
1011
1030
|
xC.tickSize = 0;
|
|
1012
1031
|
xC.shapeConfig = {
|
|
1013
|
-
labelBounds: function(d, i) {
|
|
1032
|
+
labelBounds: function labelBounds(d, i) {
|
|
1014
1033
|
var _d_labelBounds = d.labelBounds, height = _d_labelBounds.height, y = _d_labelBounds.y;
|
|
1015
1034
|
var width = _this._width / 2;
|
|
1016
1035
|
var x = i ? -width : 0;
|
|
@@ -1024,7 +1043,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1024
1043
|
labelConfig: {
|
|
1025
1044
|
padding: 0,
|
|
1026
1045
|
rotate: 0,
|
|
1027
|
-
textAnchor: function(d) {
|
|
1046
|
+
textAnchor: function textAnchor(d) {
|
|
1028
1047
|
return xTicks && d.id === xTicks[0] ? "start" : "end";
|
|
1029
1048
|
}
|
|
1030
1049
|
},
|
|
@@ -1045,9 +1064,9 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1045
1064
|
if (d.shape !== "Line") return false;
|
|
1046
1065
|
return typeof _this._lineLabels === "function" ? _this._lineLabels(d.data, d.i) : true;
|
|
1047
1066
|
});
|
|
1048
|
-
var lineData =
|
|
1067
|
+
var lineData = groups(labelData, function(d) {
|
|
1049
1068
|
return d.id;
|
|
1050
|
-
})
|
|
1069
|
+
});
|
|
1051
1070
|
if (lineData.length) {
|
|
1052
1071
|
var userConfig = configPrep.bind(this)(this._shapeConfig, "shape", "Line");
|
|
1053
1072
|
testLineShape.config(userConfig);
|
|
@@ -1058,16 +1077,17 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1058
1077
|
var fontFamilyAccessor = lineLabelConfig.fontFamily !== undefined ? lineLabelConfig.fontFamily : testTextBox.fontFamily();
|
|
1059
1078
|
var paddingAccessor = lineLabelConfig.padding !== undefined ? lineLabelConfig.padding : testTextBox.padding();
|
|
1060
1079
|
var labelFunction = userConfig.label || this._drawLabel;
|
|
1061
|
-
var xEstimate = function(d) {
|
|
1080
|
+
var xEstimate = function xEstimate(d) {
|
|
1062
1081
|
if (xConfigScale === "log" && d === 0) d = xDomain[0] < 0 ? _this._xTest._d3Scale.domain()[1] : _this._xTest._d3Scale.domain()[0];
|
|
1063
1082
|
return _this._xTest._getPosition.bind(_this._xTest)(d);
|
|
1064
1083
|
};
|
|
1065
|
-
var yEstimate = function(d) {
|
|
1084
|
+
var yEstimate = function yEstimate(d) {
|
|
1066
1085
|
if (yConfigScale === "log" && d === 0) d = yDomain[0] < 0 ? _this._yTest._d3Scale.domain()[1] : _this._yTest._d3Scale.domain()[0];
|
|
1067
1086
|
return _this._yTest._getPosition.bind(_this._yTest)(d);
|
|
1068
1087
|
};
|
|
1069
|
-
labelWidths = lineData.map(function(
|
|
1070
|
-
var
|
|
1088
|
+
labelWidths = lineData.map(function(param) {
|
|
1089
|
+
var _param = _sliced_to_array(param, 2), lineKey = _param[0], lineValues = _param[1];
|
|
1090
|
+
var d = lineValues[lineValues.length - 1];
|
|
1071
1091
|
var i;
|
|
1072
1092
|
while(d.__d3plus__ && d.data){
|
|
1073
1093
|
d = d.data;
|
|
@@ -1087,20 +1107,20 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1087
1107
|
"font-family": fontFamily,
|
|
1088
1108
|
"font-weight": fontWeight
|
|
1089
1109
|
});
|
|
1090
|
-
var coords =
|
|
1110
|
+
var coords = lineValues.map(function(d) {
|
|
1091
1111
|
return [
|
|
1092
1112
|
xEstimate(d.x),
|
|
1093
1113
|
yEstimate(d.y)
|
|
1094
1114
|
];
|
|
1095
1115
|
});
|
|
1096
|
-
var myMaxX = max(
|
|
1116
|
+
var myMaxX = max(lineValues.map(function(d) {
|
|
1097
1117
|
return xEstimate(d.x);
|
|
1098
1118
|
}));
|
|
1099
|
-
var labelY =
|
|
1119
|
+
var labelY = lineValues.find(function(d) {
|
|
1100
1120
|
return xEstimate(d.x) === myMaxX;
|
|
1101
1121
|
}).y;
|
|
1102
1122
|
return {
|
|
1103
|
-
id:
|
|
1123
|
+
id: lineKey,
|
|
1104
1124
|
labelWidth: labelWidth + labelPadding * 2,
|
|
1105
1125
|
spaceNeeded: labelWidth + labelPadding * 4,
|
|
1106
1126
|
value: labelY,
|
|
@@ -1109,7 +1129,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1109
1129
|
fontSize: fontSize,
|
|
1110
1130
|
fontColor: fontColor,
|
|
1111
1131
|
maxX: myMaxX,
|
|
1112
|
-
xValue: max(
|
|
1132
|
+
xValue: max(lineValues, function(d) {
|
|
1113
1133
|
return d.x;
|
|
1114
1134
|
}),
|
|
1115
1135
|
coords: coords
|
|
@@ -1274,7 +1294,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1274
1294
|
if (x2Exists) {
|
|
1275
1295
|
this._x2Axis.domain(x2Domain).height(height - (xHeight + topOffset + verticalMargin)).range(xRange).select(x2Group.node()).ticks(x2Ticks).width(width).config(xC).config(defaultX2Config).config(this._x2Config).scale(x2ConfigScale).render();
|
|
1276
1296
|
}
|
|
1277
|
-
this._xFunc = x = function(d, x) {
|
|
1297
|
+
this._xFunc = x = function x(d, x) {
|
|
1278
1298
|
if (x === "x2") {
|
|
1279
1299
|
if (x2ConfigScale === "log" && d === 0) d = x2Domain[0] < 0 ? _this._x2Axis._d3Scale.domain()[1] : _this._x2Axis._d3Scale.domain()[0];
|
|
1280
1300
|
return _this._x2Axis._getPosition.bind(_this._x2Axis)(d);
|
|
@@ -1296,16 +1316,16 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1296
1316
|
}
|
|
1297
1317
|
var labelPositions = {};
|
|
1298
1318
|
if (labelWidths) {
|
|
1299
|
-
|
|
1319
|
+
groups(labelWidths, function(d) {
|
|
1300
1320
|
return d.xValue;
|
|
1301
|
-
}).
|
|
1302
|
-
var
|
|
1321
|
+
}).forEach(function(param) {
|
|
1322
|
+
var _param = _sliced_to_array(param, 2), values = _param[1];
|
|
1303
1323
|
var minFontSize = max(values.map(function(d) {
|
|
1304
1324
|
return d.fontSize;
|
|
1305
1325
|
}));
|
|
1306
1326
|
var yBuckets = range(yRange[0], yRange[1], minFontSize).reverse();
|
|
1307
1327
|
var bumpLimit = (yRange[1] - yRange[0]) / 8;
|
|
1308
|
-
|
|
1328
|
+
/***/ function bumpPrevious(d, i, arr) {
|
|
1309
1329
|
if (!d.defaultY) d.defaultY = this._yAxis._getPosition(d.value);
|
|
1310
1330
|
if (i) {
|
|
1311
1331
|
var prev = arr[i - 1];
|
|
@@ -1331,7 +1351,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1331
1351
|
return obj;
|
|
1332
1352
|
}, {});
|
|
1333
1353
|
}
|
|
1334
|
-
this._yFunc = y = function(d, y) {
|
|
1354
|
+
this._yFunc = y = function y(d, y) {
|
|
1335
1355
|
if (y === "y2") {
|
|
1336
1356
|
if (y2ConfigScale === "log" && d === 0) d = y2Domain[1] < 0 ? _this._y2Axis._d3ScaleNegative.domain()[0] : _this._y2Axis._d3Scale.domain()[1];
|
|
1337
1357
|
return _this._y2Axis._getPosition.bind(_this._y2Axis)(d) - x2Height;
|
|
@@ -1372,13 +1392,13 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1372
1392
|
}));
|
|
1373
1393
|
new shapes.Line().config({
|
|
1374
1394
|
data: data1,
|
|
1375
|
-
stroke: function(d) {
|
|
1395
|
+
stroke: function stroke(d) {
|
|
1376
1396
|
return d.fontColor;
|
|
1377
1397
|
},
|
|
1378
|
-
x: function(d) {
|
|
1398
|
+
x: function x(d) {
|
|
1379
1399
|
return d.x;
|
|
1380
1400
|
},
|
|
1381
|
-
y: function(d) {
|
|
1401
|
+
y: function y(d) {
|
|
1382
1402
|
return d.y;
|
|
1383
1403
|
}
|
|
1384
1404
|
}).config(this._labelConnectorConfig).select(connectorGroup).render();
|
|
@@ -1423,7 +1443,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1423
1443
|
});
|
|
1424
1444
|
annotationData.forEach(function(annotation) {
|
|
1425
1445
|
new shapes[annotation.shape]().duration(_this._duration).config(annotation).config({
|
|
1426
|
-
x: function(d) {
|
|
1446
|
+
x: function x1(d) {
|
|
1427
1447
|
return d.x2 ? x(d.x2, "x2") : x(d.x);
|
|
1428
1448
|
},
|
|
1429
1449
|
x0: _this._discrete === "x" ? function(d) {
|
|
@@ -1432,7 +1452,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1432
1452
|
x1: _this._discrete === "x" ? null : function(d) {
|
|
1433
1453
|
return d.x2 ? x(d.x2, "x2") : x(d.x);
|
|
1434
1454
|
},
|
|
1435
|
-
y: function(d) {
|
|
1455
|
+
y: function y1(d) {
|
|
1436
1456
|
return d.y2 ? y(d.y2, "y2") : y(d.y);
|
|
1437
1457
|
},
|
|
1438
1458
|
y0: _this._discrete === "y" ? function(d) {
|
|
@@ -1455,11 +1475,11 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1455
1475
|
var shapeConfig = {
|
|
1456
1476
|
discrete: this._discrete,
|
|
1457
1477
|
duration: this._duration,
|
|
1458
|
-
label: function(d) {
|
|
1478
|
+
label: function label(d) {
|
|
1459
1479
|
return _this._drawLabel(d.data, d.i);
|
|
1460
1480
|
},
|
|
1461
1481
|
select: shapeGroup,
|
|
1462
|
-
x: function(d) {
|
|
1482
|
+
x: function x1(d) {
|
|
1463
1483
|
return d.x2 !== undefined ? x(d.x2, "x2") : x(d.x);
|
|
1464
1484
|
},
|
|
1465
1485
|
x0: discrete1 === "x" ? function(d) {
|
|
@@ -1468,7 +1488,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1468
1488
|
x1: discrete1 === "x" ? null : function(d) {
|
|
1469
1489
|
return d.x2 ? x(d.x2, "x2") : x(d.x);
|
|
1470
1490
|
},
|
|
1471
|
-
y: function(d) {
|
|
1491
|
+
y: function y1(d) {
|
|
1472
1492
|
return d.y2 !== undefined ? y(d.y2, "y2") : y(d.y);
|
|
1473
1493
|
},
|
|
1474
1494
|
y0: discrete1 === "y" ? function(d) {
|
|
@@ -1479,7 +1499,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1479
1499
|
}
|
|
1480
1500
|
};
|
|
1481
1501
|
var events = Object.keys(this._on);
|
|
1482
|
-
shapeData.forEach(function(
|
|
1502
|
+
shapeData.forEach(function(param) {
|
|
1483
1503
|
var _loop = function(e) {
|
|
1484
1504
|
s.on(globalEvents[e], function(d, i, x, event) {
|
|
1485
1505
|
return _this._on[globalEvents[e]](d.data, d.i, x, event);
|
|
@@ -1493,6 +1513,11 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1493
1513
|
return _this._on[classEvents[e2]](d.data, d.i, x, event);
|
|
1494
1514
|
});
|
|
1495
1515
|
};
|
|
1516
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], values = _param[1];
|
|
1517
|
+
var d = {
|
|
1518
|
+
key: key,
|
|
1519
|
+
values: values
|
|
1520
|
+
};
|
|
1496
1521
|
var shapeConfigInner = Object.assign({}, shapeConfig);
|
|
1497
1522
|
if (_this._stacked && [
|
|
1498
1523
|
"Area",
|
|
@@ -1534,19 +1559,22 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1534
1559
|
else space = _$range[_$range.length - 1] - _$range[0];
|
|
1535
1560
|
if (_this._groupPadding < space) space -= _this._groupPadding;
|
|
1536
1561
|
var barSize = space || 1;
|
|
1537
|
-
var
|
|
1562
|
+
var barGroups = groups(d.values, function(d) {
|
|
1538
1563
|
return d[_this._discrete];
|
|
1539
|
-
}
|
|
1564
|
+
}, function(d) {
|
|
1540
1565
|
return d.group;
|
|
1541
|
-
})
|
|
1542
|
-
var ids = merge(
|
|
1543
|
-
|
|
1544
|
-
|
|
1566
|
+
});
|
|
1567
|
+
var ids = merge(barGroups.map(function(param) {
|
|
1568
|
+
var _param = _sliced_to_array(param, 2), innerEntries = _param[1];
|
|
1569
|
+
return innerEntries.map(function(param) {
|
|
1570
|
+
var _param = _sliced_to_array(param, 1), k = _param[0];
|
|
1571
|
+
return k;
|
|
1545
1572
|
});
|
|
1546
1573
|
}));
|
|
1547
1574
|
var uniqueIds = Array.from(new Set(ids));
|
|
1548
|
-
if (max(
|
|
1549
|
-
|
|
1575
|
+
if (max(barGroups.map(function(param) {
|
|
1576
|
+
var _param = _sliced_to_array(param, 2), innerEntries = _param[1];
|
|
1577
|
+
return innerEntries.length;
|
|
1550
1578
|
})) === 1) {
|
|
1551
1579
|
s[_this._discrete](function(d, i) {
|
|
1552
1580
|
return shapeConfig[_this._discrete](d, i);
|
|
@@ -1572,13 +1600,13 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1572
1600
|
if (_this._confidence) {
|
|
1573
1601
|
var areaConfig = Object.assign({}, shapeConfig);
|
|
1574
1602
|
var discrete = _this._discrete || "x";
|
|
1575
|
-
var
|
|
1603
|
+
var key1 = discrete === "x" ? "y" : "x";
|
|
1576
1604
|
var scaleFunction = discrete === "x" ? y : x;
|
|
1577
|
-
areaConfig["".concat(
|
|
1578
|
-
return scaleFunction(_this._confidence[0] ? d.lci : d[
|
|
1605
|
+
areaConfig["".concat(key1, "0")] = function(d) {
|
|
1606
|
+
return scaleFunction(_this._confidence[0] ? d.lci : d[key1]);
|
|
1579
1607
|
};
|
|
1580
|
-
areaConfig["".concat(
|
|
1581
|
-
return scaleFunction(_this._confidence[1] ? d.hci : d[
|
|
1608
|
+
areaConfig["".concat(key1, "1")] = function(d) {
|
|
1609
|
+
return scaleFunction(_this._confidence[1] ? d.hci : d[key1]);
|
|
1582
1610
|
};
|
|
1583
1611
|
var area = new shapes.Area().config(areaConfig).data(d.values);
|
|
1584
1612
|
var confidenceConfig = Object.assign(_this._shapeConfig, _this._confidenceConfig);
|
|
@@ -1655,8 +1683,9 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1655
1683
|
_this._shapes.push(markers);
|
|
1656
1684
|
}
|
|
1657
1685
|
});
|
|
1658
|
-
var dataShapes = shapeData.map(function(
|
|
1659
|
-
|
|
1686
|
+
var dataShapes = shapeData.map(function(param) {
|
|
1687
|
+
var _param = _sliced_to_array(param, 1), key = _param[0];
|
|
1688
|
+
return key;
|
|
1660
1689
|
});
|
|
1661
1690
|
if (dataShapes.includes("Line")) {
|
|
1662
1691
|
if (this._confidence) dataShapes.push("Area");
|
|
@@ -1674,13 +1703,10 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1674
1703
|
},
|
|
1675
1704
|
{
|
|
1676
1705
|
/**
|
|
1677
|
-
|
|
1678
|
-
@desc Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).
|
|
1706
|
+
Allows drawing custom shapes to be used as annotations in the provided x/y plot. This method accepts custom config objects for the [Shape](http://d3plus.org/docs/#Shape) class, either a single config object or an array of config objects. Each config object requires an additional parameter, the "shape", which denotes which [Shape](http://d3plus.org/docs/#Shape) sub-class to use ([Rect](http://d3plus.org/docs/#Rect), [Line](http://d3plus.org/docs/#Line), etc).
|
|
1679
1707
|
|
|
1680
1708
|
Additionally, each config object can also contain an optional "layer" key, which defines whether the annotations will be displayed in "front" or in "back" of the primary visualization shapes. This value defaults to "back" if not present.
|
|
1681
|
-
|
|
1682
|
-
@chainable
|
|
1683
|
-
*/ key: "annotations",
|
|
1709
|
+
*/ key: "annotations",
|
|
1684
1710
|
value: function annotations(_) {
|
|
1685
1711
|
return arguments.length ? (this._annotations = _instanceof(_, Array) ? _ : [
|
|
1686
1712
|
_
|
|
@@ -1689,55 +1715,40 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1689
1715
|
},
|
|
1690
1716
|
{
|
|
1691
1717
|
/**
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
@param {Boolean} [*value* = false]
|
|
1695
|
-
@chainable
|
|
1696
|
-
*/ key: "axisPersist",
|
|
1718
|
+
Determines whether the x and y axes should have their scales persist while users filter the data, the timeline being the prime example (set this to `true` to make the axes stay consistent when the timeline changes).
|
|
1719
|
+
*/ key: "axisPersist",
|
|
1697
1720
|
value: function axisPersist(_) {
|
|
1698
1721
|
return arguments.length ? (this._axisPersist = _, this) : this._axisPersist;
|
|
1699
1722
|
}
|
|
1700
1723
|
},
|
|
1701
1724
|
{
|
|
1702
1725
|
/**
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
@param {Object} [*value*]
|
|
1706
|
-
@chainable
|
|
1707
|
-
*/ key: "backgroundConfig",
|
|
1726
|
+
A d3plus-shape configuration Object used for styling the background rectangle of the inner x/y plot (behind all of the shapes and gridlines).
|
|
1727
|
+
*/ key: "backgroundConfig",
|
|
1708
1728
|
value: function backgroundConfig(_) {
|
|
1709
1729
|
return arguments.length ? (this._backgroundConfig = assign(this._backgroundConfig, _), this) : this._backgroundConfig;
|
|
1710
1730
|
}
|
|
1711
1731
|
},
|
|
1712
1732
|
{
|
|
1713
1733
|
/**
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
@param {Number} *value* = 0
|
|
1717
|
-
@chainable
|
|
1718
|
-
*/ key: "barPadding",
|
|
1734
|
+
The pixel space between each bar in a group of bars.
|
|
1735
|
+
*/ key: "barPadding",
|
|
1719
1736
|
value: function barPadding(_) {
|
|
1720
1737
|
return arguments.length ? (this._barPadding = _, this) : this._barPadding;
|
|
1721
1738
|
}
|
|
1722
1739
|
},
|
|
1723
1740
|
{
|
|
1724
1741
|
/**
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
@param {Number} *value*
|
|
1728
|
-
@chainable
|
|
1729
|
-
*/ key: "baseline",
|
|
1742
|
+
The baseline for the x/y plot.
|
|
1743
|
+
*/ key: "baseline",
|
|
1730
1744
|
value: function baseline(_) {
|
|
1731
1745
|
return arguments.length ? (this._baseline = _, this) : this._baseline;
|
|
1732
1746
|
}
|
|
1733
1747
|
},
|
|
1734
1748
|
{
|
|
1735
1749
|
/**
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
@param {Object|Boolean} [*value*]
|
|
1739
|
-
@chainable
|
|
1740
|
-
*/ key: "buffer",
|
|
1750
|
+
Determines whether or not to add additional padding at the ends of x or y scales. The most commone use for this is in Scatter Plots, so that the shapes do not appear directly on the axis itself. The value provided can either be `true` or `false` to toggle the behavior for all shape types, or a keyed Object for each shape type (ie. `{Bar: false, Circle: true, Line: false}`).
|
|
1751
|
+
*/ key: "buffer",
|
|
1741
1752
|
value: function buffer(_) {
|
|
1742
1753
|
if (arguments.length) {
|
|
1743
1754
|
if (!_) this._buffer = {};
|
|
@@ -1755,11 +1766,9 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1755
1766
|
},
|
|
1756
1767
|
{
|
|
1757
1768
|
/**
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
@chainable
|
|
1762
|
-
@example <caption>Can be called with accessor functions or static keys:</caption>
|
|
1769
|
+
The confidence interval as an array of [lower, upper] bounds.
|
|
1770
|
+
|
|
1771
|
+
@example <caption>Can be called with accessor functions or static keys:</caption>
|
|
1763
1772
|
var data = {id: "alpha", value: 10, lci: 9, hci: 11};
|
|
1764
1773
|
...
|
|
1765
1774
|
// Accessor functions
|
|
@@ -1767,7 +1776,7 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1767
1776
|
|
|
1768
1777
|
// Or static keys
|
|
1769
1778
|
.confidence(["lci", "hci"])
|
|
1770
|
-
|
|
1779
|
+
*/ key: "confidence",
|
|
1771
1780
|
value: function confidence(_) {
|
|
1772
1781
|
if (arguments.length && _instanceof(_, Array)) {
|
|
1773
1782
|
this._confidence = [];
|
|
@@ -1781,176 +1790,128 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1781
1790
|
},
|
|
1782
1791
|
{
|
|
1783
1792
|
/**
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
@param {Object} [*value*]
|
|
1787
|
-
@chainable
|
|
1788
|
-
*/ key: "confidenceConfig",
|
|
1793
|
+
Configuration object for shapes rendered as confidence intervals.
|
|
1794
|
+
*/ key: "confidenceConfig",
|
|
1789
1795
|
value: function confidenceConfig(_) {
|
|
1790
1796
|
return arguments.length ? (this._confidenceConfig = assign(this._confidenceConfig, _), this) : this._confidenceConfig;
|
|
1791
1797
|
}
|
|
1792
1798
|
},
|
|
1793
1799
|
{
|
|
1794
1800
|
/**
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
@param {Number} *value*
|
|
1798
|
-
@chainable
|
|
1799
|
-
*/ key: "discreteCutoff",
|
|
1801
|
+
When the width or height of the chart is less than or equal to this pixel value, the discrete axis will not be shown. This helps produce slick sparklines. Set this value to `0` to disable the behavior entirely.
|
|
1802
|
+
*/ key: "discreteCutoff",
|
|
1800
1803
|
value: function discreteCutoff(_) {
|
|
1801
1804
|
return arguments.length ? (this._discreteCutoff = _, this) : this._discreteCutoff;
|
|
1802
1805
|
}
|
|
1803
1806
|
},
|
|
1804
1807
|
{
|
|
1805
1808
|
/**
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
@param {Number} [*value* = 5]
|
|
1809
|
-
@chainable
|
|
1810
|
-
*/ key: "groupPadding",
|
|
1809
|
+
The pixel space between groups of bars.
|
|
1810
|
+
*/ key: "groupPadding",
|
|
1811
1811
|
value: function groupPadding(_) {
|
|
1812
1812
|
return arguments.length ? (this._groupPadding = _, this) : this._groupPadding;
|
|
1813
1813
|
}
|
|
1814
1814
|
},
|
|
1815
1815
|
{
|
|
1816
1816
|
/**
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
@param {Object} [*value*]
|
|
1820
|
-
@chainable
|
|
1821
|
-
*/ key: "labelConnectorConfig",
|
|
1817
|
+
The d3plus-shape config used on the Line shapes created to connect lineLabels to the end of their associated Line path.
|
|
1818
|
+
*/ key: "labelConnectorConfig",
|
|
1822
1819
|
value: function labelConnectorConfig(_) {
|
|
1823
1820
|
return arguments.length ? (this._labelConnectorConfig = assign(this._labelConnectorConfig, _), this) : this._labelConnectorConfig;
|
|
1824
1821
|
}
|
|
1825
1822
|
},
|
|
1826
1823
|
{
|
|
1827
1824
|
/**
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
@param {Function|String} [*value* = "auto"]
|
|
1831
|
-
@chainable
|
|
1832
|
-
*/ key: "labelPosition",
|
|
1825
|
+
The behavior to be used when calculating the position and size of each shape's label(s). The value passed can either be the _String_ name of the behavior to be used for all shapes, or an accessor _Function_ that will be provided each data point and will be expected to return the behavior to be used for that data point. The availability and options for this method depend on the default logic for each Shape. As an example, the values "outside" or "inside" can be set for Bar shapes, whose "auto" default will calculate the best position dynamically based on the available space.
|
|
1826
|
+
*/ key: "labelPosition",
|
|
1833
1827
|
value: function labelPosition(_) {
|
|
1834
1828
|
return arguments.length ? (this._labelPosition = typeof _ === "function" ? _ : constant(_), this) : this._labelPosition;
|
|
1835
1829
|
}
|
|
1836
1830
|
},
|
|
1837
1831
|
{
|
|
1838
1832
|
/**
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
@param {Boolean|Function} [*value* = false]
|
|
1842
|
-
@chainable
|
|
1843
|
-
*/ key: "lineLabels",
|
|
1833
|
+
Draws labels on the right side of any Line shapes that are drawn on the plot.
|
|
1834
|
+
*/ key: "lineLabels",
|
|
1844
1835
|
value: function lineLabels(_) {
|
|
1845
1836
|
return arguments.length ? (this._lineLabels = _, this) : this._lineLabels;
|
|
1846
1837
|
}
|
|
1847
1838
|
},
|
|
1848
1839
|
{
|
|
1849
1840
|
/**
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
@param {Object} *value*
|
|
1853
|
-
@chainable
|
|
1854
|
-
*/ key: "lineMarkerConfig",
|
|
1841
|
+
Shape config for the Circle shapes drawn by the lineMarkers method.
|
|
1842
|
+
*/ key: "lineMarkerConfig",
|
|
1855
1843
|
value: function lineMarkerConfig(_) {
|
|
1856
1844
|
return arguments.length ? (this._lineMarkerConfig = assign(this._lineMarkerConfig, _), this) : this._lineMarkerConfig;
|
|
1857
1845
|
}
|
|
1858
1846
|
},
|
|
1859
1847
|
{
|
|
1860
1848
|
/**
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
@param {Boolean} [*value* = false]
|
|
1864
|
-
@chainable
|
|
1865
|
-
*/ key: "lineMarkers",
|
|
1849
|
+
Draws circle markers on each vertex of a Line.
|
|
1850
|
+
*/ key: "lineMarkers",
|
|
1866
1851
|
value: function lineMarkers(_) {
|
|
1867
1852
|
return arguments.length ? (this._lineMarkers = _, this) : this._lineMarkers;
|
|
1868
1853
|
}
|
|
1869
1854
|
},
|
|
1870
1855
|
{
|
|
1871
1856
|
/**
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
@param {Function} *value*
|
|
1875
|
-
@chainable
|
|
1876
|
-
*/ key: "shapeSort",
|
|
1857
|
+
A JavaScript [sort comparator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) that receives each shape Class (ie. "Circle", "Line", etc) as it's comparator arguments. Shapes are drawn in groups based on their type, so you are defining the layering order for all shapes of said type.
|
|
1858
|
+
*/ key: "shapeSort",
|
|
1877
1859
|
value: function shapeSort(_) {
|
|
1878
1860
|
return arguments.length ? (this._shapeSort = _, this) : this._shapeSort;
|
|
1879
1861
|
}
|
|
1880
1862
|
},
|
|
1881
1863
|
{
|
|
1882
1864
|
/**
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
@param {Function|Number|String} *value* = 10
|
|
1886
|
-
@chainable
|
|
1887
|
-
*/ key: "size",
|
|
1865
|
+
Sets the size of bubbles to the given Number, data key, or function.
|
|
1866
|
+
*/ key: "size",
|
|
1888
1867
|
value: function size(_) {
|
|
1889
1868
|
return arguments.length ? (this._size = typeof _ === "function" || !_ ? _ : accessor(_), this) : this._size;
|
|
1890
1869
|
}
|
|
1891
1870
|
},
|
|
1892
1871
|
{
|
|
1893
1872
|
/**
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
@param {Number} *value* = 20
|
|
1897
|
-
@chainable
|
|
1898
|
-
*/ key: "sizeMax",
|
|
1873
|
+
Sets the size scale maximum to the specified number.
|
|
1874
|
+
*/ key: "sizeMax",
|
|
1899
1875
|
value: function sizeMax(_) {
|
|
1900
1876
|
return arguments.length ? (this._sizeMax = _, this) : this._sizeMax;
|
|
1901
1877
|
}
|
|
1902
1878
|
},
|
|
1903
1879
|
{
|
|
1904
1880
|
/**
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
@param {Number} *value* = 5
|
|
1908
|
-
@chainable
|
|
1909
|
-
*/ key: "sizeMin",
|
|
1881
|
+
Sets the size scale minimum to the specified number.
|
|
1882
|
+
*/ key: "sizeMin",
|
|
1910
1883
|
value: function sizeMin(_) {
|
|
1911
1884
|
return arguments.length ? (this._sizeMin = _, this) : this._sizeMin;
|
|
1912
1885
|
}
|
|
1913
1886
|
},
|
|
1914
1887
|
{
|
|
1915
1888
|
/**
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
@param {String} *value* = "sqrt"
|
|
1919
|
-
@chainable
|
|
1920
|
-
*/ key: "sizeScale",
|
|
1889
|
+
Sets the size scale to the specified string.
|
|
1890
|
+
*/ key: "sizeScale",
|
|
1921
1891
|
value: function sizeScale(_) {
|
|
1922
1892
|
return arguments.length ? (this._sizeScale = _, this) : this._sizeScale;
|
|
1923
1893
|
}
|
|
1924
1894
|
},
|
|
1925
1895
|
{
|
|
1926
1896
|
/**
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
@param {Boolean} *value* = false
|
|
1930
|
-
@chainable
|
|
1931
|
-
*/ key: "stacked",
|
|
1897
|
+
If *value* is specified, toggles shape stacking. If *value* is not specified, returns the current stack value.
|
|
1898
|
+
*/ key: "stacked",
|
|
1932
1899
|
value: function stacked(_) {
|
|
1933
1900
|
return arguments.length ? (this._stacked = _, this) : this._stacked;
|
|
1934
1901
|
}
|
|
1935
1902
|
},
|
|
1936
1903
|
{
|
|
1937
1904
|
/**
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
@param {Function|String} *value* = "descending"
|
|
1941
|
-
@chainable
|
|
1942
|
-
*/ key: "stackOffset",
|
|
1905
|
+
Sets the stack offset. If *value* is not specified, returns the current stack offset function.
|
|
1906
|
+
*/ key: "stackOffset",
|
|
1943
1907
|
value: function stackOffset(_) {
|
|
1944
1908
|
return arguments.length ? (this._stackOffset = typeof _ === "function" ? _ : d3Shape["stackOffset".concat(_.charAt(0).toUpperCase() + _.slice(1))], this) : this._stackOffset;
|
|
1945
1909
|
}
|
|
1946
1910
|
},
|
|
1947
1911
|
{
|
|
1948
1912
|
/**
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
@param {Function|String|Array} *value* = "none"
|
|
1952
|
-
@chainable
|
|
1953
|
-
*/ key: "stackOrder",
|
|
1913
|
+
Sets the stack order. If *value* is not specified, returns the current stack order function.
|
|
1914
|
+
*/ key: "stackOrder",
|
|
1954
1915
|
value: function stackOrder(_) {
|
|
1955
1916
|
if (arguments.length) {
|
|
1956
1917
|
if (typeof _ === "string") this._stackOrder = _ === "ascending" ? stackOrderAscending : _ === "descending" ? stackOrderDescending : d3Shape["stackOrder".concat(_.charAt(0).toUpperCase() + _.slice(1))];
|
|
@@ -1961,11 +1922,8 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1961
1922
|
},
|
|
1962
1923
|
{
|
|
1963
1924
|
/**
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
@param {Function|String} *value*
|
|
1967
|
-
@chainable
|
|
1968
|
-
*/ key: "x",
|
|
1925
|
+
Accessor function or string key for the x-axis value of each data point.
|
|
1926
|
+
*/ key: "x",
|
|
1969
1927
|
value: function x(_) {
|
|
1970
1928
|
if (arguments.length) {
|
|
1971
1929
|
if (typeof _ === "function") this._x = _;
|
|
@@ -1979,11 +1937,8 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1979
1937
|
},
|
|
1980
1938
|
{
|
|
1981
1939
|
/**
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
@param {Function|String} *value*
|
|
1985
|
-
@chainable
|
|
1986
|
-
*/ key: "x2",
|
|
1940
|
+
Accessor function or string key for the secondary x-axis value of each data point.
|
|
1941
|
+
*/ key: "x2",
|
|
1987
1942
|
value: function x2(_) {
|
|
1988
1943
|
if (arguments.length) {
|
|
1989
1944
|
if (typeof _ === "function") this._x2 = _;
|
|
@@ -1997,88 +1952,64 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1997
1952
|
},
|
|
1998
1953
|
{
|
|
1999
1954
|
/**
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
@param {Object} *value*
|
|
2003
|
-
@chainable
|
|
2004
|
-
*/ key: "xConfig",
|
|
1955
|
+
A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the x-axis. Includes additional functionality where passing "auto" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be "linear" or "log" based on the provided data.
|
|
1956
|
+
*/ key: "xConfig",
|
|
2005
1957
|
value: function xConfig(_) {
|
|
2006
1958
|
return arguments.length ? (this._xConfig = assign(this._xConfig, _), this) : this._xConfig;
|
|
2007
1959
|
}
|
|
2008
1960
|
},
|
|
2009
1961
|
{
|
|
2010
1962
|
/**
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
@param {Number} *value*
|
|
2014
|
-
@chainable
|
|
2015
|
-
*/ key: "xCutoff",
|
|
1963
|
+
When the width of the chart is less than or equal to this pixel value, and the x-axis is not the discrete axis, it will not be shown. This helps produce slick sparklines. Set this value to `0` to disable the behavior entirely.
|
|
1964
|
+
*/ key: "xCutoff",
|
|
2016
1965
|
value: function xCutoff(_) {
|
|
2017
1966
|
return arguments.length ? (this._xCutoff = _, this) : this._xCutoff;
|
|
2018
1967
|
}
|
|
2019
1968
|
},
|
|
2020
1969
|
{
|
|
2021
1970
|
/**
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
@param {Object} *value*
|
|
2025
|
-
@chainable
|
|
2026
|
-
*/ key: "x2Config",
|
|
1971
|
+
A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary x-axis. Includes additional functionality where passing "auto" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be "linear" or "log" based on the provided data.
|
|
1972
|
+
*/ key: "x2Config",
|
|
2027
1973
|
value: function x2Config(_) {
|
|
2028
1974
|
return arguments.length ? (this._x2Config = assign(this._x2Config, _), this) : this._x2Config;
|
|
2029
1975
|
}
|
|
2030
1976
|
},
|
|
2031
1977
|
{
|
|
2032
1978
|
/**
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
@param {Array} *value*
|
|
2036
|
-
@chainable
|
|
2037
|
-
*/ key: "xDomain",
|
|
1979
|
+
The x domain as an array. If either value is undefined, it will be calculated from the data.
|
|
1980
|
+
*/ key: "xDomain",
|
|
2038
1981
|
value: function xDomain(_) {
|
|
2039
1982
|
return arguments.length ? (this._xDomain = _, this) : this._xDomain;
|
|
2040
1983
|
}
|
|
2041
1984
|
},
|
|
2042
1985
|
{
|
|
2043
1986
|
/**
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
@param {Array} *value*
|
|
2047
|
-
@chainable
|
|
2048
|
-
*/ key: "x2Domain",
|
|
1987
|
+
The x2 domain as an array. If either value is undefined, it will be calculated from the data.
|
|
1988
|
+
*/ key: "x2Domain",
|
|
2049
1989
|
value: function x2Domain(_) {
|
|
2050
1990
|
return arguments.length ? (this._x2Domain = _, this) : this._x2Domain;
|
|
2051
1991
|
}
|
|
2052
1992
|
},
|
|
2053
1993
|
{
|
|
2054
1994
|
/**
|
|
2055
|
-
|
|
2056
|
-
|
|
2057
|
-
@param {Function} *value*
|
|
2058
|
-
@chainable
|
|
2059
|
-
*/ key: "xSort",
|
|
1995
|
+
Defines a custom sorting comparitor function to be used for discrete x axes.
|
|
1996
|
+
*/ key: "xSort",
|
|
2060
1997
|
value: function xSort(_) {
|
|
2061
1998
|
return arguments.length ? (this._xSort = _, this) : this._xSort;
|
|
2062
1999
|
}
|
|
2063
2000
|
},
|
|
2064
2001
|
{
|
|
2065
2002
|
/**
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
@param {Function} *value*
|
|
2069
|
-
@chainable
|
|
2070
|
-
*/ key: "x2Sort",
|
|
2003
|
+
Defines a custom sorting comparitor function to be used for discrete x2 axes.
|
|
2004
|
+
*/ key: "x2Sort",
|
|
2071
2005
|
value: function x2Sort(_) {
|
|
2072
2006
|
return arguments.length ? (this._x2Sort = _, this) : this._x2Sort;
|
|
2073
2007
|
}
|
|
2074
2008
|
},
|
|
2075
2009
|
{
|
|
2076
2010
|
/**
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
@param {Function|String} *value*
|
|
2080
|
-
@chainable
|
|
2081
|
-
*/ key: "y",
|
|
2011
|
+
Accessor function or string key for the y-axis value of each data point.
|
|
2012
|
+
*/ key: "y",
|
|
2082
2013
|
value: function y(_) {
|
|
2083
2014
|
if (arguments.length) {
|
|
2084
2015
|
if (typeof _ === "function") this._y = _;
|
|
@@ -2092,11 +2023,8 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
2092
2023
|
},
|
|
2093
2024
|
{
|
|
2094
2025
|
/**
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
@param {Function|String} *value*
|
|
2098
|
-
@chainable
|
|
2099
|
-
*/ key: "y2",
|
|
2026
|
+
Accessor function or string key for the secondary y-axis value of each data point.
|
|
2027
|
+
*/ key: "y2",
|
|
2100
2028
|
value: function y2(_) {
|
|
2101
2029
|
if (arguments.length) {
|
|
2102
2030
|
if (typeof _ === "function") this._y2 = _;
|
|
@@ -2110,13 +2038,10 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
2110
2038
|
},
|
|
2111
2039
|
{
|
|
2112
2040
|
/**
|
|
2113
|
-
|
|
2114
|
-
@desc A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the y-axis. Includes additional functionality where passing "auto" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be "linear" or "log" based on the provided data.
|
|
2041
|
+
A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the y-axis. Includes additional functionality where passing "auto" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be "linear" or "log" based on the provided data.
|
|
2115
2042
|
|
|
2116
2043
|
*Note:* If a "domain" array is passed to the y-axis config, it will be reversed.
|
|
2117
|
-
|
|
2118
|
-
@chainable
|
|
2119
|
-
*/ key: "yConfig",
|
|
2044
|
+
*/ key: "yConfig",
|
|
2120
2045
|
value: function yConfig(_) {
|
|
2121
2046
|
if (arguments.length) {
|
|
2122
2047
|
if (_.domain) _.domain = _.domain.slice().reverse();
|
|
@@ -2128,22 +2053,16 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
2128
2053
|
},
|
|
2129
2054
|
{
|
|
2130
2055
|
/**
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
@param {Number} *value*
|
|
2134
|
-
@chainable
|
|
2135
|
-
*/ key: "yCutoff",
|
|
2056
|
+
When the height of the chart is less than or equal to this pixel value, and the y-axis is not the discrete axis, it will not be shown. This helps produce slick sparklines. Set this value to `0` to disable the behavior entirely.
|
|
2057
|
+
*/ key: "yCutoff",
|
|
2136
2058
|
value: function yCutoff(_) {
|
|
2137
2059
|
return arguments.length ? (this._yCutoff = _, this) : this._yCutoff;
|
|
2138
2060
|
}
|
|
2139
2061
|
},
|
|
2140
2062
|
{
|
|
2141
2063
|
/**
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
@param {Object} *value*
|
|
2145
|
-
@chainable
|
|
2146
|
-
*/ key: "y2Config",
|
|
2064
|
+
A pass-through to the underlying [Axis](http://d3plus.org/docs/#Axis) config used for the secondary y-axis. Includes additional functionality where passing "auto" as the value for the [scale](http://d3plus.org/docs/#Axis.scale) method will determine if the scale should be "linear" or "log" based on the provided data.
|
|
2065
|
+
*/ key: "y2Config",
|
|
2147
2066
|
value: function y2Config(_) {
|
|
2148
2067
|
if (arguments.length) {
|
|
2149
2068
|
if (_.domain) _.domain = _.domain.slice().reverse();
|
|
@@ -2155,44 +2074,32 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
2155
2074
|
},
|
|
2156
2075
|
{
|
|
2157
2076
|
/**
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
@param {Array} *value*
|
|
2161
|
-
@chainable
|
|
2162
|
-
*/ key: "yDomain",
|
|
2077
|
+
The y domain as an array. If either value is undefined, it will be calculated from the data.
|
|
2078
|
+
*/ key: "yDomain",
|
|
2163
2079
|
value: function yDomain(_) {
|
|
2164
2080
|
return arguments.length ? (this._yDomain = _, this) : this._yDomain;
|
|
2165
2081
|
}
|
|
2166
2082
|
},
|
|
2167
2083
|
{
|
|
2168
2084
|
/**
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
@param {Array} *value*
|
|
2172
|
-
@chainable
|
|
2173
|
-
*/ key: "y2Domain",
|
|
2085
|
+
The y2 domain as an array. If either value is undefined, it will be calculated from the data.
|
|
2086
|
+
*/ key: "y2Domain",
|
|
2174
2087
|
value: function y2Domain(_) {
|
|
2175
2088
|
return arguments.length ? (this._y2Domain = _, this) : this._y2Domain;
|
|
2176
2089
|
}
|
|
2177
2090
|
},
|
|
2178
2091
|
{
|
|
2179
2092
|
/**
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
@param {Function} *value*
|
|
2183
|
-
@chainable
|
|
2184
|
-
*/ key: "ySort",
|
|
2093
|
+
Defines a custom sorting comparitor function to be used for discrete y axes.
|
|
2094
|
+
*/ key: "ySort",
|
|
2185
2095
|
value: function ySort(_) {
|
|
2186
2096
|
return arguments.length ? (this._ySort = _, this) : this._ySort;
|
|
2187
2097
|
}
|
|
2188
2098
|
},
|
|
2189
2099
|
{
|
|
2190
2100
|
/**
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
@param {Function} *value*
|
|
2194
|
-
@chainable
|
|
2195
|
-
*/ key: "y2Sort",
|
|
2101
|
+
Defines a custom sorting comparitor function to be used for discrete y2 axes.
|
|
2102
|
+
*/ key: "y2Sort",
|
|
2196
2103
|
value: function y2Sort(_) {
|
|
2197
2104
|
return arguments.length ? (this._y2Sort = _, this) : this._y2Sort;
|
|
2198
2105
|
}
|
|
@@ -2201,7 +2108,5 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
2201
2108
|
return Plot;
|
|
2202
2109
|
}(Viz);
|
|
2203
2110
|
/**
|
|
2204
|
-
|
|
2205
|
-
@extends Viz
|
|
2206
|
-
@desc Creates an x/y plot based on an array of data.
|
|
2111
|
+
Creates an x/y plot based on an array of data.
|
|
2207
2112
|
*/ export { Plot as default };
|