billboard.js 4.0.0-next.3 → 4.0.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/dist/billboard.css +1 -1
- package/dist/billboard.js +240 -149
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +20 -20
- package/dist/billboard.pkgd.js +240 -149
- package/dist/billboard.pkgd.min.js +27 -27
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +11 -13
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +11 -13
- package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-tableview.js +28 -15
- package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +11 -13
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +9 -9
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +11 -13
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +28 -15
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +6 -6
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- package/dist/theme/dark.css +1 -1
- package/dist/theme/dark.min.css +1 -1
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist/theme/modern.css +1 -1
- package/dist/theme/modern.min.css +1 -1
- package/dist-esm/Chart/Chart.js +1 -1
- package/dist-esm/Chart/api/axis.js +1 -1
- package/dist-esm/Chart/api/category.js +1 -1
- package/dist-esm/Chart/api/chart.js +1 -1
- package/dist-esm/Chart/api/color.js +1 -1
- package/dist-esm/Chart/api/data.js +1 -1
- package/dist-esm/Chart/api/export.js +1 -1
- package/dist-esm/Chart/api/flow.js +1 -1
- package/dist-esm/Chart/api/focus.js +1 -1
- package/dist-esm/Chart/api/grid.js +1 -1
- package/dist-esm/Chart/api/group.js +1 -1
- package/dist-esm/Chart/api/legend.js +1 -1
- package/dist-esm/Chart/api/load.js +1 -1
- package/dist-esm/Chart/api/regions.js +1 -1
- package/dist-esm/Chart/api/selection.js +1 -1
- package/dist-esm/Chart/api/show.js +1 -1
- package/dist-esm/Chart/api/stubs.js +53 -0
- package/dist-esm/Chart/api/subchart.js +2 -2
- package/dist-esm/Chart/api/tooltip.js +1 -1
- package/dist-esm/Chart/api/x.js +1 -1
- package/dist-esm/Chart/api/zoom.js +2 -2
- package/dist-esm/ChartInternal/Axis/Axis.js +1 -1
- package/dist-esm/ChartInternal/Axis/AxisRenderer.js +149 -96
- package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
- package/dist-esm/ChartInternal/ChartInternal.js +8 -4
- package/dist-esm/ChartInternal/data/convert.helper.js +1 -1
- package/dist-esm/ChartInternal/data/convert.js +1 -1
- package/dist-esm/ChartInternal/data/data.js +1 -1
- package/dist-esm/ChartInternal/data/load.js +1 -1
- package/dist-esm/ChartInternal/interactions/drag.js +1 -1
- package/dist-esm/ChartInternal/interactions/eventrect.js +2 -2
- package/dist-esm/ChartInternal/interactions/flow.js +1 -1
- package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
- package/dist-esm/ChartInternal/interactions/subchart.js +1 -1
- package/dist-esm/ChartInternal/interactions/zoom.js +1 -1
- package/dist-esm/ChartInternal/internals/category.js +1 -1
- package/dist-esm/ChartInternal/internals/class.js +1 -1
- package/dist-esm/ChartInternal/internals/clip.js +1 -1
- package/dist-esm/ChartInternal/internals/color.js +1 -1
- package/dist-esm/ChartInternal/internals/domain.js +1 -1
- package/dist-esm/ChartInternal/internals/format.js +1 -1
- package/dist-esm/ChartInternal/internals/grid.js +1 -1
- package/dist-esm/ChartInternal/internals/legend.js +1 -1
- package/dist-esm/ChartInternal/internals/redraw.js +1 -1
- package/dist-esm/ChartInternal/internals/region.js +1 -1
- package/dist-esm/ChartInternal/internals/scale.js +1 -1
- package/dist-esm/ChartInternal/internals/selection.js +1 -1
- package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
- package/dist-esm/ChartInternal/internals/size.js +1 -1
- package/dist-esm/ChartInternal/internals/style.js +1 -1
- package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
- package/dist-esm/ChartInternal/internals/text.js +1 -1
- package/dist-esm/ChartInternal/internals/text.util.js +1 -1
- package/dist-esm/ChartInternal/internals/title.js +1 -1
- package/dist-esm/ChartInternal/internals/tooltip.js +1 -1
- package/dist-esm/ChartInternal/internals/transform.js +1 -1
- package/dist-esm/ChartInternal/internals/type.js +1 -1
- package/dist-esm/ChartInternal/shape/arc.js +1 -1
- package/dist-esm/ChartInternal/shape/area.js +1 -1
- package/dist-esm/ChartInternal/shape/bar.js +1 -1
- package/dist-esm/ChartInternal/shape/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
- package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
- package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
- package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
- package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
- package/dist-esm/ChartInternal/shape/core/path.js +1 -1
- package/dist-esm/ChartInternal/shape/core/point.js +1 -1
- package/dist-esm/ChartInternal/shape/core/treemap.js +1 -1
- package/dist-esm/ChartInternal/shape/funnel.js +1 -1
- package/dist-esm/ChartInternal/shape/gauge.js +1 -1
- package/dist-esm/ChartInternal/shape/line.js +1 -1
- package/dist-esm/ChartInternal/shape/point.js +1 -1
- package/dist-esm/ChartInternal/shape/polar.js +1 -1
- package/dist-esm/ChartInternal/shape/radar.js +1 -1
- package/dist-esm/ChartInternal/shape/shape.js +6 -4
- package/dist-esm/ChartInternal/shape/treemap.js +1 -1
- package/dist-esm/canvas/CanvasAxisRenderer.js +1 -1
- package/dist-esm/canvas/CanvasEngine.js +18 -5
- package/dist-esm/canvas/CanvasPainter.js +1 -1
- package/dist-esm/canvas/CanvasRenderer.js +58 -35
- package/dist-esm/canvas/CanvasTheme.js +1 -1
- package/dist-esm/canvas/HitDetector.js +1 -1
- package/dist-esm/canvas/axisTicks.js +1 -1
- package/dist-esm/canvas/classes.js +1 -1
- package/dist-esm/canvas/color.js +1 -1
- package/dist-esm/canvas/geometry.js +1 -1
- package/dist-esm/canvas/labels.js +1 -1
- package/dist-esm/canvas/pointPattern.js +1 -1
- package/dist-esm/canvas/util.js +1 -1
- package/dist-esm/config/Options/Options.js +1 -1
- package/dist-esm/config/Options/axis/axis.js +1 -1
- package/dist-esm/config/Options/axis/x.js +1 -1
- package/dist-esm/config/Options/axis/y.js +1 -1
- package/dist-esm/config/Options/axis/y2.js +1 -13
- package/dist-esm/config/Options/common/boost.js +1 -1
- package/dist-esm/config/Options/common/color.js +1 -1
- package/dist-esm/config/Options/common/grid.js +1 -1
- package/dist-esm/config/Options/common/legend.js +1 -1
- package/dist-esm/config/Options/common/main.js +1 -1
- package/dist-esm/config/Options/common/point.js +1 -1
- package/dist-esm/config/Options/common/title.js +1 -1
- package/dist-esm/config/Options/common/tooltip.js +1 -1
- package/dist-esm/config/Options/data/axis.js +1 -1
- package/dist-esm/config/Options/data/data.js +1 -1
- package/dist-esm/config/Options/data/selection.js +1 -1
- package/dist-esm/config/Options/interaction/interaction.js +1 -1
- package/dist-esm/config/Options/interaction/subchart.js +1 -1
- package/dist-esm/config/Options/interaction/zoom.js +1 -1
- package/dist-esm/config/Options/shape/arc.js +1 -1
- package/dist-esm/config/Options/shape/area.js +1 -1
- package/dist-esm/config/Options/shape/bar.js +1 -1
- package/dist-esm/config/Options/shape/bubble.js +1 -1
- package/dist-esm/config/Options/shape/candlestick.js +1 -1
- package/dist-esm/config/Options/shape/donut.js +1 -1
- package/dist-esm/config/Options/shape/funnel.js +1 -1
- package/dist-esm/config/Options/shape/gauge.js +1 -1
- package/dist-esm/config/Options/shape/line.js +1 -1
- package/dist-esm/config/Options/shape/pie.js +1 -1
- package/dist-esm/config/Options/shape/polar.js +1 -1
- package/dist-esm/config/Options/shape/radar.js +1 -1
- package/dist-esm/config/Options/shape/scatter.js +1 -1
- package/dist-esm/config/Options/shape/spline.js +1 -1
- package/dist-esm/config/Options/shape/treemap.js +1 -1
- package/dist-esm/config/Store/Element.js +1 -1
- package/dist-esm/config/Store/State.js +1 -1
- package/dist-esm/config/Store/Store.js +1 -1
- package/dist-esm/config/classes.js +1 -1
- package/dist-esm/config/config.js +1 -1
- package/dist-esm/config/const.js +17 -2
- package/dist-esm/config/resolver/axis.core.js +1 -1
- package/dist-esm/config/resolver/axis.js +1 -1
- package/dist-esm/config/resolver/canvas.js +1 -1
- package/dist-esm/config/resolver/canvasShape.js +1 -1
- package/dist-esm/config/resolver/category.js +1 -1
- package/dist-esm/config/resolver/export.js +1 -1
- package/dist-esm/config/resolver/flow.js +1 -1
- package/dist-esm/config/resolver/grid.js +1 -1
- package/dist-esm/config/resolver/interaction/selection.js +1 -1
- package/dist-esm/config/resolver/interaction/subchart.js +1 -1
- package/dist-esm/config/resolver/interaction/zoom.js +1 -1
- package/dist-esm/config/resolver/regions.js +1 -1
- package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/area.js +1 -1
- package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
- package/dist-esm/config/resolver/shape/bar.js +1 -1
- package/dist-esm/config/resolver/shape/bubble.js +1 -1
- package/dist-esm/config/resolver/shape/candlestick.js +1 -1
- package/dist-esm/config/resolver/shape/donut.js +1 -1
- package/dist-esm/config/resolver/shape/funnel.js +1 -1
- package/dist-esm/config/resolver/shape/gauge.js +1 -1
- package/dist-esm/config/resolver/shape/line.js +1 -1
- package/dist-esm/config/resolver/shape/pie.js +1 -1
- package/dist-esm/config/resolver/shape/polar.js +1 -1
- package/dist-esm/config/resolver/shape/radar.js +1 -1
- package/dist-esm/config/resolver/shape/scatter.js +1 -1
- package/dist-esm/config/resolver/shape/treemap.js +1 -1
- package/dist-esm/core.js +3 -3
- package/dist-esm/index.canvas.js +2 -1
- package/dist-esm/index.esm.js +2 -1
- package/dist-esm/module/Cache.js +1 -1
- package/dist-esm/module/browser.js +1 -1
- package/dist-esm/module/dsv.js +1 -1
- package/dist-esm/module/error.js +16 -3
- package/dist-esm/module/generator.js +1 -1
- package/dist-esm/module/sanitize.js +14 -18
- package/dist-esm/module/util/brush.js +1 -1
- package/dist-esm/module/util/dom.js +1 -1
- package/dist-esm/module/util/object.js +7 -4
- package/dist-esm/module/util/type-checks.js +1 -1
- package/dist-esm/module/worker.js +32 -22
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +32 -21
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +37 -11
- package/src/ChartInternal/Axis/AxisRenderer.ts +179 -105
- package/src/ChartInternal/ChartInternal.ts +11 -3
- package/src/ChartInternal/interactions/eventrect.ts +3 -1
- package/src/ChartInternal/shape/shape.ts +5 -3
- package/src/Plugin/tableview/Options.ts +17 -1
- package/src/Plugin/tableview/index.ts +1 -1
- package/src/canvas/CanvasEngine.ts +18 -5
- package/src/canvas/CanvasRenderer.ts +71 -36
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/module/sanitize.ts +13 -20
- package/src/module/util/object.ts +4 -2
- package/src/module/worker.ts +34 -24
- package/types/index.d.ts +0 -3
- package/types/plugin/tableview/options.d.ts +5 -0
package/dist/billboard.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 4.0.0
|
|
8
|
+
* @version 4.0.0
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -537,7 +537,7 @@ const DANGEROUS_CSS_PATTERNS = [
|
|
|
537
537
|
"-moz-binding:"
|
|
538
538
|
];
|
|
539
539
|
function decodeHTMLEntities(str) {
|
|
540
|
-
return str.replace(/:/gi, ":").replace(/&newline;/gi, "\n").replace(/&tab;/gi, " ").replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/&/gi, "&").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+)
|
|
540
|
+
return str.replace(/:/gi, ":").replace(/&newline;/gi, "\n").replace(/&tab;/gi, " ").replace(/ /gi, " ").replace(/</gi, "<").replace(/>/gi, ">").replace(/&/gi, "&").replace(/"/gi, '"').replace(/'/gi, "'").replace(/&#(\d+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 10))).replace(/&#x([0-9a-f]+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
|
|
541
541
|
}
|
|
542
542
|
function isSafeURI(uri) {
|
|
543
543
|
const decoded = decodeHTMLEntities(uri).trim();
|
|
@@ -545,15 +545,11 @@ function isSafeURI(uri) {
|
|
|
545
545
|
if (!normalized || normalized.startsWith("#")) {
|
|
546
546
|
return true;
|
|
547
547
|
}
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
const colonIndex = normalized.indexOf(":");
|
|
552
|
-
if (colonIndex > 0) {
|
|
553
|
-
const protocol = normalized.substring(0, colonIndex + 1);
|
|
554
|
-
return ALLOWED_URI_PROTOCOLS.has(protocol);
|
|
548
|
+
const schemeMatch = normalized.match(/^[^/?#]*:/);
|
|
549
|
+
if (schemeMatch) {
|
|
550
|
+
return ALLOWED_URI_PROTOCOLS.has(schemeMatch[0]);
|
|
555
551
|
}
|
|
556
|
-
return
|
|
552
|
+
return true;
|
|
557
553
|
}
|
|
558
554
|
function sanitizeStyleValue(style) {
|
|
559
555
|
const decoded = decodeHTMLEntities(style);
|
|
@@ -709,7 +705,7 @@ var __spreadValues = (a, b) => {
|
|
|
709
705
|
function _forEachValidItem(items, callback) {
|
|
710
706
|
for (let i = 0; i < items.length; i++) {
|
|
711
707
|
const item = items[i];
|
|
712
|
-
if (item) {
|
|
708
|
+
if (item !== null && isDefined(item)) {
|
|
713
709
|
callback(item, i);
|
|
714
710
|
}
|
|
715
711
|
}
|
|
@@ -789,7 +785,9 @@ function mergeObj(target, ...objectN) {
|
|
|
789
785
|
Object.keys(source).forEach((key) => {
|
|
790
786
|
if (!/^(__proto__|constructor|prototype)$/i.test(key)) {
|
|
791
787
|
const value = source[key];
|
|
792
|
-
if (
|
|
788
|
+
if (value instanceof Date) {
|
|
789
|
+
target[key] = new Date(value.getTime());
|
|
790
|
+
} else if (isObject(value)) {
|
|
793
791
|
!target[key] && (target[key] = {});
|
|
794
792
|
target[key] = mergeObj(target[key], value);
|
|
795
793
|
} else {
|
|
@@ -3573,6 +3571,7 @@ class CanvasEngine {
|
|
|
3573
3571
|
CanvasEngine_publicField(this, "dpr", 1);
|
|
3574
3572
|
CanvasEngine_publicField(this, "frame", null);
|
|
3575
3573
|
CanvasEngine_publicField(this, "frameCtx", null);
|
|
3574
|
+
CanvasEngine_publicField(this, "frameValid", false);
|
|
3576
3575
|
}
|
|
3577
3576
|
/**
|
|
3578
3577
|
* Create and attach the canvas element.
|
|
@@ -3607,13 +3606,14 @@ class CanvasEngine {
|
|
|
3607
3606
|
this.ctx.setTransform(this.dpr, 0, 0, this.dpr, 0, 0);
|
|
3608
3607
|
this.frame = null;
|
|
3609
3608
|
this.frameCtx = null;
|
|
3609
|
+
this.frameValid = false;
|
|
3610
3610
|
}
|
|
3611
3611
|
/**
|
|
3612
3612
|
* Clear transient overlay drawings by restoring the captured frame.
|
|
3613
3613
|
* @private
|
|
3614
3614
|
*/
|
|
3615
3615
|
clearOverlay() {
|
|
3616
|
-
this.restoreFrame();
|
|
3616
|
+
this.frameValid && this.restoreFrame();
|
|
3617
3617
|
}
|
|
3618
3618
|
/**
|
|
3619
3619
|
* Draw transient overlay content on the single visible canvas.
|
|
@@ -3622,7 +3622,12 @@ class CanvasEngine {
|
|
|
3622
3622
|
*/
|
|
3623
3623
|
withOverlay(draw) {
|
|
3624
3624
|
const { ctx } = this;
|
|
3625
|
-
this.
|
|
3625
|
+
const hasFrame = this.frameValid;
|
|
3626
|
+
if (hasFrame) {
|
|
3627
|
+
this.clearOverlay();
|
|
3628
|
+
} else {
|
|
3629
|
+
this.captureFrame();
|
|
3630
|
+
}
|
|
3626
3631
|
ctx.save();
|
|
3627
3632
|
ctx.setTransform(this.dpr, 0, 0, this.dpr, 0, 0);
|
|
3628
3633
|
try {
|
|
@@ -3639,6 +3644,7 @@ class CanvasEngine {
|
|
|
3639
3644
|
*/
|
|
3640
3645
|
beginFrame(w, h) {
|
|
3641
3646
|
const { ctx } = this;
|
|
3647
|
+
this.frameValid = false;
|
|
3642
3648
|
ctx.save();
|
|
3643
3649
|
ctx.setTransform(this.dpr, 0, 0, this.dpr, 0, 0);
|
|
3644
3650
|
ctx.clearRect(0, 0, w, h);
|
|
@@ -3649,7 +3655,6 @@ class CanvasEngine {
|
|
|
3649
3655
|
*/
|
|
3650
3656
|
endFrame() {
|
|
3651
3657
|
this.ctx.restore();
|
|
3652
|
-
this.captureFrame();
|
|
3653
3658
|
}
|
|
3654
3659
|
/**
|
|
3655
3660
|
* Capture the rendered frame for focus overlay restoration.
|
|
@@ -3657,6 +3662,7 @@ class CanvasEngine {
|
|
|
3657
3662
|
*/
|
|
3658
3663
|
captureFrame() {
|
|
3659
3664
|
const { canvas } = this;
|
|
3665
|
+
this.frameValid = false;
|
|
3660
3666
|
if (canvas.width && canvas.height) {
|
|
3661
3667
|
let { frame, frameCtx } = this;
|
|
3662
3668
|
if (!frame) {
|
|
@@ -3677,6 +3683,7 @@ class CanvasEngine {
|
|
|
3677
3683
|
frameCtx.clearRect(0, 0, canvas.width, canvas.height);
|
|
3678
3684
|
}
|
|
3679
3685
|
frameCtx.drawImage(canvas, 0, 0);
|
|
3686
|
+
this.frameValid = true;
|
|
3680
3687
|
}
|
|
3681
3688
|
}
|
|
3682
3689
|
/**
|
|
@@ -3684,7 +3691,7 @@ class CanvasEngine {
|
|
|
3684
3691
|
* @private
|
|
3685
3692
|
*/
|
|
3686
3693
|
restoreFrame() {
|
|
3687
|
-
if (!this.frame || !this.frameCtx) {
|
|
3694
|
+
if (!this.frameValid || !this.frame || !this.frameCtx) {
|
|
3688
3695
|
return;
|
|
3689
3696
|
}
|
|
3690
3697
|
const { canvas, ctx } = this;
|
|
@@ -3704,6 +3711,7 @@ class CanvasEngine {
|
|
|
3704
3711
|
(_a = this.canvas) == null ? void 0 : _a.remove();
|
|
3705
3712
|
this.frame = null;
|
|
3706
3713
|
this.frameCtx = null;
|
|
3714
|
+
this.frameValid = false;
|
|
3707
3715
|
}
|
|
3708
3716
|
}
|
|
3709
3717
|
|
|
@@ -4941,6 +4949,12 @@ function drawCanvasArea($$, target, indices, painter, isSub = false) {
|
|
|
4941
4949
|
generateDrawAreaPath($$, indices, isSub, ctx)(target);
|
|
4942
4950
|
});
|
|
4943
4951
|
}
|
|
4952
|
+
function getVisibleCanvasTarget($$, target) {
|
|
4953
|
+
const range = getCanvasTargetVisibleRange($$, target);
|
|
4954
|
+
return range.start === 0 && range.end === target.values.length ? target : CanvasRenderer_spreadProps(CanvasRenderer_spreadValues({}, target), {
|
|
4955
|
+
values: target.values.slice(range.start, range.end)
|
|
4956
|
+
});
|
|
4957
|
+
}
|
|
4944
4958
|
function getFocusedCanvasDatum(focusData, d) {
|
|
4945
4959
|
if (!(focusData == null ? void 0 : focusData.length) || !(d == null ? void 0 : d.id)) {
|
|
4946
4960
|
return null;
|
|
@@ -5944,7 +5958,7 @@ class CanvasRenderer {
|
|
|
5944
5958
|
*/
|
|
5945
5959
|
hasExpandedShapeFocus($$, selectedData) {
|
|
5946
5960
|
return !!(selectedData == null ? void 0 : selectedData.some(
|
|
5947
|
-
(d) => d && (isCanvasBarType($$, d) || isCanvasCandlestickType($$, d)
|
|
5961
|
+
(d) => d && (isCanvasBarType($$, d) || isCanvasCandlestickType($$, d))
|
|
5948
5962
|
));
|
|
5949
5963
|
}
|
|
5950
5964
|
/**
|
|
@@ -5965,13 +5979,14 @@ class CanvasRenderer {
|
|
|
5965
5979
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
5966
5980
|
var _a;
|
|
5967
5981
|
for (const target of targets) {
|
|
5968
|
-
|
|
5982
|
+
const visibleTarget = getVisibleCanvasTarget($$, target);
|
|
5983
|
+
if (!visibleTarget.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
5969
5984
|
continue;
|
|
5970
5985
|
}
|
|
5971
5986
|
ctx.globalAlpha = getCanvasTargetFocusOpacity($$, target);
|
|
5972
5987
|
ctx.lineWidth = isCanvasTargetFocused($$, target) ? style.shape.lineFocusedWidth : style.shape.lineWidth;
|
|
5973
5988
|
ctx.strokeStyle = $$.color(target.id);
|
|
5974
|
-
((_a = $$.config.data_regions) == null ? void 0 : _a[
|
|
5989
|
+
((_a = $$.config.data_regions) == null ? void 0 : _a[visibleTarget.id]) ? drawCanvasLineWithDataRegions($$, visibleTarget, painter) : drawCanvasLine($$, visibleTarget, indices, painter);
|
|
5975
5990
|
}
|
|
5976
5991
|
ctx.globalAlpha = 1;
|
|
5977
5992
|
});
|
|
@@ -5994,21 +6009,23 @@ class CanvasRenderer {
|
|
|
5994
6009
|
}
|
|
5995
6010
|
painter.withTranslation(margin.left, margin.top, () => {
|
|
5996
6011
|
for (const target of targets) {
|
|
5997
|
-
|
|
6012
|
+
const visibleTarget = getVisibleCanvasTarget($$, target);
|
|
6013
|
+
if (!visibleTarget.values.some(hasCanvasDrawableValue.bind(null, $$))) {
|
|
5998
6014
|
continue;
|
|
5999
6015
|
}
|
|
6000
|
-
const color = getCanvasRenderColor($$,
|
|
6016
|
+
const color = getCanvasRenderColor($$, visibleTarget, focusData);
|
|
6001
6017
|
ctx.globalAlpha = style.shape.areaOpacity * getCanvasTargetFocusOpacity($$, target);
|
|
6002
6018
|
ctx.fillStyle = getCanvasLinearGradientFill(
|
|
6003
6019
|
$$,
|
|
6004
6020
|
ctx,
|
|
6005
|
-
|
|
6021
|
+
visibleTarget,
|
|
6006
6022
|
"area",
|
|
6007
|
-
//
|
|
6023
|
+
// Bounds computation walks visible rows, so skip it when no gradient is set.
|
|
6024
|
+
// Use the original target so the range cache stays aligned with unsliced values.
|
|
6008
6025
|
$$.config.area_linearGradient ? getCanvasAreaBounds($$, target, indices) : null,
|
|
6009
6026
|
color
|
|
6010
6027
|
);
|
|
6011
|
-
drawCanvasArea($$,
|
|
6028
|
+
drawCanvasArea($$, visibleTarget, indices, painter);
|
|
6012
6029
|
}
|
|
6013
6030
|
ctx.globalAlpha = 1;
|
|
6014
6031
|
});
|
|
@@ -6279,7 +6296,7 @@ class CanvasRenderer {
|
|
|
6279
6296
|
const d = data[i];
|
|
6280
6297
|
const text = getLabelText($$, d);
|
|
6281
6298
|
if (text && d.index >= range.start && d.index < range.end && hasCanvasDrawableValue($$, d)) {
|
|
6282
|
-
rows.push({ d,
|
|
6299
|
+
rows.push({ d, text });
|
|
6283
6300
|
}
|
|
6284
6301
|
}
|
|
6285
6302
|
labelCount += rows.length;
|
|
@@ -6292,12 +6309,12 @@ class CanvasRenderer {
|
|
|
6292
6309
|
ctx.font = style.label.font;
|
|
6293
6310
|
ctx.textAlign = "center";
|
|
6294
6311
|
targetRows.forEach((rows) => {
|
|
6295
|
-
var _a2;
|
|
6296
|
-
for (const { d,
|
|
6312
|
+
var _a2, _b;
|
|
6313
|
+
for (const { d, text } of rows) {
|
|
6297
6314
|
let x;
|
|
6298
6315
|
let y;
|
|
6299
6316
|
if (isCanvasBarType($$, d) && barPoints) {
|
|
6300
|
-
const geometry = getCanvasBarGeometry($$, barPoints, d,
|
|
6317
|
+
const geometry = getCanvasBarGeometry($$, barPoints, d, d.index);
|
|
6301
6318
|
if (!geometry) {
|
|
6302
6319
|
continue;
|
|
6303
6320
|
}
|
|
@@ -6316,19 +6333,21 @@ class CanvasRenderer {
|
|
|
6316
6333
|
$$,
|
|
6317
6334
|
candlestickPoints,
|
|
6318
6335
|
d,
|
|
6319
|
-
|
|
6336
|
+
d.index
|
|
6320
6337
|
);
|
|
6321
6338
|
const isUp = value == null ? void 0 : value._isUp;
|
|
6322
6339
|
if (!geometry) {
|
|
6323
6340
|
continue;
|
|
6324
6341
|
}
|
|
6325
|
-
const {
|
|
6326
|
-
|
|
6327
|
-
|
|
6342
|
+
const { wickEnd, wickStart } = geometry;
|
|
6343
|
+
const isInverted = $$.config[`axis_${(_b = $$.axis) == null ? void 0 : _b.getId(d.id)}_inverted`];
|
|
6344
|
+
x = $$.config.axis_rotated ? isUp ? wickEnd[0] + 4 : wickStart[0] - 4 : wickStart[0];
|
|
6345
|
+
y = $$.config.axis_rotated ? wickStart[1] + 3 : isUp ? wickEnd[1] - 3 : wickStart[1] + 12;
|
|
6346
|
+
!$$.config.axis_rotated && isInverted && (y += 15 * (isUp ? 1 : -1));
|
|
6328
6347
|
ctx.textAlign = $$.config.axis_rotated ? isUp ? "left" : "right" : "center";
|
|
6329
|
-
ctx.textBaseline =
|
|
6348
|
+
ctx.textBaseline = "alphabetic";
|
|
6330
6349
|
} else if (cx && cy) {
|
|
6331
|
-
({ x, y } = getShapePoint(shape.pos, d,
|
|
6350
|
+
({ x, y } = getShapePoint(shape.pos, d, d.index));
|
|
6332
6351
|
({ x, y } = getPointLabelAnchor($$, ctx, d, x, y));
|
|
6333
6352
|
}
|
|
6334
6353
|
x += getLabelPosition($$, d, "x", texts);
|
|
@@ -6558,15 +6577,24 @@ class CanvasRenderer {
|
|
|
6558
6577
|
const r = (_d = (_c = $$.pointExpandedR) == null ? void 0 : _c.call($$, d)) != null ? _d : baseR * 1.75;
|
|
6559
6578
|
const overColor = getCanvasOverColor($$, d);
|
|
6560
6579
|
const color = overColor || $$.color(d.id);
|
|
6580
|
+
const fill = overColor || style.focusPoint.fill || style.shape.pointFillColor || color;
|
|
6581
|
+
const stroke = overColor || style.focusPoint.stroke || color;
|
|
6582
|
+
const lineWidth = style.focusPoint.lineWidth;
|
|
6583
|
+
const alpha = getPointOpacity($$, d);
|
|
6584
|
+
const hasStroke = !!stroke && (lineWidth != null ? lineWidth : 0) > 0;
|
|
6585
|
+
const mergeSameColorStroke = pointType === "circle" && hasStroke && isNumber(alpha) && alpha < 1 && fill === stroke;
|
|
6561
6586
|
if (!isFiniteCanvasCoordinate(x, y)) {
|
|
6562
6587
|
return;
|
|
6563
6588
|
}
|
|
6564
|
-
drawPointPattern(
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
|
|
6569
|
-
|
|
6589
|
+
drawPointPattern(
|
|
6590
|
+
painter,
|
|
6591
|
+
pointType,
|
|
6592
|
+
x,
|
|
6593
|
+
y,
|
|
6594
|
+
mergeSameColorStroke ? r + (lineWidth || 0) / 2 : r,
|
|
6595
|
+
hasStroke && !mergeSameColorStroke ? { fill, lineWidth, stroke, alpha } : { fill, alpha },
|
|
6596
|
+
baseR
|
|
6597
|
+
);
|
|
6570
6598
|
});
|
|
6571
6599
|
}
|
|
6572
6600
|
this.drawFocusLabels($$, selectedData);
|
|
@@ -10892,20 +10920,24 @@ function getOrCreateWorkerResources(fn, depsFn) {
|
|
|
10892
10920
|
const depsString = (_a = depsFn == null ? void 0 : depsFn.map(String).join(";")) != null ? _a : "";
|
|
10893
10921
|
const key = (fnString + depsString).replace(/(function|[\s\W\n])/g, "").substring(0, 30);
|
|
10894
10922
|
if (!(key in cache)) {
|
|
10895
|
-
|
|
10896
|
-
|
|
10897
|
-
|
|
10898
|
-
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10904
|
-
|
|
10905
|
-
|
|
10906
|
-
|
|
10907
|
-
|
|
10908
|
-
|
|
10923
|
+
try {
|
|
10924
|
+
const blob = new win.Blob([
|
|
10925
|
+
`${depsString}
|
|
10926
|
+
|
|
10927
|
+
self.onmessage=function({data}) {
|
|
10928
|
+
const result = (${fnString}).apply(null, data.args);
|
|
10929
|
+
self.postMessage({id: data.id, result});
|
|
10930
|
+
};`
|
|
10931
|
+
], {
|
|
10932
|
+
type: "text/javascript"
|
|
10933
|
+
});
|
|
10934
|
+
cache[key] = {
|
|
10935
|
+
src: win.URL.createObjectURL(blob),
|
|
10936
|
+
worker: null
|
|
10937
|
+
};
|
|
10938
|
+
} catch (e) {
|
|
10939
|
+
return null;
|
|
10940
|
+
}
|
|
10909
10941
|
}
|
|
10910
10942
|
return { key, src: cache[key].src };
|
|
10911
10943
|
}
|
|
@@ -10915,7 +10947,11 @@ function getWorker(key, src) {
|
|
|
10915
10947
|
return null;
|
|
10916
10948
|
}
|
|
10917
10949
|
if (!cached.worker) {
|
|
10918
|
-
|
|
10950
|
+
try {
|
|
10951
|
+
cached.worker = new win.Worker(src);
|
|
10952
|
+
} catch (e) {
|
|
10953
|
+
return null;
|
|
10954
|
+
}
|
|
10919
10955
|
if (cached.worker) {
|
|
10920
10956
|
cached.worker.onerror = function(e) {
|
|
10921
10957
|
console.error ? console.error(e) : console.log(e);
|
|
@@ -10930,10 +10966,10 @@ function runWorker(useWorker = true, fn, callback, depsFn) {
|
|
|
10930
10966
|
callback(res);
|
|
10931
10967
|
};
|
|
10932
10968
|
if (win.Worker && useWorker) {
|
|
10933
|
-
const
|
|
10934
|
-
const worker = getWorker(key, src);
|
|
10935
|
-
|
|
10936
|
-
|
|
10969
|
+
const workerResources = getOrCreateWorkerResources(fn, depsFn);
|
|
10970
|
+
const worker = workerResources && getWorker(workerResources.key, workerResources.src);
|
|
10971
|
+
if (worker) {
|
|
10972
|
+
runFn = function(...args) {
|
|
10937
10973
|
const id = ++messageId;
|
|
10938
10974
|
const handler = function(e) {
|
|
10939
10975
|
var _a;
|
|
@@ -10944,8 +10980,8 @@ function runWorker(useWorker = true, fn, callback, depsFn) {
|
|
|
10944
10980
|
};
|
|
10945
10981
|
worker.addEventListener("message", handler);
|
|
10946
10982
|
worker.postMessage({ id, args });
|
|
10947
|
-
}
|
|
10948
|
-
}
|
|
10983
|
+
};
|
|
10984
|
+
}
|
|
10949
10985
|
}
|
|
10950
10986
|
return runFn;
|
|
10951
10987
|
}
|
|
@@ -17007,10 +17043,11 @@ function updateTargetsForShape(targets, config) {
|
|
|
17007
17043
|
const targets = $$.orderTargets(
|
|
17008
17044
|
$$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))
|
|
17009
17045
|
);
|
|
17046
|
+
const dataGeneration = $$.state.dataGeneration;
|
|
17010
17047
|
const targetIds = targets.map((t) => t.id).join("_");
|
|
17011
17048
|
const cacheKey = `${KEY.shapeOffset}_${targetIds}`;
|
|
17012
17049
|
const cachedData = $$.cache.get(cacheKey);
|
|
17013
|
-
if (cachedData) {
|
|
17050
|
+
if ((cachedData == null ? void 0 : cachedData.generation) === dataGeneration) {
|
|
17014
17051
|
return cachedData;
|
|
17015
17052
|
}
|
|
17016
17053
|
const isStackNormalized = $$.isStackNormalized();
|
|
@@ -17038,7 +17075,7 @@ function updateTargetsForShape(targets, config) {
|
|
|
17038
17075
|
out[id] = index;
|
|
17039
17076
|
return out;
|
|
17040
17077
|
}, {});
|
|
17041
|
-
const result = { indexMapByTargetId, shapeOffsetTargets };
|
|
17078
|
+
const result = { generation: dataGeneration, indexMapByTargetId, shapeOffsetTargets };
|
|
17042
17079
|
$$.cache.add(cacheKey, result);
|
|
17043
17080
|
return result;
|
|
17044
17081
|
},
|
|
@@ -17804,7 +17841,7 @@ class ChartInternal {
|
|
|
17804
17841
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_b = $$.hasLegendDefsPoint) == null ? void 0 : _b.call($$))) {
|
|
17805
17842
|
$el.defs = $el.svg.append("defs");
|
|
17806
17843
|
if (hasAxis) {
|
|
17807
|
-
["id", "idXAxis", "idYAxis", "
|
|
17844
|
+
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
17808
17845
|
$$.appendClip($el.defs, state.clip[v]);
|
|
17809
17846
|
});
|
|
17810
17847
|
}
|
|
@@ -18048,6 +18085,7 @@ class ChartInternal {
|
|
|
18048
18085
|
return $$.getBaseValue(d) !== null && withoutFadeIn[d.id] ? null : "0";
|
|
18049
18086
|
}
|
|
18050
18087
|
bindResize() {
|
|
18088
|
+
var _a, _b;
|
|
18051
18089
|
const $$ = this;
|
|
18052
18090
|
const { $el, config, state } = $$;
|
|
18053
18091
|
const resizeFunction = generateResize(config.resize_timer);
|
|
@@ -18056,7 +18094,7 @@ class ChartInternal {
|
|
|
18056
18094
|
list.push(() => callFn(config.onresize, $$.api));
|
|
18057
18095
|
if (/^(true|parent)$/.test(resize_auto)) {
|
|
18058
18096
|
list.push(() => {
|
|
18059
|
-
var
|
|
18097
|
+
var _a2;
|
|
18060
18098
|
const prevWidth = state.current.width;
|
|
18061
18099
|
const prevHeight = state.current.height;
|
|
18062
18100
|
$$.setContainerSize();
|
|
@@ -18066,7 +18104,7 @@ class ChartInternal {
|
|
|
18066
18104
|
state.resizing = true;
|
|
18067
18105
|
if (config.legend_show) {
|
|
18068
18106
|
$$.updateSizes();
|
|
18069
|
-
state.isCanvasMode ? (
|
|
18107
|
+
state.isCanvasMode ? (_a2 = $$.updateHtmlLegend) == null ? void 0 : _a2.call($$) : $$.updateLegend();
|
|
18070
18108
|
}
|
|
18071
18109
|
$$.api.flush(false);
|
|
18072
18110
|
});
|
|
@@ -18077,9 +18115,17 @@ class ChartInternal {
|
|
|
18077
18115
|
});
|
|
18078
18116
|
list.forEach((v) => resizeFunction.add(v));
|
|
18079
18117
|
$$.resizeFunction = resizeFunction;
|
|
18080
|
-
if (resize_auto === "parent") {
|
|
18081
|
-
($$.resizeFunction.resizeObserver = new ResizeObserver(
|
|
18118
|
+
if (resize_auto === "parent" && win.ResizeObserver) {
|
|
18119
|
+
($$.resizeFunction.resizeObserver = new win.ResizeObserver(
|
|
18120
|
+
$$.resizeFunction.bind($$)
|
|
18121
|
+
)).observe($el.chart.node().parentNode);
|
|
18082
18122
|
} else {
|
|
18123
|
+
if (resize_auto === "parent") {
|
|
18124
|
+
(_b = (_a = win.console) == null ? void 0 : _a.warn) == null ? void 0 : _b.call(
|
|
18125
|
+
_a,
|
|
18126
|
+
"[billboard.js] resize.auto='parent' requires ResizeObserver; falling back to window resize."
|
|
18127
|
+
);
|
|
18128
|
+
}
|
|
18083
18129
|
win.addEventListener("resize", $$.resizeFunction);
|
|
18084
18130
|
}
|
|
18085
18131
|
}
|
|
@@ -26190,6 +26236,33 @@ class AxisRenderer {
|
|
|
26190
26236
|
this.params = params;
|
|
26191
26237
|
this.helper = new AxisRendererHelper(this);
|
|
26192
26238
|
}
|
|
26239
|
+
canReuseTickTextOnResize(isLeftRight) {
|
|
26240
|
+
const { config, params } = this;
|
|
26241
|
+
const { config: chartConfig, id, owner } = params;
|
|
26242
|
+
const isX = /^(x|subX)$/.test(id);
|
|
26243
|
+
const type = id === "subX" ? "x" : id;
|
|
26244
|
+
const customTickFormat = id === "subX" ? chartConfig.subchart_axis_x_tick_format || chartConfig.axis_x_tick_format : chartConfig[`axis_${type}_tick_format`];
|
|
26245
|
+
const categoryAutoWrap = params.tickMultiline && params.isCategory && !isLeftRight && !(params.tickWidth > 0);
|
|
26246
|
+
return !!(owner.state.resizing && !owner.state.flowing && !isFunction(chartConfig.axis_evalTextSize) && !customTickFormat && !params.tickTitle && !(isX && chartConfig.axis_x_tick_autorotate) && !categoryAutoWrap && config.withoutTransition);
|
|
26247
|
+
}
|
|
26248
|
+
canReuseTickNodesOnResize(tickNodes, ticks, isLeftRight, tickShow) {
|
|
26249
|
+
if (tickShow.tick || !tickShow.text || !this.canReuseTickTextOnResize(isLeftRight) || tickNodes.size() !== ticks.length) {
|
|
26250
|
+
return false;
|
|
26251
|
+
}
|
|
26252
|
+
const nodes = tickNodes.nodes();
|
|
26253
|
+
for (let i = 0; i < ticks.length; i++) {
|
|
26254
|
+
const current = nodes[i].__data__;
|
|
26255
|
+
const next = ticks[i];
|
|
26256
|
+
if (current instanceof Date || next instanceof Date) {
|
|
26257
|
+
if (+current !== +next) {
|
|
26258
|
+
return false;
|
|
26259
|
+
}
|
|
26260
|
+
} else if (current !== next) {
|
|
26261
|
+
return false;
|
|
26262
|
+
}
|
|
26263
|
+
}
|
|
26264
|
+
return true;
|
|
26265
|
+
}
|
|
26193
26266
|
/**
|
|
26194
26267
|
* Create axis element
|
|
26195
26268
|
* @param {d3.selection} g Axis selection
|
|
@@ -26234,76 +26307,106 @@ class AxisRenderer {
|
|
|
26234
26307
|
if (tickShow.tick || tickShow.text) {
|
|
26235
26308
|
const ticks = config.tickValues || helper.generateTicks(scale1, isLeftRight || params.config.axis_rotated);
|
|
26236
26309
|
ctx.generatedTicks = ticks;
|
|
26237
|
-
let tick = g2.selectAll(".tick")
|
|
26238
|
-
const
|
|
26239
|
-
|
|
26240
|
-
|
|
26241
|
-
|
|
26242
|
-
|
|
26243
|
-
|
|
26244
|
-
|
|
26245
|
-
|
|
26246
|
-
|
|
26247
|
-
|
|
26248
|
-
|
|
26249
|
-
|
|
26250
|
-
|
|
26251
|
-
|
|
26252
|
-
|
|
26253
|
-
|
|
26254
|
-
|
|
26255
|
-
|
|
26256
|
-
let
|
|
26257
|
-
if (
|
|
26258
|
-
|
|
26259
|
-
|
|
26260
|
-
|
|
26261
|
-
|
|
26310
|
+
let tick = g2.selectAll(".tick");
|
|
26311
|
+
const canReuseTickNodes = ctx.canReuseTickNodesOnResize(
|
|
26312
|
+
tick,
|
|
26313
|
+
ticks,
|
|
26314
|
+
isLeftRight || params.config.axis_rotated,
|
|
26315
|
+
tickShow
|
|
26316
|
+
);
|
|
26317
|
+
if (canReuseTickNodes) {
|
|
26318
|
+
tickTransform(tick, scale1);
|
|
26319
|
+
} else {
|
|
26320
|
+
tick = tick.data(ticks, scale1);
|
|
26321
|
+
const tickEnter = tick.enter().insert("g", ".domain").attr("class", "tick");
|
|
26322
|
+
const tickExit = tick.exit().remove();
|
|
26323
|
+
tick = tickEnter.merge(tick);
|
|
26324
|
+
tickShow.tick && tickEnter.append("line");
|
|
26325
|
+
tickShow.text && tickEnter.append("text");
|
|
26326
|
+
const hasTickChange = !tickEnter.empty() || !tickExit.empty();
|
|
26327
|
+
const reuseTickText = tickShow.text && !hasTickChange && ctx.canReuseTickTextOnResize(isLeftRight || params.config.axis_rotated);
|
|
26328
|
+
let sizeFor1Char = { w: 0, h: 0 };
|
|
26329
|
+
let textUpdate = tick.selectAll("text.__bb-empty");
|
|
26330
|
+
if (tickShow.text && !reuseTickText) {
|
|
26331
|
+
const tickText = tick.select("text");
|
|
26332
|
+
const counts = [];
|
|
26333
|
+
textUpdate = tickText;
|
|
26334
|
+
if (isFunction(evalTextSize)) {
|
|
26335
|
+
sizeFor1Char = evalTextSize.bind(ctx.params.owner.api)(
|
|
26336
|
+
tickText.node(),
|
|
26337
|
+
id
|
|
26338
|
+
);
|
|
26339
|
+
if (this.classList.contains($COMMON.dummy)) {
|
|
26340
|
+
this.sizeFor1Char = sizeFor1Char;
|
|
26341
|
+
}
|
|
26342
|
+
}
|
|
26343
|
+
if (!sizeFor1Char || sizeFor1Char.w === 0 || sizeFor1Char.h === 0) {
|
|
26344
|
+
sizeFor1Char = ctx.helper.getSizeFor1Char(
|
|
26345
|
+
orient,
|
|
26346
|
+
tickText,
|
|
26347
|
+
!!evalTextSize
|
|
26348
|
+
);
|
|
26349
|
+
}
|
|
26350
|
+
let tspan = tickText.selectAll("tspan").data((d, index) => {
|
|
26351
|
+
let split;
|
|
26352
|
+
if (params.tickMultiline) {
|
|
26353
|
+
split = splitTickText(
|
|
26354
|
+
d,
|
|
26355
|
+
scale1,
|
|
26356
|
+
ticks,
|
|
26357
|
+
isLeftRight,
|
|
26358
|
+
sizeFor1Char.w
|
|
26359
|
+
);
|
|
26360
|
+
} else {
|
|
26361
|
+
const formatted = helper.textFormatted(d);
|
|
26362
|
+
split = isArray(formatted) ? formatted.concat() : [formatted];
|
|
26363
|
+
}
|
|
26364
|
+
counts[index] = split.length;
|
|
26365
|
+
return split.map((splitted) => ({ index, splitted }));
|
|
26366
|
+
});
|
|
26367
|
+
tspan.exit().remove();
|
|
26368
|
+
tspan = tspan.enter().append("tspan").merge(tspan).text((d) => d.splitted);
|
|
26369
|
+
tspan.attr("x", isTopBottom ? 0 : tickLength * sign).attr("dx", (() => {
|
|
26370
|
+
let dx = 0;
|
|
26371
|
+
if (/(top|bottom)/.test(orient) && rotate) {
|
|
26372
|
+
dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1);
|
|
26373
|
+
}
|
|
26374
|
+
return dx + (tickTextPos.x || 0);
|
|
26375
|
+
})()).attr("dy", (d, i) => {
|
|
26376
|
+
const defValue = ".71em";
|
|
26377
|
+
let dy = 0;
|
|
26378
|
+
if (orient !== "top") {
|
|
26379
|
+
dy = sizeFor1Char.h;
|
|
26380
|
+
if (i === 0) {
|
|
26381
|
+
dy = isLeftRight ? -((counts[d.index] - 1) * (sizeFor1Char.h / 2) - 3) : tickTextPos.y === 0 ? defValue : 0;
|
|
26382
|
+
}
|
|
26383
|
+
}
|
|
26384
|
+
return isNumber(dy) && tickTextPos.y ? dy + tickTextPos.y : dy || defValue;
|
|
26385
|
+
});
|
|
26262
26386
|
}
|
|
26263
|
-
|
|
26264
|
-
|
|
26265
|
-
|
|
26266
|
-
|
|
26267
|
-
|
|
26268
|
-
|
|
26269
|
-
|
|
26270
|
-
|
|
26271
|
-
dx = 8 * Math.sin(Math.PI * (rotate / 180)) * (orient === "top" ? -1 : 1);
|
|
26387
|
+
const lineUpdate = tick.select("line");
|
|
26388
|
+
tickEnter.select("line").attr(`${axisPx}2`, innerTickSize * sign);
|
|
26389
|
+
tickEnter.select("text").attr(axisPx, tickLength * sign);
|
|
26390
|
+
ctx.setTickLineTextPosition(lineUpdate, textUpdate, sizeFor1Char);
|
|
26391
|
+
if (params.tickTitle) {
|
|
26392
|
+
const title = textUpdate.select("title");
|
|
26393
|
+
const tickTitle = params.tickTitle;
|
|
26394
|
+
(title.empty() ? textUpdate.append("title") : title).text((index) => tickTitle[Number(index)]);
|
|
26272
26395
|
}
|
|
26273
|
-
|
|
26274
|
-
|
|
26275
|
-
|
|
26276
|
-
|
|
26277
|
-
|
|
26278
|
-
|
|
26279
|
-
|
|
26280
|
-
|
|
26281
|
-
|
|
26396
|
+
if (scale1.bandwidth) {
|
|
26397
|
+
const x = scale1;
|
|
26398
|
+
const dx = x.bandwidth() / 2;
|
|
26399
|
+
scale0 = (d) => x(d) + dx;
|
|
26400
|
+
scale1 = scale0;
|
|
26401
|
+
} else if (scale0.bandwidth) {
|
|
26402
|
+
scale0 = scale1;
|
|
26403
|
+
} else {
|
|
26404
|
+
tickTransform(tickExit, scale1);
|
|
26282
26405
|
}
|
|
26283
|
-
|
|
26284
|
-
|
|
26285
|
-
|
|
26286
|
-
const textUpdate = tick.select("text");
|
|
26287
|
-
tickEnter.select("line").attr(`${axisPx}2`, innerTickSize * sign);
|
|
26288
|
-
tickEnter.select("text").attr(axisPx, tickLength * sign);
|
|
26289
|
-
ctx.setTickLineTextPosition(lineUpdate, textUpdate, sizeFor1Char);
|
|
26290
|
-
if (params.tickTitle) {
|
|
26291
|
-
const title = textUpdate.select("title");
|
|
26292
|
-
(title.empty() ? textUpdate.append("title") : title).text((index) => params.tickTitle[index]);
|
|
26406
|
+
tick = params.owner.state.flowing ? helper.transitionise(tick) : params.owner.$T(tick);
|
|
26407
|
+
tickTransform(tickEnter, scale0);
|
|
26408
|
+
tickTransform(tick.style("opacity", null), scale1);
|
|
26293
26409
|
}
|
|
26294
|
-
if (scale1.bandwidth) {
|
|
26295
|
-
const x = scale1;
|
|
26296
|
-
const dx = x.bandwidth() / 2;
|
|
26297
|
-
scale0 = (d) => x(d) + dx;
|
|
26298
|
-
scale1 = scale0;
|
|
26299
|
-
} else if (scale0.bandwidth) {
|
|
26300
|
-
scale0 = scale1;
|
|
26301
|
-
} else {
|
|
26302
|
-
tickTransform(tickExit, scale1);
|
|
26303
|
-
}
|
|
26304
|
-
tick = params.owner.state.flowing ? helper.transitionise(tick) : params.owner.$T(tick);
|
|
26305
|
-
tickTransform(tickEnter, scale0);
|
|
26306
|
-
tickTransform(tick.style("opacity", null), scale1);
|
|
26307
26410
|
}
|
|
26308
26411
|
});
|
|
26309
26412
|
this.g = $g;
|
|
@@ -26386,7 +26489,7 @@ class AxisRenderer {
|
|
|
26386
26489
|
switch (orient) {
|
|
26387
26490
|
case "bottom":
|
|
26388
26491
|
lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", (d) => this.getTickSize.bind(this)(d) * (tickLineInner ? -1 : 1));
|
|
26389
|
-
textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor",
|
|
26492
|
+
textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", (d, i, { length }) => {
|
|
26390
26493
|
if (!isRotated && i === 0 && (inner === true || inner.first)) {
|
|
26391
26494
|
return "start";
|
|
26392
26495
|
} else if (!isRotated && i === length - 1 && (inner === true || inner.last)) {
|
|
@@ -27882,7 +27985,7 @@ var __pow = Math.pow;
|
|
|
27882
27985
|
const isRotated = config.axis_rotated;
|
|
27883
27986
|
const isMultipleX = $$.isMultipleX();
|
|
27884
27987
|
const xDomain = xScale == null ? void 0 : xScale.domain();
|
|
27885
|
-
const fingerprint = xDomain ? `${xDomain[0]}_${xDomain[1]}_${state.width}_${state.height}_${$$.data.targets.length}_${[...state.hiddenTargetIds].join(",")}` : null;
|
|
27988
|
+
const fingerprint = xDomain ? `${xDomain[0]}_${xDomain[1]}_${state.width}_${state.height}_${$$.data.targets.length}_${state.dataGeneration}_${[...state.hiddenTargetIds].join(",")}` : null;
|
|
27886
27989
|
if (fingerprint && fingerprint === state._eventRectFingerprint) {
|
|
27887
27990
|
return;
|
|
27888
27991
|
}
|
|
@@ -29687,18 +29790,6 @@ var __pow = Math.pow;
|
|
|
29687
29790
|
|
|
29688
29791
|
;// ./src/config/Options/axis/y2.ts
|
|
29689
29792
|
/* harmony default export */ var y2 = ({
|
|
29690
|
-
/**
|
|
29691
|
-
* Set clip-path attribute for y2 axis element
|
|
29692
|
-
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
29693
|
-
* @name axis․y2․clipPath
|
|
29694
|
-
* @memberof Options
|
|
29695
|
-
* @type {boolean}
|
|
29696
|
-
* @default true
|
|
29697
|
-
* @example
|
|
29698
|
-
* // don't set 'clip-path' attribute
|
|
29699
|
-
* clipPath: false
|
|
29700
|
-
*/
|
|
29701
|
-
axis_y2_clipPath: true,
|
|
29702
29793
|
/**
|
|
29703
29794
|
* Show or hide y2 axis.
|
|
29704
29795
|
* - **NOTE**:
|
|
@@ -34605,7 +34696,7 @@ const bb = {
|
|
|
34605
34696
|
* bb.version; // "1.0.0"
|
|
34606
34697
|
* @memberof bb
|
|
34607
34698
|
*/
|
|
34608
|
-
version: "4.0.0
|
|
34699
|
+
version: "4.0.0",
|
|
34609
34700
|
/**
|
|
34610
34701
|
* Generate chart
|
|
34611
34702
|
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|