@d3plus/core 3.0.10 → 3.0.11
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 +48 -57
- package/es/src/charts/Viz.js +46 -40
- package/package.json +8 -8
- package/umd/d3plus-core.full.js +41 -40
- package/umd/d3plus-core.full.js.map +1 -1
- package/umd/d3plus-core.full.min.js +173 -176
- package/umd/d3plus-core.js +39 -38
- package/umd/d3plus-core.js.map +1 -1
- package/umd/d3plus-core.min.js +10 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d3plus/core",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
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.
|
|
38
|
-
"@d3plus/data": "3.0.
|
|
39
|
-
"@d3plus/dom": "3.0.
|
|
40
|
-
"@d3plus/format": "3.0.
|
|
41
|
-
"@d3plus/locales": "3.0.
|
|
42
|
-
"@d3plus/math": "3.0.
|
|
43
|
-
"@d3plus/text": "3.0.
|
|
37
|
+
"@d3plus/color": "3.0.11",
|
|
38
|
+
"@d3plus/data": "3.0.11",
|
|
39
|
+
"@d3plus/dom": "3.0.11",
|
|
40
|
+
"@d3plus/format": "3.0.11",
|
|
41
|
+
"@d3plus/locales": "3.0.11",
|
|
42
|
+
"@d3plus/math": "3.0.11",
|
|
43
|
+
"@d3plus/text": "3.0.11",
|
|
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.
|
|
2
|
+
@d3plus/core v3.0.11
|
|
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
|
|
@@ -31923,7 +31923,7 @@
|
|
|
31923
31923
|
}, []);
|
|
31924
31924
|
}
|
|
31925
31925
|
|
|
31926
|
-
function debounce(fn) {
|
|
31926
|
+
function debounce$1(fn) {
|
|
31927
31927
|
var pending;
|
|
31928
31928
|
return function() {
|
|
31929
31929
|
if (!pending) {
|
|
@@ -32055,7 +32055,7 @@
|
|
|
32055
32055
|
},
|
|
32056
32056
|
// Async and optimistically optimized update – it will not be executed if
|
|
32057
32057
|
// not necessary (debounced to run at most once-per-tick)
|
|
32058
|
-
update: debounce(function() {
|
|
32058
|
+
update: debounce$1(function() {
|
|
32059
32059
|
return new Promise(function(resolve) {
|
|
32060
32060
|
instance.forceUpdate();
|
|
32061
32061
|
resolve(state);
|
|
@@ -34146,6 +34146,14 @@
|
|
|
34146
34146
|
this._tooltipClass.data([]).render();
|
|
34147
34147
|
}
|
|
34148
34148
|
|
|
34149
|
+
function debounce(func, delay) {
|
|
34150
|
+
let timeout;
|
|
34151
|
+
return function(...args) {
|
|
34152
|
+
const context = this;
|
|
34153
|
+
clearTimeout(timeout);
|
|
34154
|
+
timeout = setTimeout(()=>func.apply(context, args), delay);
|
|
34155
|
+
};
|
|
34156
|
+
}
|
|
34149
34157
|
/**
|
|
34150
34158
|
* Default padding logic that will return false if the screen is less than 600 pixels wide.
|
|
34151
34159
|
* @private
|
|
@@ -34356,12 +34364,34 @@
|
|
|
34356
34364
|
*/ _thresholdFunction(data) {
|
|
34357
34365
|
return data;
|
|
34358
34366
|
}
|
|
34367
|
+
/**
|
|
34368
|
+
* Detects width and height and sets SVG properties
|
|
34369
|
+
* @private
|
|
34370
|
+
*/ _setSVGSize() {
|
|
34371
|
+
const display = this._select.style("display");
|
|
34372
|
+
this._select.style("display", "none");
|
|
34373
|
+
let [w, h] = getSize(this._select.node().parentNode);
|
|
34374
|
+
w -= parseFloat(this._select.style("border-left-width"), 10);
|
|
34375
|
+
w -= parseFloat(this._select.style("border-right-width"), 10);
|
|
34376
|
+
h -= parseFloat(this._select.style("border-top-width"), 10);
|
|
34377
|
+
h -= parseFloat(this._select.style("border-bottom-width"), 10);
|
|
34378
|
+
this._select.style("display", display);
|
|
34379
|
+
if (this._autoWidth) {
|
|
34380
|
+
this.width(w);
|
|
34381
|
+
this._select.style("width", `${this._width}px`).attr("width", `${this._width}px`);
|
|
34382
|
+
}
|
|
34383
|
+
if (this._autoHeight) {
|
|
34384
|
+
this.height(h);
|
|
34385
|
+
this._select.style("height", `${this._height}px`).attr("height", `${this._height}px`);
|
|
34386
|
+
}
|
|
34387
|
+
}
|
|
34359
34388
|
/**
|
|
34360
34389
|
@memberof Viz
|
|
34361
34390
|
@desc Draws the visualization given the specified configuration.
|
|
34362
34391
|
@param {Function} [*callback*] An optional callback function that, if passed, will be called after animation is complete.
|
|
34363
34392
|
@chainable
|
|
34364
34393
|
*/ render(callback) {
|
|
34394
|
+
this._callback = callback;
|
|
34365
34395
|
// Resets margins and padding
|
|
34366
34396
|
this._margin = {
|
|
34367
34397
|
bottom: 0,
|
|
@@ -34381,29 +34411,11 @@
|
|
|
34381
34411
|
const svg = parent.select(".d3plus-viz").size() ? parent.select(".d3plus-viz") : parent.append("svg");
|
|
34382
34412
|
this.select(svg.node());
|
|
34383
34413
|
}
|
|
34384
|
-
/** detects width and height and sets SVG properties */ function setSVGSize() {
|
|
34385
|
-
const display = this._select.style("display");
|
|
34386
|
-
this._select.style("display", "none");
|
|
34387
|
-
let [w, h] = getSize(this._select.node().parentNode);
|
|
34388
|
-
w -= parseFloat(this._select.style("border-left-width"), 10);
|
|
34389
|
-
w -= parseFloat(this._select.style("border-right-width"), 10);
|
|
34390
|
-
h -= parseFloat(this._select.style("border-top-width"), 10);
|
|
34391
|
-
h -= parseFloat(this._select.style("border-bottom-width"), 10);
|
|
34392
|
-
this._select.style("display", display);
|
|
34393
|
-
if (this._autoWidth) {
|
|
34394
|
-
this.width(w);
|
|
34395
|
-
this._select.style("width", `${this._width}px`).attr("width", `${this._width}px`);
|
|
34396
|
-
}
|
|
34397
|
-
if (this._autoHeight) {
|
|
34398
|
-
this.height(h);
|
|
34399
|
-
this._select.style("height", `${this._height}px`).attr("height", `${this._height}px`);
|
|
34400
|
-
}
|
|
34401
|
-
}
|
|
34402
34414
|
// Calculates the width and/or height of the Viz based on the this._select, if either has not been defined.
|
|
34403
34415
|
if ((!this._width || !this._height) && (!this._detectVisible || inViewport(this._select.node()))) {
|
|
34404
34416
|
this._autoWidth = this._width === undefined;
|
|
34405
34417
|
this._autoHeight = this._height === undefined;
|
|
34406
|
-
|
|
34418
|
+
this._setSVGSize();
|
|
34407
34419
|
}
|
|
34408
34420
|
this._select.attr("class", "d3plus-viz").attr("aria-hidden", this._ariaHidden).attr("aria-labelledby", `${this._uuid}-title ${this._uuid}-desc`).attr("role", "img").attr("xmlns", "http://www.w3.org/2000/svg").attr("xmlns:xlink", "http://www.w3.org/1999/xlink").transition().duration(this._duration).style("width", this._width !== undefined ? `${this._width}px` : undefined).style("height", this._height !== undefined ? `${this._height}px` : undefined).attr("width", this._width !== undefined ? `${this._width}px` : undefined).attr("height", this._height !== undefined ? `${this._height}px` : undefined);
|
|
34409
34421
|
// sets "position: relative" on the SVG parent if currently undefined
|
|
@@ -34429,7 +34441,6 @@
|
|
|
34429
34441
|
this._resizePoll = clearTimeout(this._resizePoll);
|
|
34430
34442
|
this._scrollPoll = clearTimeout(this._scrollPoll);
|
|
34431
34443
|
select(this._scrollContainer).on(`scroll.${this._uuid}`, null);
|
|
34432
|
-
select(this._resizeContainer).on(`resize.${this._uuid}`, null);
|
|
34433
34444
|
if (this._detectVisible && this._select.style("visibility") === "hidden") {
|
|
34434
34445
|
this._visiblePoll = setInterval(()=>{
|
|
34435
34446
|
if (this._select.style("visibility") !== "hidden") {
|
|
@@ -34499,14 +34510,9 @@
|
|
|
34499
34510
|
if (this._select.attr("opacity") === "0") this._select.transition().duration(this._duration).attr("opacity", 1);
|
|
34500
34511
|
}
|
|
34501
34512
|
if (this._detectResize && (this._autoWidth || this._autoHeight)) {
|
|
34502
|
-
|
|
34503
|
-
|
|
34504
|
-
|
|
34505
|
-
this._resizePoll = clearTimeout(this._resizePoll);
|
|
34506
|
-
setSVGSize.bind(this)();
|
|
34507
|
-
this.render(callback);
|
|
34508
|
-
}, this._detectResizeDelay);
|
|
34509
|
-
});
|
|
34513
|
+
this._resizeObserver.observe(this._select.node().parentNode);
|
|
34514
|
+
} else {
|
|
34515
|
+
this._resizeObserver.unobserve(this._select.node().parentNode);
|
|
34510
34516
|
}
|
|
34511
34517
|
if (callback) setTimeout(callback, this._duration + 100);
|
|
34512
34518
|
});
|
|
@@ -34988,14 +34994,6 @@
|
|
|
34988
34994
|
*/ noDataMessage(_) {
|
|
34989
34995
|
return arguments.length ? (this._noDataMessage = _, this) : this._noDataMessage;
|
|
34990
34996
|
}
|
|
34991
|
-
/**
|
|
34992
|
-
@memberof Viz
|
|
34993
|
-
@desc If using resize detection, this method allow a custom override of the element to which the resize detection function gets attached.
|
|
34994
|
-
@param {String|HTMLElement} *selector*
|
|
34995
|
-
@chainable
|
|
34996
|
-
*/ resizeContainer(_) {
|
|
34997
|
-
return arguments.length ? (this._resizeContainer = _, this) : this._resizeContainer;
|
|
34998
|
-
}
|
|
34999
34997
|
/**
|
|
35000
34998
|
@memberof Viz
|
|
35001
34999
|
@desc If using scroll or visibility detection, this method allow a custom override of the element to which the scroll detection function gets attached.
|
|
@@ -35484,7 +35482,10 @@
|
|
|
35484
35482
|
"mousemove.legend": mousemoveLegend.bind(this)
|
|
35485
35483
|
};
|
|
35486
35484
|
this._queue = [];
|
|
35487
|
-
this.
|
|
35485
|
+
this._resizeObserver = new ResizeObserver(debounce(()=>{
|
|
35486
|
+
this._setSVGSize();
|
|
35487
|
+
this.render(this._callback);
|
|
35488
|
+
}, this._detectResizeDelay));
|
|
35488
35489
|
this._scrollContainer = typeof window === "undefined" ? "" : window;
|
|
35489
35490
|
this._shape = constant$9("Rect");
|
|
35490
35491
|
this._shapes = [];
|