@d3plus/core 3.0.0-alpha.2 → 3.0.0-alpha.4
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 +183 -240
- package/es/src/charts/AreaPlot.js +0 -1
- package/es/src/charts/BarChart.js +0 -1
- package/es/src/charts/BoxWhisker.js +0 -1
- package/es/src/charts/BumpChart.js +0 -2
- package/es/src/charts/LinePlot.js +0 -1
- package/es/src/charts/Pack.js +7 -6
- package/es/src/charts/Plot.js +12 -21
- package/es/src/charts/Viz.js +3 -0
- package/es/src/components/Tooltip.js +1 -1
- package/es/src/shapes/Shape.js +30 -3
- package/package.json +8 -8
- package/umd/d3plus-core.full.js +56 -53
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +445 -449
- package/umd/d3plus-core.js +54 -34
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +125 -121
|
@@ -69,7 +69,6 @@ var BoxWhisker = /*#__PURE__*/ function(Plot) {
|
|
|
69
69
|
_this = _call_super(this, BoxWhisker);
|
|
70
70
|
_this._discrete = "x";
|
|
71
71
|
_this._shape = constant("Box");
|
|
72
|
-
_this.x("x");
|
|
73
72
|
_this._tooltipConfig = assign(_this._tooltipConfig, {
|
|
74
73
|
title: function(d, i) {
|
|
75
74
|
if (!d) return "";
|
|
@@ -75,7 +75,6 @@ var BumpChart = /*#__PURE__*/ function(Plot) {
|
|
|
75
75
|
_this = _call_super(this, BumpChart);
|
|
76
76
|
_this._discrete = "x";
|
|
77
77
|
_this._shape = constant("Line");
|
|
78
|
-
_this.x("x");
|
|
79
78
|
_this.y2(function(d) {
|
|
80
79
|
return _this._y(d);
|
|
81
80
|
});
|
|
@@ -123,7 +122,6 @@ var BumpChart = /*#__PURE__*/ function(Plot) {
|
|
|
123
122
|
new d3plus.Plot()
|
|
124
123
|
.discrete("x")
|
|
125
124
|
.shape("Line")
|
|
126
|
-
.x("x")
|
|
127
125
|
.y2(d => this._y(d))
|
|
128
126
|
.yConfig({
|
|
129
127
|
tickFormat: val => {
|
package/es/src/charts/Pack.js
CHANGED
|
@@ -173,10 +173,11 @@ var Pack = /*#__PURE__*/ function(Viz) {
|
|
|
173
173
|
var defaultMouseMoveShape = _this._on["mousemove.shape"];
|
|
174
174
|
_this._on["mousemove.shape"] = function(d, i, x, event) {
|
|
175
175
|
if (d.__d3plusTooltip__) defaultMouseMoveShape(d, i, x, event);
|
|
176
|
+
var hoverData = recursionCircles(d, [
|
|
177
|
+
d
|
|
178
|
+
]);
|
|
176
179
|
_this.hover(function(h) {
|
|
177
|
-
return
|
|
178
|
-
d
|
|
179
|
-
]).includes(h);
|
|
180
|
+
return hoverData.includes(h);
|
|
180
181
|
});
|
|
181
182
|
};
|
|
182
183
|
_this._pack = pack();
|
|
@@ -224,13 +225,13 @@ var Pack = /*#__PURE__*/ function(Viz) {
|
|
|
224
225
|
values: nestedData
|
|
225
226
|
}, function(d) {
|
|
226
227
|
return d.values;
|
|
227
|
-
}).sum(this._sum).sort(this._sort)).descendants()
|
|
228
|
-
packData.forEach(function(d, i) {
|
|
228
|
+
}).sum(this._sum).sort(this._sort)).descendants().filter(function(d, i) {
|
|
229
229
|
d.__d3plus__ = true;
|
|
230
230
|
d.i = i;
|
|
231
|
-
d.id = d.parent ? d.parent.data.key :
|
|
231
|
+
d.id = d.parent ? d.parent.data.key : "root";
|
|
232
232
|
d.data.__d3plusOpacity__ = d.height ? _this._packOpacity(d.data, i) : 1;
|
|
233
233
|
d.data.__d3plusTooltip__ = !d.height ? true : false;
|
|
234
|
+
return !d.children || d.children.length > 1;
|
|
234
235
|
});
|
|
235
236
|
this._shapes.push(new Circle().data(packData).select(elem("g.d3plus-Pack", {
|
|
236
237
|
parent: this._select,
|
package/es/src/charts/Plot.js
CHANGED
|
@@ -461,6 +461,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
461
461
|
});
|
|
462
462
|
_this._x = accessor("x");
|
|
463
463
|
_this._xAxis = new AxisBottom().align("end");
|
|
464
|
+
_this._xKey = "x";
|
|
464
465
|
_this._xTest = new AxisBottom().align("end").gridSize(0);
|
|
465
466
|
_this._xConfig = {
|
|
466
467
|
gridConfig: {
|
|
@@ -481,6 +482,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
481
482
|
};
|
|
482
483
|
_this._y = accessor("y");
|
|
483
484
|
_this._yAxis = new AxisLeft().align("start");
|
|
485
|
+
_this._yKey = "y";
|
|
484
486
|
_this._yTest = new AxisLeft().align("start").gridSize(0);
|
|
485
487
|
_this._yConfig = {
|
|
486
488
|
gridConfig: {
|
|
@@ -912,7 +914,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
912
914
|
rounding: this._yDomain ? "none" : "outside",
|
|
913
915
|
scalePadding: y.padding ? y.padding() : 0
|
|
914
916
|
};
|
|
915
|
-
if (!showX) {
|
|
917
|
+
if (!showX && showY) {
|
|
916
918
|
yC.barConfig = {
|
|
917
919
|
stroke: "transparent"
|
|
918
920
|
};
|
|
@@ -1002,7 +1004,7 @@ var Plot = /*#__PURE__*/ function(Viz) {
|
|
|
1002
1004
|
rounding: this._xDomain ? "none" : "outside",
|
|
1003
1005
|
scalePadding: x.padding ? x.padding() : 0
|
|
1004
1006
|
};
|
|
1005
|
-
if (!showY) {
|
|
1007
|
+
if (!showY && showX) {
|
|
1006
1008
|
xC.barConfig = {
|
|
1007
1009
|
stroke: "transparent"
|
|
1008
1010
|
};
|
|
@@ -1791,17 +1793,6 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1791
1793
|
{
|
|
1792
1794
|
/**
|
|
1793
1795
|
@memberof Plot
|
|
1794
|
-
@desc Sets the discrete axis to the specified string. If *value* is not specified, returns the current discrete axis.
|
|
1795
|
-
@param {String} *value*
|
|
1796
|
-
@chainable
|
|
1797
|
-
*/ key: "discrete",
|
|
1798
|
-
value: function discrete(_) {
|
|
1799
|
-
return arguments.length ? (this._discrete = _, this) : this._discrete;
|
|
1800
|
-
}
|
|
1801
|
-
},
|
|
1802
|
-
{
|
|
1803
|
-
/**
|
|
1804
|
-
@memberof Plot
|
|
1805
1796
|
@desc 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.
|
|
1806
1797
|
@param {Number} *value*
|
|
1807
1798
|
@chainable
|
|
@@ -1971,8 +1962,8 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1971
1962
|
{
|
|
1972
1963
|
/**
|
|
1973
1964
|
@memberof Plot
|
|
1974
|
-
@desc Sets the x accessor to the specified
|
|
1975
|
-
@param {Function|
|
|
1965
|
+
@desc Sets the x accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current x accessor.
|
|
1966
|
+
@param {Function|String} *value*
|
|
1976
1967
|
@chainable
|
|
1977
1968
|
*/ key: "x",
|
|
1978
1969
|
value: function x(_) {
|
|
@@ -1989,8 +1980,8 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
1989
1980
|
{
|
|
1990
1981
|
/**
|
|
1991
1982
|
@memberof Plot
|
|
1992
|
-
@desc Sets the x2 accessor to the specified
|
|
1993
|
-
@param {Function|
|
|
1983
|
+
@desc Sets the x2 accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current x2 accessor.
|
|
1984
|
+
@param {Function|String} *value*
|
|
1994
1985
|
@chainable
|
|
1995
1986
|
*/ key: "x2",
|
|
1996
1987
|
value: function x2(_) {
|
|
@@ -2084,8 +2075,8 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
2084
2075
|
{
|
|
2085
2076
|
/**
|
|
2086
2077
|
@memberof Plot
|
|
2087
|
-
@desc Sets the y accessor to the specified
|
|
2088
|
-
@param {Function|
|
|
2078
|
+
@desc Sets the y accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current y accessor.
|
|
2079
|
+
@param {Function|String} *value*
|
|
2089
2080
|
@chainable
|
|
2090
2081
|
*/ key: "y",
|
|
2091
2082
|
value: function y(_) {
|
|
@@ -2102,8 +2093,8 @@ Additionally, each config object can also contain an optional "layer" key, which
|
|
|
2102
2093
|
{
|
|
2103
2094
|
/**
|
|
2104
2095
|
@memberof Plot
|
|
2105
|
-
@desc Sets the y2 accessor to the specified
|
|
2106
|
-
@param {Function|
|
|
2096
|
+
@desc Sets the y2 accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current y2 accessor.
|
|
2097
|
+
@param {Function|String} *value*
|
|
2107
2098
|
@chainable
|
|
2108
2099
|
*/ key: "y2",
|
|
2109
2100
|
value: function y2(_) {
|
package/es/src/charts/Viz.js
CHANGED
|
@@ -223,11 +223,13 @@ import mousemoveShape from "./events/mousemove.shape.js";
|
|
|
223
223
|
import touchstartBody from "./events/touchstart.body.js";
|
|
224
224
|
/**
|
|
225
225
|
* Default padding logic that will return false if the screen is less than 600 pixels wide.
|
|
226
|
+
* @private
|
|
226
227
|
*/ function defaultPadding() {
|
|
227
228
|
return typeof window !== "undefined" ? window.innerWidth > 600 : true;
|
|
228
229
|
}
|
|
229
230
|
/**
|
|
230
231
|
* Turns an array of values into a list string.
|
|
232
|
+
* @private
|
|
231
233
|
*/ function listify(n) {
|
|
232
234
|
return n.reduce(function(str, item, i) {
|
|
233
235
|
if (!i) str += item;
|
|
@@ -707,6 +709,7 @@ var Viz = /*#__PURE__*/ function(BaseClass) {
|
|
|
707
709
|
/**
|
|
708
710
|
* Applies the threshold algorithm according to the type of chart used.
|
|
709
711
|
* @param {Array} data The data to process.
|
|
712
|
+
* @private
|
|
710
713
|
*/ key: "_thresholdFunction",
|
|
711
714
|
value: function _thresholdFunction(data) {
|
|
712
715
|
return data;
|
|
@@ -80,7 +80,7 @@ import { accessor, BaseClass, constant } from "../utils/index.js";
|
|
|
80
80
|
/**
|
|
81
81
|
* Creates a reference element for popper.
|
|
82
82
|
* @param {Number[]} position
|
|
83
|
-
* @
|
|
83
|
+
* @private
|
|
84
84
|
*/ function generateReference() {
|
|
85
85
|
var position = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [
|
|
86
86
|
0,
|
package/es/src/shapes/Shape.js
CHANGED
|
@@ -91,6 +91,21 @@ import { pointDistance } from "@d3plus/math";
|
|
|
91
91
|
import { strip } from "@d3plus/text";
|
|
92
92
|
import { TextBox } from "../components/index.js";
|
|
93
93
|
import { accessor, BaseClass, configPrep, constant } from "../utils/index.js";
|
|
94
|
+
/**
|
|
95
|
+
* @param {*} nodeList
|
|
96
|
+
* @param {*} classNames
|
|
97
|
+
* @private
|
|
98
|
+
*/ function findLastIndexWithClass(nodeList, classNames) {
|
|
99
|
+
for(var x = 0; x < classNames.length; x++){
|
|
100
|
+
var className = classNames[x];
|
|
101
|
+
for(var i = nodeList.length - 1; i >= 0; i--){
|
|
102
|
+
if (nodeList[i].classList.contains(className)) {
|
|
103
|
+
return i; // Return the index if found
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return 0; // Return -1 if no element is found with the class
|
|
108
|
+
}
|
|
94
109
|
import Image from "./Image.js";
|
|
95
110
|
var Shape = /*#__PURE__*/ function(BaseClass) {
|
|
96
111
|
"use strict";
|
|
@@ -405,16 +420,28 @@ var Shape = /*#__PURE__*/ function(BaseClass) {
|
|
|
405
420
|
this._group.selectAll("g.d3plus-".concat(this._name, "-shape, g.d3plus-").concat(this._name, "-image, g.d3plus-").concat(this._name, "-text, g.d3plus-").concat(this._name, "-hover")).selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox").each(function(d, i) {
|
|
406
421
|
if (!d) d = {};
|
|
407
422
|
if (!d.parentNode) d.parentNode = this.parentNode;
|
|
423
|
+
if (!d.dataIndex) d.dataIndex = i;
|
|
424
|
+
var dataIndex = d.dataIndex;
|
|
408
425
|
var parent = d.parentNode;
|
|
409
|
-
|
|
426
|
+
var d3plusType = select(this).classed("d3plus-textBox") ? "textBox" : select(this).classed("d3plus-Image") ? "Image" : "Shape";
|
|
427
|
+
if (d3plusType === "textBox") d = d.data;
|
|
410
428
|
if (d.__d3plusShape__ || d.__d3plus__) {
|
|
411
429
|
while(d && (d.__d3plusShape__ || d.__d3plus__)){
|
|
412
430
|
i = d.i;
|
|
413
431
|
d = d.data;
|
|
414
432
|
}
|
|
415
433
|
} else i = that._data.indexOf(d);
|
|
416
|
-
var
|
|
417
|
-
|
|
434
|
+
var notHovering = !that._hover || typeof that._hover !== "function" || !that._hover(d, i);
|
|
435
|
+
var group = notHovering ? parent : that._hoverGroup.node();
|
|
436
|
+
if (group !== this.parentNode) {
|
|
437
|
+
var offset = d3plusType === "textBox" ? findLastIndexWithClass(group.childNodes, [
|
|
438
|
+
"d3plus-Image",
|
|
439
|
+
"d3plus-Shape"
|
|
440
|
+
]) : d3plusType === "Image" ? findLastIndexWithClass(group.childNodes, [
|
|
441
|
+
"d3plus-Shape"
|
|
442
|
+
]) : 0;
|
|
443
|
+
group.insertBefore(this, group.childNodes[offset + dataIndex]);
|
|
444
|
+
}
|
|
418
445
|
if (this.className.baseVal.includes("d3plus-Shape")) {
|
|
419
446
|
if (parent === group) select(this).call(that._applyStyle.bind(that));
|
|
420
447
|
else select(this).call(that._updateStyle.bind(that, select(this), that._hoverStyle));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d3plus/core",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.4",
|
|
4
4
|
"description": "Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,13 +34,13 @@
|
|
|
34
34
|
"test": "eslint index.js src/**/*.js && eslint --global=it test && mocha 'test/**/*-test.js'"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@d3plus/color": "3.0.0-alpha.
|
|
38
|
-
"@d3plus/data": "3.0.0-alpha.
|
|
39
|
-
"@d3plus/dom": "3.0.0-alpha.
|
|
40
|
-
"@d3plus/format": "3.0.0-alpha.
|
|
41
|
-
"@d3plus/locales": "3.0.0-alpha.
|
|
42
|
-
"@d3plus/math": "3.0.0-alpha.
|
|
43
|
-
"@d3plus/text": "3.0.0-alpha.
|
|
37
|
+
"@d3plus/color": "3.0.0-alpha.4",
|
|
38
|
+
"@d3plus/data": "3.0.0-alpha.4",
|
|
39
|
+
"@d3plus/dom": "3.0.0-alpha.4",
|
|
40
|
+
"@d3plus/format": "3.0.0-alpha.4",
|
|
41
|
+
"@d3plus/locales": "3.0.0-alpha.4",
|
|
42
|
+
"@d3plus/math": "3.0.0-alpha.4",
|
|
43
|
+
"@d3plus/text": "3.0.0-alpha.4",
|
|
44
44
|
"@popperjs/core": "^2.11.8",
|
|
45
45
|
"d3-array": "^3.2.4",
|
|
46
46
|
"d3-brush": "^3.0.0",
|
package/umd/d3plus-core.full.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
@d3plus/core v3.0.0-alpha.
|
|
2
|
+
@d3plus/core v3.0.0-alpha.4
|
|
3
3
|
Data visualization made easy. A javascript library that extends the popular D3.js to enable fast and beautiful visualizations.
|
|
4
4
|
Copyright (c) 2025 D3plus - https://d3plus.org
|
|
5
5
|
@license MIT
|
|
@@ -5059,14 +5059,6 @@
|
|
|
5059
5059
|
/**
|
|
5060
5060
|
@namespace {Object} formatLocale
|
|
5061
5061
|
@desc A set of default locale formatters used when assigning suffixes and currency in numbers.
|
|
5062
|
-
*
|
|
5063
|
-
* | Name | Default | Description |
|
|
5064
|
-
* |---|---|---|
|
|
5065
|
-
* | separator | "" | Separation between the number with the suffix. |
|
|
5066
|
-
* | suffixes | [] | List of suffixes used to format numbers. |
|
|
5067
|
-
* | grouping | [3] | The array of group sizes, |
|
|
5068
|
-
* | delimiters | {thousands: ",", decimal: "."} | Decimal and group separators. |
|
|
5069
|
-
* | currency | ["$", ""] | The currency prefix and suffix. |
|
|
5070
5062
|
*/ var formatLocale$2 = {
|
|
5071
5063
|
"ar-SA": {
|
|
5072
5064
|
separator: "",
|
|
@@ -20604,15 +20596,6 @@
|
|
|
20604
20596
|
/**
|
|
20605
20597
|
@namespace {Object} colorDefaults
|
|
20606
20598
|
@desc A set of default color values used when assigning colors based on data.
|
|
20607
|
-
*
|
|
20608
|
-
* | Name | Default | Description |
|
|
20609
|
-
* |---|---|---|
|
|
20610
|
-
* | dark | gray-7 | Used in the [contrast](#contrast) function when the color given is very light. |
|
|
20611
|
-
* | light | gray-0 | Used in the [contrast](#contrast) function when the color given is very dark. |
|
|
20612
|
-
* | missing | gray-4 | Used in the [assign](#assign) function when the value passed is `null` or `undefined`. |
|
|
20613
|
-
* | off | red-9 | Used in the [assign](#assign) function when the value passed is `false`. |
|
|
20614
|
-
* | on | green-9 | Used in the [assign](#assign) function when the value passed is `true`. |
|
|
20615
|
-
* | scale | [indigo-900, yellow-600, red-900, green-900, orange-600, grape-900, cyan-600, pink-600, lime-600, blue-300, pink-300, lime-300, violet-300, cyan-100, orange-100, green-100, grape-100, red-100] | An ordinal scale used in the [assign](#assign) function for non-valid color strings and numbers. |
|
|
20616
20599
|
*/ var defaults = {
|
|
20617
20600
|
dark: openColor$2.colors.gray[700],
|
|
20618
20601
|
light: openColor$2.colors.gray[50],
|
|
@@ -22155,7 +22138,7 @@
|
|
|
22155
22138
|
var angleStep = 5; // step size for angles (in degrees); has linear impact on running time
|
|
22156
22139
|
var polyCache = {};
|
|
22157
22140
|
/**
|
|
22158
|
-
@typedef {Object}
|
|
22141
|
+
@typedef {Object} largestRect
|
|
22159
22142
|
@desc The returned Object of the largestRect function.
|
|
22160
22143
|
@property {Number} width The width of the rectangle
|
|
22161
22144
|
@property {Number} height The height of the rectangle
|
|
@@ -22180,7 +22163,7 @@
|
|
|
22180
22163
|
@param {Number} [options.tolerance = 0.02] The simplification tolerance factor, between 0 and 1. A larger tolerance corresponds to more extensive simplification.
|
|
22181
22164
|
@param {Array} [options.origin] The center point of the rectangle. If specified, the rectangle will be fixed at that point, otherwise the algorithm optimizes across all possible points. The given value can be either a two dimensional array specifying the x and y coordinate of the origin or an array of two dimensional points specifying multiple possible center points of the rectangle.
|
|
22182
22165
|
@param {Boolean} [options.cache] Whether or not to cache the result, which would be used in subsequent calculations to preserve consistency and speed up calculation time.
|
|
22183
|
-
@return {
|
|
22166
|
+
@return {largestRect}
|
|
22184
22167
|
*/ function largestRect(poly) {
|
|
22185
22168
|
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
22186
22169
|
if (poly.length < 3) {
|
|
@@ -23171,6 +23154,21 @@
|
|
|
23171
23154
|
}
|
|
23172
23155
|
}
|
|
23173
23156
|
|
|
23157
|
+
/**
|
|
23158
|
+
* @param {*} nodeList
|
|
23159
|
+
* @param {*} classNames
|
|
23160
|
+
* @private
|
|
23161
|
+
*/ function findLastIndexWithClass(nodeList, classNames) {
|
|
23162
|
+
for(let x = 0; x < classNames.length; x++){
|
|
23163
|
+
const className = classNames[x];
|
|
23164
|
+
for(let i = nodeList.length - 1; i >= 0; i--){
|
|
23165
|
+
if (nodeList[i].classList.contains(className)) {
|
|
23166
|
+
return i; // Return the index if found
|
|
23167
|
+
}
|
|
23168
|
+
}
|
|
23169
|
+
}
|
|
23170
|
+
return 0; // Return -1 if no element is found with the class
|
|
23171
|
+
}
|
|
23174
23172
|
class Shape extends BaseClass {
|
|
23175
23173
|
/**
|
|
23176
23174
|
@memberof Shape
|
|
@@ -23366,16 +23364,28 @@
|
|
|
23366
23364
|
this._group.selectAll(`g.d3plus-${this._name}-shape, g.d3plus-${this._name}-image, g.d3plus-${this._name}-text, g.d3plus-${this._name}-hover`).selectAll(".d3plus-Shape, .d3plus-Image, .d3plus-textBox").each(function(d, i) {
|
|
23367
23365
|
if (!d) d = {};
|
|
23368
23366
|
if (!d.parentNode) d.parentNode = this.parentNode;
|
|
23367
|
+
if (!d.dataIndex) d.dataIndex = i;
|
|
23368
|
+
const dataIndex = d.dataIndex;
|
|
23369
23369
|
const parent = d.parentNode;
|
|
23370
|
-
|
|
23370
|
+
const d3plusType = select(this).classed("d3plus-textBox") ? "textBox" : select(this).classed("d3plus-Image") ? "Image" : "Shape";
|
|
23371
|
+
if (d3plusType === "textBox") d = d.data;
|
|
23371
23372
|
if (d.__d3plusShape__ || d.__d3plus__) {
|
|
23372
23373
|
while(d && (d.__d3plusShape__ || d.__d3plus__)){
|
|
23373
23374
|
i = d.i;
|
|
23374
23375
|
d = d.data;
|
|
23375
23376
|
}
|
|
23376
23377
|
} else i = that._data.indexOf(d);
|
|
23377
|
-
const
|
|
23378
|
-
|
|
23378
|
+
const notHovering = !that._hover || typeof that._hover !== "function" || !that._hover(d, i);
|
|
23379
|
+
const group = notHovering ? parent : that._hoverGroup.node();
|
|
23380
|
+
if (group !== this.parentNode) {
|
|
23381
|
+
const offset = d3plusType === "textBox" ? findLastIndexWithClass(group.childNodes, [
|
|
23382
|
+
"d3plus-Image",
|
|
23383
|
+
"d3plus-Shape"
|
|
23384
|
+
]) : d3plusType === "Image" ? findLastIndexWithClass(group.childNodes, [
|
|
23385
|
+
"d3plus-Shape"
|
|
23386
|
+
]) : 0;
|
|
23387
|
+
group.insertBefore(this, group.childNodes[offset + dataIndex]);
|
|
23388
|
+
}
|
|
23379
23389
|
if (this.className.baseVal.includes("d3plus-Shape")) {
|
|
23380
23390
|
if (parent === group) select(this).call(that._applyStyle.bind(that));
|
|
23381
23391
|
else select(this).call(that._updateStyle.bind(that, select(this), that._hoverStyle));
|
|
@@ -31577,7 +31587,7 @@
|
|
|
31577
31587
|
/**
|
|
31578
31588
|
* Creates a reference element for popper.
|
|
31579
31589
|
* @param {Number[]} position
|
|
31580
|
-
* @
|
|
31590
|
+
* @private
|
|
31581
31591
|
*/ function generateReference(position = [
|
|
31582
31592
|
0,
|
|
31583
31593
|
0
|
|
@@ -33604,11 +33614,13 @@
|
|
|
33604
33614
|
|
|
33605
33615
|
/**
|
|
33606
33616
|
* Default padding logic that will return false if the screen is less than 600 pixels wide.
|
|
33617
|
+
* @private
|
|
33607
33618
|
*/ function defaultPadding() {
|
|
33608
33619
|
return typeof window !== "undefined" ? window.innerWidth > 600 : true;
|
|
33609
33620
|
}
|
|
33610
33621
|
/**
|
|
33611
33622
|
* Turns an array of values into a list string.
|
|
33623
|
+
* @private
|
|
33612
33624
|
*/ function listify(n) {
|
|
33613
33625
|
return n.reduce((str, item, i)=>{
|
|
33614
33626
|
if (!i) str += item;
|
|
@@ -33806,6 +33818,7 @@
|
|
|
33806
33818
|
/**
|
|
33807
33819
|
* Applies the threshold algorithm according to the type of chart used.
|
|
33808
33820
|
* @param {Array} data The data to process.
|
|
33821
|
+
* @private
|
|
33809
33822
|
*/ _thresholdFunction(data) {
|
|
33810
33823
|
return data;
|
|
33811
33824
|
}
|
|
@@ -35781,7 +35794,7 @@
|
|
|
35781
35794
|
rounding: this._yDomain ? "none" : "outside",
|
|
35782
35795
|
scalePadding: y.padding ? y.padding() : 0
|
|
35783
35796
|
};
|
|
35784
|
-
if (!showX) {
|
|
35797
|
+
if (!showX && showY) {
|
|
35785
35798
|
yC.barConfig = {
|
|
35786
35799
|
stroke: "transparent"
|
|
35787
35800
|
};
|
|
@@ -35851,7 +35864,7 @@
|
|
|
35851
35864
|
rounding: this._xDomain ? "none" : "outside",
|
|
35852
35865
|
scalePadding: x.padding ? x.padding() : 0
|
|
35853
35866
|
};
|
|
35854
|
-
if (!showY) {
|
|
35867
|
+
if (!showY && showX) {
|
|
35855
35868
|
xC.barConfig = {
|
|
35856
35869
|
stroke: "transparent"
|
|
35857
35870
|
};
|
|
@@ -36471,14 +36484,6 @@
|
|
|
36471
36484
|
*/ confidenceConfig(_) {
|
|
36472
36485
|
return arguments.length ? (this._confidenceConfig = assign(this._confidenceConfig, _), this) : this._confidenceConfig;
|
|
36473
36486
|
}
|
|
36474
|
-
/**
|
|
36475
|
-
@memberof Plot
|
|
36476
|
-
@desc Sets the discrete axis to the specified string. If *value* is not specified, returns the current discrete axis.
|
|
36477
|
-
@param {String} *value*
|
|
36478
|
-
@chainable
|
|
36479
|
-
*/ discrete(_) {
|
|
36480
|
-
return arguments.length ? (this._discrete = _, this) : this._discrete;
|
|
36481
|
-
}
|
|
36482
36487
|
/**
|
|
36483
36488
|
@memberof Plot
|
|
36484
36489
|
@desc 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.
|
|
@@ -36605,8 +36610,8 @@
|
|
|
36605
36610
|
}
|
|
36606
36611
|
/**
|
|
36607
36612
|
@memberof Plot
|
|
36608
|
-
@desc Sets the x accessor to the specified
|
|
36609
|
-
@param {Function|
|
|
36613
|
+
@desc Sets the x accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current x accessor.
|
|
36614
|
+
@param {Function|String} *value*
|
|
36610
36615
|
@chainable
|
|
36611
36616
|
*/ x(_) {
|
|
36612
36617
|
if (arguments.length) {
|
|
@@ -36620,8 +36625,8 @@
|
|
|
36620
36625
|
}
|
|
36621
36626
|
/**
|
|
36622
36627
|
@memberof Plot
|
|
36623
|
-
@desc Sets the x2 accessor to the specified
|
|
36624
|
-
@param {Function|
|
|
36628
|
+
@desc Sets the x2 accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current x2 accessor.
|
|
36629
|
+
@param {Function|String} *value*
|
|
36625
36630
|
@chainable
|
|
36626
36631
|
*/ x2(_) {
|
|
36627
36632
|
if (arguments.length) {
|
|
@@ -36691,8 +36696,8 @@
|
|
|
36691
36696
|
}
|
|
36692
36697
|
/**
|
|
36693
36698
|
@memberof Plot
|
|
36694
|
-
@desc Sets the y accessor to the specified
|
|
36695
|
-
@param {Function|
|
|
36699
|
+
@desc Sets the y accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current y accessor.
|
|
36700
|
+
@param {Function|String} *value*
|
|
36696
36701
|
@chainable
|
|
36697
36702
|
*/ y(_) {
|
|
36698
36703
|
if (arguments.length) {
|
|
@@ -36706,8 +36711,8 @@
|
|
|
36706
36711
|
}
|
|
36707
36712
|
/**
|
|
36708
36713
|
@memberof Plot
|
|
36709
|
-
@desc Sets the y2 accessor to the specified
|
|
36710
|
-
@param {Function|
|
|
36714
|
+
@desc Sets the y2 accessor to the specified accessor Function or String representing which key in the data to reference. If *value* is not specified, returns the current y2 accessor.
|
|
36715
|
+
@param {Function|String} *value*
|
|
36711
36716
|
@chainable
|
|
36712
36717
|
*/ y2(_) {
|
|
36713
36718
|
if (arguments.length) {
|
|
@@ -36968,6 +36973,7 @@
|
|
|
36968
36973
|
});
|
|
36969
36974
|
this._x = accessor("x");
|
|
36970
36975
|
this._xAxis = new AxisBottom().align("end");
|
|
36976
|
+
this._xKey = "x";
|
|
36971
36977
|
this._xTest = new AxisBottom().align("end").gridSize(0);
|
|
36972
36978
|
this._xConfig = {
|
|
36973
36979
|
gridConfig: {
|
|
@@ -36988,6 +36994,7 @@
|
|
|
36988
36994
|
};
|
|
36989
36995
|
this._y = accessor("y");
|
|
36990
36996
|
this._yAxis = new AxisLeft().align("start");
|
|
36997
|
+
this._yKey = "y";
|
|
36991
36998
|
this._yTest = new AxisLeft().align("start").gridSize(0);
|
|
36992
36999
|
this._yConfig = {
|
|
36993
37000
|
gridConfig: {
|
|
@@ -37017,7 +37024,6 @@
|
|
|
37017
37024
|
this._baseline = 0;
|
|
37018
37025
|
this._discrete = "x";
|
|
37019
37026
|
this._shape = constant$9("Area");
|
|
37020
|
-
this.x("x");
|
|
37021
37027
|
}
|
|
37022
37028
|
}
|
|
37023
37029
|
|
|
@@ -37038,7 +37044,6 @@
|
|
|
37038
37044
|
return defaultLegend.bind(this)(config, arr);
|
|
37039
37045
|
};
|
|
37040
37046
|
this._shape = constant$9("Bar");
|
|
37041
|
-
this.x("x");
|
|
37042
37047
|
}
|
|
37043
37048
|
}
|
|
37044
37049
|
|
|
@@ -37051,7 +37056,6 @@
|
|
|
37051
37056
|
super();
|
|
37052
37057
|
this._discrete = "x";
|
|
37053
37058
|
this._shape = constant$9("Box");
|
|
37054
|
-
this.x("x");
|
|
37055
37059
|
this._tooltipConfig = assign(this._tooltipConfig, {
|
|
37056
37060
|
title: (d, i)=>{
|
|
37057
37061
|
if (!d) return "";
|
|
@@ -37076,7 +37080,6 @@
|
|
|
37076
37080
|
super();
|
|
37077
37081
|
this._discrete = "x";
|
|
37078
37082
|
this._shape = constant$9("Line");
|
|
37079
|
-
this.x("x");
|
|
37080
37083
|
this.y2((d)=>this._y(d));
|
|
37081
37084
|
this.yConfig({
|
|
37082
37085
|
tickFormat: (val)=>{
|
|
@@ -51773,7 +51776,6 @@
|
|
|
51773
51776
|
super();
|
|
51774
51777
|
this._discrete = "x";
|
|
51775
51778
|
this._shape = constant$9("Line");
|
|
51776
|
-
this.x("x");
|
|
51777
51779
|
}
|
|
51778
51780
|
}
|
|
51779
51781
|
|
|
@@ -54122,13 +54124,13 @@
|
|
|
54122
54124
|
])(hierarchy({
|
|
54123
54125
|
key: nestedData.key,
|
|
54124
54126
|
values: nestedData
|
|
54125
|
-
}, (d)=>d.values).sum(this._sum).sort(this._sort)).descendants()
|
|
54126
|
-
packData.forEach((d, i)=>{
|
|
54127
|
+
}, (d)=>d.values).sum(this._sum).sort(this._sort)).descendants().filter((d, i)=>{
|
|
54127
54128
|
d.__d3plus__ = true;
|
|
54128
54129
|
d.i = i;
|
|
54129
|
-
d.id = d.parent ? d.parent.data.key :
|
|
54130
|
+
d.id = d.parent ? d.parent.data.key : "root";
|
|
54130
54131
|
d.data.__d3plusOpacity__ = d.height ? this._packOpacity(d.data, i) : 1;
|
|
54131
54132
|
d.data.__d3plusTooltip__ = !d.height ? true : false;
|
|
54133
|
+
return !d.children || d.children.length > 1;
|
|
54132
54134
|
});
|
|
54133
54135
|
this._shapes.push(new Circle().data(packData).select(elem("g.d3plus-Pack", {
|
|
54134
54136
|
parent: this._select,
|
|
@@ -54218,9 +54220,10 @@
|
|
|
54218
54220
|
const defaultMouseMoveShape = this._on["mousemove.shape"];
|
|
54219
54221
|
this._on["mousemove.shape"] = (d, i, x, event)=>{
|
|
54220
54222
|
if (d.__d3plusTooltip__) defaultMouseMoveShape(d, i, x, event);
|
|
54221
|
-
|
|
54222
|
-
|
|
54223
|
-
|
|
54223
|
+
const hoverData = recursionCircles(d, [
|
|
54224
|
+
d
|
|
54225
|
+
]);
|
|
54226
|
+
this.hover((h)=>hoverData.includes(h));
|
|
54224
54227
|
};
|
|
54225
54228
|
this._pack = pack();
|
|
54226
54229
|
this._packOpacity = constant$9(0.25);
|