@bino-bi/bn-template-engine 1.0.0-next.44 → 1.0.0-next.46
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-8b28c9bd.entry.js → p-16623e0f.entry.js} +1 -1
- package/dist/bn-template-engine/p-17970e07.entry.js +1 -0
- package/dist/bn-template-engine/{p-ce764078.entry.js → p-21930d0a.entry.js} +1 -1
- package/dist/bn-template-engine/{p-5a64f90f.entry.js → p-46c46067.entry.js} +1 -1
- package/dist/bn-template-engine/p-9caa7f46.entry.js +1 -0
- package/dist/bn-template-engine/p-B0MEAsAS.js +1 -0
- package/dist/bn-template-engine/{p-qpZjVnX5.js → p-BA-fydUt.js} +1 -1
- package/dist/bn-template-engine/p-BEGt_7Hr.js +1 -0
- package/dist/bn-template-engine/p-BRO1oW7m.js +1 -0
- package/dist/bn-template-engine/{p-BjozxTTW.js → p-BnzIfgCq.js} +1 -1
- package/dist/bn-template-engine/{p-b0dfc113.entry.js → p-b0d528f2.entry.js} +1 -1
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +612 -84
- package/dist/cjs/bn-grid.cjs.entry.js +161 -34
- package/dist/cjs/bn-image.cjs.entry.js +2 -2
- package/dist/cjs/bn-internationalization.cjs.entry.js +2 -2
- package/dist/cjs/bn-ruleset.cjs.entry.js +2 -2
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{localFrame-U3Qs0psw.js → localFrame-C27GGom1.js} +1 -1
- package/dist/cjs/{withBodyObserver-S-FGHpAX.js → withBodyObserver-B78wzw3f.js} +1 -1
- package/dist/cjs/{withHasError-BkBrsCpI.js → withHasError-0hW3-4mr.js} +11 -5
- package/dist/cjs/{withStyled-BZb6snOx.js → withStyled-D0hrcfE_.js} +25 -1
- package/dist/cjs/{withTranslation-FxXGUB3H.js → withTranslation-B4WipL_5.js} +7 -4
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +33 -2
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +112 -16
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +1 -1
- package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +3 -3
- package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +113 -3
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +261 -22
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +221 -12
- package/dist/collection/components/bn-chart-time/utils/elements/Axis.js +9 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Column.js +10 -4
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +9 -3
- package/dist/collection/components/bn-chart-time/utils/factories/ScenarioFactory.js +2 -2
- package/dist/collection/components/bn-chart-time/utils/model/DataPoint.js +9 -6
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +15 -0
- package/dist/collection/components/bn-grid/bn-grid.js +118 -24
- package/dist/collection/components/bn-grid/utils/cellLayout.js +55 -9
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +4 -2
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +23 -1
- package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.css +10 -0
- package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.js +23 -1
- package/dist/collection/components/bn-title/bn-title.js +40 -2
- package/dist/collection/components/bn-tree/bn-tree.js +4 -1
- package/dist/collection/stores/componentStyles.js +9 -3
- package/dist/collection/stores/internationalization.js +2 -2
- package/dist/collection/utils/DateStringFactory.js +19 -0
- package/dist/collection/utils/model/DataFormatDigits.js +4 -2
- package/dist/collection/utils/model/VarianceScenario.js +13 -0
- package/dist/collection/utils/parentDimensions.js +5 -2
- package/dist/collection/utils/validate.js +4 -0
- package/dist/components/bn-annotation-layer.js +1 -1
- package/dist/components/bn-annotation-list.js +1 -1
- package/dist/components/bn-asset.js +1 -1
- package/dist/components/bn-body.js +1 -1
- package/dist/components/bn-card.js +1 -1
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-ruleset.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title-renderer.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/p-9X5fVJqR.js +1 -0
- package/dist/components/p-B5GRtTLX.js +1 -0
- package/dist/components/{p-DJUffGeB.js → p-BKA15uoz.js} +1 -1
- package/dist/components/p-BKLq0Pbv.js +1 -0
- package/dist/components/p-BKTBdrEA.js +1 -0
- package/dist/components/p-Bd8cQiLx.js +1 -0
- package/dist/components/{p-CvEdUq8i.js → p-Be0Q3bvf.js} +1 -1
- package/dist/components/{p-xIWChKGS.js → p-Bj3RWsEx.js} +1 -1
- package/dist/components/{p-B4L069XF.js → p-BoBamuPt.js} +1 -1
- package/dist/components/{p-DaOm9YwQ.js → p-BrJZUp-K.js} +1 -1
- package/dist/components/{p-CyfGkLMh.js → p-BuWNCnvR.js} +1 -1
- package/dist/components/p-C50Ge-4H.js +1 -0
- package/dist/components/{p-M2k_I8lv.js → p-CFVoK5Rb.js} +1 -1
- package/dist/components/{p-fKJx8WtW.js → p-CgJB5mCu.js} +1 -1
- package/dist/components/p-Cxx0YNnl.js +1 -0
- package/dist/components/p-D9F5IBFT.js +1 -0
- package/dist/components/{p-BfUdaxZ9.js → p-DQFahsnV.js} +1 -1
- package/dist/components/p-DROj8gke.js +1 -0
- package/dist/components/p-D_Sbhd0L.js +1 -0
- package/dist/components/{p-Cel0a6ma.js → p-DbWh9W5D.js} +1 -1
- package/dist/components/{p-2eicD9rF.js → p-DkCeSWKR.js} +1 -1
- package/dist/components/{p-7ieJFBUk.js → p-DoOSXntC.js} +1 -1
- package/dist/components/p-Dxj_pf8s.js +1 -0
- package/dist/components/{p-DQl2K2Xl.js → p-DzYhS_9s.js} +1 -1
- package/dist/components/{p-B2bvM2Ig.js → p-EQNS13GN.js} +1 -1
- package/dist/components/{p-Y9bth2Y_.js → p-G56USTsQ.js} +1 -1
- package/dist/components/p-OgFFKehL.js +1 -0
- package/dist/components/{p-C2ycO60j.js → p-kvYRImZT.js} +1 -1
- package/dist/components/{p-Chuj-LpI.js → p-rEdNIgD8.js} +1 -1
- package/dist/components/{p-DwuXVo2h.js → p-uCpFBDF5.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +612 -84
- package/dist/esm/bn-grid.entry.js +161 -34
- package/dist/esm/bn-image.entry.js +2 -2
- package/dist/esm/bn-internationalization.entry.js +2 -2
- package/dist/esm/bn-ruleset.entry.js +2 -2
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{localFrame-BNWPPaQa.js → localFrame-CEZ7-hBs.js} +1 -1
- package/dist/esm/{withBodyObserver-AHQAUV85.js → withBodyObserver-D9yIMxdr.js} +1 -1
- package/dist/esm/{withHasError-B6Lvj9Cq.js → withHasError-UGtkLrYT.js} +11 -5
- package/dist/esm/{withStyled-CzzXg64f.js → withStyled-BlMqEIfr.js} +25 -2
- package/dist/esm/{withTranslation-Daq2JXkv.js → withTranslation-Bc3bjHTb.js} +7 -4
- package/dist/schemas/theme.schema.json +18 -0
- package/dist/types/components/bn-annotation-layer/bn-annotation-layer.d.ts +11 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +16 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Needle.d.ts +2 -1
- package/dist/types/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.d.ts +8 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +46 -1
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +37 -0
- package/dist/types/components/bn-chart-time/utils/elements/Axis.d.ts +2 -0
- package/dist/types/components/bn-chart-time/utils/elements/Needle.d.ts +2 -1
- package/dist/types/components/bn-chart-time/utils/factories/ScenarioFactory.d.ts +1 -1
- package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +6 -1
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +6 -0
- package/dist/types/components/bn-grid/bn-grid.d.ts +23 -0
- package/dist/types/components/bn-grid/utils/cellLayout.d.ts +39 -3
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -1
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +9 -0
- package/dist/types/components/bn-title/bn-title-renderer/bn-title-renderer.d.ts +2 -0
- package/dist/types/components/bn-title/bn-title.d.ts +10 -0
- package/dist/types/components.d.ts +173 -6
- package/dist/types/stores/componentStyles.d.ts +8 -0
- package/dist/types/utils/DateStringFactory.d.ts +4 -0
- package/dist/types/utils/layoutState/types.d.ts +3 -0
- package/dist/types/utils/model/VarianceScenario.d.ts +2 -0
- package/dist/types/utils/validate.d.ts +2 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-3c4af59a.entry.js +0 -1
- package/dist/bn-template-engine/p-D0tNATZq.js +0 -1
- package/dist/bn-template-engine/p-DF9sfwBN.js +0 -1
- package/dist/bn-template-engine/p-EcC0qLtU.js +0 -1
- package/dist/bn-template-engine/p-a4b76176.entry.js +0 -1
- package/dist/components/p-1B_s8oPY.js +0 -1
- package/dist/components/p-AwH1w8Mu.js +0 -1
- package/dist/components/p-BiSytXUy.js +0 -1
- package/dist/components/p-C3gYq-HU.js +0 -1
- package/dist/components/p-CEf5X8MZ.js +0 -1
- package/dist/components/p-CniN8ALm.js +0 -1
- package/dist/components/p-D2Epww9R.js +0 -1
- package/dist/components/p-D40Am1Ap.js +0 -1
- package/dist/components/p-DDvWTgk1.js +0 -1
- package/dist/components/p-DjPWZfry.js +0 -1
- package/dist/components/p-DnDL1pPc.js +0 -1
- package/dist/components/p-sLbQ7yZ1.js +0 -1
- /package/dist/components/{p-DD1zlev_.js → p-Dsvjkuy3.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DGis1BzT.js');
|
|
4
|
-
var withHasError = require('./withHasError-
|
|
5
|
-
var withStyled = require('./withStyled-
|
|
6
|
-
var withTranslation = require('./withTranslation-
|
|
7
|
-
var withBodyObserver = require('./withBodyObserver-
|
|
8
|
-
var localFrame = require('./localFrame-
|
|
4
|
+
var withHasError = require('./withHasError-0hW3-4mr.js');
|
|
5
|
+
var withStyled = require('./withStyled-D0hrcfE_.js');
|
|
6
|
+
var withTranslation = require('./withTranslation-B4WipL_5.js');
|
|
7
|
+
var withBodyObserver = require('./withBodyObserver-B78wzw3f.js');
|
|
8
|
+
var localFrame = require('./localFrame-C27GGom1.js');
|
|
9
9
|
var index$1 = require('./index.cjs.js');
|
|
10
10
|
var queryError = require('./queryError-BZjnIW_w.js');
|
|
11
11
|
|
|
@@ -321,6 +321,7 @@ const AnnotationLayer = class {
|
|
|
321
321
|
this.scheduled = false;
|
|
322
322
|
this.run = 0;
|
|
323
323
|
this.observed = new WeakSet();
|
|
324
|
+
this.observedAround = new WeakSet();
|
|
324
325
|
this.reported = new Set();
|
|
325
326
|
/**
|
|
326
327
|
* Places the marks after the next paint. The layer counts as working until
|
|
@@ -348,6 +349,7 @@ const AnnotationLayer = class {
|
|
|
348
349
|
this.stores = withHasError.getStores(this.element);
|
|
349
350
|
this.pageKey = annotationPageKey(this.element);
|
|
350
351
|
this.observed = new WeakSet();
|
|
352
|
+
this.observedAround = new WeakSet();
|
|
351
353
|
this.resizeObserver = new ResizeObserver(this.schedule);
|
|
352
354
|
this.mutationObserver = new MutationObserver(this.schedule);
|
|
353
355
|
this.observeSize(this.element);
|
|
@@ -414,7 +416,10 @@ const AnnotationLayer = class {
|
|
|
414
416
|
await Promise.all(visuals.map((visual) => { var _a; return (_a = visual.componentOnReady) === null || _a === void 0 ? void 0 : _a.call(visual); }));
|
|
415
417
|
if (run !== this.run)
|
|
416
418
|
return;
|
|
417
|
-
visuals.forEach((visual) =>
|
|
419
|
+
visuals.forEach((visual) => {
|
|
420
|
+
this.observe(visual);
|
|
421
|
+
this.observeAround(visual, page);
|
|
422
|
+
});
|
|
418
423
|
const states = new Map();
|
|
419
424
|
await Promise.all(visuals.map(async (visual) => {
|
|
420
425
|
var _a;
|
|
@@ -573,6 +578,28 @@ const AnnotationLayer = class {
|
|
|
573
578
|
};
|
|
574
579
|
walk(visual.shadowRoot);
|
|
575
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* A component around a target can move it without resizing anything: a
|
|
583
|
+
* grid pads a cell down to line up a baseline, and writes that into its own
|
|
584
|
+
* shadow root, or into the style of a card in the cell.
|
|
585
|
+
*/
|
|
586
|
+
observeAround(visual, page) {
|
|
587
|
+
var _a, _b;
|
|
588
|
+
for (let el = visual.parentElement; el && el !== page; el = el.parentElement) {
|
|
589
|
+
if (this.observedAround.has(el))
|
|
590
|
+
continue;
|
|
591
|
+
this.observedAround.add(el);
|
|
592
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(el, { attributes: true, attributeFilter: ["style"] });
|
|
593
|
+
if (el.shadowRoot) {
|
|
594
|
+
(_b = this.mutationObserver) === null || _b === void 0 ? void 0 : _b.observe(el.shadowRoot, {
|
|
595
|
+
childList: true,
|
|
596
|
+
subtree: true,
|
|
597
|
+
attributes: true,
|
|
598
|
+
attributeFilter: ["style", "class"],
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
576
603
|
observeSize(element) {
|
|
577
604
|
var _a;
|
|
578
605
|
if (!this.observed.has(element)) {
|
|
@@ -597,7 +624,7 @@ const AnnotationLayer = class {
|
|
|
597
624
|
return (index.h("g", { class: "mark arrow", "data-label": (_b = mark.badge) === null || _b === void 0 ? void 0 : _b.label }, index.h("line", { x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, style: { stroke: color, strokeWidth: "1.5" } }), index.h("polygon", { points: mark.head, style: { fill: color } }), this.renderBadge(mark.badge, color)));
|
|
598
625
|
}
|
|
599
626
|
render() {
|
|
600
|
-
return (index.h(index.Host, { key: '
|
|
627
|
+
return (index.h(index.Host, { key: 'd4d027728ae578a5ced829a3f86f0137530551fc' }, index.h("svg", { key: 'a3813930e420db9fdd618bc38c38941295cf4c22', ref: (el) => (this.svg = el) }, this.marks.map((mark) => this.renderMark(mark)))));
|
|
601
628
|
}
|
|
602
629
|
get element() { return index.getElement(this); }
|
|
603
630
|
static get watchers() { return {
|
|
@@ -2593,6 +2620,19 @@ function resolveSentiment(direction, operation, signedValues) {
|
|
|
2593
2620
|
const subtracts = !signedValues && operation === "-";
|
|
2594
2621
|
return (direction === "op") !== subtracts ? "pos" : "neg";
|
|
2595
2622
|
}
|
|
2623
|
+
/** The scenarios a list of variances is calculated from, each once, in order. */
|
|
2624
|
+
function variancesScenarios(variances) {
|
|
2625
|
+
const scenarios = [];
|
|
2626
|
+
for (const variance of variances) {
|
|
2627
|
+
const parsed = new VarianceScenario(variance);
|
|
2628
|
+
for (const scenario of parsed.isValid ? [parsed.base, parsed.delta] : []) {
|
|
2629
|
+
if (!scenarios.includes(scenario)) {
|
|
2630
|
+
scenarios.push(scenario);
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
}
|
|
2634
|
+
return scenarios;
|
|
2635
|
+
}
|
|
2596
2636
|
|
|
2597
2637
|
const FAMILIES = ["ac", "pp", "fc", "pl"];
|
|
2598
2638
|
const SLOT_BY_COLOR_INDEX = { 10: "ac", 20: "pp", 30: "fc", 50: "pl" };
|
|
@@ -14236,7 +14276,7 @@ const Chart$1 = class Chart {
|
|
|
14236
14276
|
}
|
|
14237
14277
|
validateScenario(newValue) {
|
|
14238
14278
|
const errId = "WARN_scenarios";
|
|
14239
|
-
if (withTranslation.isInheritedValue(newValue)) {
|
|
14279
|
+
if (withTranslation.isInheritedValue(newValue) || withStyled.isNoScenarios(newValue)) {
|
|
14240
14280
|
this.errors.remove(errId);
|
|
14241
14281
|
return;
|
|
14242
14282
|
}
|
|
@@ -14382,6 +14422,25 @@ const Chart$1 = class Chart {
|
|
|
14382
14422
|
this.errors.remove(errId);
|
|
14383
14423
|
}
|
|
14384
14424
|
}
|
|
14425
|
+
validateDataFormatDigitsDecimal(newValue) {
|
|
14426
|
+
this.validateDigits("dataFormatDigitsDecimal", newValue);
|
|
14427
|
+
}
|
|
14428
|
+
validateDataFormatDigitsPercent(newValue) {
|
|
14429
|
+
this.validateDigits("dataFormatDigitsPercent", newValue);
|
|
14430
|
+
}
|
|
14431
|
+
validateDigits(name, value) {
|
|
14432
|
+
const errId = `WARN_${name}`;
|
|
14433
|
+
if (!withStyled.isValidInteger(value) || Number(value) < 0 || Number(value) > 100) {
|
|
14434
|
+
this.errors.addOrReplace({
|
|
14435
|
+
id: errId,
|
|
14436
|
+
type: "warning",
|
|
14437
|
+
message: name + ": invalid value '" + value + "' is not supported.",
|
|
14438
|
+
});
|
|
14439
|
+
}
|
|
14440
|
+
else {
|
|
14441
|
+
this.errors.remove(errId);
|
|
14442
|
+
}
|
|
14443
|
+
}
|
|
14385
14444
|
validateStack(newValue) {
|
|
14386
14445
|
const errId = "WARN_stack";
|
|
14387
14446
|
const errors = withStyled.validateStackConfig(newValue);
|
|
@@ -14487,6 +14546,14 @@ const Chart$1 = class Chart {
|
|
|
14487
14546
|
* @example measure-unit="EUR"
|
|
14488
14547
|
*/
|
|
14489
14548
|
this.measureUnit = "";
|
|
14549
|
+
/**
|
|
14550
|
+
* Number of decimal digits of the value labels
|
|
14551
|
+
*/
|
|
14552
|
+
this.dataFormatDigitsDecimal = 1;
|
|
14553
|
+
/**
|
|
14554
|
+
* Number of decimal digits of the percent labels (relative variances, shares of a 100 % stack)
|
|
14555
|
+
*/
|
|
14556
|
+
this.dataFormatDigitsPercent = 2;
|
|
14490
14557
|
/**
|
|
14491
14558
|
* Stacking configuration as a JSON string. When set, bars are drawn as
|
|
14492
14559
|
* stacked segments instead of side-by-side.
|
|
@@ -14579,6 +14646,8 @@ const Chart$1 = class Chart {
|
|
|
14579
14646
|
componentWillLoad() {
|
|
14580
14647
|
this.validateFilter(this.filter);
|
|
14581
14648
|
this.validateScenario(this.scenarios);
|
|
14649
|
+
this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal);
|
|
14650
|
+
this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent);
|
|
14582
14651
|
this.validateVariances(this.variances);
|
|
14583
14652
|
this.validateUnitScaling(this.unitScaling);
|
|
14584
14653
|
//this.validateSelectedStyle(this.selectedStyle);
|
|
@@ -14758,8 +14827,7 @@ const Chart$1 = class Chart {
|
|
|
14758
14827
|
}
|
|
14759
14828
|
prepareDimension() {
|
|
14760
14829
|
const parent = withTranslation.getParentDimensions(this.element);
|
|
14761
|
-
const
|
|
14762
|
-
const segmentCount = 1 + variancesList.length;
|
|
14830
|
+
const segmentCount = Math.max(1, this.prepareSegments().length);
|
|
14763
14831
|
this.canvasWidthSegmented = parent.width / segmentCount;
|
|
14764
14832
|
return { width: this.canvasWidthSegmented, height: parent.height };
|
|
14765
14833
|
}
|
|
@@ -14770,6 +14838,10 @@ const Chart$1 = class Chart {
|
|
|
14770
14838
|
this.errors.remove("AUTO_scenarios");
|
|
14771
14839
|
return scenarios.value.split(",").map((entry) => entry.trim());
|
|
14772
14840
|
}
|
|
14841
|
+
if (withStyled.isNoScenarios(scenarios.value)) {
|
|
14842
|
+
this.errors.remove("AUTO_scenarios");
|
|
14843
|
+
return [];
|
|
14844
|
+
}
|
|
14773
14845
|
const isAuto = ((_a = scenarios.value) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
14774
14846
|
if (withStyled.isBlankInput(scenarios.value) || isAuto) {
|
|
14775
14847
|
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
@@ -14798,6 +14870,15 @@ const Chart$1 = class Chart {
|
|
|
14798
14870
|
}
|
|
14799
14871
|
return variances === null || variances === void 0 ? void 0 : variances.split(",").map((entry) => entry.trim());
|
|
14800
14872
|
}
|
|
14873
|
+
/** `scenarios="none"`: the chart draws its variances only. */
|
|
14874
|
+
hidesScenarios() {
|
|
14875
|
+
const scenarios = this.resolveInherited("scenarios", this.scenarios);
|
|
14876
|
+
return !scenarios.inherited && withStyled.isNoScenarios(scenarios.value);
|
|
14877
|
+
}
|
|
14878
|
+
/** The segments side by side: `""` is the base chart, else one variance. */
|
|
14879
|
+
prepareSegments() {
|
|
14880
|
+
return this.hidesScenarios() ? this.prepareVariances() : ["", ...this.prepareVariances()];
|
|
14881
|
+
}
|
|
14801
14882
|
prepareHideCategories(idx) {
|
|
14802
14883
|
return idx >= 1 || !this.showCategories;
|
|
14803
14884
|
}
|
|
@@ -14966,7 +15047,8 @@ const Chart$1 = class Chart {
|
|
|
14966
15047
|
});
|
|
14967
15048
|
}
|
|
14968
15049
|
prepareChartTitle(idx) {
|
|
14969
|
-
|
|
15050
|
+
// a variance keeps its own name as title
|
|
15051
|
+
if (idx >= 1 || this.hidesScenarios()) {
|
|
14970
15052
|
return "";
|
|
14971
15053
|
}
|
|
14972
15054
|
return this.chartTitle;
|
|
@@ -15076,10 +15158,11 @@ const Chart$1 = class Chart {
|
|
|
15076
15158
|
const ppu = this.preparePixelPerUnit();
|
|
15077
15159
|
const ppp = this.preparePixelPerPercentage();
|
|
15078
15160
|
const stackConfig = this.prepareStackConfig();
|
|
15079
|
-
const
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15161
|
+
const isBase = localScenarioString === "";
|
|
15162
|
+
const scenarios = this.hidesScenarios() ? variancesScenarios([localScenarioString]) : this.prepareScenarios();
|
|
15163
|
+
// Dimension stacking uses only the first scenario. Only the base chart draws a stack, a variance needs both of its scenarios
|
|
15164
|
+
const effectiveScenarios = isBase && (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === withStyled.StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
15165
|
+
return (index.h("bn-chart-structure-renderer", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, limit: this.prepareLimit(), styles: this.prepareStyle(), i18n: this.prepareI18n(), order: this.prepareOrder(), level: this.prepareLevel(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(idx), stackConfig: stackConfig, dataFormatDigits: { percent: this.dataFormatDigitsPercent, decimal: this.dataFormatDigitsDecimal }, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
|
|
15083
15166
|
}
|
|
15084
15167
|
/**
|
|
15085
15168
|
* The line this chart wants to be aligned on, in CSS px from the host's
|
|
@@ -15106,7 +15189,7 @@ const Chart$1 = class Chart {
|
|
|
15106
15189
|
const factor = Number.isFinite(rawFactor) && rawFactor > 0 ? rawFactor : 1;
|
|
15107
15190
|
const fontSizePx = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * factor;
|
|
15108
15191
|
const variances = this.prepareVariances();
|
|
15109
|
-
const layout = collectChartFacadeLayout(this.element, "bn-chart-structure-renderer",
|
|
15192
|
+
const layout = collectChartFacadeLayout(this.element, "bn-chart-structure-renderer", this.prepareSegments().map((segment) => segment || "base"), origins, detail);
|
|
15110
15193
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15111
15194
|
const firstInner = (_b = this.element.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("bn-chart-structure-renderer");
|
|
15112
15195
|
const state = {
|
|
@@ -15197,13 +15280,19 @@ const Chart$1 = class Chart {
|
|
|
15197
15280
|
});
|
|
15198
15281
|
}
|
|
15199
15282
|
render() {
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15283
|
+
const scenariosArray = this.prepareSegments();
|
|
15284
|
+
if (scenariosArray.length === 0) {
|
|
15285
|
+
this.errors.addOrReplace({
|
|
15286
|
+
id: "WARN_scenarios_none",
|
|
15287
|
+
type: "warning",
|
|
15288
|
+
message: "scenarios: none needs at least one variance, the chart is empty.",
|
|
15289
|
+
});
|
|
15290
|
+
}
|
|
15291
|
+
else {
|
|
15292
|
+
this.errors.remove("WARN_scenarios_none");
|
|
15204
15293
|
}
|
|
15205
15294
|
const fontStyles = this.getFontStyles();
|
|
15206
|
-
return (index.h(index.Host, { key: '
|
|
15295
|
+
return (index.h(index.Host, { key: 'a9b487fd43e785b1f14d0599ad0145a248b35f5d', style: fontStyles }, index.h("div", { key: '950ab383346b288ab17c2a1bbdfcfcd240e0f4d8', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
15207
15296
|
}
|
|
15208
15297
|
get element() { return index.getElement(this); }
|
|
15209
15298
|
static get watchers() { return {
|
|
@@ -15237,6 +15326,12 @@ const Chart$1 = class Chart {
|
|
|
15237
15326
|
"measureScale": [{
|
|
15238
15327
|
"validateMeasureScale": 0
|
|
15239
15328
|
}],
|
|
15329
|
+
"dataFormatDigitsDecimal": [{
|
|
15330
|
+
"validateDataFormatDigitsDecimal": 0
|
|
15331
|
+
}],
|
|
15332
|
+
"dataFormatDigitsPercent": [{
|
|
15333
|
+
"validateDataFormatDigitsPercent": 0
|
|
15334
|
+
}],
|
|
15240
15335
|
"stack": [{
|
|
15241
15336
|
"validateStack": 0
|
|
15242
15337
|
}],
|
|
@@ -16946,11 +17041,11 @@ let Needle$1 = class Needle {
|
|
|
16946
17041
|
(_a = this.label) === null || _a === void 0 ? void 0 : _a.updateGroup(newGroup);
|
|
16947
17042
|
return this;
|
|
16948
17043
|
}
|
|
16949
|
-
draw() {
|
|
17044
|
+
draw(dataFormatDigits = { percent: 2, decimal: 1 }) {
|
|
16950
17045
|
var _a, _b, _c;
|
|
16951
17046
|
if (((_a = this.dataPoint) === null || _a === void 0 ? void 0 : _a.value) === undefined) {
|
|
16952
17047
|
// reference 0: the label says "n/a", there is no pin
|
|
16953
|
-
(_b = this.label) === null || _b === void 0 ? void 0 : _b.draw();
|
|
17048
|
+
(_b = this.label) === null || _b === void 0 ? void 0 : _b.draw(dataFormatDigits);
|
|
16954
17049
|
return this;
|
|
16955
17050
|
}
|
|
16956
17051
|
if (this.isEmpty()) {
|
|
@@ -16980,7 +17075,7 @@ let Needle$1 = class Needle {
|
|
|
16980
17075
|
.stroke(strokeStyle)
|
|
16981
17076
|
.cy(this.dimensions.yPos)
|
|
16982
17077
|
.x(this.dimensions.xPos);
|
|
16983
|
-
(_c = this.label) === null || _c === void 0 ? void 0 : _c.draw();
|
|
17078
|
+
(_c = this.label) === null || _c === void 0 ? void 0 : _c.draw(dataFormatDigits);
|
|
16984
17079
|
}
|
|
16985
17080
|
createDimensions(position, dataPoint, index) {
|
|
16986
17081
|
if (dataPoint.getScaledPercentUnit() < 0) {
|
|
@@ -18194,7 +18289,7 @@ class StructureChart {
|
|
|
18194
18289
|
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
18195
18290
|
dataModel.forEach((elements, index) => {
|
|
18196
18291
|
if (elements["type"] === VarianceType$1.RELATIVE) {
|
|
18197
|
-
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw();
|
|
18292
|
+
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits);
|
|
18198
18293
|
}
|
|
18199
18294
|
else {
|
|
18200
18295
|
scenarioFactory.createVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
@@ -18506,10 +18601,12 @@ class DataFormatDigits {
|
|
|
18506
18601
|
class DataFormatDigitsAdapter {
|
|
18507
18602
|
adapt(data) {
|
|
18508
18603
|
const prefix = new DataFormatDigits();
|
|
18509
|
-
|
|
18604
|
+
// Intl.NumberFormat throws outside 0 to 100
|
|
18605
|
+
const valid = (value) => withStyled.CompareUtil.isNumber(value) && Number.isInteger(value) && value >= 0 && value <= 100;
|
|
18606
|
+
if (valid(data.percent)) {
|
|
18510
18607
|
prefix.percent = data.percent;
|
|
18511
18608
|
}
|
|
18512
|
-
if (
|
|
18609
|
+
if (valid(data.decimal)) {
|
|
18513
18610
|
prefix.decimal = data.decimal;
|
|
18514
18611
|
}
|
|
18515
18612
|
return prefix;
|
|
@@ -18837,7 +18934,7 @@ const Chart = class {
|
|
|
18837
18934
|
}
|
|
18838
18935
|
validateScenario(newValue) {
|
|
18839
18936
|
const errId = "WARN_scenarios";
|
|
18840
|
-
if (withTranslation.isInheritedValue(newValue)) {
|
|
18937
|
+
if (withTranslation.isInheritedValue(newValue) || withStyled.isNoScenarios(newValue)) {
|
|
18841
18938
|
this.errors.remove(errId);
|
|
18842
18939
|
return;
|
|
18843
18940
|
}
|
|
@@ -19025,6 +19122,51 @@ const Chart = class {
|
|
|
19025
19122
|
this.errors.remove(errId);
|
|
19026
19123
|
}
|
|
19027
19124
|
}
|
|
19125
|
+
validateDataFormatDigitsDecimal(newValue) {
|
|
19126
|
+
this.validateDigits("dataFormatDigitsDecimal", newValue);
|
|
19127
|
+
}
|
|
19128
|
+
validateDataFormatDigitsPercent(newValue) {
|
|
19129
|
+
this.validateDigits("dataFormatDigitsPercent", newValue);
|
|
19130
|
+
}
|
|
19131
|
+
validateDigits(name, value) {
|
|
19132
|
+
const errId = `WARN_${name}`;
|
|
19133
|
+
if (!withStyled.isValidInteger(value) || Number(value) < 0 || Number(value) > 100) {
|
|
19134
|
+
this.errors.addOrReplace({
|
|
19135
|
+
id: errId,
|
|
19136
|
+
type: "warning",
|
|
19137
|
+
message: name + ": invalid value '" + value + "' is not supported.",
|
|
19138
|
+
});
|
|
19139
|
+
}
|
|
19140
|
+
else {
|
|
19141
|
+
this.errors.remove(errId);
|
|
19142
|
+
}
|
|
19143
|
+
}
|
|
19144
|
+
validateAxisLabelsStep(newValue) {
|
|
19145
|
+
const errId = "WARN_axisLabelsStep";
|
|
19146
|
+
if (!withStyled.isValidInteger(newValue) || Number(newValue) < 1) {
|
|
19147
|
+
this.errors.addOrReplace({
|
|
19148
|
+
id: errId,
|
|
19149
|
+
type: "warning",
|
|
19150
|
+
message: "axisLabelsStep: invalid value '" + newValue + "' is not supported.",
|
|
19151
|
+
});
|
|
19152
|
+
}
|
|
19153
|
+
else {
|
|
19154
|
+
this.errors.remove(errId);
|
|
19155
|
+
}
|
|
19156
|
+
}
|
|
19157
|
+
validateAxisTitlePosition(newValue) {
|
|
19158
|
+
const errId = "WARN_axisTitlePosition";
|
|
19159
|
+
if (!withStyled.isBlankInput(newValue) && !["left", "right", "none"].includes(newValue.trim().toLowerCase())) {
|
|
19160
|
+
this.errors.addOrReplace({
|
|
19161
|
+
id: errId,
|
|
19162
|
+
type: "warning",
|
|
19163
|
+
message: "axisTitlePosition: invalid value '" + newValue + "' is not supported.",
|
|
19164
|
+
});
|
|
19165
|
+
}
|
|
19166
|
+
else {
|
|
19167
|
+
this.errors.remove(errId);
|
|
19168
|
+
}
|
|
19169
|
+
}
|
|
19028
19170
|
constructor(hostRef) {
|
|
19029
19171
|
index.registerInstance(this, hostRef);
|
|
19030
19172
|
/** Active dataset name (the last subscribed dataset to fire `onUpdate`). */
|
|
@@ -19163,6 +19305,35 @@ const Chart = class {
|
|
|
19163
19305
|
* measureUnit displayed in table.
|
|
19164
19306
|
*/
|
|
19165
19307
|
this.measureUnit = "";
|
|
19308
|
+
/**
|
|
19309
|
+
* Number of decimal digits of the value labels
|
|
19310
|
+
*/
|
|
19311
|
+
this.dataFormatDigitsDecimal = 1;
|
|
19312
|
+
/**
|
|
19313
|
+
* Number of decimal digits of the percent labels (relative variances)
|
|
19314
|
+
*/
|
|
19315
|
+
this.dataFormatDigitsPercent = 2;
|
|
19316
|
+
/**
|
|
19317
|
+
* Prints only every n-th category label, starting with the first period.
|
|
19318
|
+
* 2 labels every second period. Bar mode only.
|
|
19319
|
+
*/
|
|
19320
|
+
this.axisLabelsStep = 1;
|
|
19321
|
+
/**
|
|
19322
|
+
* For a series that changes its scenario along the time axis, for example
|
|
19323
|
+
* AC up to this year and PL after it. In a period where the first scenario
|
|
19324
|
+
* has no value, the next scenario with a value is drawn in its place with
|
|
19325
|
+
* its value label. A vertical line marks the change, and the scenario names
|
|
19326
|
+
* stand under the axis. Variances with the same reference and type share
|
|
19327
|
+
* one row. Bar mode without stack only.
|
|
19328
|
+
*/
|
|
19329
|
+
this.scenarioSwitch = false;
|
|
19330
|
+
/**
|
|
19331
|
+
* Where the axis title stands (the chart title, or the name of a variance).
|
|
19332
|
+
* <br /><br />
|
|
19333
|
+
* values:<br />
|
|
19334
|
+
* ```left // right // none```
|
|
19335
|
+
*/
|
|
19336
|
+
this.axisTitlePosition = "left";
|
|
19166
19337
|
this.pixelPerUnitGroupMap = new Map();
|
|
19167
19338
|
this._autoScaleGuard = false;
|
|
19168
19339
|
this._lastObservedWidth = 0;
|
|
@@ -19241,6 +19412,10 @@ const Chart = class {
|
|
|
19241
19412
|
this.validateMaxBars(this.maxBars);
|
|
19242
19413
|
this.validateStack(this.stack);
|
|
19243
19414
|
this.validateScaling(this.scale);
|
|
19415
|
+
this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal);
|
|
19416
|
+
this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent);
|
|
19417
|
+
this.validateAxisLabelsStep(this.axisLabelsStep);
|
|
19418
|
+
this.validateAxisTitlePosition(this.axisTitlePosition);
|
|
19244
19419
|
}
|
|
19245
19420
|
/**
|
|
19246
19421
|
* Content width from the rendered SVG width attributes (segments stack
|
|
@@ -19454,14 +19629,14 @@ const Chart = class {
|
|
|
19454
19629
|
prepareDimension() {
|
|
19455
19630
|
const parent = withTranslation.getParentDimensions(this.element);
|
|
19456
19631
|
const scenariosList = this.prepareScenarios();
|
|
19457
|
-
const
|
|
19458
|
-
this.canvasWidthSegmented = parent.width / (scenariosList.length +
|
|
19632
|
+
const segments = this.prepareSegments();
|
|
19633
|
+
this.canvasWidthSegmented = parent.width / (scenariosList.length + this.prepareVariances().length || 1);
|
|
19459
19634
|
this._lastAppliedHeight = parent.height;
|
|
19460
19635
|
// The base chart and each variance render as vertically stacked segments
|
|
19461
19636
|
// (see render()), so each one may only claim its share of the height.
|
|
19462
19637
|
// The measure-scale footer (first segment only) renders below its SVG:
|
|
19463
19638
|
// reserve roughly one em for it so the fitted charts leave it room.
|
|
19464
|
-
const segmentCount = 1
|
|
19639
|
+
const segmentCount = Math.max(1, segments.length);
|
|
19465
19640
|
const footerAllowance = this.showMeasureScale ? this.getEffectiveFontPx() : 0;
|
|
19466
19641
|
return { width: this.canvasWidthSegmented, height: Math.max(0, parent.height - footerAllowance) / segmentCount };
|
|
19467
19642
|
}
|
|
@@ -19472,6 +19647,10 @@ const Chart = class {
|
|
|
19472
19647
|
this.errors.remove("AUTO_scenarios");
|
|
19473
19648
|
return scenarios.value.split(",").map((entry) => entry.trim());
|
|
19474
19649
|
}
|
|
19650
|
+
if (withStyled.isNoScenarios(scenarios.value)) {
|
|
19651
|
+
this.errors.remove("AUTO_scenarios");
|
|
19652
|
+
return [];
|
|
19653
|
+
}
|
|
19475
19654
|
const isAuto = ((_a = scenarios.value) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
19476
19655
|
if (withStyled.isBlankInput(scenarios.value) || isAuto) {
|
|
19477
19656
|
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
@@ -19493,6 +19672,40 @@ const Chart = class {
|
|
|
19493
19672
|
this.errors.remove("AUTO_scenarios");
|
|
19494
19673
|
return (_d = scenarios.value) === null || _d === void 0 ? void 0 : _d.split(",").map((entry) => entry.trim());
|
|
19495
19674
|
}
|
|
19675
|
+
/** `scenarios="none"`: the chart draws its variances only. */
|
|
19676
|
+
hidesScenarios() {
|
|
19677
|
+
const scenarios = this.resolveInherited("scenarios", this.scenarios);
|
|
19678
|
+
return !scenarios.inherited && withStyled.isNoScenarios(scenarios.value);
|
|
19679
|
+
}
|
|
19680
|
+
/**
|
|
19681
|
+
* The stacked segments, bottom to top: `[]` is the base chart, else the
|
|
19682
|
+
* variances of one row. With `scenarioSwitch`, variances of one type over
|
|
19683
|
+
* the same reference share a row.
|
|
19684
|
+
*/
|
|
19685
|
+
prepareSegments() {
|
|
19686
|
+
const rows = this.hidesScenarios() ? [] : [[]];
|
|
19687
|
+
const rowByKey = new Map();
|
|
19688
|
+
for (const variance of this.prepareVariances()) {
|
|
19689
|
+
const parsed = new VarianceScenario(variance);
|
|
19690
|
+
const key = `${parsed.type}:${parsed.delta}`;
|
|
19691
|
+
const row = this.scenarioSwitch && parsed.isValid ? rowByKey.get(key) : undefined;
|
|
19692
|
+
if (row) {
|
|
19693
|
+
row.push(variance);
|
|
19694
|
+
continue;
|
|
19695
|
+
}
|
|
19696
|
+
const created = [variance];
|
|
19697
|
+
rows.push(created);
|
|
19698
|
+
if (parsed.isValid) {
|
|
19699
|
+
rowByKey.set(key, created);
|
|
19700
|
+
}
|
|
19701
|
+
}
|
|
19702
|
+
return rows;
|
|
19703
|
+
}
|
|
19704
|
+
prepareAxisTitlePosition() {
|
|
19705
|
+
var _a;
|
|
19706
|
+
const position = (_a = this.axisTitlePosition) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase();
|
|
19707
|
+
return position === "right" || position === "none" ? position : "left";
|
|
19708
|
+
}
|
|
19496
19709
|
prepareAvg() {
|
|
19497
19710
|
return this.showOverlayAvg;
|
|
19498
19711
|
}
|
|
@@ -19523,7 +19736,7 @@ const Chart = class {
|
|
|
19523
19736
|
}
|
|
19524
19737
|
}
|
|
19525
19738
|
}
|
|
19526
|
-
if (scenarios.length > 0 && missing.length > 0) {
|
|
19739
|
+
if (!this.hidesScenarios() && scenarios.length > 0 && missing.length > 0) {
|
|
19527
19740
|
this.errors.addOrReplace({
|
|
19528
19741
|
id: errId,
|
|
19529
19742
|
type: "warning",
|
|
@@ -19538,7 +19751,7 @@ const Chart = class {
|
|
|
19538
19751
|
return idx >= 1 || !this.showCategories;
|
|
19539
19752
|
}
|
|
19540
19753
|
prepareI18n() {
|
|
19541
|
-
const i18nMetaLabelsLocal = ["no-data"];
|
|
19754
|
+
const i18nMetaLabelsLocal = ["no-data", "date-format-short-year"];
|
|
19542
19755
|
const i18nMetaLabelsGlobal = withHasError.globalLabelKeys;
|
|
19543
19756
|
const i18nMapLocal = new Map(i18nMetaLabelsLocal.map((key) => [key, this.t(".".concat(key))]));
|
|
19544
19757
|
const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
|
|
@@ -19648,14 +19861,17 @@ const Chart = class {
|
|
|
19648
19861
|
if (this.syncSpaceLeft > -1) {
|
|
19649
19862
|
return this.syncSpaceLeft;
|
|
19650
19863
|
}
|
|
19651
|
-
|
|
19864
|
+
// without a title on the left only the scenario names stand there
|
|
19865
|
+
const titles = this.prepareAxisTitlePosition() === "left" ? [...this.prepareVariances(), this.chartTitle] : [];
|
|
19866
|
+
const leftSideOffset = Formatter.getMaxWidthOfArrayItems([...titles, ...this.prepareScenarios()], preparedI18n, preparedStyle);
|
|
19652
19867
|
//if(leftSideOffset < this.syncSpaceLeft) {
|
|
19653
19868
|
// return this.syncSpaceLeft;
|
|
19654
19869
|
//}
|
|
19655
19870
|
return leftSideOffset;
|
|
19656
19871
|
}
|
|
19657
19872
|
prepareChartTitle(idx) {
|
|
19658
|
-
|
|
19873
|
+
// a variance keeps its own name as title
|
|
19874
|
+
if (idx >= 1 || this.hidesScenarios()) {
|
|
19659
19875
|
return "";
|
|
19660
19876
|
}
|
|
19661
19877
|
return this.chartTitle;
|
|
@@ -19807,16 +20023,18 @@ const Chart = class {
|
|
|
19807
20023
|
prepareMaxBars() {
|
|
19808
20024
|
return Math.floor(Number(this.maxBars) || 28);
|
|
19809
20025
|
}
|
|
19810
|
-
chartTemplate(
|
|
20026
|
+
chartTemplate(segmentVariances, idx) {
|
|
19811
20027
|
const preparedI18n = this.prepareI18n();
|
|
19812
20028
|
const preparedStyle = this.prepareStyle();
|
|
19813
20029
|
const fullParentWidth = withTranslation.getParentDimensions(this.element).width;
|
|
19814
20030
|
const ppu = this.preparePixelPerUnit();
|
|
19815
20031
|
const ppp = this.preparePixelPerPercentage();
|
|
19816
20032
|
const stackConfig = this.prepareStackConfig();
|
|
19817
|
-
const
|
|
19818
|
-
const
|
|
19819
|
-
|
|
20033
|
+
const isBase = segmentVariances.length === 0;
|
|
20034
|
+
const scenarios = this.hidesScenarios() ? variancesScenarios(segmentVariances) : this.prepareScenarios();
|
|
20035
|
+
// only the base chart draws a stack, a variance needs both of its scenarios
|
|
20036
|
+
const effectiveScenarios = isBase && (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === withStyled.StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
20037
|
+
return (index.h("bn-chart-time-renderer", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: segmentVariances.length > 0 ? segmentVariances : [""], hideAxisLabels: this.prepareHideAxisLabels(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, leftSideOffsetForHorizontalSync: this.prepareLeftSideOffset(preparedI18n, preparedStyle), styles: preparedStyle, i18n: preparedI18n, dateInterval: this.prepareDateInterval(), intervalSpanLimit: this.prepareIntervalSpanLimit(), axisLabelsMode: this.prepareAxisLabelsMode(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showOverlayAvg: this.prepareAvg(), showOverlayMedian: this.prepareMedian(), showMeasureScale: this.prepareShowMeasureScale(idx), chartMode: this.prepareChartMode(), maxBars: this.prepareMaxBars(), stackConfig: stackConfig, lineFullWidth: this.prepareLineFullWidth(), dataFormatDigits: { percent: this.dataFormatDigitsPercent, decimal: this.dataFormatDigitsDecimal }, axisLabelsStep: Math.max(1, Math.floor(Number(this.axisLabelsStep) || 1)), scenarioSwitch: this.scenarioSwitch, axisTitlePosition: this.prepareAxisTitlePosition(), containerWidth: fullParentWidth, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
|
|
19820
20038
|
}
|
|
19821
20039
|
/**
|
|
19822
20040
|
* The line this chart wants to be aligned on, in CSS px from the host's
|
|
@@ -19843,7 +20061,7 @@ const Chart = class {
|
|
|
19843
20061
|
const factor = Number.isFinite(rawFactor) && rawFactor > 0 ? rawFactor : 1;
|
|
19844
20062
|
const fontSizePx = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * factor;
|
|
19845
20063
|
const variances = this.prepareVariances();
|
|
19846
|
-
const layout = collectChartFacadeLayout(this.element, "bn-chart-time-renderer",
|
|
20064
|
+
const layout = collectChartFacadeLayout(this.element, "bn-chart-time-renderer", this.prepareSegments().map((segment) => (segment.length > 0 ? segment.join(",") : "base")), origins, detail);
|
|
19847
20065
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19848
20066
|
const firstInner = (_b = this.element.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("bn-chart-time-renderer");
|
|
19849
20067
|
const state = {
|
|
@@ -19935,14 +20153,20 @@ const Chart = class {
|
|
|
19935
20153
|
});
|
|
19936
20154
|
}
|
|
19937
20155
|
render() {
|
|
19938
|
-
|
|
19939
|
-
const
|
|
19940
|
-
|
|
19941
|
-
|
|
19942
|
-
|
|
20156
|
+
this.checkVarianceScenarios(this.prepareVariances());
|
|
20157
|
+
const segments = this.prepareSegments();
|
|
20158
|
+
if (segments.length === 0) {
|
|
20159
|
+
this.errors.addOrReplace({
|
|
20160
|
+
id: "WARN_scenarios_none",
|
|
20161
|
+
type: "warning",
|
|
20162
|
+
message: "scenarios: none needs at least one variance, the chart is empty.",
|
|
20163
|
+
});
|
|
20164
|
+
}
|
|
20165
|
+
else {
|
|
20166
|
+
this.errors.remove("WARN_scenarios_none");
|
|
19943
20167
|
}
|
|
19944
20168
|
const fontStyles = this.getFontStyles();
|
|
19945
|
-
return (index.h(index.Host, { key: '
|
|
20169
|
+
return (index.h(index.Host, { key: '530c7c27c23afc339ca03506f2cb608774e8a7ed', style: fontStyles }, index.h("div", { key: '99bbe8fa9d17ef14bbb6a3b5e2dce21025cdc40c', class: "container" }, segments.map(this.chartTemplate))));
|
|
19946
20170
|
}
|
|
19947
20171
|
get element() { return index.getElement(this); }
|
|
19948
20172
|
static get watchers() { return {
|
|
@@ -19984,6 +20208,18 @@ const Chart = class {
|
|
|
19984
20208
|
}],
|
|
19985
20209
|
"measureScale": [{
|
|
19986
20210
|
"validateMeasureScale": 0
|
|
20211
|
+
}],
|
|
20212
|
+
"dataFormatDigitsDecimal": [{
|
|
20213
|
+
"validateDataFormatDigitsDecimal": 0
|
|
20214
|
+
}],
|
|
20215
|
+
"dataFormatDigitsPercent": [{
|
|
20216
|
+
"validateDataFormatDigitsPercent": 0
|
|
20217
|
+
}],
|
|
20218
|
+
"axisLabelsStep": [{
|
|
20219
|
+
"validateAxisLabelsStep": 0
|
|
20220
|
+
}],
|
|
20221
|
+
"axisTitlePosition": [{
|
|
20222
|
+
"validateAxisTitlePosition": 0
|
|
19987
20223
|
}]
|
|
19988
20224
|
}; }
|
|
19989
20225
|
};
|
|
@@ -20422,6 +20658,8 @@ class CustomPattern {
|
|
|
20422
20658
|
*/
|
|
20423
20659
|
class DataPoint {
|
|
20424
20660
|
constructor(value, scenario, pixelPerUnit, variance) {
|
|
20661
|
+
/** Relative variances beyond this fraction are cut. Infinity when the chart has room for the full pin. */
|
|
20662
|
+
this.percentClamp = DataPoint.PERCENT_CLAMP;
|
|
20425
20663
|
this.value = value;
|
|
20426
20664
|
this.scenario = scenario;
|
|
20427
20665
|
this.pixelPerUnit = pixelPerUnit || 1;
|
|
@@ -20448,7 +20686,7 @@ class DataPoint {
|
|
|
20448
20686
|
return this.value * this.pixelPerUnit;
|
|
20449
20687
|
}
|
|
20450
20688
|
/**
|
|
20451
|
-
* Returns the percentage value scaled to pixel height, clipped at +/-145
|
|
20689
|
+
* Returns the percentage value scaled to pixel height, clipped at +/-145% unless the clamp is lifted.
|
|
20452
20690
|
*
|
|
20453
20691
|
* Values beyond +/-1.45 (145%) are clamped to prevent extreme bars from
|
|
20454
20692
|
* distorting the chart layout. Use {@link isClipped} to check if clipping occurred.
|
|
@@ -20457,11 +20695,11 @@ class DataPoint {
|
|
|
20457
20695
|
if (this.value == null) {
|
|
20458
20696
|
return 0;
|
|
20459
20697
|
}
|
|
20460
|
-
if (this.value >
|
|
20461
|
-
return
|
|
20698
|
+
if (this.value > this.percentClamp) {
|
|
20699
|
+
return this.percentClamp * this.pixelPerUnit;
|
|
20462
20700
|
}
|
|
20463
|
-
if (this.value < -
|
|
20464
|
-
return -
|
|
20701
|
+
if (this.value < -this.percentClamp) {
|
|
20702
|
+
return -this.percentClamp * this.pixelPerUnit;
|
|
20465
20703
|
}
|
|
20466
20704
|
return this.value * this.pixelPerUnit;
|
|
20467
20705
|
}
|
|
@@ -20492,7 +20730,7 @@ class DataPoint {
|
|
|
20492
20730
|
if (this.value == null) {
|
|
20493
20731
|
return false;
|
|
20494
20732
|
}
|
|
20495
|
-
return Math.abs(this.value) >
|
|
20733
|
+
return Math.abs(this.value) > this.percentClamp;
|
|
20496
20734
|
}
|
|
20497
20735
|
/** Returns the fixed display value (145) shown on clipped percentage bars. */
|
|
20498
20736
|
getClippedValue() {
|
|
@@ -20504,6 +20742,7 @@ class DataPoint {
|
|
|
20504
20742
|
return (_a = this.scenario) === null || _a === void 0 ? void 0 : _a.slice(0, 2);
|
|
20505
20743
|
}
|
|
20506
20744
|
}
|
|
20745
|
+
DataPoint.PERCENT_CLAMP = 1.45;
|
|
20507
20746
|
|
|
20508
20747
|
// import { IAdapter } from "../../../../utils/helper/IAdapter";
|
|
20509
20748
|
// import { CompareUtil } from "../../../../utils/helper/CompareUtil";
|
|
@@ -20766,6 +21005,7 @@ class Axis {
|
|
|
20766
21005
|
this.scenarioType = axis.scenarioType;
|
|
20767
21006
|
this.labelText = axis.labelText || null;
|
|
20768
21007
|
this.isRelative = axis.isRelative || false;
|
|
21008
|
+
this.titlePosition = axis.titlePosition || "left";
|
|
20769
21009
|
this.position = position;
|
|
20770
21010
|
this.svgGroup = svgParentGroup.group().id(this.ID_AXIS);
|
|
20771
21011
|
}
|
|
@@ -20773,12 +21013,19 @@ class Axis {
|
|
|
20773
21013
|
if (null == text) {
|
|
20774
21014
|
text = "";
|
|
20775
21015
|
}
|
|
21016
|
+
if (this.titlePosition === "right") {
|
|
21017
|
+
group
|
|
21018
|
+
.text(text)
|
|
21019
|
+
.addClass(this.CSS_AXIS_TITLE)
|
|
21020
|
+
.move(this.position.getAxisEndPositionX() + this.position.spacings.labelToColumn, this.position.getAxisTitlePositionY(true, this.isRelative));
|
|
21021
|
+
return;
|
|
21022
|
+
}
|
|
20776
21023
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20777
21024
|
const title = group.text(text).addClass(this.CSS_AXIS_TITLE).attr("text-anchor", "middle");
|
|
20778
21025
|
title.move(this.position.getAxisTitlePositionX(group), this.position.getAxisTitlePositionY(true, this.isRelative));
|
|
20779
21026
|
}
|
|
20780
21027
|
draw() {
|
|
20781
|
-
if (this.labelText) {
|
|
21028
|
+
if (this.labelText && this.titlePosition !== "none") {
|
|
20782
21029
|
this.drawAxisTitle(this.svgGroup, this.labelText);
|
|
20783
21030
|
}
|
|
20784
21031
|
this.svgGroup
|
|
@@ -20863,16 +21110,22 @@ class Column {
|
|
|
20863
21110
|
return this;
|
|
20864
21111
|
}
|
|
20865
21112
|
draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
|
|
20866
|
-
var _a;
|
|
21113
|
+
var _a, _b, _c;
|
|
20867
21114
|
// TODE: JHE: Remove DataFOrmatDigits Type Duplicates
|
|
20868
21115
|
if (this.isEmpty()) {
|
|
20869
21116
|
return this;
|
|
20870
21117
|
}
|
|
20871
21118
|
const scenarioStyle = this.getScenarioStyle();
|
|
20872
|
-
|
|
20873
|
-
|
|
21119
|
+
let strokeStyle = this.convertToSVGStyle(scenarioStyle, "stroke");
|
|
21120
|
+
let fillStyle = this.getFillStyle(scenarioStyle);
|
|
21121
|
+
if (this.isVarianceColumn && this.dataPoint.notation === "pl") {
|
|
21122
|
+
// outlined like a plan column: the colour of the variance on the edge only
|
|
21123
|
+
const planWidth = Number((_b = (_a = this.columnBarStyles) === null || _a === void 0 ? void 0 : _a.pl) === null || _b === void 0 ? void 0 : _b.width);
|
|
21124
|
+
strokeStyle = { color: (scenarioStyle === null || scenarioStyle === void 0 ? void 0 : scenarioStyle.fill) || this.FALLBACK_COLOUR, width: planWidth > 0 ? planWidth : 1 };
|
|
21125
|
+
fillStyle = this.styles.fontStyles.background || "#ffffff";
|
|
21126
|
+
}
|
|
20874
21127
|
this.scenarioGroup.attr(dataPointAttributes(this.dataPoint.key));
|
|
20875
|
-
(
|
|
21128
|
+
(_c = this.columnGroup) === null || _c === void 0 ? void 0 : _c.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
20876
21129
|
if (this.columnGroup != null) {
|
|
20877
21130
|
if (this.isOverflowing && this.overflowConfig) {
|
|
20878
21131
|
this.drawOverdriveBar(fillStyle, strokeStyle);
|
|
@@ -21239,11 +21492,11 @@ class Needle {
|
|
|
21239
21492
|
(_a = this.dataLabel) === null || _a === void 0 ? void 0 : _a.updateGroup(newGroup);
|
|
21240
21493
|
return this;
|
|
21241
21494
|
}
|
|
21242
|
-
draw() {
|
|
21495
|
+
draw(dataFormatDigits = { percent: 2, decimal: 1 }) {
|
|
21243
21496
|
var _a, _b, _c;
|
|
21244
21497
|
if (((_a = this.dataPoint) === null || _a === void 0 ? void 0 : _a.value) === undefined) {
|
|
21245
21498
|
// reference 0: the label says "n/a", there is no pin
|
|
21246
|
-
(_b = this.dataLabel) === null || _b === void 0 ? void 0 : _b.draw();
|
|
21499
|
+
(_b = this.dataLabel) === null || _b === void 0 ? void 0 : _b.draw(true, dataFormatDigits);
|
|
21247
21500
|
return this;
|
|
21248
21501
|
}
|
|
21249
21502
|
if (this.isEmpty()) {
|
|
@@ -21263,6 +21516,12 @@ class Needle {
|
|
|
21263
21516
|
fillStyle = polygonPattern.pattern;
|
|
21264
21517
|
}
|
|
21265
21518
|
}
|
|
21519
|
+
if (this.dataPoint.notation === "pl") {
|
|
21520
|
+
// outlined like a plan column: the colour of the variance on the edge only
|
|
21521
|
+
strokeStyle.color = (scenarioStyle === null || scenarioStyle === void 0 ? void 0 : scenarioStyle.fill) || strokeStyle.color;
|
|
21522
|
+
strokeStyle.width = Math.max(1, Number(strokeStyle.width) || 0);
|
|
21523
|
+
fillStyle = this.styles.fontStyles.background || "#ffffff";
|
|
21524
|
+
}
|
|
21266
21525
|
if (this.dimensions.clipped) {
|
|
21267
21526
|
this.createClippedNeedleHead(fillStyle, strokeStyle);
|
|
21268
21527
|
}
|
|
@@ -21275,7 +21534,7 @@ class Needle {
|
|
|
21275
21534
|
.y(this.dimensions.yPos)
|
|
21276
21535
|
.fill(fillStyle)
|
|
21277
21536
|
.stroke(strokeStyle);
|
|
21278
|
-
(_c = this.dataLabel) === null || _c === void 0 ? void 0 : _c.draw();
|
|
21537
|
+
(_c = this.dataLabel) === null || _c === void 0 ? void 0 : _c.draw(true, dataFormatDigits);
|
|
21279
21538
|
}
|
|
21280
21539
|
createDimensions(position, dataPoint, index) {
|
|
21281
21540
|
if (dataPoint.getScaledPercentUnit() < 0) {
|
|
@@ -21990,12 +22249,12 @@ class ScenarioFactory {
|
|
|
21990
22249
|
}
|
|
21991
22250
|
return new Line(this.position, this.styles, dataPoint, previousDataPoint, index, isPrimaryColumn, columnGroup, lineLabel).updateLabelGroup(labelGroup);
|
|
21992
22251
|
}
|
|
21993
|
-
createPrimaryBar(dataPoint, index) {
|
|
22252
|
+
createPrimaryBar(dataPoint, index, withScenarioLabel = true) {
|
|
21994
22253
|
const isPrimaryColumn = true;
|
|
21995
22254
|
const columnGroup = this.svgGroups.scenario1.group().id("" + index);
|
|
21996
22255
|
const labelGroup = this.svgGroups.scenario1Label.group().id("" + index);
|
|
21997
22256
|
let columnLabel = null;
|
|
21998
|
-
if (this.isLastDataPoint(index)) {
|
|
22257
|
+
if (withScenarioLabel && this.isLastDataPoint(index)) {
|
|
21999
22258
|
columnLabel = `${this.i18n.get(dataPoint.scenario) || dataPoint.scenario}`;
|
|
22000
22259
|
}
|
|
22001
22260
|
return new Column(this.position, this.styles, dataPoint, index, isPrimaryColumn, columnGroup, columnLabel, this.overflowConfig).updateLabelGroup(labelGroup);
|
|
@@ -22218,6 +22477,11 @@ class TimeChart {
|
|
|
22218
22477
|
this.availableWidth = 0;
|
|
22219
22478
|
this.overflowConfig = null;
|
|
22220
22479
|
this.lastScenarios = [];
|
|
22480
|
+
this.axisLabelsStep = 1;
|
|
22481
|
+
this.scenarioSwitch = false;
|
|
22482
|
+
this.axisTitlePosition = "left";
|
|
22483
|
+
/** Periods in which more than one variance of a shared row has a value. */
|
|
22484
|
+
this.varianceOverlaps = 0;
|
|
22221
22485
|
this.db = db;
|
|
22222
22486
|
this.tableName = tableName;
|
|
22223
22487
|
this.ruleSet = ruleSet || new IBCSRuleSet();
|
|
@@ -22272,7 +22536,8 @@ class TimeChart {
|
|
|
22272
22536
|
this.position.padding.top +
|
|
22273
22537
|
this.position.padding.bottom +
|
|
22274
22538
|
this.position.spacings.labelToAxis +
|
|
22275
|
-
fontSize
|
|
22539
|
+
fontSize + // axis labels approximate height
|
|
22540
|
+
this.switchNamesHeight();
|
|
22276
22541
|
const overdriveZoneHeight = fontSize * 1.5;
|
|
22277
22542
|
const breakGap = fontSize * 0.3;
|
|
22278
22543
|
const cutHeight = availableHeight - nonBarOverhead - overdriveZoneHeight - breakGap;
|
|
@@ -22296,7 +22561,7 @@ class TimeChart {
|
|
|
22296
22561
|
};
|
|
22297
22562
|
}
|
|
22298
22563
|
setConfig(config) {
|
|
22299
|
-
var _a;
|
|
22564
|
+
var _a, _b, _c, _d;
|
|
22300
22565
|
this.state = FactoryState$1.DIRTY;
|
|
22301
22566
|
// Must precede setSource/populateModel: the locale is baked into the
|
|
22302
22567
|
// normalizeDate() SQL as well as into the axis date labels.
|
|
@@ -22309,11 +22574,14 @@ class TimeChart {
|
|
|
22309
22574
|
this.pixelPerPercentage = config.pixelPerPercentage;
|
|
22310
22575
|
this.axisLabelsMode = config.axisLabelsMode;
|
|
22311
22576
|
this.intervalSpanLimit = config.intervalSpanLimit;
|
|
22577
|
+
this.axisLabelsStep = (_a = config.axisLabelsStep) !== null && _a !== void 0 ? _a : 1;
|
|
22578
|
+
this.scenarioSwitch = (_b = config.scenarioSwitch) !== null && _b !== void 0 ? _b : false;
|
|
22579
|
+
this.axisTitlePosition = (_c = config.axisTitlePosition) !== null && _c !== void 0 ? _c : "left";
|
|
22312
22580
|
this.dateInterval = this.findDateInterval(config.dateInterval);
|
|
22313
22581
|
this.dataModel = this.populateModel(scenarios, this.dateInterval);
|
|
22314
22582
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
22315
22583
|
this.configTitle = config.title;
|
|
22316
|
-
this.configVariances = (
|
|
22584
|
+
this.configVariances = (_d = config === null || config === void 0 ? void 0 : config.variances) !== null && _d !== void 0 ? _d : [];
|
|
22317
22585
|
this.updateTitle();
|
|
22318
22586
|
this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
|
|
22319
22587
|
this.smallestVarianceDataPointValue = this.findSmallestDataPointValue(this.variancesDataModel);
|
|
@@ -22381,8 +22649,10 @@ class TimeChart {
|
|
|
22381
22649
|
}
|
|
22382
22650
|
/** Derives the variance title from the stored config and the current i18n map. */
|
|
22383
22651
|
updateTitle() {
|
|
22384
|
-
var _a;
|
|
22385
|
-
|
|
22652
|
+
var _a, _b;
|
|
22653
|
+
// variances that share a row have the same reference: the first one names the row
|
|
22654
|
+
const variance = this.scenarioSwitch ? (_a = this.configVariances) === null || _a === void 0 ? void 0 : _a[0] : (_b = this.configVariances) === null || _b === void 0 ? void 0 : _b.toString();
|
|
22655
|
+
this.title = this.configTitle || Formatter.translateScenarioLabel(variance, this.i18n);
|
|
22386
22656
|
}
|
|
22387
22657
|
/**
|
|
22388
22658
|
* Resolves the dataset (a table or view in the shared alasql database) and
|
|
@@ -22423,7 +22693,15 @@ class TimeChart {
|
|
|
22423
22693
|
// Also consider bbox-based measurement as a fallback (works for rects)
|
|
22424
22694
|
const bboxWidth = Math.max(this.axisCategoryArea.width, this.scenariosArea.width);
|
|
22425
22695
|
const bboxTotal = bboxWidth > 0 ? bboxWidth + this.position.leftSideLabelLength : 0;
|
|
22426
|
-
|
|
22696
|
+
let titleEnd = 0;
|
|
22697
|
+
if (this.axisTitlePosition === "right" && this.title) {
|
|
22698
|
+
const titleWidth = CalculateSize(this.title, {
|
|
22699
|
+
font: this.styles.fontStyles.font,
|
|
22700
|
+
fontSize: this.styles.fontStyles.size + "px",
|
|
22701
|
+
}).width;
|
|
22702
|
+
titleEnd = axisEnd + this.position.spacings.labelToColumn + titleWidth + this.styles.padding.right;
|
|
22703
|
+
}
|
|
22704
|
+
return Math.max(axisEnd + labelBuffer, bboxTotal, titleEnd);
|
|
22427
22705
|
}
|
|
22428
22706
|
getAllocatedCanvasHeight() {
|
|
22429
22707
|
if (this.smallestVarianceDataPointValue.value == null ||
|
|
@@ -22454,7 +22732,91 @@ class TimeChart {
|
|
|
22454
22732
|
const bboxHeight = isOnSameAxisSide
|
|
22455
22733
|
? this.axisCategoryArea.height + this.scenariosArea.height
|
|
22456
22734
|
: this.scenariosArea.height;
|
|
22457
|
-
return Math.max(analyticalHeight, bboxHeight);
|
|
22735
|
+
return Math.max(analyticalHeight, bboxHeight) + this.switchNamesHeight();
|
|
22736
|
+
}
|
|
22737
|
+
/** Room for the scenario names under the category labels of a series that changes its scenario. */
|
|
22738
|
+
switchNamesHeight() {
|
|
22739
|
+
return !this.hideAxisLabels && this.switchRuns().length > 1 ? this.position.dataLabelHeight : 0;
|
|
22740
|
+
}
|
|
22741
|
+
/** True for a scenario slot that has a value in this period. */
|
|
22742
|
+
static hasValue(dataPoint) {
|
|
22743
|
+
return dataPoint != null && !dataPoint.isEmpty() && dataPoint.value != null && !Number.isNaN(dataPoint.value);
|
|
22744
|
+
}
|
|
22745
|
+
/**
|
|
22746
|
+
* The slots that continue the first scenario: they have values, and only in
|
|
22747
|
+
* periods where the first scenario has none. Empty without `scenarioSwitch`.
|
|
22748
|
+
*/
|
|
22749
|
+
followerSlots() {
|
|
22750
|
+
if (!this.scenarioSwitch || this.stackConfig != null || this.determineEffectiveChartMode() !== withStyled.ChartMode.BAR) {
|
|
22751
|
+
return [];
|
|
22752
|
+
}
|
|
22753
|
+
return ["scenario2", "scenario3", "scenario4"].filter((slot) => {
|
|
22754
|
+
let values = 0;
|
|
22755
|
+
for (const row of this.dataModel) {
|
|
22756
|
+
if (TimeChart.hasValue(row[slot])) {
|
|
22757
|
+
if (TimeChart.hasValue(row.scenario1)) {
|
|
22758
|
+
return false;
|
|
22759
|
+
}
|
|
22760
|
+
values++;
|
|
22761
|
+
}
|
|
22762
|
+
}
|
|
22763
|
+
return values > 0;
|
|
22764
|
+
});
|
|
22765
|
+
}
|
|
22766
|
+
/** The slot drawn as the column of a period: the first scenario, else the first follower with a value. */
|
|
22767
|
+
visibleSlot(row, followers) {
|
|
22768
|
+
var _a;
|
|
22769
|
+
if (TimeChart.hasValue(row.scenario1)) {
|
|
22770
|
+
return "scenario1";
|
|
22771
|
+
}
|
|
22772
|
+
return (_a = followers.find((slot) => TimeChart.hasValue(row[slot]))) !== null && _a !== void 0 ? _a : null;
|
|
22773
|
+
}
|
|
22774
|
+
/** Runs of periods with the same visible scenario. A period without a value belongs to the run before it. */
|
|
22775
|
+
switchRuns() {
|
|
22776
|
+
const followers = this.followerSlots();
|
|
22777
|
+
if (followers.length === 0) {
|
|
22778
|
+
return [];
|
|
22779
|
+
}
|
|
22780
|
+
const runs = [];
|
|
22781
|
+
this.dataModel.forEach((row, index) => {
|
|
22782
|
+
const slot = this.visibleSlot(row, followers);
|
|
22783
|
+
const scenario = slot ? row[slot].scenario : null;
|
|
22784
|
+
const last = runs[runs.length - 1];
|
|
22785
|
+
if (scenario == null || (last === null || last === void 0 ? void 0 : last.scenario) === scenario) {
|
|
22786
|
+
if (last)
|
|
22787
|
+
last.to = index;
|
|
22788
|
+
return;
|
|
22789
|
+
}
|
|
22790
|
+
runs.push({ scenario, from: index, to: index });
|
|
22791
|
+
});
|
|
22792
|
+
return runs;
|
|
22793
|
+
}
|
|
22794
|
+
/** Number of periods where variances of one row overlap. The component warns about it. */
|
|
22795
|
+
getVarianceOverlaps() {
|
|
22796
|
+
return this.varianceOverlaps;
|
|
22797
|
+
}
|
|
22798
|
+
/**
|
|
22799
|
+
* Lifts the 145 % cut of relative variances when the uncut pins fit into
|
|
22800
|
+
* `availableHeight`. Only for a fixed percentage scale: the author chose it,
|
|
22801
|
+
* so a long pin is cut for lack of room only.
|
|
22802
|
+
*/
|
|
22803
|
+
fitRelativeVariances(availableHeight) {
|
|
22804
|
+
const points = this.variancesDataModel
|
|
22805
|
+
.filter((entry) => entry.type === VarianceType.RELATIVE)
|
|
22806
|
+
.map((entry) => entry.scenario1);
|
|
22807
|
+
if (points.length === 0 || !points.some((point) => point.isClipped())) {
|
|
22808
|
+
return;
|
|
22809
|
+
}
|
|
22810
|
+
const setClamp = (clamp) => {
|
|
22811
|
+
points.forEach((point) => (point.percentClamp = clamp));
|
|
22812
|
+
this.updatePosition(this.lastScenarios);
|
|
22813
|
+
};
|
|
22814
|
+
setClamp(Number.POSITIVE_INFINITY);
|
|
22815
|
+
this.layout();
|
|
22816
|
+
// an unknown height on either side keeps the cut
|
|
22817
|
+
if (!(availableHeight > 0) || !(this.getAllocatedCanvasHeight() <= availableHeight)) {
|
|
22818
|
+
setClamp(DataPoint.PERCENT_CLAMP);
|
|
22819
|
+
}
|
|
22458
22820
|
}
|
|
22459
22821
|
/**
|
|
22460
22822
|
* Total column extent (data units) proportional to pixelPerUnit, covering
|
|
@@ -22957,6 +23319,11 @@ class TimeChart {
|
|
|
22957
23319
|
if (dataModel != null && dataModel.length > 0) {
|
|
22958
23320
|
firstRow = dataModel[0];
|
|
22959
23321
|
}
|
|
23322
|
+
this.varianceOverlaps = 0;
|
|
23323
|
+
const parsed = variancesConfig.map((variance) => new VarianceScenario(variance));
|
|
23324
|
+
if (this.scenarioSwitch && parsed.filter((variance) => variance.isValid).length > 1) {
|
|
23325
|
+
return this.populateSharedVarianceRow(variancesConfig, parsed, dataModel, firstRow);
|
|
23326
|
+
}
|
|
22960
23327
|
for (const varianceScenario in variancesConfig) {
|
|
22961
23328
|
const scenarios = new VarianceScenario(variancesConfig[varianceScenario]);
|
|
22962
23329
|
if (scenarios.isValid) {
|
|
@@ -22986,6 +23353,47 @@ class TimeChart {
|
|
|
22986
23353
|
}
|
|
22987
23354
|
return varianceModel;
|
|
22988
23355
|
}
|
|
23356
|
+
/**
|
|
23357
|
+
* One row for several variances over the same reference: each period shows
|
|
23358
|
+
* the first variance that has a value there, in the notation of its scenario.
|
|
23359
|
+
*/
|
|
23360
|
+
populateSharedVarianceRow(variancesConfig, parsed, dataModel, firstRow) {
|
|
23361
|
+
const varianceModel = [];
|
|
23362
|
+
const valid = parsed.map((variance, index) => ({ variance, name: variancesConfig[index] }));
|
|
23363
|
+
const candidates = valid.filter((entry) => entry.variance.isValid);
|
|
23364
|
+
const isRelative = candidates[0].variance.type === "dr";
|
|
23365
|
+
const pixelPerUnit = isRelative ? this.pixelPerPercentage : this.pixelPerUnit;
|
|
23366
|
+
dataModel.forEach((row, index) => {
|
|
23367
|
+
let point = null;
|
|
23368
|
+
let values = 0;
|
|
23369
|
+
for (const { variance, name } of candidates) {
|
|
23370
|
+
const value = this.calculateVariance(variance, row, this.mapScenarios(variance, firstRow));
|
|
23371
|
+
if (value === null || Number.isNaN(value)) {
|
|
23372
|
+
continue;
|
|
23373
|
+
}
|
|
23374
|
+
values++;
|
|
23375
|
+
if (point == null) {
|
|
23376
|
+
point = new DataPoint(value, variance.delta, pixelPerUnit, variance.direction);
|
|
23377
|
+
point.notation = variance.base.slice(0, 2);
|
|
23378
|
+
point.key = { date: TimeChart.pointDate(row.date), scenario: name };
|
|
23379
|
+
}
|
|
23380
|
+
}
|
|
23381
|
+
if (values > 1) {
|
|
23382
|
+
this.varianceOverlaps++;
|
|
23383
|
+
}
|
|
23384
|
+
varianceModel.push({
|
|
23385
|
+
id: index,
|
|
23386
|
+
category: row.category,
|
|
23387
|
+
type: isRelative ? VarianceType.RELATIVE : VarianceType.ABSOLUTE,
|
|
23388
|
+
date: row.date,
|
|
23389
|
+
scenario1: point !== null && point !== void 0 ? point : new DataPoint(null, candidates[0].variance.delta, pixelPerUnit, candidates[0].variance.direction),
|
|
23390
|
+
scenario2: new DataPoint(null, null, null, null),
|
|
23391
|
+
scenario3: new DataPoint(null, null, null, null),
|
|
23392
|
+
scenario4: new DataPoint(null, null, null, null),
|
|
23393
|
+
});
|
|
23394
|
+
});
|
|
23395
|
+
return varianceModel;
|
|
23396
|
+
}
|
|
22989
23397
|
calculateVariance(scenarios, element, scenarioMap) {
|
|
22990
23398
|
const scenarioBase = scenarioMap.get(scenarios.base);
|
|
22991
23399
|
const scenarioDelta = scenarioMap.get(scenarios.delta);
|
|
@@ -23028,6 +23436,11 @@ class TimeChart {
|
|
|
23028
23436
|
createDateFactory() {
|
|
23029
23437
|
const factory = new withStyled.DateStringFactory();
|
|
23030
23438
|
factory.setLocale(this.locale);
|
|
23439
|
+
// a Luxon pattern from the translations, for example ’yy
|
|
23440
|
+
const shortYear = this.i18n.get("date-format-short-year");
|
|
23441
|
+
if (typeof shortYear === "string" && /y/.test(shortYear) && !shortYear.includes("date-format")) {
|
|
23442
|
+
factory.patchDateFormatShort({ year: shortYear });
|
|
23443
|
+
}
|
|
23031
23444
|
return factory;
|
|
23032
23445
|
}
|
|
23033
23446
|
/**
|
|
@@ -23072,6 +23485,12 @@ class TimeChart {
|
|
|
23072
23485
|
if (elements["type"] === VarianceType.RELATIVE) {
|
|
23073
23486
|
isRelative = true;
|
|
23074
23487
|
}
|
|
23488
|
+
// in smart mode a period that starts a year or month carries that part alone, so it is never skipped
|
|
23489
|
+
const carriesBoundary = this.axisLabelsMode === withStyled.AxisLabelsMode.SMART &&
|
|
23490
|
+
dateStringFactory.isSmartBoundary(elements.date, this.dateInterval);
|
|
23491
|
+
if (index % this.axisLabelsStep !== 0 && !carriesBoundary) {
|
|
23492
|
+
return;
|
|
23493
|
+
}
|
|
23075
23494
|
let datelabel = dateStringFactory.getDateString(elements.date, this.dateInterval);
|
|
23076
23495
|
if (this.axisLabelsMode === withStyled.AxisLabelsMode.SMART) {
|
|
23077
23496
|
datelabel = dateStringFactory.getSmartDateString(elements.date, this.dateInterval);
|
|
@@ -23095,6 +23514,7 @@ class TimeChart {
|
|
|
23095
23514
|
scenarioType: this.axisScenario,
|
|
23096
23515
|
labelText: this.title,
|
|
23097
23516
|
isRelative: isRelative,
|
|
23517
|
+
titlePosition: this.axisTitlePosition,
|
|
23098
23518
|
}, this.position, axisLabelGroup).draw();
|
|
23099
23519
|
// svg.js's width()/height() getters each default to their own bbox() call,
|
|
23100
23520
|
// so reading both measures the group twice. Measure once.
|
|
@@ -23103,17 +23523,65 @@ class TimeChart {
|
|
|
23103
23523
|
height: axisBox.height,
|
|
23104
23524
|
width: axisBox.width,
|
|
23105
23525
|
};
|
|
23526
|
+
this.drawScenarioSwitch(svgContainer);
|
|
23527
|
+
}
|
|
23528
|
+
/**
|
|
23529
|
+
* A vertical line where the visible scenario of the series changes, and the
|
|
23530
|
+
* scenario names under the category labels. Drawn after the axis is
|
|
23531
|
+
* measured, so it does not change the allocated size by itself.
|
|
23532
|
+
*/
|
|
23533
|
+
drawScenarioSwitch(svgContainer) {
|
|
23534
|
+
const runs = this.switchRuns();
|
|
23535
|
+
if (runs.length < 2) {
|
|
23536
|
+
return;
|
|
23537
|
+
}
|
|
23538
|
+
const group = svgContainer.group().id("ScenarioSwitch");
|
|
23539
|
+
const namesHeight = this.switchNamesHeight();
|
|
23540
|
+
const height = this.getAllocatedCanvasHeight();
|
|
23541
|
+
const bottom = namesHeight > 0 ? height - this.styles.padding.bottom : height;
|
|
23542
|
+
const lineWidth = Math.max(1, this.position.spacings.auxiliaryLineWidth);
|
|
23543
|
+
runs.slice(1).forEach((run) => {
|
|
23544
|
+
const x = (this.position.getColumnCenterPositionX(run.from - 1) + this.position.getColumnCenterPositionX(run.from)) / 2;
|
|
23545
|
+
group
|
|
23546
|
+
.line(x, 0, x, bottom)
|
|
23547
|
+
.stroke({ color: this.styles.fontStyles.color || "#000000", width: lineWidth })
|
|
23548
|
+
.addClass("scenario-switch");
|
|
23549
|
+
});
|
|
23550
|
+
if (namesHeight === 0) {
|
|
23551
|
+
return;
|
|
23552
|
+
}
|
|
23553
|
+
runs.forEach((run) => {
|
|
23554
|
+
const center = (this.position.getColumnCenterPositionX(run.from) + this.position.getColumnCenterPositionX(run.to)) / 2;
|
|
23555
|
+
new Label$1(group, center, bottom - namesHeight, "SWITCH_" + run.scenario, Formatter.translateScenarioLabel(run.scenario, this.i18n), this.styles, HookLocation$1.Top, HookLocation$1.Center).forceStringTypeDraw();
|
|
23556
|
+
});
|
|
23106
23557
|
}
|
|
23107
23558
|
drawScenarios(dataModel, svgContainer) {
|
|
23108
23559
|
const columnGroup = svgContainer.group().id("Scenarios");
|
|
23109
23560
|
const scenarioFactory = new ScenarioFactory(this.position, columnGroup, this.scenarioStyles(), dataModel.length, this.i18n);
|
|
23110
23561
|
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
23111
23562
|
let hasValidPrim = false;
|
|
23563
|
+
const followers = this.followerSlots();
|
|
23112
23564
|
dataModel.forEach((elements, index) => {
|
|
23113
|
-
|
|
23114
|
-
|
|
23115
|
-
|
|
23116
|
-
|
|
23565
|
+
// a follower takes the place of the first scenario: full column with value label, named under the axis
|
|
23566
|
+
const visible = followers.length > 0 ? this.visibleSlot(elements, followers) : "scenario1";
|
|
23567
|
+
if (visible != null && visible !== "scenario1") {
|
|
23568
|
+
scenarioFactory
|
|
23569
|
+
.createPrimaryBar(elements[visible], index, false)
|
|
23570
|
+
.draw(this.dataFormatDigits, this.measureScale);
|
|
23571
|
+
hasValidPrim = true;
|
|
23572
|
+
}
|
|
23573
|
+
else {
|
|
23574
|
+
scenarioFactory.createPrimaryBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
23575
|
+
}
|
|
23576
|
+
if (visible !== "scenario2") {
|
|
23577
|
+
scenarioFactory.createSecondaryBar(elements["scenario2"], index).draw();
|
|
23578
|
+
}
|
|
23579
|
+
if (visible !== "scenario3") {
|
|
23580
|
+
scenarioFactory.createPrimaryMarker(elements["scenario3"], index).draw();
|
|
23581
|
+
}
|
|
23582
|
+
if (visible !== "scenario4") {
|
|
23583
|
+
scenarioFactory.createSecondaryMarker(elements["scenario4"], index).draw();
|
|
23584
|
+
}
|
|
23117
23585
|
if (elements["scenario1"].isEmpty() === false) {
|
|
23118
23586
|
hasValidPrim = true;
|
|
23119
23587
|
}
|
|
@@ -23305,7 +23773,7 @@ class TimeChart {
|
|
|
23305
23773
|
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
23306
23774
|
dataModel.forEach((elements, index) => {
|
|
23307
23775
|
if (elements["type"] === VarianceType.RELATIVE) {
|
|
23308
|
-
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw();
|
|
23776
|
+
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits);
|
|
23309
23777
|
}
|
|
23310
23778
|
else {
|
|
23311
23779
|
scenarioFactory.createVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
@@ -23745,6 +24213,12 @@ class TimeChartComponentConfig {
|
|
|
23745
24213
|
this.stackConfig = null;
|
|
23746
24214
|
/** When true, line charts extend to the full width of the chart area. */
|
|
23747
24215
|
this.lineFullWidth = true;
|
|
24216
|
+
/** Print every n-th category label only. */
|
|
24217
|
+
this.axisLabelsStep = 1;
|
|
24218
|
+
/** One series that changes its scenario along the time axis, see `bn-chart-time`. */
|
|
24219
|
+
this.scenarioSwitch = false;
|
|
24220
|
+
/** Side of the axis title: left, right or none. */
|
|
24221
|
+
this.axisTitlePosition = "left";
|
|
23748
24222
|
/** Locale used for date-axis labels and SQL date normalization; set from the bn-context locale. */
|
|
23749
24223
|
this.locale = "de";
|
|
23750
24224
|
}
|
|
@@ -23827,6 +24301,15 @@ class TimeChartComponentConfigAdapter {
|
|
|
23827
24301
|
if (withStyled.CompareUtil.isBoolean(data.lineFullWidth)) {
|
|
23828
24302
|
config.lineFullWidth = data.lineFullWidth;
|
|
23829
24303
|
}
|
|
24304
|
+
if (withStyled.CompareUtil.isNumber(data.axisLabelsStep) && data.axisLabelsStep >= 1) {
|
|
24305
|
+
config.axisLabelsStep = data.axisLabelsStep;
|
|
24306
|
+
}
|
|
24307
|
+
if (withStyled.CompareUtil.isBoolean(data.scenarioSwitch)) {
|
|
24308
|
+
config.scenarioSwitch = data.scenarioSwitch;
|
|
24309
|
+
}
|
|
24310
|
+
if (withStyled.CompareUtil.isString(data.axisTitlePosition)) {
|
|
24311
|
+
config.axisTitlePosition = data.axisTitlePosition;
|
|
24312
|
+
}
|
|
23830
24313
|
if (withStyled.CompareUtil.isString(data.locale)) {
|
|
23831
24314
|
config.locale = data.locale;
|
|
23832
24315
|
}
|
|
@@ -23840,6 +24323,13 @@ class TimeChartComponentConfigAdapter {
|
|
|
23840
24323
|
const bnChartTimeRendererCss = () => `:host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}: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}.hide{opacity:0}.footer{margin:0.2em;font-size:0.6em}.footer-hide{display:none}svg#drawCanvas{display:block}`;
|
|
23841
24324
|
|
|
23842
24325
|
const BnChartTimeRenderer = class {
|
|
24326
|
+
disconnectedCallback() {
|
|
24327
|
+
var _a;
|
|
24328
|
+
if (this.overlapErrId) {
|
|
24329
|
+
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.remove(this.overlapErrId);
|
|
24330
|
+
this.overlapErrId = undefined;
|
|
24331
|
+
}
|
|
24332
|
+
}
|
|
23843
24333
|
constructor(hostRef) {
|
|
23844
24334
|
index.registerInstance(this, hostRef);
|
|
23845
24335
|
/**
|
|
@@ -23897,6 +24387,12 @@ const BnChartTimeRenderer = class {
|
|
|
23897
24387
|
/** @internal */
|
|
23898
24388
|
this.dataFormatDigits = { percent: 2, decimal: 1 };
|
|
23899
24389
|
/** @internal */
|
|
24390
|
+
this.axisLabelsStep = 1;
|
|
24391
|
+
/** @internal */
|
|
24392
|
+
this.scenarioSwitch = false;
|
|
24393
|
+
/** @internal */
|
|
24394
|
+
this.axisTitlePosition = "left";
|
|
24395
|
+
/** @internal */
|
|
23900
24396
|
this.parentDimensions = { width: 0, height: 0 };
|
|
23901
24397
|
withHasError.withComponentStatus(this);
|
|
23902
24398
|
}
|
|
@@ -23918,12 +24414,29 @@ const BnChartTimeRenderer = class {
|
|
|
23918
24414
|
}
|
|
23919
24415
|
/** Reports a failed query as the wrapper's `ERR_sql` item. Without it the chart would only show "No Data". */
|
|
23920
24416
|
syncQueryError() {
|
|
23921
|
-
var _a, _b;
|
|
24417
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
23922
24418
|
this.queryError = (_a = this.measureScaleError) !== null && _a !== void 0 ? _a : (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getQueryError();
|
|
23923
24419
|
queryError.reportQueryError(this.errors, this.queryError);
|
|
24420
|
+
const errId = `WARN_variances_overlap_${this.variances.join("_")}`;
|
|
24421
|
+
const overlaps = (_d = (_c = this.chart) === null || _c === void 0 ? void 0 : _c.getVarianceOverlaps()) !== null && _d !== void 0 ? _d : 0;
|
|
24422
|
+
// the row can get other variances: the warning of the old list has to go
|
|
24423
|
+
if (this.overlapErrId && this.overlapErrId !== errId) {
|
|
24424
|
+
(_e = this.errors) === null || _e === void 0 ? void 0 : _e.remove(this.overlapErrId);
|
|
24425
|
+
}
|
|
24426
|
+
this.overlapErrId = overlaps > 0 ? errId : undefined;
|
|
24427
|
+
if (overlaps > 0) {
|
|
24428
|
+
(_f = this.errors) === null || _f === void 0 ? void 0 : _f.addOrReplace({
|
|
24429
|
+
id: errId,
|
|
24430
|
+
type: "warning",
|
|
24431
|
+
message: `scenarioSwitch: the variances ${this.variances.join(", ")} share a row, but ${overlaps} period(s) have more than one value. The first variance wins there.`,
|
|
24432
|
+
});
|
|
24433
|
+
}
|
|
24434
|
+
else {
|
|
24435
|
+
(_g = this.errors) === null || _g === void 0 ? void 0 : _g.remove(errId);
|
|
24436
|
+
}
|
|
23924
24437
|
}
|
|
23925
24438
|
async componentWillLoad() {
|
|
23926
|
-
var _a;
|
|
24439
|
+
var _a, _b;
|
|
23927
24440
|
const config = this.prepareConfig();
|
|
23928
24441
|
const styles = this.prepareStyle();
|
|
23929
24442
|
const availableWidth = this.containerWidth || 0;
|
|
@@ -23935,14 +24448,18 @@ const BnChartTimeRenderer = class {
|
|
|
23935
24448
|
// fitted chart fits by construction, and the overdrive's rough overhead
|
|
23936
24449
|
// estimate would falsely re-engage on it.
|
|
23937
24450
|
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
24451
|
+
const percentWasAuto = config.pixelPerPercentage <= 0;
|
|
23938
24452
|
this.autoFitScaling(config, styles);
|
|
23939
24453
|
this.chart.setAvailableHeight(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
24454
|
+
if (!percentWasAuto) {
|
|
24455
|
+
this.chart.fitRelativeVariances(((_b = this.parentDimensions) === null || _b === void 0 ? void 0 : _b.height) || 0);
|
|
24456
|
+
}
|
|
23940
24457
|
this.pattern = new CustomPattern(this.chart.styles);
|
|
23941
24458
|
this.chart.setPattern("hatched", this.pattern.getFCPolygonPattern());
|
|
23942
24459
|
this.syncQueryError();
|
|
23943
24460
|
}
|
|
23944
24461
|
async componentWillUpdate() {
|
|
23945
|
-
var _a;
|
|
24462
|
+
var _a, _b;
|
|
23946
24463
|
if (this.chart == null) {
|
|
23947
24464
|
return;
|
|
23948
24465
|
}
|
|
@@ -23955,8 +24472,12 @@ const BnChartTimeRenderer = class {
|
|
|
23955
24472
|
this.chart.setConfig(config);
|
|
23956
24473
|
// See componentWillLoad: no broken-bar overdrive for auto-fitted scaling
|
|
23957
24474
|
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
24475
|
+
const percentWasAuto = config.pixelPerPercentage <= 0;
|
|
23958
24476
|
this.autoFitScaling(config, styles);
|
|
23959
24477
|
this.chart.setAvailableHeight(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
24478
|
+
if (!percentWasAuto) {
|
|
24479
|
+
this.chart.fitRelativeVariances(((_b = this.parentDimensions) === null || _b === void 0 ? void 0 : _b.height) || 0);
|
|
24480
|
+
}
|
|
23960
24481
|
this.pattern = new CustomPattern(this.chart.styles);
|
|
23961
24482
|
this.chart.setPattern("hatched", this.pattern.getFCPolygonPattern());
|
|
23962
24483
|
this.syncQueryError();
|
|
@@ -24142,6 +24663,9 @@ const BnChartTimeRenderer = class {
|
|
|
24142
24663
|
maxBars: this.maxBars,
|
|
24143
24664
|
stackConfig: this.stackConfig,
|
|
24144
24665
|
lineFullWidth: this.lineFullWidth,
|
|
24666
|
+
axisLabelsStep: this.axisLabelsStep,
|
|
24667
|
+
scenarioSwitch: this.scenarioSwitch,
|
|
24668
|
+
axisTitlePosition: this.axisTitlePosition,
|
|
24145
24669
|
locale: ((_c = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.locale) || "de",
|
|
24146
24670
|
});
|
|
24147
24671
|
}
|
|
@@ -25979,6 +26503,7 @@ const LayoutCard = class {
|
|
|
25979
26503
|
this.cardShowBorder = true;
|
|
25980
26504
|
withHasError.withComponentStatus(this);
|
|
25981
26505
|
this.errors = withHasError.withHasError(this);
|
|
26506
|
+
this.componentStyle = withStyled.withComponentStyle(this);
|
|
25982
26507
|
this.resolveInherited = withTranslation.withInheritedProps(this, [
|
|
25983
26508
|
{ propName: "titleScenarios", ancestorAttr: "title-scenarios" },
|
|
25984
26509
|
{ propName: "titleVariances", ancestorAttr: "title-variances" },
|
|
@@ -26082,7 +26607,7 @@ const LayoutCard = class {
|
|
|
26082
26607
|
var _a;
|
|
26083
26608
|
const style = this.getLayoutStyle();
|
|
26084
26609
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
26085
|
-
return (index.h("bn-card", { key: '
|
|
26610
|
+
return (index.h("bn-card", { key: '3db479047905de01ac517491f2d68a9bd0a3a576', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, index.h("div", { key: 'fd9948acd84ce55badf87a7e03d733d1e75a1bea', class: "cardtitle" }, index.h("bn-title", { key: '21200c96fb03d403fa616b093d753ea4b746c6f2', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.titleProp("ruleset"), "title-font-size": this.componentStyle(($) => { var _a; return (_a = $ === null || $ === void 0 ? void 0 : $["bn-layout-card"]) === null || _a === void 0 ? void 0 : _a.titleFontSize; }), "business-unit": this.titleBusinessUnit, scenarios: this.titleProp("titleScenarios"), variances: this.titleProp("titleVariances"), order: this.titleProp("titleOrder"), "order-direction": this.titleProp("titleOrderDirection"), measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), this.titleImage != null && this.titleImage !== "" ? (index.h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), index.h("bn-body", { key: 'c5b1957822ff216d33084154afdf6deb3e4426cc' }, index.h("div", { key: 'bc17f6f73825894641f775137eaefd5059a25cf6', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), index.h("bn-footer", { key: 'cfbeba76eaf11358e92002d309cafae19d2525e2', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
|
|
26086
26611
|
}
|
|
26087
26612
|
get element() { return index.getElement(this); }
|
|
26088
26613
|
};
|
|
@@ -26318,7 +26843,7 @@ const LayoutPage = class {
|
|
|
26318
26843
|
const style = this.getLayoutStyle();
|
|
26319
26844
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
26320
26845
|
const rotation = this.rotation();
|
|
26321
|
-
return (index.h(index.Host, { key: '
|
|
26846
|
+
return (index.h(index.Host, { key: '2ec4b279578c40e0aa56ec89ede269abb4d2951b', style: rotation === null || rotation === void 0 ? void 0 : rotation.host }, index.h("bn-page", { key: 'fae96a429fad331f28fdf69e5036e6857db866c6', styles: this.styles, "selected-style": this.selectedStyle, format: this.pageFormat, orientation: this.pageOrientation, style: rotation === null || rotation === void 0 ? void 0 : rotation.page }, index.h("bn-message", { key: '17e10377a10a257417acc50460cc2a66e1010abd', text: this.messageText, image: this.messageImage }), index.h("bn-title", { key: '3149bfdb60c2782c65a3c956fe15d291b2748327', "i18n-namespace": (_a = this.i18nNamespace) !== null && _a !== void 0 ? _a : this.titleNamespace, ruleset: this.ruleset, "title-id": this.titleId, "business-unit": this.titleBusinessUnit, scenarios: this.titleScenarios, variances: this.titleVariances, order: this.titleOrder, "order-direction": this.titleOrderDirection, measures: this.titleMeasures, "date-start": this.titleDateStart, "date-end": this.titleDateEnd, "date-format": this.titleDateFormat, "date-link": this.titleDateLink }), index.h("bn-body", { key: '8ef72077b8656469db320af429a1226453866558' }, index.h("div", { key: '99b22034f2c6edbe7e25e1a3cb6873f2af287178', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots)), index.h("slot", { key: '918b8f2c8991d801a0033748f37250500cf2d2e9', name: "annotations" })), index.h("bn-footer", { key: 'a77e27405f7fbc68c90a95c563628ddc2d708e02', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber }))));
|
|
26322
26847
|
}
|
|
26323
26848
|
get element() { return index.getElement(this); }
|
|
26324
26849
|
};
|
|
@@ -32791,7 +33316,7 @@ const Title$1 = class Title {
|
|
|
32791
33316
|
var _a, _b, _c, _d;
|
|
32792
33317
|
return ({
|
|
32793
33318
|
"--bn-font-family": ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
32794
|
-
"--bn-font-size": `${((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
|
|
33319
|
+
"--bn-font-size": `${this.titleFontSize > 0 ? this.titleFontSize : ((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
|
|
32795
33320
|
"--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
|
|
32796
33321
|
"--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
|
|
32797
33322
|
});
|
|
@@ -32799,7 +33324,7 @@ const Title$1 = class Title {
|
|
|
32799
33324
|
}
|
|
32800
33325
|
render() {
|
|
32801
33326
|
const fontStyles = this.getFontStyles();
|
|
32802
|
-
return (index.h(index.Host, { key: '
|
|
33327
|
+
return (index.h(index.Host, { key: '2f19926cf90c8e8738c335088f6d814be7221f05', style: fontStyles }, index.h("bn-title-renderer", { key: '85c4a3985352920a9eddfa166479fbde7d114971', businessUnit: this.prepareBusinessUnit(), scenarios: this.prepareScenarios(), measures: this.prepareMeasures(), timeperiod: this.prepareTitleTimePeriod(), order: this.prepareTitleOrder(), i18n: this.prepareI18n(), "i18n-mode": this.prepareI18nMode(), locale: this.prepareLocale(), ruleSetConfig: this.ruleSetConfig(), titleId: this.titleId || undefined })));
|
|
32803
33328
|
}
|
|
32804
33329
|
get element() { return index.getElement(this); }
|
|
32805
33330
|
static get watchers() { return {
|
|
@@ -33121,7 +33646,7 @@ class TimePeriodAdapter {
|
|
|
33121
33646
|
}
|
|
33122
33647
|
}
|
|
33123
33648
|
|
|
33124
|
-
const bnTitleRendererCss = () => `:host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.measure{font-weight:bold}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}p{margin:0}`;
|
|
33649
|
+
const bnTitleRendererCss = () => `:host{display:block;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.measure{font-weight:bold}.with-id{display:flow-root}.title-id{float:right;margin-left:1em;font-weight:normal}div{background-color:var(--bn-font-background, white);color:var(--bn-font-color, black)}p{margin:0}`;
|
|
33125
33650
|
|
|
33126
33651
|
const BnTitleRenderer = class {
|
|
33127
33652
|
constructor(hostRef) {
|
|
@@ -33152,7 +33677,7 @@ const BnTitleRenderer = class {
|
|
|
33152
33677
|
withHasError.withComponentStatus(this);
|
|
33153
33678
|
}
|
|
33154
33679
|
render() {
|
|
33155
|
-
return (index.h("div", { key: '
|
|
33680
|
+
return (index.h("div", { key: 'd32015c18f77cc23ace9a26d8bb0820acdce543a', class: this.titleId ? "with-id" : undefined }, this.titleId ? index.h("div", { class: "title-id" }, this.titleId) : null, index.h("div", { key: 'c3151be4218ff1720402865ffa4b972c974fea67', innerHTML: withTranslation.sanitizeHtml(this.title.unit) }), index.h("div", { key: '0a03e44bd5ec8d0177801bce8d1cf938a24daabb' }, this.title.measures.map((measure, index$1) => (index.h("span", null, this.isFirstElement(index$1) ? this.title.i18n.get("SEPARATOR_WS") : "", index.h("span", { class: "measure" }, measure.name), " ", measure.unit ? this.title.i18n.get("in") : "", " ", measure.unit)))), index.h("div", { key: 'ab32e07b35e1cc02ec26137ce392946c8f94ac73' }, this.title.dimension)));
|
|
33156
33681
|
}
|
|
33157
33682
|
componentWillLoad() {
|
|
33158
33683
|
const config = this.prepareConfig();
|
|
@@ -34315,7 +34840,10 @@ const ChartTree = class {
|
|
|
34315
34840
|
if (!this.treeConfig || !this.layout) {
|
|
34316
34841
|
return null;
|
|
34317
34842
|
}
|
|
34318
|
-
return Array.from(this.treeConfig.allNodes).map((nodeId) => (
|
|
34843
|
+
return Array.from(this.treeConfig.allNodes).map((nodeId) => (
|
|
34844
|
+
// data-bn-fit-content: a node is as high as its content, so no height in it is a limit
|
|
34845
|
+
// for that content (see findConstrainedHeight in utils/parentDimensions)
|
|
34846
|
+
index.h("div", { key: nodeId, class: "tree-node", "data-bn-fit-content": "", style: this.getSlotStyle(nodeId) }, index.h("slot", { name: nodeId }))));
|
|
34319
34847
|
}
|
|
34320
34848
|
getFontStyles() {
|
|
34321
34849
|
return this.componentStyle(($) => {
|