@bino-bi/bn-template-engine 1.0.0-next.22 → 1.0.0-next.23
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/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/{p-28d5c266.entry.js → p-0a49cf00.entry.js} +1 -1
- package/dist/bn-template-engine/{p-93eaded3.entry.js → p-22b8d044.entry.js} +1 -1
- package/dist/bn-template-engine/{p-e49f9170.entry.js → p-251bb53d.entry.js} +1 -1
- package/dist/bn-template-engine/p-2aed639e.entry.js +1 -0
- package/dist/bn-template-engine/{p-91e5dddf.entry.js → p-4616b879.entry.js} +1 -1
- package/dist/bn-template-engine/{p-445c76cd.entry.js → p-629edcca.entry.js} +1 -1
- package/dist/bn-template-engine/p-686d8e44.entry.js +1 -0
- package/dist/bn-template-engine/{p-a4ea9a79.entry.js → p-68aa61cc.entry.js} +1 -1
- package/dist/bn-template-engine/{p-DwYUTvvI.js → p-B5x8M8OC.js} +1 -1
- package/dist/bn-template-engine/{p-fFtEvsY-.js → p-BGrnfif3.js} +1 -1
- package/dist/bn-template-engine/{p-6lOdN-fB.js → p-BVfLus3u.js} +1 -1
- package/dist/bn-template-engine/{p-CJThzFZm.js → p-BcZ5GQZ8.js} +1 -1
- package/dist/bn-template-engine/{p-CYE0I1Mx.js → p-Bca5V28_.js} +1 -1
- package/dist/bn-template-engine/p-C5UYpZUU.js +2 -0
- package/dist/bn-template-engine/{p-BgIpdpfH.js → p-C7T4DAAW.js} +1 -1
- package/dist/bn-template-engine/p-CDo04UEU.js +1 -0
- package/dist/bn-template-engine/p-CTrNbSXN.js +1 -0
- package/dist/bn-template-engine/{p-C5uvAEKI.js → p-CbciPY-M.js} +1 -1
- package/dist/bn-template-engine/{p-D1SJ10zl.js → p-CuR4S456.js} +1 -1
- package/dist/bn-template-engine/p-DWtTjg0f.js +1 -0
- package/dist/bn-template-engine/{p-eEfqksk-.js → p-DdqXNsKP.js} +1 -1
- package/dist/bn-template-engine/{p-B4JfKvVT.js → p-DtLI_CzV.js} +1 -1
- package/dist/bn-template-engine/{p-D75i_YOP.js → p-UtNHLX1j.js} +1 -1
- package/dist/bn-template-engine/{p-cda4322a.entry.js → p-aecb5de3.entry.js} +1 -1
- package/dist/bn-template-engine/{p-687032d5.entry.js → p-ba43d46e.entry.js} +1 -1
- package/dist/bn-template-engine/{p-f275b9fe.entry.js → p-c476e7bb.entry.js} +1 -1
- package/dist/bn-template-engine/{p-2d3ea756.entry.js → p-d7c670ec.entry.js} +1 -1
- package/dist/bn-template-engine/{p-c3383557.entry.js → p-e4a584a8.entry.js} +1 -1
- package/dist/bn-template-engine/{p-de29986f.entry.js → p-f12fb09b.entry.js} +1 -1
- package/dist/bn-template-engine/p-f9a721bb.entry.js +1 -0
- package/dist/cjs/{AxisConfig-D7CAyPLO.js → AxisConfig-DmP4U3JM.js} +1 -1
- package/dist/cjs/{LabelCollisionManager-DkdQ9Xdg.js → LabelCollisionManager-Cet3WPm0.js} +2 -2
- package/dist/cjs/{Order-IPfAP0q8.js → Order-DlKLywO_.js} +1 -1
- package/dist/cjs/{SVGStyle-BD8jApd4.js → SVGStyle-D78RaNnj.js} +2 -2
- package/dist/cjs/{SVGVariancesStyleGroup-BaWzR951.js → SVGVariancesStyleGroup-XvNAnYYA.js} +1 -1
- package/dist/cjs/{VarianceMeasure-BBWTgv2e.js → VarianceMeasure-BfZLlICl.js} +4 -4
- package/dist/cjs/{XYChartDataRow-BoR0CTfl.js → XYChartDataRow-B0NNOqxB.js} +4 -4
- package/dist/cjs/bn-asset_21.cjs.entry.js +693 -202
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +10 -10
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +9 -9
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +9 -9
- package/dist/cjs/bn-grid.cjs.entry.js +6 -6
- package/dist/cjs/bn-image.cjs.entry.js +6 -6
- package/dist/cjs/bn-internationalization.cjs.entry.js +4 -4
- package/dist/cjs/bn-ruleset.cjs.entry.js +4 -4
- package/dist/cjs/bn-template-engine.cjs.js +2 -2
- package/dist/cjs/bn-template.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +7 -7
- package/dist/cjs/bn-tree.cjs.entry.js +6 -6
- package/dist/cjs/{context-protocol-BBhT9B52.js → context-protocol-DeLmu5s2.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +6 -6
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +6 -6
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +6 -6
- package/dist/cjs/{index-CDKG4xmO.js → index-C1Z9vO7z.js} +61 -19
- package/dist/cjs/{layoutObserver-D8leSb4j.js → layoutObserver-CrzQQGpv.js} +5 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-B6_M_HWH.js → scaling-JAU6IJnR.js} +3 -3
- package/dist/cjs/{withBodyObserver-BKUE_ypL.js → withBodyObserver-DJO98AJ-.js} +2 -2
- package/dist/cjs/{withHasError-Cl2gTQzA.js → withHasError-BdDmiOXM.js} +1 -1
- package/dist/cjs/{withScalingGroup-D5clRvRe.js → withScalingGroup-Bu5gatHT.js} +3 -3
- package/dist/cjs/{withStyled-DuwvaDMp.js → withStyled-50UepUwV.js} +5 -5
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +6 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +73 -23
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +101 -28
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +30 -19
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +107 -15
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +9 -3
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +107 -22
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +36 -0
- package/dist/collection/components/bn-table/bn-table.js +11 -5
- package/dist/collection/components/bn-table/ibcs-table.js +46 -40
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +18 -32
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -5
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +89 -0
- package/dist/collection/utils/autoFit.js +63 -0
- package/dist/collection/utils/constants.js +3 -3
- package/dist/components/autoFit.js +1 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/esm/{AxisConfig-ByIP5J-9.js → AxisConfig-Cjy_RANi.js} +1 -1
- package/dist/esm/{LabelCollisionManager-DaNiDiM9.js → LabelCollisionManager-B_NUM9yq.js} +2 -2
- package/dist/esm/{Order-BQeJE_yi.js → Order-B-aF6Rwn.js} +1 -1
- package/dist/esm/{SVGStyle-BwBlY3Km.js → SVGStyle-8FfAtUF-.js} +2 -2
- package/dist/esm/{SVGVariancesStyleGroup-BpGW4CvN.js → SVGVariancesStyleGroup-DD4mIOjT.js} +1 -1
- package/dist/esm/{VarianceMeasure-CE3N8Bea.js → VarianceMeasure-DLOuIIJ7.js} +4 -4
- package/dist/esm/{XYChartDataRow-DeMI1JKU.js → XYChartDataRow-CKfILBFG.js} +4 -4
- package/dist/esm/bn-asset_21.entry.js +693 -202
- package/dist/esm/bn-chart-bubble.entry.js +10 -10
- package/dist/esm/bn-chart-bullet.entry.js +9 -9
- package/dist/esm/bn-chart-scatter.entry.js +9 -9
- package/dist/esm/bn-grid.entry.js +6 -6
- package/dist/esm/bn-image.entry.js +6 -6
- package/dist/esm/bn-internationalization.entry.js +4 -4
- package/dist/esm/bn-ruleset.entry.js +4 -4
- package/dist/esm/bn-template-engine.js +3 -3
- package/dist/esm/bn-template.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +7 -7
- package/dist/esm/bn-tree.entry.js +6 -6
- package/dist/esm/{context-protocol-d8MHrEo8.js → context-protocol-BoEL0caI.js} +1 -1
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/ibcs-chart-bubble.entry.js +6 -6
- package/dist/esm/ibcs-chart-bullet.entry.js +6 -6
- package/dist/esm/ibcs-chart-scatter.entry.js +6 -6
- package/dist/esm/{index-B_d-jp99.js → index-C5UYpZUU.js} +61 -19
- package/dist/esm/{layoutObserver-DtZb2vdM.js → layoutObserver-cgIXg2sg.js} +5 -5
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{scaling-Bw8XyrFq.js → scaling-CxyNpMQM.js} +3 -3
- package/dist/esm/{withBodyObserver-IokS6fHD.js → withBodyObserver-Cb9ZC5_J.js} +2 -2
- package/dist/esm/{withHasError-DW_vMDUp.js → withHasError-Bh1Viz52.js} +1 -1
- package/dist/esm/{withScalingGroup-CC3UcvC5.js → withScalingGroup-Yv9nGGe1.js} +3 -3
- package/dist/esm/{withStyled-41rsCSM1.js → withStyled-By9Jd-Oy.js} +5 -5
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +14 -3
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +9 -3
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +11 -3
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +17 -0
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +10 -3
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +12 -0
- package/dist/types/components/bn-table/bn-table.d.ts +8 -2
- package/dist/types/components/bn-table/ibcs-table.d.ts +15 -6
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +9 -1
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +51 -0
- package/dist/types/components.d.ts +6 -4
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/dist/types/utils/autoFit.d.ts +79 -0
- package/dist/types/utils/constants.d.ts +3 -3
- package/package.json +1 -1
- package/dist/bn-template-engine/p-2fba7c99.entry.js +0 -1
- package/dist/bn-template-engine/p-7d1083f6.entry.js +0 -1
- package/dist/bn-template-engine/p-B_d-jp99.js +0 -2
- package/dist/bn-template-engine/p-BjBz5cSL.js +0 -1
- package/dist/bn-template-engine/p-C8Q0lsaU.js +0 -1
- package/dist/bn-template-engine/p-Da6p_F4J.js +0 -1
- package/dist/bn-template-engine/p-a8291de2.entry.js +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
4
|
-
var withHasError = require('./withHasError-
|
|
5
|
-
var contextProtocol = require('./context-protocol-
|
|
6
|
-
var withBodyObserver = require('./withBodyObserver-
|
|
7
|
-
var withStyled = require('./withStyled-
|
|
8
|
-
var scaling = require('./scaling-
|
|
9
|
-
var withScalingGroup = require('./withScalingGroup-
|
|
10
|
-
var layoutObserver = require('./layoutObserver-
|
|
11
|
-
var VarianceMeasure = require('./VarianceMeasure-
|
|
12
|
-
var Order = require('./Order-
|
|
13
|
-
var SVGStyle = require('./SVGStyle-
|
|
3
|
+
var index = require('./index-C1Z9vO7z.js');
|
|
4
|
+
var withHasError = require('./withHasError-BdDmiOXM.js');
|
|
5
|
+
var contextProtocol = require('./context-protocol-DeLmu5s2.js');
|
|
6
|
+
var withBodyObserver = require('./withBodyObserver-DJO98AJ-.js');
|
|
7
|
+
var withStyled = require('./withStyled-50UepUwV.js');
|
|
8
|
+
var scaling = require('./scaling-JAU6IJnR.js');
|
|
9
|
+
var withScalingGroup = require('./withScalingGroup-Bu5gatHT.js');
|
|
10
|
+
var layoutObserver = require('./layoutObserver-CrzQQGpv.js');
|
|
11
|
+
var VarianceMeasure = require('./VarianceMeasure-BfZLlICl.js');
|
|
12
|
+
var Order = require('./Order-DlKLywO_.js');
|
|
13
|
+
var SVGStyle = require('./SVGStyle-D78RaNnj.js');
|
|
14
14
|
var sanitizeHtml = require('./sanitizeHtml-LuZr1IMd.js');
|
|
15
|
-
var LabelCollisionManager = require('./LabelCollisionManager-
|
|
16
|
-
var SVGVariancesStyleGroup = require('./SVGVariancesStyleGroup-
|
|
15
|
+
var LabelCollisionManager = require('./LabelCollisionManager-Cet3WPm0.js');
|
|
16
|
+
var SVGVariancesStyleGroup = require('./SVGVariancesStyleGroup-XvNAnYYA.js');
|
|
17
17
|
|
|
18
18
|
const bnAssetCss = () => `:host{display:none}`;
|
|
19
19
|
|
|
@@ -101,7 +101,7 @@ const Card = class {
|
|
|
101
101
|
};
|
|
102
102
|
Card.style = bnCardCss();
|
|
103
103
|
|
|
104
|
-
const bnChartStructureCss$1 = () => `:host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}`;
|
|
104
|
+
const bnChartStructureCss$1 = () => `:host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}`;
|
|
105
105
|
|
|
106
106
|
const Chart$1 = class Chart {
|
|
107
107
|
validateScenario(newValue) {
|
|
@@ -477,18 +477,18 @@ const Chart$1 = class Chart {
|
|
|
477
477
|
const { mode } = scaling.parseScaling(this.scale);
|
|
478
478
|
if (mode !== "auto" && mode !== "empty") {
|
|
479
479
|
this._autoScaleGuard = false;
|
|
480
|
-
this.
|
|
480
|
+
this.checkOverflow();
|
|
481
481
|
return;
|
|
482
482
|
}
|
|
483
483
|
if (this._autoScaleGuard) {
|
|
484
484
|
this._autoScaleGuard = false;
|
|
485
|
-
this.
|
|
485
|
+
this.checkOverflow();
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
488
|
const host = this.element;
|
|
489
489
|
const { height: parentHeight } = scaling.getParentDimensions(host);
|
|
490
490
|
if (parentHeight <= 0) {
|
|
491
|
-
this.
|
|
491
|
+
this.checkOverflow();
|
|
492
492
|
return;
|
|
493
493
|
}
|
|
494
494
|
// Record height so the ResizeObserver callback can tell
|
|
@@ -506,7 +506,7 @@ const Chart$1 = class Chart {
|
|
|
506
506
|
// Content fits. Don't reset to factor 1 — the content only fits
|
|
507
507
|
// BECAUSE of the current factor. Resetting would cause oscillation.
|
|
508
508
|
this.errors.remove("AUTO_scale");
|
|
509
|
-
this.
|
|
509
|
+
this.checkOverflow();
|
|
510
510
|
return;
|
|
511
511
|
}
|
|
512
512
|
// Content overflows. Compute a new factor based on the ratio of
|
|
@@ -516,7 +516,7 @@ const Chart$1 = class Chart {
|
|
|
516
516
|
// SVG charts have non-linear scaling so we use a wider tolerance
|
|
517
517
|
// than tables to avoid oscillation from sub-pixel rounding.
|
|
518
518
|
if (Math.abs(computedFactor - currentFactor) < 0.01) {
|
|
519
|
-
this.
|
|
519
|
+
this.checkOverflow();
|
|
520
520
|
return;
|
|
521
521
|
}
|
|
522
522
|
host.style.setProperty("--bn-font-size", `${baseFontSize * computedFactor}px`);
|
|
@@ -534,7 +534,10 @@ const Chart$1 = class Chart {
|
|
|
534
534
|
index.writeTask(() => {
|
|
535
535
|
this.appliedScaleFactor = computedFactor;
|
|
536
536
|
});
|
|
537
|
-
|
|
537
|
+
// Check with the current (pre-factor) content so overflow is reported
|
|
538
|
+
// even if the scheduled re-render stalls; the follow-up render re-checks
|
|
539
|
+
// in the guard branch and clears any transiently reported overflow.
|
|
540
|
+
this.checkOverflow();
|
|
538
541
|
}
|
|
539
542
|
componentDidLoad() {
|
|
540
543
|
// Observe the parent container for size changes so auto-scaling
|
|
@@ -572,27 +575,74 @@ const Chart$1 = class Chart {
|
|
|
572
575
|
this.layoutObserver = null;
|
|
573
576
|
}
|
|
574
577
|
/**
|
|
575
|
-
*
|
|
576
|
-
*
|
|
578
|
+
* Content width from the rendered SVG width attributes (segments render
|
|
579
|
+
* side by side) — immune to the inner hosts' overflow:hidden clipping:
|
|
580
|
+
* flex items with hidden overflow shrink below their content size, so the
|
|
581
|
+
* host's scrollWidth cannot see the overflow. Falls back to scrollWidth
|
|
582
|
+
* before the inner charts have rendered.
|
|
577
583
|
*/
|
|
578
|
-
|
|
584
|
+
measureContentWidth() {
|
|
585
|
+
var _a;
|
|
586
|
+
const inners = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("ibcs-chart-structure");
|
|
587
|
+
let total = 0;
|
|
588
|
+
let found = false;
|
|
589
|
+
inners === null || inners === void 0 ? void 0 : inners.forEach((inner) => {
|
|
590
|
+
var _a, _b, _c;
|
|
591
|
+
const width = parseFloat((_c = (_b = (_a = inner.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("svg#drawCanvas")) === null || _b === void 0 ? void 0 : _b.getAttribute("width")) !== null && _c !== void 0 ? _c : "");
|
|
592
|
+
if (!Number.isNaN(width)) {
|
|
593
|
+
total += width;
|
|
594
|
+
found = true;
|
|
595
|
+
}
|
|
596
|
+
});
|
|
597
|
+
// scrollWidth additionally sees non-SVG chrome, but is blind to clipped
|
|
598
|
+
// segments (see above) — take the larger of the two measurements.
|
|
599
|
+
// Floor the fractional SVG widths so borderline sub-pixel overhangs are
|
|
600
|
+
// judged with the same integer tolerance as the scroll metrics.
|
|
601
|
+
return found ? Math.max(Math.floor(total), this.element.scrollWidth) : this.element.scrollWidth;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Reports a WARN_overflow item when the rendered chart exceeds its
|
|
605
|
+
* container. Overflow attributable to a fixed scaling attribute is an
|
|
606
|
+
* error (width: unit-scaling / percentage-scaling, height: scale);
|
|
607
|
+
* overflow in fully-auto mode is a warning — auto-fit prevents it by
|
|
608
|
+
* construction, so it only fires when the content cannot fit at any scale.
|
|
609
|
+
*/
|
|
610
|
+
checkOverflow() {
|
|
579
611
|
const errId = "WARN_overflow";
|
|
580
|
-
if (scaling.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind !== "value") {
|
|
581
|
-
// Auto (explicit or fallback) fits the width by construction.
|
|
582
|
-
this.errors.remove(errId);
|
|
583
|
-
return;
|
|
584
|
-
}
|
|
585
612
|
const parent = scaling.getParentDimensions(this.element);
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
else {
|
|
613
|
+
const contentWidth = this.measureContentWidth();
|
|
614
|
+
const contentHeight = this.element.scrollHeight;
|
|
615
|
+
const widthOver = parent.width > 0 && contentWidth > parent.width + 1;
|
|
616
|
+
const heightOver = parent.height > 0 && contentHeight > parent.height + 1;
|
|
617
|
+
if (!widthOver && !heightOver) {
|
|
594
618
|
this.errors.remove(errId);
|
|
619
|
+
return;
|
|
595
620
|
}
|
|
621
|
+
const hasRelativeVariance = this.prepareVariances().some((variance) => variance.startsWith("dr"));
|
|
622
|
+
const fixedUnit = scaling.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
623
|
+
const fixedPercent = hasRelativeVariance && scaling.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
624
|
+
const { mode } = scaling.parseScaling(this.scale);
|
|
625
|
+
const fixedScale = mode !== "auto" && mode !== "empty";
|
|
626
|
+
const fixedAttrs = [];
|
|
627
|
+
if (widthOver && fixedUnit)
|
|
628
|
+
fixedAttrs.push("unit-scaling");
|
|
629
|
+
if (widthOver && fixedPercent)
|
|
630
|
+
fixedAttrs.push("percentage-scaling");
|
|
631
|
+
if (heightOver && fixedScale)
|
|
632
|
+
fixedAttrs.push("scale");
|
|
633
|
+
const dims = [];
|
|
634
|
+
if (widthOver)
|
|
635
|
+
dims.push(`width (${Math.round(contentWidth)}px > ${Math.round(parent.width)}px)`);
|
|
636
|
+
if (heightOver)
|
|
637
|
+
dims.push(`height (${Math.round(contentHeight)}px > ${Math.round(parent.height)}px)`);
|
|
638
|
+
this.errors.addOrReplace({
|
|
639
|
+
id: errId,
|
|
640
|
+
type: fixedAttrs.length > 0 ? "error" : "warning",
|
|
641
|
+
message: `Chart exceeds available ${dims.join(" and ")}. ` +
|
|
642
|
+
(fixedAttrs.length > 0
|
|
643
|
+
? `Adjust ${fixedAttrs.join(" / ")} or set to "auto".`
|
|
644
|
+
: "Content does not fit even at minimum auto scaling; enlarge the container."),
|
|
645
|
+
});
|
|
596
646
|
}
|
|
597
647
|
prepareDimension() {
|
|
598
648
|
const parent = scaling.getParentDimensions(this.element);
|
|
@@ -948,7 +998,7 @@ const Chart$1 = class Chart {
|
|
|
948
998
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
949
999
|
}
|
|
950
1000
|
const fontStyles = this.getFontStyles();
|
|
951
|
-
return (index.h(index.Host, { key: '
|
|
1001
|
+
return (index.h(index.Host, { key: '68eb9fbcc6fb712dd06729f13a33c61c2c5c90e6', style: fontStyles }, index.h("div", { key: '9d7c49c1d5e2940dd1a4381a90e08912fef77f33', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
952
1002
|
}
|
|
953
1003
|
get element() { return index.getElement(this); }
|
|
954
1004
|
static get watchers() { return {
|
|
@@ -1536,32 +1586,111 @@ const Chart = class {
|
|
|
1536
1586
|
this.validateStack(this.stack);
|
|
1537
1587
|
this.validateScaling(this.scale);
|
|
1538
1588
|
}
|
|
1589
|
+
/**
|
|
1590
|
+
* Content width from the rendered SVG width attributes (segments stack
|
|
1591
|
+
* vertically, so the widest one counts) — immune to overflow:hidden
|
|
1592
|
+
* clipping along the ancestor chain. Falls back to scrollWidth before the
|
|
1593
|
+
* inner charts have rendered.
|
|
1594
|
+
*/
|
|
1595
|
+
measureContentWidth() {
|
|
1596
|
+
var _a;
|
|
1597
|
+
const inners = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("ibcs-chart-time");
|
|
1598
|
+
let widest = 0;
|
|
1599
|
+
let found = false;
|
|
1600
|
+
inners === null || inners === void 0 ? void 0 : inners.forEach((inner) => {
|
|
1601
|
+
var _a, _b, _c;
|
|
1602
|
+
const width = parseFloat((_c = (_b = (_a = inner.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("svg#drawCanvas")) === null || _b === void 0 ? void 0 : _b.getAttribute("width")) !== null && _c !== void 0 ? _c : "");
|
|
1603
|
+
if (!Number.isNaN(width)) {
|
|
1604
|
+
widest = Math.max(widest, width);
|
|
1605
|
+
found = true;
|
|
1606
|
+
}
|
|
1607
|
+
});
|
|
1608
|
+
// scrollWidth additionally sees non-SVG chrome, so take the larger.
|
|
1609
|
+
// Floor the fractional SVG width so borderline sub-pixel overhangs are
|
|
1610
|
+
// judged with the same integer tolerance as the scroll metrics.
|
|
1611
|
+
return found ? Math.max(Math.floor(widest), this.element.scrollWidth) : this.element.scrollWidth;
|
|
1612
|
+
}
|
|
1613
|
+
/** Content height as the sum of the vertically stacked segment SVGs. */
|
|
1614
|
+
measureContentHeight() {
|
|
1615
|
+
var _a;
|
|
1616
|
+
const inners = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("ibcs-chart-time");
|
|
1617
|
+
let total = 0;
|
|
1618
|
+
let found = false;
|
|
1619
|
+
inners === null || inners === void 0 ? void 0 : inners.forEach((inner) => {
|
|
1620
|
+
var _a, _b, _c;
|
|
1621
|
+
const height = parseFloat((_c = (_b = (_a = inner.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector("svg#drawCanvas")) === null || _b === void 0 ? void 0 : _b.getAttribute("height")) !== null && _c !== void 0 ? _c : "");
|
|
1622
|
+
if (!Number.isNaN(height)) {
|
|
1623
|
+
total += height;
|
|
1624
|
+
found = true;
|
|
1625
|
+
}
|
|
1626
|
+
});
|
|
1627
|
+
// scrollHeight additionally sees non-SVG chrome (e.g. the footer).
|
|
1628
|
+
// Floor the fractional SVG heights so borderline sub-pixel overhangs are
|
|
1629
|
+
// judged with the same integer tolerance as the scroll metrics.
|
|
1630
|
+
return found ? Math.max(Math.floor(total), this.element.scrollHeight) : this.element.scrollHeight;
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Reports a WARN_overflow item when the rendered chart exceeds its
|
|
1634
|
+
* container. Overflow attributable to a fixed scaling attribute is an
|
|
1635
|
+
* error (height: unit-scaling / percentage-scaling, width: scale);
|
|
1636
|
+
* overflow in fully-auto mode is a warning — auto-fit prevents it by
|
|
1637
|
+
* construction, so it only fires when the content cannot fit at any scale.
|
|
1638
|
+
*/
|
|
1639
|
+
checkOverflow() {
|
|
1640
|
+
const errId = "WARN_overflow";
|
|
1641
|
+
const parent = scaling.getParentDimensions(this.element);
|
|
1642
|
+
const contentWidth = this.measureContentWidth();
|
|
1643
|
+
const contentHeight = this.measureContentHeight();
|
|
1644
|
+
const widthOver = parent.width > 0 && contentWidth > parent.width + 1;
|
|
1645
|
+
const heightOver = parent.height > 0 && contentHeight > parent.height + 1;
|
|
1646
|
+
if (!widthOver && !heightOver) {
|
|
1647
|
+
this.errors.remove(errId);
|
|
1648
|
+
return;
|
|
1649
|
+
}
|
|
1650
|
+
const hasRelativeVariance = this.prepareVariances().some((variance) => variance.startsWith("dr"));
|
|
1651
|
+
const fixedUnit = scaling.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
1652
|
+
const fixedPercent = hasRelativeVariance && scaling.resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
1653
|
+
const { mode } = scaling.parseScaling(this.scale);
|
|
1654
|
+
const fixedScale = mode !== "auto" && mode !== "empty";
|
|
1655
|
+
const fixedAttrs = [];
|
|
1656
|
+
if (heightOver && fixedUnit)
|
|
1657
|
+
fixedAttrs.push("unit-scaling");
|
|
1658
|
+
if (heightOver && fixedPercent)
|
|
1659
|
+
fixedAttrs.push("percentage-scaling");
|
|
1660
|
+
if (widthOver && fixedScale)
|
|
1661
|
+
fixedAttrs.push("scale");
|
|
1662
|
+
const dims = [];
|
|
1663
|
+
if (widthOver)
|
|
1664
|
+
dims.push(`width (${Math.round(contentWidth)}px > ${Math.round(parent.width)}px)`);
|
|
1665
|
+
if (heightOver)
|
|
1666
|
+
dims.push(`height (${Math.round(contentHeight)}px > ${Math.round(parent.height)}px)`);
|
|
1667
|
+
this.errors.addOrReplace({
|
|
1668
|
+
id: errId,
|
|
1669
|
+
type: fixedAttrs.length > 0 ? "error" : "warning",
|
|
1670
|
+
message: `Chart exceeds available ${dims.join(" and ")}. ` +
|
|
1671
|
+
(fixedAttrs.length > 0
|
|
1672
|
+
? `Adjust ${fixedAttrs.join(" / ")} or set to "auto".`
|
|
1673
|
+
: "Content does not fit even at minimum auto scaling; enlarge the container."),
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1539
1676
|
componentDidRender() {
|
|
1540
1677
|
const { mode } = scaling.parseScaling(this.scale);
|
|
1541
1678
|
if (mode !== "auto" && mode !== "empty") {
|
|
1542
1679
|
this._autoScaleGuard = false;
|
|
1543
|
-
|
|
1544
|
-
const errId = "WARN_overflow";
|
|
1545
|
-
if (parent.width > 0 && this.element.scrollWidth > parent.width + 1) {
|
|
1546
|
-
this.errors.addOrReplace({
|
|
1547
|
-
id: errId,
|
|
1548
|
-
type: "warning",
|
|
1549
|
-
message: "Chart exceeds available space and will be cut off. Check unit-scaling value.",
|
|
1550
|
-
});
|
|
1551
|
-
}
|
|
1552
|
-
else {
|
|
1553
|
-
this.errors.remove(errId);
|
|
1554
|
-
}
|
|
1680
|
+
this.checkOverflow();
|
|
1555
1681
|
return;
|
|
1556
1682
|
}
|
|
1557
1683
|
if (this._autoScaleGuard) {
|
|
1558
1684
|
this._autoScaleGuard = false;
|
|
1685
|
+
this.checkOverflow();
|
|
1559
1686
|
return;
|
|
1560
1687
|
}
|
|
1561
1688
|
const host = this.element;
|
|
1562
1689
|
const { width: parentWidth } = scaling.getParentDimensions(host);
|
|
1563
|
-
if (parentWidth <= 0)
|
|
1690
|
+
if (parentWidth <= 0) {
|
|
1691
|
+
this.checkOverflow();
|
|
1564
1692
|
return;
|
|
1693
|
+
}
|
|
1565
1694
|
// Keep observer tracking in sync so the observer callback does not
|
|
1566
1695
|
// trigger spurious forceUpdate calls with stale threshold values.
|
|
1567
1696
|
this._lastObservedWidth = parentWidth;
|
|
@@ -1572,6 +1701,7 @@ const Chart = class {
|
|
|
1572
1701
|
// the content only fits BECAUSE of the current factor.
|
|
1573
1702
|
if (currentWidth <= parentWidth + 1) {
|
|
1574
1703
|
this.errors.remove("AUTO_scale");
|
|
1704
|
+
this.checkOverflow();
|
|
1575
1705
|
return;
|
|
1576
1706
|
}
|
|
1577
1707
|
// Content overflows. Compute a new factor based on the ratio of
|
|
@@ -1579,6 +1709,8 @@ const Chart = class {
|
|
|
1579
1709
|
const computedFactor = Math.max(0.3, (currentFactor * (parentWidth - 1)) / currentWidth);
|
|
1580
1710
|
// Only apply if the change is significant (> 1% of current factor).
|
|
1581
1711
|
if (Math.abs(computedFactor - currentFactor) < 0.01) {
|
|
1712
|
+
// Converged (possibly at the 0.3 floor) but still overflowing — report it.
|
|
1713
|
+
this.checkOverflow();
|
|
1582
1714
|
return;
|
|
1583
1715
|
}
|
|
1584
1716
|
host.style.setProperty("--bn-font-size", `${baseFontSize * computedFactor}px`);
|
|
@@ -1596,6 +1728,10 @@ const Chart = class {
|
|
|
1596
1728
|
index.writeTask(() => {
|
|
1597
1729
|
this.appliedScaleFactor = computedFactor;
|
|
1598
1730
|
});
|
|
1731
|
+
// Check with the current (pre-factor) content so overflow is reported
|
|
1732
|
+
// even if the scheduled re-render stalls; the follow-up render re-checks
|
|
1733
|
+
// in the guard branch and clears any transiently reported overflow.
|
|
1734
|
+
this.checkOverflow();
|
|
1599
1735
|
}
|
|
1600
1736
|
componentDidLoad() {
|
|
1601
1737
|
// Watch for size changes (window resize, card relayout).
|
|
@@ -1669,7 +1805,13 @@ const Chart = class {
|
|
|
1669
1805
|
const variancesList = this.prepareVariances();
|
|
1670
1806
|
this.canvasWidthSegmented = parent.width / (scenariosList.length + variancesList.length || 1);
|
|
1671
1807
|
this._lastAppliedHeight = parent.height;
|
|
1672
|
-
|
|
1808
|
+
// The base chart and each variance render as vertically stacked segments
|
|
1809
|
+
// (see render()), so each one may only claim its share of the height.
|
|
1810
|
+
// The measure-scale footer (first segment only) renders below its SVG:
|
|
1811
|
+
// reserve roughly one em for it so the fitted charts leave it room.
|
|
1812
|
+
const segmentCount = 1 + variancesList.length;
|
|
1813
|
+
const footerAllowance = this.showMeasureScale === "true" ? this.getEffectiveFontPx() : 0;
|
|
1814
|
+
return { width: this.canvasWidthSegmented, height: Math.max(0, parent.height - footerAllowance) / segmentCount };
|
|
1673
1815
|
}
|
|
1674
1816
|
prepareScenarios() {
|
|
1675
1817
|
var _a, _b, _c, _d;
|
|
@@ -2084,7 +2226,7 @@ const Chart = class {
|
|
|
2084
2226
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
2085
2227
|
}
|
|
2086
2228
|
const fontStyles = this.getFontStyles();
|
|
2087
|
-
return (index.h(index.Host, { key: '
|
|
2229
|
+
return (index.h(index.Host, { key: 'aff5ffed56838af70ca1525204497a708194012e', style: fontStyles }, index.h("div", { key: 'a9e0699c0fdbff19efe787e438ddf2921fac35a4', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
2088
2230
|
}
|
|
2089
2231
|
get element() { return index.getElement(this); }
|
|
2090
2232
|
static get watchers() { return {
|
|
@@ -4383,7 +4525,10 @@ const Table$1 = class Table {
|
|
|
4383
4525
|
*/
|
|
4384
4526
|
this.measureUnit = "";
|
|
4385
4527
|
/**
|
|
4386
|
-
* Set width of bar chart columns
|
|
4528
|
+
* Set the total width of bar chart columns, in em of the table font — the same
|
|
4529
|
+
* unit and vocabulary as ```categoryWidth```, so ```bar-column-width="w15"```
|
|
4530
|
+
* renders exactly as wide as ```category-width="w15"```. The bar/pin drawing
|
|
4531
|
+
* area is that width minus the value-label gutters.
|
|
4387
4532
|
* <br /><br />
|
|
4388
4533
|
* values:<br />
|
|
4389
4534
|
* ``` w5 // w10 // w15 // w20 // w25 // w30 // w40 // w60 // w80 // w100 ```
|
|
@@ -4576,10 +4721,13 @@ const Table$1 = class Table {
|
|
|
4576
4721
|
*/
|
|
4577
4722
|
this.dataFormatDigitsPercent = 2;
|
|
4578
4723
|
/**
|
|
4579
|
-
* Set width of category column. <br />
|
|
4724
|
+
* Set width of category column, in em of the table font. <br />
|
|
4580
4725
|
* If INF is selected the columns scaling to the min space they need
|
|
4581
4726
|
* seperatly.
|
|
4582
4727
|
* <br /><br />
|
|
4728
|
+
* The column is fixed at this width; a category label too long to fit is
|
|
4729
|
+
* truncated with an ellipsis.
|
|
4730
|
+
* <br /><br />
|
|
4583
4731
|
* values:<br />
|
|
4584
4732
|
* ``` w5 // w10 // w15 // w20 // w25 // w50 // inf ```
|
|
4585
4733
|
*/
|
|
@@ -5503,7 +5651,7 @@ const Table$1 = class Table {
|
|
|
5503
5651
|
render() {
|
|
5504
5652
|
const fontStyles = this.getFontStyles();
|
|
5505
5653
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
5506
|
-
return (index.h(index.Host, { key: '
|
|
5654
|
+
return (index.h(index.Host, { key: '7960f554ac93c0fb6a09cf47f886827fff1aea84', style: fontStyles }, index.h("div", { key: 'e9f328144ab89bbde8c47111f7ce7de7a6c882db' }, index.h("ibcs-table", { key: 'a06695fad28dc30967784006c151abd47d2efd77', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
|
|
5507
5655
|
}
|
|
5508
5656
|
get element() { return index.getElement(this); }
|
|
5509
5657
|
static get watchers() { return {
|
|
@@ -7871,6 +8019,70 @@ let ScenarioFactory$1 = class ScenarioFactory {
|
|
|
7871
8019
|
}
|
|
7872
8020
|
};
|
|
7873
8021
|
|
|
8022
|
+
/**
|
|
8023
|
+
* Pure math for the chart auto-fit loops (ibcs-chart-structure fits width,
|
|
8024
|
+
* ibcs-chart-time fits height). Kept free of chart/svg.js imports so it can
|
|
8025
|
+
* be unit-tested under mock-doc (which lacks getBBox).
|
|
8026
|
+
*
|
|
8027
|
+
* Model: a chart's size along its fit axis is affine in the pixel scales,
|
|
8028
|
+
* measured = fixed + unitExtent * pixelPerUnit + pctExtent * pixelPerPercentage
|
|
8029
|
+
* where the extents are the total bar lengths in data units (positive plus
|
|
8030
|
+
* negative side of the axis). The chart classes report their extents via
|
|
8031
|
+
* getUnitBarExtent()/getPercentBarExtent(); {@link solveAutoFitStep} solves
|
|
8032
|
+
* the model for the target size against a fresh measurement, so repeated
|
|
8033
|
+
* steps converge even when clamped label widths flip between passes.
|
|
8034
|
+
*/
|
|
8035
|
+
/** Lower bound for auto-fitted pixelPerUnit / pixelPerPercentage values. */
|
|
8036
|
+
const MIN_PIXEL_SCALE = 0.001;
|
|
8037
|
+
/**
|
|
8038
|
+
* Total bar extent (in data units) that scales linearly with pixelPerUnit.
|
|
8039
|
+
* Counts BOTH sides of the axis — a chart with values -13..+12 spans 25
|
|
8040
|
+
* units, not 12 (fitting only the positive side is how charts used to
|
|
8041
|
+
* overshoot their container).
|
|
8042
|
+
*/
|
|
8043
|
+
function computeUnitBarExtent(inputs) {
|
|
8044
|
+
if (inputs.fixedDomain != null) {
|
|
8045
|
+
return Math.max(0, inputs.fixedDomain);
|
|
8046
|
+
}
|
|
8047
|
+
if (inputs.relativeVariance) {
|
|
8048
|
+
return 0; // relative variance bars scale with pixelPerPercentage instead
|
|
8049
|
+
}
|
|
8050
|
+
return Math.max(0, inputs.maxPositive) + Math.abs(Math.min(0, inputs.minNegative));
|
|
8051
|
+
}
|
|
8052
|
+
/**
|
|
8053
|
+
* Total bar extent (in fraction units) that scales linearly with
|
|
8054
|
+
* pixelPerPercentage. Only relative variances use it; each side is clamped
|
|
8055
|
+
* because extreme pins render as fixed-size arrows instead of longer bars.
|
|
8056
|
+
*/
|
|
8057
|
+
function computePercentBarExtent(inputs) {
|
|
8058
|
+
var _a;
|
|
8059
|
+
if (!inputs.relativeVariance) {
|
|
8060
|
+
return 0;
|
|
8061
|
+
}
|
|
8062
|
+
const clamp = (_a = inputs.sideClamp) !== null && _a !== void 0 ? _a : 1.45;
|
|
8063
|
+
const positive = Math.min(clamp, Math.max(0, inputs.maxPositive));
|
|
8064
|
+
const negative = Math.min(clamp, Math.abs(Math.min(0, inputs.minNegative)));
|
|
8065
|
+
return positive + negative;
|
|
8066
|
+
}
|
|
8067
|
+
/**
|
|
8068
|
+
* Solves the affine size model for the target and returns corrected scale
|
|
8069
|
+
* values (floored at {@link MIN_PIXEL_SCALE}). Returns an empty object when
|
|
8070
|
+
* nothing scales with the solved values (both extents 0) — callers fall back
|
|
8071
|
+
* to a ratio heuristic. Only the quantities whose extent is > 0 are returned.
|
|
8072
|
+
*/
|
|
8073
|
+
function solveAutoFitStep(inputs) {
|
|
8074
|
+
const divisor = inputs.unitExtent + inputs.pctExtent;
|
|
8075
|
+
if (divisor <= 0) {
|
|
8076
|
+
return {};
|
|
8077
|
+
}
|
|
8078
|
+
const fixed = inputs.measured - inputs.unitExtent * inputs.currentPpu - inputs.pctExtent * inputs.currentPpp;
|
|
8079
|
+
const solved = Math.max(MIN_PIXEL_SCALE, (inputs.target - fixed) / divisor);
|
|
8080
|
+
return {
|
|
8081
|
+
ppu: inputs.unitExtent > 0 ? solved : undefined,
|
|
8082
|
+
ppp: inputs.pctExtent > 0 ? solved : undefined,
|
|
8083
|
+
};
|
|
8084
|
+
}
|
|
8085
|
+
|
|
7874
8086
|
/**
|
|
7875
8087
|
* Orchestrates the full rendering pipeline for an IBCS structure (categorical) chart.
|
|
7876
8088
|
*
|
|
@@ -8071,28 +8283,38 @@ class StructureChart {
|
|
|
8071
8283
|
}
|
|
8072
8284
|
}
|
|
8073
8285
|
/**
|
|
8074
|
-
*
|
|
8075
|
-
*
|
|
8286
|
+
* Total bar extent (data units) proportional to pixelPerUnit, covering
|
|
8287
|
+
* BOTH sides of the axis (left side scales with negative values, right
|
|
8288
|
+
* side with positive ones). Used by autoFitScaling to separate fixed
|
|
8289
|
+
* from variable width components.
|
|
8076
8290
|
*/
|
|
8077
|
-
|
|
8291
|
+
getUnitBarExtent() {
|
|
8078
8292
|
var _a, _b;
|
|
8079
|
-
|
|
8080
|
-
if (this.stackConfig != null && this.highestStackedTotal > 0) {
|
|
8081
|
-
if (this.stackConfig.mode === VarianceMeasure.StackMode.RELATIVE) {
|
|
8082
|
-
return 1;
|
|
8083
|
-
}
|
|
8084
|
-
return this.highestStackedTotal;
|
|
8085
|
-
}
|
|
8086
|
-
// Non-stacked: bar extent = highestDataPointValue * ppu
|
|
8293
|
+
const stacked = this.stackConfig != null && this.highestStackedTotal > 0;
|
|
8087
8294
|
const vt = this.getVarianceType();
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8295
|
+
const isVariance = vt !== VarianceType$1.NONE;
|
|
8296
|
+
const highest = isVariance ? this.highestVarianceDataPointValue : this.highestDataPointValue;
|
|
8297
|
+
const smallest = isVariance ? this.smallestVarianceDataPointValue : this.smallestDataPointValue;
|
|
8298
|
+
return computeUnitBarExtent({
|
|
8299
|
+
// Relative stacks span exactly 1 * ppu; absolute stacks the max row total
|
|
8300
|
+
fixedDomain: stacked ? (this.stackConfig.mode === VarianceMeasure.StackMode.RELATIVE ? 1 : this.highestStackedTotal) : undefined,
|
|
8301
|
+
relativeVariance: vt === VarianceType$1.RELATIVE,
|
|
8302
|
+
maxPositive: (_a = highest === null || highest === void 0 ? void 0 : highest.value) !== null && _a !== void 0 ? _a : 0,
|
|
8303
|
+
minNegative: (_b = smallest === null || smallest === void 0 ? void 0 : smallest.value) !== null && _b !== void 0 ? _b : 0,
|
|
8304
|
+
});
|
|
8305
|
+
}
|
|
8306
|
+
/**
|
|
8307
|
+
* Total bar extent (fraction units) proportional to pixelPerPercentage.
|
|
8308
|
+
* Only relative variances scale with it; each side clamps at +/-145%
|
|
8309
|
+
* because clipped needles render as fixed-size arrows.
|
|
8310
|
+
*/
|
|
8311
|
+
getPercentBarExtent() {
|
|
8312
|
+
var _a, _b, _c, _d;
|
|
8313
|
+
return computePercentBarExtent({
|
|
8314
|
+
relativeVariance: this.getVarianceType() === VarianceType$1.RELATIVE,
|
|
8315
|
+
maxPositive: (_b = (_a = this.highestVarianceDataPointValue) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0,
|
|
8316
|
+
minNegative: (_d = (_c = this.smallestVarianceDataPointValue) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 0,
|
|
8317
|
+
});
|
|
8096
8318
|
}
|
|
8097
8319
|
getAllocatedCanvasWidth() {
|
|
8098
8320
|
//let columnLabelWidth = this.calculateCategoryWidth();
|
|
@@ -8983,7 +9205,7 @@ class DataFormatDigitsAdapter {
|
|
|
8983
9205
|
}
|
|
8984
9206
|
}
|
|
8985
9207
|
|
|
8986
|
-
const bnChartStructureCss = () => `:host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}`;
|
|
9208
|
+
const bnChartStructureCss = () => `:host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}svg#drawCanvas{display:block}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}`;
|
|
8987
9209
|
|
|
8988
9210
|
const IbcsChartStructure = class {
|
|
8989
9211
|
constructor(hostRef) {
|
|
@@ -9036,8 +9258,14 @@ const IbcsChartStructure = class {
|
|
|
9036
9258
|
const styles = this.prepareStyle();
|
|
9037
9259
|
this.chart = new StructureChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
|
|
9038
9260
|
this.chart.setI18n(this.i18n);
|
|
9261
|
+
// The broken-bar overdrive exists to absorb MANUAL scaling overflow.
|
|
9262
|
+
// autoFitScaling mutates config.pixelPerUnit to the solved value, so
|
|
9263
|
+
// remember auto mode beforehand and skip the overdrive for it — the
|
|
9264
|
+
// fitted chart fits by construction, and the overdrive's rough overhead
|
|
9265
|
+
// estimate would falsely re-engage on it.
|
|
9266
|
+
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
9039
9267
|
this.autoFitScaling(config, styles);
|
|
9040
|
-
this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
|
|
9268
|
+
this.chart.setAvailableWidth(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
|
|
9041
9269
|
this.pattern = new CustomPattern$1(this.chart.styles);
|
|
9042
9270
|
this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
|
|
9043
9271
|
}
|
|
@@ -9052,16 +9280,24 @@ const IbcsChartStructure = class {
|
|
|
9052
9280
|
this.chart.setStyles(styles);
|
|
9053
9281
|
this.chart.setRuleSet(new SVGStyle.IBCSRuleSet(this.ruleSetConfig));
|
|
9054
9282
|
this.chart.setConfig(config);
|
|
9283
|
+
// See componentWillLoad: no broken-bar overdrive for auto-fitted scaling
|
|
9284
|
+
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
9055
9285
|
this.autoFitScaling(config, styles);
|
|
9056
|
-
this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
|
|
9286
|
+
this.chart.setAvailableWidth(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
|
|
9057
9287
|
this.pattern = new CustomPattern$1(this.chart.styles);
|
|
9058
9288
|
this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
|
|
9059
9289
|
}
|
|
9060
9290
|
/**
|
|
9061
|
-
*
|
|
9062
|
-
* When either is 0 (auto mode), renders a measurement pass at 1,
|
|
9063
|
-
* computes the ratio to fit the available width, and rebuilds.
|
|
9291
|
+
* Auto-fit for pixelPerUnit and/or pixelPerPercentage (0 = auto mode).
|
|
9064
9292
|
* Structure charts grow horizontally, so we fit to width.
|
|
9293
|
+
*
|
|
9294
|
+
* The chart width is affine in the pixel scales (width = fixed labels +
|
|
9295
|
+
* bar extent × scale), but label clamps flip between passes, so a single
|
|
9296
|
+
* analytic solve is not enough: measure at 1, solve, then verify against
|
|
9297
|
+
* fresh measurements and re-solve until the chart fits. The loop never
|
|
9298
|
+
* ends on an overshoot — the last fitting values are restored, or when
|
|
9299
|
+
* even the minimum scale cannot fit (labels alone exceed the container)
|
|
9300
|
+
* the values are floored and the wrapper reports the overflow.
|
|
9065
9301
|
* Explicit (> 0) values are never overridden.
|
|
9066
9302
|
*/
|
|
9067
9303
|
autoFitScaling(config, styles) {
|
|
@@ -9080,49 +9316,107 @@ const IbcsChartStructure = class {
|
|
|
9080
9316
|
};
|
|
9081
9317
|
const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
|
|
9082
9318
|
const db = this.getDb();
|
|
9319
|
+
const rebuild = () => {
|
|
9320
|
+
this.chart = new StructureChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
|
|
9321
|
+
this.chart.setI18n(this.i18n);
|
|
9322
|
+
};
|
|
9323
|
+
// toString() runs draw(), which finalizes positions — an undrawn chart
|
|
9324
|
+
// reports a stale allocated width.
|
|
9325
|
+
const measure = () => {
|
|
9326
|
+
this.chart.toString();
|
|
9327
|
+
return this.chart.getAllocatedCanvasWidth();
|
|
9328
|
+
};
|
|
9083
9329
|
if (!targetWidth || targetWidth <= 0) {
|
|
9084
9330
|
if (autoUnit)
|
|
9085
9331
|
config.pixelPerUnit = 1;
|
|
9086
9332
|
if (autoPercent)
|
|
9087
9333
|
config.pixelPerPercentage = 50;
|
|
9088
|
-
|
|
9089
|
-
this.chart.setI18n(this.i18n);
|
|
9334
|
+
rebuild();
|
|
9090
9335
|
reportResolved();
|
|
9091
9336
|
return;
|
|
9092
9337
|
}
|
|
9093
|
-
//
|
|
9338
|
+
// Measurement pass: render the auto quantities at 1
|
|
9094
9339
|
if (autoUnit)
|
|
9095
9340
|
config.pixelPerUnit = 1;
|
|
9096
9341
|
if (autoPercent)
|
|
9097
9342
|
config.pixelPerPercentage = 1;
|
|
9098
|
-
|
|
9099
|
-
|
|
9100
|
-
|
|
9101
|
-
const svgWidth = this.chart.getAllocatedCanvasWidth();
|
|
9102
|
-
if (svgWidth <= 0) {
|
|
9343
|
+
rebuild();
|
|
9344
|
+
let width = measure();
|
|
9345
|
+
if (width <= 0) {
|
|
9103
9346
|
reportResolved();
|
|
9104
9347
|
return;
|
|
9105
9348
|
}
|
|
9106
|
-
//
|
|
9107
|
-
//
|
|
9108
|
-
|
|
9109
|
-
const
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
9349
|
+
// Fallback for auto quantities nothing scales with (no bar extent):
|
|
9350
|
+
// plain ratio against the measurement pass, as before.
|
|
9351
|
+
const ratioFallback = Math.max(MIN_PIXEL_SCALE, (targetWidth * 0.9) / width);
|
|
9352
|
+
const EPS = 0.5;
|
|
9353
|
+
const MAX_CORRECTIONS = 3;
|
|
9354
|
+
let solvedUnit = false;
|
|
9355
|
+
let solvedPercent = false;
|
|
9356
|
+
let fitting = null;
|
|
9357
|
+
for (let iteration = 0; iteration <= MAX_CORRECTIONS; iteration++) {
|
|
9358
|
+
const step = solveAutoFitStep({
|
|
9359
|
+
target: targetWidth,
|
|
9360
|
+
measured: width,
|
|
9361
|
+
unitExtent: autoUnit ? this.chart.getUnitBarExtent() : 0,
|
|
9362
|
+
pctExtent: autoPercent ? this.chart.getPercentBarExtent() : 0,
|
|
9363
|
+
currentPpu: config.pixelPerUnit,
|
|
9364
|
+
currentPpp: config.pixelPerPercentage,
|
|
9365
|
+
});
|
|
9366
|
+
if (step.ppu === undefined && step.ppp === undefined) {
|
|
9367
|
+
break; // nothing scales with the auto values — fallback below
|
|
9368
|
+
}
|
|
9369
|
+
if (autoUnit && step.ppu !== undefined) {
|
|
9370
|
+
config.pixelPerUnit = step.ppu;
|
|
9371
|
+
solvedUnit = true;
|
|
9372
|
+
}
|
|
9373
|
+
if (autoPercent && step.ppp !== undefined) {
|
|
9374
|
+
config.pixelPerPercentage = step.ppp;
|
|
9375
|
+
solvedPercent = true;
|
|
9376
|
+
}
|
|
9377
|
+
rebuild();
|
|
9378
|
+
width = measure();
|
|
9379
|
+
if (width <= targetWidth + EPS) {
|
|
9380
|
+
fitting = { ppu: config.pixelPerUnit, ppp: config.pixelPerPercentage };
|
|
9381
|
+
if (width >= targetWidth * 0.98) {
|
|
9382
|
+
break; // fits and tight — done
|
|
9383
|
+
}
|
|
9384
|
+
// else a released label clamp left slack — loop once more to grow into it
|
|
9385
|
+
}
|
|
9386
|
+
}
|
|
9387
|
+
// Auto quantities the solver never touched get the ratio fallback
|
|
9388
|
+
let needsRebuild = false;
|
|
9389
|
+
if (autoUnit && !solvedUnit) {
|
|
9390
|
+
config.pixelPerUnit = ratioFallback;
|
|
9391
|
+
needsRebuild = true;
|
|
9392
|
+
}
|
|
9393
|
+
if (autoPercent && !solvedPercent) {
|
|
9394
|
+
config.pixelPerPercentage = ratioFallback;
|
|
9395
|
+
needsRebuild = true;
|
|
9396
|
+
}
|
|
9397
|
+
// Never end on an overshoot
|
|
9398
|
+
if (width > targetWidth + EPS) {
|
|
9399
|
+
if (fitting) {
|
|
9400
|
+
// Restore the last values that fit (fallback quantities have no extent)
|
|
9401
|
+
if (solvedUnit)
|
|
9402
|
+
config.pixelPerUnit = fitting.ppu;
|
|
9403
|
+
if (solvedPercent)
|
|
9404
|
+
config.pixelPerPercentage = fitting.ppp;
|
|
9114
9405
|
}
|
|
9115
9406
|
else {
|
|
9116
|
-
|
|
9407
|
+
// Even the solved minimum overshoots (labels alone exceed the
|
|
9408
|
+
// container) — shrink proportionally; the wrapper reports this.
|
|
9409
|
+
const shrink = targetWidth / width;
|
|
9410
|
+
if (autoUnit)
|
|
9411
|
+
config.pixelPerUnit = Math.max(MIN_PIXEL_SCALE, config.pixelPerUnit * shrink);
|
|
9412
|
+
if (autoPercent)
|
|
9413
|
+
config.pixelPerPercentage = Math.max(MIN_PIXEL_SCALE, config.pixelPerPercentage * shrink);
|
|
9117
9414
|
}
|
|
9415
|
+
needsRebuild = true;
|
|
9118
9416
|
}
|
|
9119
|
-
if (
|
|
9120
|
-
|
|
9121
|
-
config.pixelPerPercentage = (targetWidth * 0.9) / svgWidth;
|
|
9417
|
+
if (needsRebuild) {
|
|
9418
|
+
rebuild();
|
|
9122
9419
|
}
|
|
9123
|
-
// Second pass with the corrected scaling
|
|
9124
|
-
this.chart = new StructureChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
|
|
9125
|
-
this.chart.setI18n(this.i18n);
|
|
9126
9420
|
reportResolved();
|
|
9127
9421
|
}
|
|
9128
9422
|
async componentWillRender() {
|
|
@@ -11546,6 +11840,41 @@ class TimeChart {
|
|
|
11546
11840
|
: this.scenariosArea.height;
|
|
11547
11841
|
return Math.max(analyticalHeight, bboxHeight);
|
|
11548
11842
|
}
|
|
11843
|
+
/**
|
|
11844
|
+
* Total column extent (data units) proportional to pixelPerUnit, covering
|
|
11845
|
+
* both sides of the axis (negative columns extend below it). Mirrors the
|
|
11846
|
+
* DataPoints getAllocatedCanvasHeight allocates with; used by autoFitScaling
|
|
11847
|
+
* to separate fixed from variable height components.
|
|
11848
|
+
*/
|
|
11849
|
+
getUnitBarExtent() {
|
|
11850
|
+
var _a, _b, _c;
|
|
11851
|
+
const isRelative = this.isVarianceChart() &&
|
|
11852
|
+
this.variancesDataModel.some((e) => e.type === VarianceType.RELATIVE);
|
|
11853
|
+
const usesVariance = this.isVarianceChart();
|
|
11854
|
+
const highest = usesVariance ? this.highestVarianceDataPointValue : this.highestDataPointValue;
|
|
11855
|
+
const smallest = usesVariance ? this.smallestVarianceDataPointValue : this.smallestDataPointValue;
|
|
11856
|
+
return computeUnitBarExtent({
|
|
11857
|
+
// Relative stacks span exactly RELATIVE_STACK_UNITS * ppu
|
|
11858
|
+
fixedDomain: ((_a = this.stackConfig) === null || _a === void 0 ? void 0 : _a.mode) === VarianceMeasure.StackMode.RELATIVE ? VarianceMeasure.RELATIVE_STACK_UNITS : undefined,
|
|
11859
|
+
relativeVariance: isRelative,
|
|
11860
|
+
maxPositive: (_b = highest === null || highest === void 0 ? void 0 : highest.value) !== null && _b !== void 0 ? _b : 0,
|
|
11861
|
+
minNegative: this.isOnSameAxisSide() ? 0 : ((_c = smallest === null || smallest === void 0 ? void 0 : smallest.value) !== null && _c !== void 0 ? _c : 0),
|
|
11862
|
+
});
|
|
11863
|
+
}
|
|
11864
|
+
/**
|
|
11865
|
+
* Total column extent (fraction units) proportional to pixelPerPercentage.
|
|
11866
|
+
* Only relative variances scale with it; each side clamps at +/-145%.
|
|
11867
|
+
*/
|
|
11868
|
+
getPercentBarExtent() {
|
|
11869
|
+
var _a, _b, _c, _d;
|
|
11870
|
+
const isRelative = this.isVarianceChart() &&
|
|
11871
|
+
this.variancesDataModel.some((e) => e.type === VarianceType.RELATIVE);
|
|
11872
|
+
return computePercentBarExtent({
|
|
11873
|
+
relativeVariance: isRelative,
|
|
11874
|
+
maxPositive: (_b = (_a = this.highestVarianceDataPointValue) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : 0,
|
|
11875
|
+
minNegative: this.isOnSameAxisSide() ? 0 : ((_d = (_c = this.smallestVarianceDataPointValue) === null || _c === void 0 ? void 0 : _c.value) !== null && _d !== void 0 ? _d : 0),
|
|
11876
|
+
});
|
|
11877
|
+
}
|
|
11549
11878
|
toString() {
|
|
11550
11879
|
const container = new SVGStyle.Svg();
|
|
11551
11880
|
this.draw(container);
|
|
@@ -12850,7 +13179,7 @@ class TimeChartComponentConfigAdapter {
|
|
|
12850
13179
|
}
|
|
12851
13180
|
}
|
|
12852
13181
|
|
|
12853
|
-
const ibcsChartTimeCss = () => `:host{position:relative;display:inline-block}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-default{stroke:black;stroke-width:0.1em}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.hide{opacity:0}.footer{margin:0.2em;font-size:0.6em}.footer-hide{
|
|
13182
|
+
const ibcsChartTimeCss = () => `:host{position:relative;display:inline-block}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-default{stroke:black;stroke-width:0.1em}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.hide{opacity:0}.footer{margin:0.2em;font-size:0.6em}.footer-hide{display:none}svg#drawCanvas{display:block}`;
|
|
12854
13183
|
|
|
12855
13184
|
const IbcsChartTime = class {
|
|
12856
13185
|
constructor(hostRef) {
|
|
@@ -12912,8 +13241,14 @@ const IbcsChartTime = class {
|
|
|
12912
13241
|
const availableWidth = this.containerWidth || 0;
|
|
12913
13242
|
this.chart = new TimeChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), this.getDb(), this.tableName, config, styles, availableWidth);
|
|
12914
13243
|
this.chart.setI18n(this.i18n);
|
|
13244
|
+
// The broken-bar overdrive exists to absorb MANUAL scaling overflow.
|
|
13245
|
+
// autoFitScaling mutates config.pixelPerUnit to the solved value, so
|
|
13246
|
+
// remember auto mode beforehand and skip the overdrive for it — the
|
|
13247
|
+
// fitted chart fits by construction, and the overdrive's rough overhead
|
|
13248
|
+
// estimate would falsely re-engage on it.
|
|
13249
|
+
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
12915
13250
|
this.autoFitScaling(config, styles);
|
|
12916
|
-
this.chart.setAvailableHeight(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
13251
|
+
this.chart.setAvailableHeight(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
12917
13252
|
this.pattern = new CustomPattern(this.chart.styles);
|
|
12918
13253
|
this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
|
|
12919
13254
|
}
|
|
@@ -12929,15 +13264,24 @@ const IbcsChartTime = class {
|
|
|
12929
13264
|
this.chart.setAvailableWidth(this.containerWidth || 0);
|
|
12930
13265
|
this.chart.setRuleSet(new SVGStyle.IBCSRuleSet(this.ruleSetConfig));
|
|
12931
13266
|
this.chart.setConfig(config);
|
|
13267
|
+
// See componentWillLoad: no broken-bar overdrive for auto-fitted scaling
|
|
13268
|
+
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
12932
13269
|
this.autoFitScaling(config, styles);
|
|
12933
|
-
this.chart.setAvailableHeight(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
13270
|
+
this.chart.setAvailableHeight(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
12934
13271
|
this.pattern = new CustomPattern(this.chart.styles);
|
|
12935
13272
|
this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
|
|
12936
13273
|
}
|
|
12937
13274
|
/**
|
|
12938
|
-
*
|
|
12939
|
-
*
|
|
12940
|
-
*
|
|
13275
|
+
* Auto-fit for pixelPerUnit and/or pixelPerPercentage (0 = auto mode).
|
|
13276
|
+
* Time charts grow vertically, so we fit to height.
|
|
13277
|
+
*
|
|
13278
|
+
* The chart height is affine in the pixel scales (height = fixed labels +
|
|
13279
|
+
* column extent × scale), but label allocations shift between passes, so a
|
|
13280
|
+
* single analytic solve is not enough: measure at 1, solve, then verify
|
|
13281
|
+
* against fresh measurements and re-solve until the chart fits. The loop
|
|
13282
|
+
* never ends on an overshoot — the last fitting values are restored, or
|
|
13283
|
+
* when even the minimum scale cannot fit (labels alone exceed the
|
|
13284
|
+
* container) the values are floored and the wrapper reports the overflow.
|
|
12941
13285
|
* Explicit (> 0) values are never overridden.
|
|
12942
13286
|
*/
|
|
12943
13287
|
autoFitScaling(config, styles) {
|
|
@@ -12956,38 +13300,107 @@ const IbcsChartTime = class {
|
|
|
12956
13300
|
};
|
|
12957
13301
|
const targetHeight = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height;
|
|
12958
13302
|
const availableWidth = this.containerWidth || 0;
|
|
13303
|
+
const rebuild = () => {
|
|
13304
|
+
this.chart = new TimeChart(new SVGStyle.IBCSRuleSet(this.ruleSetConfig), this.getDb(), this.tableName, config, styles, availableWidth);
|
|
13305
|
+
this.chart.setI18n(this.i18n);
|
|
13306
|
+
};
|
|
13307
|
+
// toString() runs draw(), which finalizes positions — an undrawn chart
|
|
13308
|
+
// reports a stale allocated height.
|
|
13309
|
+
const measure = () => {
|
|
13310
|
+
this.chart.toString();
|
|
13311
|
+
return this.chart.getAllocatedCanvasHeight();
|
|
13312
|
+
};
|
|
12959
13313
|
if (!targetHeight || targetHeight <= 0) {
|
|
12960
13314
|
if (autoUnit)
|
|
12961
13315
|
config.pixelPerUnit = 1;
|
|
12962
13316
|
if (autoPercent)
|
|
12963
13317
|
config.pixelPerPercentage = 50;
|
|
12964
|
-
|
|
12965
|
-
this.chart.setI18n(this.i18n);
|
|
13318
|
+
rebuild();
|
|
12966
13319
|
reportResolved();
|
|
12967
13320
|
return;
|
|
12968
13321
|
}
|
|
12969
|
-
//
|
|
13322
|
+
// Measurement pass: render the auto quantities at 1
|
|
12970
13323
|
if (autoUnit)
|
|
12971
13324
|
config.pixelPerUnit = 1;
|
|
12972
13325
|
if (autoPercent)
|
|
12973
13326
|
config.pixelPerPercentage = 1;
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
const svgHeight = this.chart.getAllocatedCanvasHeight();
|
|
12978
|
-
if (svgHeight <= 0) {
|
|
13327
|
+
rebuild();
|
|
13328
|
+
let height = measure();
|
|
13329
|
+
if (height <= 0) {
|
|
12979
13330
|
reportResolved();
|
|
12980
13331
|
return;
|
|
12981
13332
|
}
|
|
12982
|
-
//
|
|
12983
|
-
|
|
12984
|
-
|
|
12985
|
-
|
|
12986
|
-
|
|
12987
|
-
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
|
|
13333
|
+
// Fallback for auto quantities nothing scales with (no column extent):
|
|
13334
|
+
// plain ratio against the measurement pass, as before.
|
|
13335
|
+
const ratioFallback = Math.max(MIN_PIXEL_SCALE, (targetHeight * 0.9) / height);
|
|
13336
|
+
const EPS = 0.5;
|
|
13337
|
+
const MAX_CORRECTIONS = 3;
|
|
13338
|
+
let solvedUnit = false;
|
|
13339
|
+
let solvedPercent = false;
|
|
13340
|
+
let fitting = null;
|
|
13341
|
+
for (let iteration = 0; iteration <= MAX_CORRECTIONS; iteration++) {
|
|
13342
|
+
const step = solveAutoFitStep({
|
|
13343
|
+
target: targetHeight,
|
|
13344
|
+
measured: height,
|
|
13345
|
+
unitExtent: autoUnit ? this.chart.getUnitBarExtent() : 0,
|
|
13346
|
+
pctExtent: autoPercent ? this.chart.getPercentBarExtent() : 0,
|
|
13347
|
+
currentPpu: config.pixelPerUnit,
|
|
13348
|
+
currentPpp: config.pixelPerPercentage,
|
|
13349
|
+
});
|
|
13350
|
+
if (step.ppu === undefined && step.ppp === undefined) {
|
|
13351
|
+
break; // nothing scales with the auto values — fallback below
|
|
13352
|
+
}
|
|
13353
|
+
if (autoUnit && step.ppu !== undefined) {
|
|
13354
|
+
config.pixelPerUnit = step.ppu;
|
|
13355
|
+
solvedUnit = true;
|
|
13356
|
+
}
|
|
13357
|
+
if (autoPercent && step.ppp !== undefined) {
|
|
13358
|
+
config.pixelPerPercentage = step.ppp;
|
|
13359
|
+
solvedPercent = true;
|
|
13360
|
+
}
|
|
13361
|
+
rebuild();
|
|
13362
|
+
height = measure();
|
|
13363
|
+
if (height <= targetHeight + EPS) {
|
|
13364
|
+
fitting = { ppu: config.pixelPerUnit, ppp: config.pixelPerPercentage };
|
|
13365
|
+
if (height >= targetHeight * 0.98) {
|
|
13366
|
+
break; // fits and tight — done
|
|
13367
|
+
}
|
|
13368
|
+
// else the label allocation left slack — loop once more to grow into it
|
|
13369
|
+
}
|
|
13370
|
+
}
|
|
13371
|
+
// Auto quantities the solver never touched get the ratio fallback
|
|
13372
|
+
let needsRebuild = false;
|
|
13373
|
+
if (autoUnit && !solvedUnit) {
|
|
13374
|
+
config.pixelPerUnit = ratioFallback;
|
|
13375
|
+
needsRebuild = true;
|
|
13376
|
+
}
|
|
13377
|
+
if (autoPercent && !solvedPercent) {
|
|
13378
|
+
config.pixelPerPercentage = ratioFallback;
|
|
13379
|
+
needsRebuild = true;
|
|
13380
|
+
}
|
|
13381
|
+
// Never end on an overshoot
|
|
13382
|
+
if (height > targetHeight + EPS) {
|
|
13383
|
+
if (fitting) {
|
|
13384
|
+
// Restore the last values that fit (fallback quantities have no extent)
|
|
13385
|
+
if (solvedUnit)
|
|
13386
|
+
config.pixelPerUnit = fitting.ppu;
|
|
13387
|
+
if (solvedPercent)
|
|
13388
|
+
config.pixelPerPercentage = fitting.ppp;
|
|
13389
|
+
}
|
|
13390
|
+
else {
|
|
13391
|
+
// Even the solved minimum overshoots (labels alone exceed the
|
|
13392
|
+
// container) — shrink proportionally; the wrapper reports this.
|
|
13393
|
+
const shrink = targetHeight / height;
|
|
13394
|
+
if (autoUnit)
|
|
13395
|
+
config.pixelPerUnit = Math.max(MIN_PIXEL_SCALE, config.pixelPerUnit * shrink);
|
|
13396
|
+
if (autoPercent)
|
|
13397
|
+
config.pixelPerPercentage = Math.max(MIN_PIXEL_SCALE, config.pixelPerPercentage * shrink);
|
|
13398
|
+
}
|
|
13399
|
+
needsRebuild = true;
|
|
13400
|
+
}
|
|
13401
|
+
if (needsRebuild) {
|
|
13402
|
+
rebuild();
|
|
13403
|
+
}
|
|
12991
13404
|
reportResolved();
|
|
12992
13405
|
}
|
|
12993
13406
|
async componentWillRender() {
|
|
@@ -13205,6 +13618,98 @@ class TableRow {
|
|
|
13205
13618
|
}
|
|
13206
13619
|
}
|
|
13207
13620
|
|
|
13621
|
+
/**
|
|
13622
|
+
* Column geometry for the inline bar / pin / waterfall charts of bn-table.
|
|
13623
|
+
*
|
|
13624
|
+
* `bar-column-width="wN"` and `category-width="wN"` both mean "N em of the table font",
|
|
13625
|
+
* so both columns render at the same width for the same N. The em used here is the TRUE
|
|
13626
|
+
* table em (`--bn-font-size`, i.e. `global.fontSizePx × scaleFactor`) — deliberately NOT
|
|
13627
|
+
* `CellBarChartStyles.fontSize`, which is 0.85 of it and doubles as the unitScaling /
|
|
13628
|
+
* percentageScaling basis.
|
|
13629
|
+
*
|
|
13630
|
+
* Every quantity is returned in px so the SVG renderers stay in one coordinate space.
|
|
13631
|
+
*/
|
|
13632
|
+
/**
|
|
13633
|
+
* SVG label font size relative to the table em. Also the multiplier in the
|
|
13634
|
+
* unitScaling / percentageScaling math, so changing it rescales every user-set value.
|
|
13635
|
+
*/
|
|
13636
|
+
const BAR_LABEL_FONT_RATIO = 0.85;
|
|
13637
|
+
/**
|
|
13638
|
+
* Horizontal padding of a bar cell, in table em:
|
|
13639
|
+
* `td:has(.cell-bar-chart) { padding: 0 0.25em }` (ibcs-table.scss:320).
|
|
13640
|
+
* With `box-sizing: border-box` the SVG has to be that much narrower than the requested
|
|
13641
|
+
* column width, so the cell's border box lands on exactly N em — the same box
|
|
13642
|
+
* `.category-wN` (ibcs-table.scss:50-83) produces.
|
|
13643
|
+
*/
|
|
13644
|
+
const BAR_CELL_PADDING_EM = 0.5;
|
|
13645
|
+
/** Value-label gutter beside a bar, in em (was a hardcoded 38 px at the 13.3333 px em). */
|
|
13646
|
+
const BAR_LABEL_EM = 2.85;
|
|
13647
|
+
/** Value-label gutter beside a pin, in em (was 45 px). */
|
|
13648
|
+
const PIN_LABEL_EM = 3.375;
|
|
13649
|
+
/** Gap between the axis and the start of a pin's reserved side, in em (was 5 px). */
|
|
13650
|
+
const PIN_PADDING_EM = 0.375;
|
|
13651
|
+
/** Zigzag break gap of an overdrive bar, in em (was 4 px). */
|
|
13652
|
+
const BREAK_GAP_EM = 0.3;
|
|
13653
|
+
/** Gap between a bar/pin end and its value label, in em (was 4 px). */
|
|
13654
|
+
const LABEL_GAP_EM = 0.3;
|
|
13655
|
+
/** Share of the per-side bar extent reserved for the overdrive stub. */
|
|
13656
|
+
const OVERDRIVE_FRACTION = 0.15;
|
|
13657
|
+
/** The SVG fills the cell's content box: the requested column width minus the cell padding. */
|
|
13658
|
+
function contentWidth(widthEm, emPx) {
|
|
13659
|
+
return Math.max(0, (widthEm - BAR_CELL_PADDING_EM) * emPx);
|
|
13660
|
+
}
|
|
13661
|
+
/** Sides the axis serves. Clamped to 1 so a hypothetical all-zero column never divides by 0. */
|
|
13662
|
+
function sideCount(hasNeg, hasPos) {
|
|
13663
|
+
return Math.max(1, (hasNeg ? 1 : 0) + (hasPos ? 1 : 0));
|
|
13664
|
+
}
|
|
13665
|
+
function absoluteBarGeometry(widthEm, emPx, hasNeg, hasPos) {
|
|
13666
|
+
const totalWidth = contentWidth(widthEm, emPx);
|
|
13667
|
+
const sides = sideCount(hasNeg, hasPos);
|
|
13668
|
+
// Narrow columns shrink the gutters rather than the total, so wN stays wN.
|
|
13669
|
+
const labelAreaWidth = Math.min(BAR_LABEL_EM * emPx, totalWidth / (2 * sides));
|
|
13670
|
+
const maxBarWidth = (totalWidth - labelAreaWidth * sides) / sides;
|
|
13671
|
+
const breakGap = Math.min(BREAK_GAP_EM * emPx, maxBarWidth * 0.2);
|
|
13672
|
+
const overdriveZoneWidth = maxBarWidth * OVERDRIVE_FRACTION;
|
|
13673
|
+
return {
|
|
13674
|
+
totalWidth,
|
|
13675
|
+
labelAreaWidth,
|
|
13676
|
+
maxBarWidth,
|
|
13677
|
+
axisX: hasNeg ? labelAreaWidth + maxBarWidth : 0,
|
|
13678
|
+
breakGap,
|
|
13679
|
+
overdriveZoneWidth,
|
|
13680
|
+
cutWidth: Math.max(0, maxBarWidth - breakGap - overdriveZoneWidth),
|
|
13681
|
+
labelGap: LABEL_GAP_EM * emPx,
|
|
13682
|
+
};
|
|
13683
|
+
}
|
|
13684
|
+
function relativePinGeometry(widthEm, emPx, hasNeg, hasPos) {
|
|
13685
|
+
const totalWidth = contentWidth(widthEm, emPx);
|
|
13686
|
+
const sides = sideCount(hasNeg, hasPos);
|
|
13687
|
+
const labelAreaWidth = Math.min(PIN_LABEL_EM * emPx, totalWidth / 2);
|
|
13688
|
+
const pinAreaWidth = totalWidth - labelAreaWidth;
|
|
13689
|
+
const sideWidth = pinAreaWidth / sides;
|
|
13690
|
+
const pinPadding = Math.min(PIN_PADDING_EM * emPx, sideWidth * 0.2);
|
|
13691
|
+
return {
|
|
13692
|
+
totalWidth,
|
|
13693
|
+
labelAreaWidth,
|
|
13694
|
+
maxPinLength: Math.max(0, sideWidth - pinPadding),
|
|
13695
|
+
pinPadding,
|
|
13696
|
+
axisX: hasNeg ? sideWidth : 0,
|
|
13697
|
+
labelX: pinAreaWidth + LABEL_GAP_EM * emPx,
|
|
13698
|
+
};
|
|
13699
|
+
}
|
|
13700
|
+
function waterfallGeometry(widthEm, emPx) {
|
|
13701
|
+
const totalWidth = contentWidth(widthEm, emPx);
|
|
13702
|
+
const labelAreaWidth = Math.min(BAR_LABEL_EM * emPx, totalWidth / 4);
|
|
13703
|
+
return {
|
|
13704
|
+
totalWidth,
|
|
13705
|
+
labelAreaWidth,
|
|
13706
|
+
barAreaWidth: totalWidth - labelAreaWidth * 2,
|
|
13707
|
+
labelGap: LABEL_GAP_EM * emPx,
|
|
13708
|
+
};
|
|
13709
|
+
}
|
|
13710
|
+
|
|
13711
|
+
/** Matches SYSTEM_STYLE_DEFAULTS.global.fontSizePx; only used when `styles` is omitted. */
|
|
13712
|
+
const DEFAULT_EM_PX = 13.3333;
|
|
13208
13713
|
// Default fallback colors (should come from componentStyle)
|
|
13209
13714
|
const DEFAULT_STYLES = {
|
|
13210
13715
|
positive: { stroke: "#008f96", fill: "#008f96", fillpattern: "solid" },
|
|
@@ -13217,7 +13722,8 @@ const DEFAULT_STYLES = {
|
|
|
13217
13722
|
pl: { stroke: "#404040", fill: "#ffffff", fillpattern: "outlined" },
|
|
13218
13723
|
},
|
|
13219
13724
|
fontColor: "#000000",
|
|
13220
|
-
fontSize:
|
|
13725
|
+
fontSize: DEFAULT_EM_PX * BAR_LABEL_FONT_RATIO,
|
|
13726
|
+
emPx: DEFAULT_EM_PX,
|
|
13221
13727
|
fontFamily: "'Noto Sans', sans-serif",
|
|
13222
13728
|
unitScaling: 0.01, // Default: 100 units per em of bar
|
|
13223
13729
|
percentageScaling: 0.5, // Default: 2 percentage points per em of pin
|
|
@@ -13392,21 +13898,20 @@ function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
|
|
|
13392
13898
|
/**
|
|
13393
13899
|
* Renders an absolute variance bar chart (d_ prefix).
|
|
13394
13900
|
* Horizontal bar with centered axis, green for positive, red for negative.
|
|
13395
|
-
* When a bar exceeds
|
|
13901
|
+
* When a bar exceeds the geometry's cut width it is drawn as an overdrive bar:
|
|
13396
13902
|
* base segment + zigzag break + proportional overdrive stub (like structure chart).
|
|
13397
13903
|
*
|
|
13398
|
-
* Layout: [left label area][bar area with axis][right label area]
|
|
13904
|
+
* Layout: [left label area][bar area with axis][right label area], summing to
|
|
13905
|
+
* exactly `columnWidthEm` em — see barColumnGeometry.ts.
|
|
13399
13906
|
*/
|
|
13400
13907
|
const AbsoluteVarianceBar = (props) => {
|
|
13401
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale,
|
|
13908
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, columnWidthEm = 10, styles = DEFAULT_STYLES, } = props;
|
|
13402
13909
|
const s = styles.scaleFactor;
|
|
13403
13910
|
const fs = styles.fontSize;
|
|
13404
|
-
|
|
13405
|
-
const
|
|
13406
|
-
|
|
13407
|
-
const breakGap =
|
|
13408
|
-
const overdriveZoneWidth = maxBarWidth * 0.15;
|
|
13409
|
-
const cutWidth = maxBarWidth - breakGap - overdriveZoneWidth;
|
|
13911
|
+
// Adaptive axis placement based on data range
|
|
13912
|
+
const hasNeg = columnStats.min < 0;
|
|
13913
|
+
const hasPos = columnStats.max > 0;
|
|
13914
|
+
const { totalWidth, axisX, breakGap, overdriveZoneWidth, cutWidth, labelGap } = absoluteBarGeometry(columnWidthEm, styles.emPx, hasNeg, hasPos);
|
|
13410
13915
|
// Direct unit scaling via fontSize
|
|
13411
13916
|
const scaledWidth = Math.abs(value) * styles.unitScaling * fs;
|
|
13412
13917
|
const isExtreme = scaledWidth > cutWidth;
|
|
@@ -13415,16 +13920,8 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
13415
13920
|
const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
|
|
13416
13921
|
const overflowAmount = Math.max(0, scaledWidth - cutWidth);
|
|
13417
13922
|
const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
|
|
13418
|
-
// Adaptive axis placement based on data range
|
|
13419
|
-
const hasNeg = columnStats.min < 0;
|
|
13420
|
-
const hasPos = columnStats.max > 0;
|
|
13421
|
-
const negBarWidth = hasNeg ? maxBarWidth : 0;
|
|
13422
|
-
const posBarWidth = hasPos ? maxBarWidth : 0;
|
|
13423
|
-
const barAreaWidth = negBarWidth + posBarWidth;
|
|
13424
|
-
const totalWidth = (hasNeg ? labelAreaWidth : 0) + barAreaWidth + (hasPos ? labelAreaWidth : 0);
|
|
13425
13923
|
const padding = 2 * s;
|
|
13426
13924
|
const barHeight = height - padding * 2;
|
|
13427
|
-
const axisX = (hasNeg ? labelAreaWidth : 0) + negBarWidth;
|
|
13428
13925
|
const barY = padding;
|
|
13429
13926
|
const isPositive = value >= 0;
|
|
13430
13927
|
// Get style based on column type (scenario vs variance)
|
|
@@ -13445,7 +13942,7 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
13445
13942
|
const baseBarWidth = isExtreme ? cutWidth : scaledWidth;
|
|
13446
13943
|
// Label position accounts for overdrive
|
|
13447
13944
|
const totalVisualWidth = isExtreme ? cutWidth + breakGap + overdriveWidth : scaledWidth;
|
|
13448
|
-
const labelX = isPositive ? axisX + totalVisualWidth +
|
|
13945
|
+
const labelX = isPositive ? axisX + totalVisualWidth + labelGap : axisX - totalVisualWidth - labelGap;
|
|
13449
13946
|
const labelAnchor = isPositive ? "start" : "end";
|
|
13450
13947
|
return (index.h("svg", { width: totalWidth, height: height, class: "cell-bar-chart absolute-variance", style: { overflow: "visible" } }, index.h(PatternDefs, { styles: styles }), index.h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), baseBarWidth > 0 && (index.h("rect", { x: isPositive ? axisX : axisX - baseBarWidth, y: barY, width: baseBarWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme && overdriveWidth > 0 && (index.h("rect", { x: isPositive ? axisX + cutWidth + breakGap : axisX - cutWidth - breakGap - overdriveWidth, y: barY, width: overdriveWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme &&
|
|
13451
13948
|
renderZigzagBreak(isPositive ? axisX + cutWidth : axisX - cutWidth - breakGap, breakGap, barY, barHeight, s), index.h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelAnchor, fill: styles.fontColor, "font-size": fs, "font-family": styles.fontFamily }, displayValue)));
|
|
@@ -13454,25 +13951,18 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
13454
13951
|
* Renders a relative variance pin chart (dr_ prefix).
|
|
13455
13952
|
* Thin horizontal line from axis with dot at end and value label.
|
|
13456
13953
|
*
|
|
13457
|
-
* Layout: [pin area with axis][label area on right]
|
|
13954
|
+
* Layout: [pin area with axis][label area on right], summing to exactly
|
|
13955
|
+
* `columnWidthEm` em — see barColumnGeometry.ts.
|
|
13458
13956
|
* Uses percentageScaling to determine pin length (pixels per percentage point).
|
|
13459
13957
|
*/
|
|
13460
13958
|
const RelativeVariancePin = (props) => {
|
|
13461
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale,
|
|
13959
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, columnWidthEm = 10, styles = DEFAULT_STYLES, } = props;
|
|
13462
13960
|
const s = styles.scaleFactor;
|
|
13463
13961
|
const fs = styles.fontSize;
|
|
13464
|
-
// Pin length is ~2/3 of bar width for visual balance
|
|
13465
|
-
const maxPinLength = Math.round(maxBarWidthEm * 0.67 * fs);
|
|
13466
|
-
const pinPadding = 5 * s;
|
|
13467
13962
|
// Adaptive axis placement based on data range
|
|
13468
13963
|
const hasNeg = columnStats.min < 0;
|
|
13469
13964
|
const hasPos = columnStats.max > 0;
|
|
13470
|
-
const
|
|
13471
|
-
const posPinWidth = hasPos ? maxPinLength + pinPadding : 0;
|
|
13472
|
-
const pinAreaWidth = negPinWidth + posPinWidth;
|
|
13473
|
-
const labelAreaWidth = 45 * s;
|
|
13474
|
-
const totalWidth = pinAreaWidth + labelAreaWidth;
|
|
13475
|
-
const axisX = negPinWidth;
|
|
13965
|
+
const { totalWidth, maxPinLength, axisX, labelX } = relativePinGeometry(columnWidthEm, styles.emPx, hasNeg, hasPos);
|
|
13476
13966
|
const centerY = height / 2;
|
|
13477
13967
|
// Direct unit scaling via fontSize
|
|
13478
13968
|
const percentValue = Math.abs(value) * 100;
|
|
@@ -13485,8 +13975,6 @@ const RelativeVariancePin = (props) => {
|
|
|
13485
13975
|
const barStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
13486
13976
|
const dotRadius = 3 * s;
|
|
13487
13977
|
const displayValue = formattedValue || formatValue(value, true, measureScale);
|
|
13488
|
-
// Label always on the right side after the pin area
|
|
13489
|
-
const labelX = pinAreaWidth + 4 * s;
|
|
13490
13978
|
return (index.h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, index.h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), !isExtreme && index.h("circle", { cx: pinEndX, cy: centerY, r: dotRadius, fill: styles.fontColor }), index.h("line", { x1: axisX, y1: centerY, x2: pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": 2 * s }), isExtreme && isPositive && (index.h("polygon", { points: `${axisX + maxPinLength},${centerY} ${axisX + maxPinLength - 6 * s},${centerY - 3 * s} ${axisX + maxPinLength - 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), isExtreme && !isPositive && (index.h("polygon", { points: `${axisX - maxPinLength},${centerY} ${axisX - maxPinLength + 6 * s},${centerY - 3 * s} ${axisX - maxPinLength + 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), index.h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": "start", fill: styles.fontColor, "font-size": fs, "font-style": "italic", "font-family": styles.fontFamily }, displayValue)));
|
|
13491
13979
|
};
|
|
13492
13980
|
/**
|
|
@@ -13524,16 +14012,14 @@ const CellBarChart = (props) => {
|
|
|
13524
14012
|
* guides marking their parent bar's extent.
|
|
13525
14013
|
*/
|
|
13526
14014
|
const WaterfallBar = (props) => {
|
|
13527
|
-
const { value, scenario, height, measureScale,
|
|
14015
|
+
const { value, scenario, height, measureScale, columnWidthEm = 10, styles = DEFAULT_STYLES, waterfall } = props;
|
|
13528
14016
|
const s = styles.scaleFactor;
|
|
13529
14017
|
const fs = styles.fontSize;
|
|
13530
14018
|
const range = waterfall.max - waterfall.min;
|
|
13531
14019
|
if (value === null || value === undefined || isNaN(value) || range <= 0) {
|
|
13532
14020
|
return (index.h("span", { class: "bar-chart-empty", style: { color: styles.fontColor, fontStyle: "italic" } }, "-"));
|
|
13533
14021
|
}
|
|
13534
|
-
const labelAreaWidth =
|
|
13535
|
-
const barAreaWidth = maxBarWidthEm * fs;
|
|
13536
|
-
const totalWidth = labelAreaWidth + barAreaWidth + labelAreaWidth;
|
|
14022
|
+
const { totalWidth, labelAreaWidth, barAreaWidth, labelGap } = waterfallGeometry(columnWidthEm, styles.emPx);
|
|
13537
14023
|
const pxPerUnit = barAreaWidth / range;
|
|
13538
14024
|
const xOf = (coordinate) => labelAreaWidth + (coordinate - waterfall.min) * pxPerUnit;
|
|
13539
14025
|
const padding = 2 * s;
|
|
@@ -13550,7 +14036,7 @@ const WaterfallBar = (props) => {
|
|
|
13550
14036
|
// Scenario values carry no variance sentiment — labels are unsigned per IBCS
|
|
13551
14037
|
const displayValue = formatValue(value, waterfall.kind === "partof", measureScale).replace(/^\+/, "");
|
|
13552
14038
|
const pointsLeft = endX < startX;
|
|
13553
|
-
const labelX = pointsLeft ? barX -
|
|
14039
|
+
const labelX = pointsLeft ? barX - labelGap : barX + barWidth + labelGap;
|
|
13554
14040
|
const labelAnchor = pointsLeft ? "end" : "start";
|
|
13555
14041
|
return (index.h("svg", { width: totalWidth, height: height, class: "cell-bar-chart waterfall-bar", style: { overflow: "visible" } }, index.h(PatternDefs, { styles: styles }), index.h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), waterfall.parentStart !== undefined && waterfall.parentEnd !== undefined && (index.h("line", { x1: xOf(waterfall.parentStart), y1: 0, x2: xOf(waterfall.parentStart), y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s, "stroke-dasharray": `${2 * s},${2 * s}` })), waterfall.parentStart !== undefined && waterfall.parentEnd !== undefined && (index.h("line", { x1: xOf(waterfall.parentEnd), y1: 0, x2: xOf(waterfall.parentEnd), y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s, "stroke-dasharray": `${2 * s},${2 * s}` })), barWidth > 0 && (index.h("rect", { x: barX, y: barY, width: barWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), index.h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelAnchor, fill: styles.fontColor, "font-size": fs, "font-family": styles.fontFamily }, displayValue)));
|
|
13556
14042
|
};
|
|
@@ -15761,6 +16247,10 @@ const IbcsTable = class {
|
|
|
15761
16247
|
this.filter = "";
|
|
15762
16248
|
this.barColumns = [];
|
|
15763
16249
|
this.interval = "none";
|
|
16250
|
+
/**
|
|
16251
|
+
* Total width of a bar chart column, in em of the table font — the same unit
|
|
16252
|
+
* `categoryWidth` uses, so the two render at the same width for the same value.
|
|
16253
|
+
*/
|
|
15764
16254
|
this.barColumnMaxWidth = 30;
|
|
15765
16255
|
this.unitScaling = 0.01;
|
|
15766
16256
|
this.percentageScaling = 0.5;
|
|
@@ -15779,7 +16269,7 @@ const IbcsTable = class {
|
|
|
15779
16269
|
}
|
|
15780
16270
|
return (index.h("table", null, index.h("thead", null, this.table.getHeader().map((row) => (index.h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (index.h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (index.h("span", null, i === arr.length - 1 ? (index.h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (index.h("span", null, line, cell.drawPrefix(), index.h("br", null))))))))))))), index.h("tbody", null, this.table.getBody().map((row) => (index.h("tr", { class: row.cssStyle }, row === null || row === void 0 ? void 0 : row.getCells().map((cell) => (index.h("td", { colSpan: cell.colSpan, class: cell.type ? `${cell.cssStyle} ${cell.type}` : cell.cssStyle }, cell.prefix != null ? (index.h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
15781
16271
|
cell.columnStats &&
|
|
15782
|
-
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (index.h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale,
|
|
16272
|
+
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (index.h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (index.h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits)))))))))));
|
|
15783
16273
|
};
|
|
15784
16274
|
return index.h(index.Host, null, helper());
|
|
15785
16275
|
}
|
|
@@ -15845,7 +16335,7 @@ const IbcsTable = class {
|
|
|
15845
16335
|
});
|
|
15846
16336
|
}
|
|
15847
16337
|
return this.componentStyle(($) => {
|
|
15848
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
16338
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
15849
16339
|
const varianceStyles = (_a = $["bn-chart-time"]) === null || _a === void 0 ? void 0 : _a["varianceStyles"];
|
|
15850
16340
|
const barStyles = (_b = $["bn-chart-time"]) === null || _b === void 0 ? void 0 : _b["barStyles"];
|
|
15851
16341
|
// Default variance styles with fillpattern
|
|
@@ -15898,26 +16388,32 @@ const IbcsTable = class {
|
|
|
15898
16388
|
},
|
|
15899
16389
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
15900
16390
|
fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
|
|
15901
|
-
fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) *
|
|
15902
|
-
|
|
16391
|
+
fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * BAR_LABEL_FONT_RATIO * this.scaleFactor,
|
|
16392
|
+
emPx: (((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontSizePx"]) || 13.3333) * this.scaleFactor,
|
|
16393
|
+
fontFamily: ((_2 = $["global"]) === null || _2 === void 0 ? void 0 : _2["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
15903
16394
|
unitScaling: resolvedUnit,
|
|
15904
16395
|
percentageScaling: resolvedPercent,
|
|
15905
16396
|
scaleFactor: this.scaleFactor,
|
|
15906
16397
|
};
|
|
15907
16398
|
});
|
|
15908
16399
|
}
|
|
16400
|
+
/** The table's true em in px — the unit `.category-wN` and the bar columns share. */
|
|
16401
|
+
emPx() {
|
|
16402
|
+
return this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * this.scaleFactor;
|
|
16403
|
+
}
|
|
15909
16404
|
/**
|
|
15910
16405
|
* Auto-calculate unitScaling so the largest absolute variance bar
|
|
15911
|
-
* fills ~80% of the bar
|
|
16406
|
+
* fills ~80% of its side of the bar area, without tripping the overdrive break.
|
|
15912
16407
|
*/
|
|
15913
16408
|
autoUnitScaling() {
|
|
15914
|
-
const
|
|
15915
|
-
const
|
|
15916
|
-
const
|
|
15917
|
-
const absMax = this.getMaxAbsValue();
|
|
16409
|
+
const emPx = this.emPx();
|
|
16410
|
+
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
16411
|
+
const { absMax, hasNeg, hasPos } = this.getAbsBarColumnStats();
|
|
15918
16412
|
if (absMax <= 0 || fs <= 0) {
|
|
15919
16413
|
return 0.01;
|
|
15920
16414
|
}
|
|
16415
|
+
const { maxBarWidth, cutWidth } = absoluteBarGeometry(this.barColumnMaxWidth, emPx, hasNeg, hasPos);
|
|
16416
|
+
const targetWidth = Math.min(maxBarWidth * 0.8, cutWidth);
|
|
15921
16417
|
return targetWidth / (absMax * fs);
|
|
15922
16418
|
}
|
|
15923
16419
|
/**
|
|
@@ -15925,52 +16421,47 @@ const IbcsTable = class {
|
|
|
15925
16421
|
* fills ~80% of the pin area.
|
|
15926
16422
|
*/
|
|
15927
16423
|
autoPercentageScaling() {
|
|
15928
|
-
const
|
|
15929
|
-
const
|
|
15930
|
-
const
|
|
15931
|
-
const maxPct = this.getMaxRelativeValue();
|
|
16424
|
+
const emPx = this.emPx();
|
|
16425
|
+
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
16426
|
+
const { absMax: maxPct, hasNeg, hasPos } = this.getRelativeBarColumnStats();
|
|
15932
16427
|
if (maxPct <= 0 || fs <= 0) {
|
|
15933
16428
|
return 0.5;
|
|
15934
16429
|
}
|
|
15935
|
-
|
|
16430
|
+
const { maxPinLength } = relativePinGeometry(this.barColumnMaxWidth, emPx, hasNeg, hasPos);
|
|
16431
|
+
return (maxPinLength * 0.8) / (maxPct * fs);
|
|
15936
16432
|
}
|
|
15937
16433
|
/**
|
|
15938
|
-
*
|
|
16434
|
+
* Maximum value and sign coverage across all absolute variance columns (d_*) in the table body.
|
|
16435
|
+
* Sign coverage decides how much of the column the bar area gets (see barColumnGeometry.ts);
|
|
16436
|
+
* OR-ing it across columns keeps the single shared scaling inside the narrowest bar area.
|
|
15939
16437
|
*/
|
|
15940
|
-
|
|
15941
|
-
|
|
15942
|
-
|
|
15943
|
-
let max = 0;
|
|
15944
|
-
for (const row of this.table.getBody()) {
|
|
15945
|
-
if (row.type === TableRowType.SUM)
|
|
15946
|
-
continue;
|
|
15947
|
-
for (const cell of row.getCells()) {
|
|
15948
|
-
// waterfall cells scale independently and must not skew variance auto-scaling
|
|
15949
|
-
if (cell.isBarChart && cell.columnStats && !cell.key.startsWith("dr") && !cell.waterfall) {
|
|
15950
|
-
max = Math.max(max, cell.columnStats.absMax);
|
|
15951
|
-
}
|
|
15952
|
-
}
|
|
15953
|
-
}
|
|
15954
|
-
return max;
|
|
16438
|
+
getAbsBarColumnStats() {
|
|
16439
|
+
// waterfall cells scale independently and must not skew variance auto-scaling
|
|
16440
|
+
return this.collectBarColumnStats((cell) => !cell.key.startsWith("dr") && !cell.waterfall, 1);
|
|
15955
16441
|
}
|
|
15956
16442
|
/**
|
|
15957
|
-
*
|
|
15958
|
-
*
|
|
16443
|
+
* Same for the relative variance columns (dr_*). Values are stored as decimals
|
|
16444
|
+
* (e.g. 0.2 = 20%), returned as percentage (20).
|
|
15959
16445
|
*/
|
|
15960
|
-
|
|
16446
|
+
getRelativeBarColumnStats() {
|
|
16447
|
+
return this.collectBarColumnStats((cell) => cell.key.startsWith("dr"), 100);
|
|
16448
|
+
}
|
|
16449
|
+
collectBarColumnStats(accept, valueFactor) {
|
|
16450
|
+
const stats = { absMax: 0, hasNeg: false, hasPos: false };
|
|
15961
16451
|
if (!this.table)
|
|
15962
|
-
return
|
|
15963
|
-
let max = 0;
|
|
16452
|
+
return stats;
|
|
15964
16453
|
for (const row of this.table.getBody()) {
|
|
15965
16454
|
if (row.type === TableRowType.SUM)
|
|
15966
16455
|
continue;
|
|
15967
16456
|
for (const cell of row.getCells()) {
|
|
15968
|
-
if (cell.isBarChart
|
|
15969
|
-
|
|
15970
|
-
|
|
16457
|
+
if (!cell.isBarChart || !cell.columnStats || !accept(cell))
|
|
16458
|
+
continue;
|
|
16459
|
+
stats.absMax = Math.max(stats.absMax, cell.columnStats.absMax * valueFactor);
|
|
16460
|
+
stats.hasNeg = stats.hasNeg || cell.columnStats.min < 0;
|
|
16461
|
+
stats.hasPos = stats.hasPos || cell.columnStats.max > 0;
|
|
15971
16462
|
}
|
|
15972
16463
|
}
|
|
15973
|
-
return
|
|
16464
|
+
return stats;
|
|
15974
16465
|
}
|
|
15975
16466
|
get element() { return index.getElement(this); }
|
|
15976
16467
|
};
|