@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,9 +1,9 @@
|
|
|
1
1
|
import { r as registerInstance, h, a as Host, g as getElement, f as forceUpdate, d as writeTask, F as Fragment$1 } from './index-CCZcKl0Q.js';
|
|
2
|
-
import { S as SYSTEM_STYLE_DEFAULTS, w as withComponentStatus, a as withHasError, g as getStores, C as ComponentRegister, r as runIfExisits, c as clearStoresCache, h as hasInlineJs, d as globalLabelKeys, e as SYSTEM_RULESET_DEFAULTS, X as XY_SERIES_PALETTE, i as getDefaultExportFromCjs, D as DateTime, j as resolveSeriesColor, m as markTreatment, s as shade, k as sourceExpr, l as reportOverflow, u as unknownStyleKeys, n as getOrCreateStores } from './withHasError-
|
|
3
|
-
import { a as withComponentStyle, m as merge, C as CompareUtil, i as isBlankInput, b as isValidInteger, w as withStyled, c as isValidMeasureToken, r as resolveMeasure, s as scenarioFamily, d as scenarioSlotNumber, e as axisInValueUnits, f as isRelativeMeasure, v as validateOrderList, g as isValidDirection, A as AggregationLevel, O as OrderDirection, h as Order, j as OrderColumn, k as
|
|
4
|
-
import { s as sanitizeHtml, g as getParentDimensions, b as getClippedHeight, i as isInheritedValue, f as findLayoutAncestors, r as readInherited, a as withDataset, w as withTranslation, p as parseScaling, c as strokeWidthPx, d as resolveScalingValue, e as formatScalingValue, h as withInheritedProps, j as parseScalingValue } from './withTranslation-
|
|
5
|
-
import { w as withBodyObserver } from './withBodyObserver-
|
|
6
|
-
import { r as readDiagnostics, m as measure, a as resolveStandaloneId, l as localFrameOf, o as originsFor, b as assignIds, c as resolveOwnIdentity, t as toLayoutRect, d as measureContent, e as measureSign } from './localFrame-
|
|
2
|
+
import { S as SYSTEM_STYLE_DEFAULTS, w as withComponentStatus, a as withHasError, g as getStores, C as ComponentRegister, r as runIfExisits, c as clearStoresCache, h as hasInlineJs, d as globalLabelKeys, e as SYSTEM_RULESET_DEFAULTS, X as XY_SERIES_PALETTE, i as getDefaultExportFromCjs, D as DateTime, j as resolveSeriesColor, m as markTreatment, s as shade, k as sourceExpr, l as reportOverflow, u as unknownStyleKeys, n as getOrCreateStores } from './withHasError-UGtkLrYT.js';
|
|
3
|
+
import { a as withComponentStyle, m as merge, C as CompareUtil, i as isBlankInput, b as isValidInteger, w as withStyled, c as isValidMeasureToken, r as resolveMeasure, s as scenarioFamily, d as scenarioSlotNumber, e as axisInValueUnits, f as isRelativeMeasure, v as validateOrderList, g as isValidDirection, A as AggregationLevel, O as OrderDirection, h as Order, j as OrderColumn, k as isNoScenarios, l as validateScenarioList, n as validateVariancesList, o as isValidLevel, p as isValidMeasureScale, q as validateStackConfig, S as StackBy, t as StackOrder, u as StackMode, x as AdapterUtils, y as OrderAdapter, N as NOT_AVAILABLE, z as relativeVariance, B as isValidNumber, D as isValidDateFormat, E as isValidAxisLabelsMode, F as DateDistance, G as AxisLabelsMode, H as ChartMode, I as DateStringFactory, R as RELATIVE_STACK_UNITS, J as murmur2, K as validateBarColumnsList, L as isTableBarColumnWidth, M as isValidDataFormat, P as isValidTableType, Q as validateThereOfJsonStr, T as isValidThereofPosition, U as validatePartOfJsonStr, V as validateTableOrderList, W as isValidMeasureType, X as isTableCategoryWidth, Y as validateColumnThereOfJsonStr, Z as validateAttributesJsonStr, _ as DataFormat, $ as ThereofPosition, a0 as TableType$2, a1 as normalizeOrderToken, a2 as I18nMode, a3 as TableCategoryWidth, a4 as MeasureType, a5 as parseTableAttributeExpression, a6 as BAR_COLUMN_WIDTH_EM, a7 as TableBarColumnWidth, a8 as TableRowType, a9 as FIELD_IDENTIFIER_REGEX, aa as parseOrderToken, ab as Scenarios, ac as OrderDirection$1, ad as FactoryState$3, ae as validateMeasureList, af as isValidDate, ag as isValidDateLink, ah as DateLink } from './withStyled-BlMqEIfr.js';
|
|
4
|
+
import { s as sanitizeHtml, g as getParentDimensions, b as getClippedHeight, i as isInheritedValue, f as findLayoutAncestors, r as readInherited, a as withDataset, w as withTranslation, p as parseScaling, c as strokeWidthPx, d as resolveScalingValue, e as formatScalingValue, h as withInheritedProps, j as parseScalingValue } from './withTranslation-Bc3bjHTb.js';
|
|
5
|
+
import { w as withBodyObserver } from './withBodyObserver-D9yIMxdr.js';
|
|
6
|
+
import { r as readDiagnostics, m as measure, a as resolveStandaloneId, l as localFrameOf, o as originsFor, b as assignIds, c as resolveOwnIdentity, t as toLayoutRect, d as measureContent, e as measureSign } from './localFrame-CEZ7-hBs.js';
|
|
7
7
|
import { LAYOUT_STATE_VERSION } from './index.js';
|
|
8
8
|
import { e as errorText, r as reportQueryError } from './queryError-ClruFZD_.js';
|
|
9
9
|
|
|
@@ -319,6 +319,7 @@ const AnnotationLayer = class {
|
|
|
319
319
|
this.scheduled = false;
|
|
320
320
|
this.run = 0;
|
|
321
321
|
this.observed = new WeakSet();
|
|
322
|
+
this.observedAround = new WeakSet();
|
|
322
323
|
this.reported = new Set();
|
|
323
324
|
/**
|
|
324
325
|
* Places the marks after the next paint. The layer counts as working until
|
|
@@ -346,6 +347,7 @@ const AnnotationLayer = class {
|
|
|
346
347
|
this.stores = getStores(this.element);
|
|
347
348
|
this.pageKey = annotationPageKey(this.element);
|
|
348
349
|
this.observed = new WeakSet();
|
|
350
|
+
this.observedAround = new WeakSet();
|
|
349
351
|
this.resizeObserver = new ResizeObserver(this.schedule);
|
|
350
352
|
this.mutationObserver = new MutationObserver(this.schedule);
|
|
351
353
|
this.observeSize(this.element);
|
|
@@ -412,7 +414,10 @@ const AnnotationLayer = class {
|
|
|
412
414
|
await Promise.all(visuals.map((visual) => { var _a; return (_a = visual.componentOnReady) === null || _a === void 0 ? void 0 : _a.call(visual); }));
|
|
413
415
|
if (run !== this.run)
|
|
414
416
|
return;
|
|
415
|
-
visuals.forEach((visual) =>
|
|
417
|
+
visuals.forEach((visual) => {
|
|
418
|
+
this.observe(visual);
|
|
419
|
+
this.observeAround(visual, page);
|
|
420
|
+
});
|
|
416
421
|
const states = new Map();
|
|
417
422
|
await Promise.all(visuals.map(async (visual) => {
|
|
418
423
|
var _a;
|
|
@@ -571,6 +576,28 @@ const AnnotationLayer = class {
|
|
|
571
576
|
};
|
|
572
577
|
walk(visual.shadowRoot);
|
|
573
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* A component around a target can move it without resizing anything: a
|
|
581
|
+
* grid pads a cell down to line up a baseline, and writes that into its own
|
|
582
|
+
* shadow root, or into the style of a card in the cell.
|
|
583
|
+
*/
|
|
584
|
+
observeAround(visual, page) {
|
|
585
|
+
var _a, _b;
|
|
586
|
+
for (let el = visual.parentElement; el && el !== page; el = el.parentElement) {
|
|
587
|
+
if (this.observedAround.has(el))
|
|
588
|
+
continue;
|
|
589
|
+
this.observedAround.add(el);
|
|
590
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(el, { attributes: true, attributeFilter: ["style"] });
|
|
591
|
+
if (el.shadowRoot) {
|
|
592
|
+
(_b = this.mutationObserver) === null || _b === void 0 ? void 0 : _b.observe(el.shadowRoot, {
|
|
593
|
+
childList: true,
|
|
594
|
+
subtree: true,
|
|
595
|
+
attributes: true,
|
|
596
|
+
attributeFilter: ["style", "class"],
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
}
|
|
574
601
|
observeSize(element) {
|
|
575
602
|
var _a;
|
|
576
603
|
if (!this.observed.has(element)) {
|
|
@@ -595,7 +622,7 @@ const AnnotationLayer = class {
|
|
|
595
622
|
return (h("g", { class: "mark arrow", "data-label": (_b = mark.badge) === null || _b === void 0 ? void 0 : _b.label }, h("line", { x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, style: { stroke: color, strokeWidth: "1.5" } }), h("polygon", { points: mark.head, style: { fill: color } }), this.renderBadge(mark.badge, color)));
|
|
596
623
|
}
|
|
597
624
|
render() {
|
|
598
|
-
return (h(Host, { key: '
|
|
625
|
+
return (h(Host, { key: 'd4d027728ae578a5ced829a3f86f0137530551fc' }, h("svg", { key: 'a3813930e420db9fdd618bc38c38941295cf4c22', ref: (el) => (this.svg = el) }, this.marks.map((mark) => this.renderMark(mark)))));
|
|
599
626
|
}
|
|
600
627
|
get element() { return getElement(this); }
|
|
601
628
|
static get watchers() { return {
|
|
@@ -2591,6 +2618,19 @@ function resolveSentiment(direction, operation, signedValues) {
|
|
|
2591
2618
|
const subtracts = !signedValues && operation === "-";
|
|
2592
2619
|
return (direction === "op") !== subtracts ? "pos" : "neg";
|
|
2593
2620
|
}
|
|
2621
|
+
/** The scenarios a list of variances is calculated from, each once, in order. */
|
|
2622
|
+
function variancesScenarios(variances) {
|
|
2623
|
+
const scenarios = [];
|
|
2624
|
+
for (const variance of variances) {
|
|
2625
|
+
const parsed = new VarianceScenario(variance);
|
|
2626
|
+
for (const scenario of parsed.isValid ? [parsed.base, parsed.delta] : []) {
|
|
2627
|
+
if (!scenarios.includes(scenario)) {
|
|
2628
|
+
scenarios.push(scenario);
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
return scenarios;
|
|
2633
|
+
}
|
|
2594
2634
|
|
|
2595
2635
|
const FAMILIES = ["ac", "pp", "fc", "pl"];
|
|
2596
2636
|
const SLOT_BY_COLOR_INDEX = { 10: "ac", 20: "pp", 30: "fc", 50: "pl" };
|
|
@@ -14234,7 +14274,7 @@ const Chart$1 = class Chart {
|
|
|
14234
14274
|
}
|
|
14235
14275
|
validateScenario(newValue) {
|
|
14236
14276
|
const errId = "WARN_scenarios";
|
|
14237
|
-
if (isInheritedValue(newValue)) {
|
|
14277
|
+
if (isInheritedValue(newValue) || isNoScenarios(newValue)) {
|
|
14238
14278
|
this.errors.remove(errId);
|
|
14239
14279
|
return;
|
|
14240
14280
|
}
|
|
@@ -14380,6 +14420,25 @@ const Chart$1 = class Chart {
|
|
|
14380
14420
|
this.errors.remove(errId);
|
|
14381
14421
|
}
|
|
14382
14422
|
}
|
|
14423
|
+
validateDataFormatDigitsDecimal(newValue) {
|
|
14424
|
+
this.validateDigits("dataFormatDigitsDecimal", newValue);
|
|
14425
|
+
}
|
|
14426
|
+
validateDataFormatDigitsPercent(newValue) {
|
|
14427
|
+
this.validateDigits("dataFormatDigitsPercent", newValue);
|
|
14428
|
+
}
|
|
14429
|
+
validateDigits(name, value) {
|
|
14430
|
+
const errId = `WARN_${name}`;
|
|
14431
|
+
if (!isValidInteger(value) || Number(value) < 0 || Number(value) > 100) {
|
|
14432
|
+
this.errors.addOrReplace({
|
|
14433
|
+
id: errId,
|
|
14434
|
+
type: "warning",
|
|
14435
|
+
message: name + ": invalid value '" + value + "' is not supported.",
|
|
14436
|
+
});
|
|
14437
|
+
}
|
|
14438
|
+
else {
|
|
14439
|
+
this.errors.remove(errId);
|
|
14440
|
+
}
|
|
14441
|
+
}
|
|
14383
14442
|
validateStack(newValue) {
|
|
14384
14443
|
const errId = "WARN_stack";
|
|
14385
14444
|
const errors = validateStackConfig(newValue);
|
|
@@ -14485,6 +14544,14 @@ const Chart$1 = class Chart {
|
|
|
14485
14544
|
* @example measure-unit="EUR"
|
|
14486
14545
|
*/
|
|
14487
14546
|
this.measureUnit = "";
|
|
14547
|
+
/**
|
|
14548
|
+
* Number of decimal digits of the value labels
|
|
14549
|
+
*/
|
|
14550
|
+
this.dataFormatDigitsDecimal = 1;
|
|
14551
|
+
/**
|
|
14552
|
+
* Number of decimal digits of the percent labels (relative variances, shares of a 100 % stack)
|
|
14553
|
+
*/
|
|
14554
|
+
this.dataFormatDigitsPercent = 2;
|
|
14488
14555
|
/**
|
|
14489
14556
|
* Stacking configuration as a JSON string. When set, bars are drawn as
|
|
14490
14557
|
* stacked segments instead of side-by-side.
|
|
@@ -14577,6 +14644,8 @@ const Chart$1 = class Chart {
|
|
|
14577
14644
|
componentWillLoad() {
|
|
14578
14645
|
this.validateFilter(this.filter);
|
|
14579
14646
|
this.validateScenario(this.scenarios);
|
|
14647
|
+
this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal);
|
|
14648
|
+
this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent);
|
|
14580
14649
|
this.validateVariances(this.variances);
|
|
14581
14650
|
this.validateUnitScaling(this.unitScaling);
|
|
14582
14651
|
//this.validateSelectedStyle(this.selectedStyle);
|
|
@@ -14756,8 +14825,7 @@ const Chart$1 = class Chart {
|
|
|
14756
14825
|
}
|
|
14757
14826
|
prepareDimension() {
|
|
14758
14827
|
const parent = getParentDimensions(this.element);
|
|
14759
|
-
const
|
|
14760
|
-
const segmentCount = 1 + variancesList.length;
|
|
14828
|
+
const segmentCount = Math.max(1, this.prepareSegments().length);
|
|
14761
14829
|
this.canvasWidthSegmented = parent.width / segmentCount;
|
|
14762
14830
|
return { width: this.canvasWidthSegmented, height: parent.height };
|
|
14763
14831
|
}
|
|
@@ -14768,6 +14836,10 @@ const Chart$1 = class Chart {
|
|
|
14768
14836
|
this.errors.remove("AUTO_scenarios");
|
|
14769
14837
|
return scenarios.value.split(",").map((entry) => entry.trim());
|
|
14770
14838
|
}
|
|
14839
|
+
if (isNoScenarios(scenarios.value)) {
|
|
14840
|
+
this.errors.remove("AUTO_scenarios");
|
|
14841
|
+
return [];
|
|
14842
|
+
}
|
|
14771
14843
|
const isAuto = ((_a = scenarios.value) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
14772
14844
|
if (isBlankInput(scenarios.value) || isAuto) {
|
|
14773
14845
|
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
@@ -14796,6 +14868,15 @@ const Chart$1 = class Chart {
|
|
|
14796
14868
|
}
|
|
14797
14869
|
return variances === null || variances === void 0 ? void 0 : variances.split(",").map((entry) => entry.trim());
|
|
14798
14870
|
}
|
|
14871
|
+
/** `scenarios="none"`: the chart draws its variances only. */
|
|
14872
|
+
hidesScenarios() {
|
|
14873
|
+
const scenarios = this.resolveInherited("scenarios", this.scenarios);
|
|
14874
|
+
return !scenarios.inherited && isNoScenarios(scenarios.value);
|
|
14875
|
+
}
|
|
14876
|
+
/** The segments side by side: `""` is the base chart, else one variance. */
|
|
14877
|
+
prepareSegments() {
|
|
14878
|
+
return this.hidesScenarios() ? this.prepareVariances() : ["", ...this.prepareVariances()];
|
|
14879
|
+
}
|
|
14799
14880
|
prepareHideCategories(idx) {
|
|
14800
14881
|
return idx >= 1 || !this.showCategories;
|
|
14801
14882
|
}
|
|
@@ -14964,7 +15045,8 @@ const Chart$1 = class Chart {
|
|
|
14964
15045
|
});
|
|
14965
15046
|
}
|
|
14966
15047
|
prepareChartTitle(idx) {
|
|
14967
|
-
|
|
15048
|
+
// a variance keeps its own name as title
|
|
15049
|
+
if (idx >= 1 || this.hidesScenarios()) {
|
|
14968
15050
|
return "";
|
|
14969
15051
|
}
|
|
14970
15052
|
return this.chartTitle;
|
|
@@ -15074,10 +15156,11 @@ const Chart$1 = class Chart {
|
|
|
15074
15156
|
const ppu = this.preparePixelPerUnit();
|
|
15075
15157
|
const ppp = this.preparePixelPerPercentage();
|
|
15076
15158
|
const stackConfig = this.prepareStackConfig();
|
|
15077
|
-
const
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
|
|
15159
|
+
const isBase = localScenarioString === "";
|
|
15160
|
+
const scenarios = this.hidesScenarios() ? variancesScenarios([localScenarioString]) : this.prepareScenarios();
|
|
15161
|
+
// Dimension stacking uses only the first scenario. Only the base chart draws a stack, a variance needs both of its scenarios
|
|
15162
|
+
const effectiveScenarios = isBase && (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
15163
|
+
return (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() }));
|
|
15081
15164
|
}
|
|
15082
15165
|
/**
|
|
15083
15166
|
* The line this chart wants to be aligned on, in CSS px from the host's
|
|
@@ -15104,7 +15187,7 @@ const Chart$1 = class Chart {
|
|
|
15104
15187
|
const factor = Number.isFinite(rawFactor) && rawFactor > 0 ? rawFactor : 1;
|
|
15105
15188
|
const fontSizePx = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * factor;
|
|
15106
15189
|
const variances = this.prepareVariances();
|
|
15107
|
-
const layout = collectChartFacadeLayout(this.element, "bn-chart-structure-renderer",
|
|
15190
|
+
const layout = collectChartFacadeLayout(this.element, "bn-chart-structure-renderer", this.prepareSegments().map((segment) => segment || "base"), origins, detail);
|
|
15108
15191
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15109
15192
|
const firstInner = (_b = this.element.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("bn-chart-structure-renderer");
|
|
15110
15193
|
const state = {
|
|
@@ -15195,13 +15278,19 @@ const Chart$1 = class Chart {
|
|
|
15195
15278
|
});
|
|
15196
15279
|
}
|
|
15197
15280
|
render() {
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15281
|
+
const scenariosArray = this.prepareSegments();
|
|
15282
|
+
if (scenariosArray.length === 0) {
|
|
15283
|
+
this.errors.addOrReplace({
|
|
15284
|
+
id: "WARN_scenarios_none",
|
|
15285
|
+
type: "warning",
|
|
15286
|
+
message: "scenarios: none needs at least one variance, the chart is empty.",
|
|
15287
|
+
});
|
|
15288
|
+
}
|
|
15289
|
+
else {
|
|
15290
|
+
this.errors.remove("WARN_scenarios_none");
|
|
15202
15291
|
}
|
|
15203
15292
|
const fontStyles = this.getFontStyles();
|
|
15204
|
-
return (h(Host, { key: '
|
|
15293
|
+
return (h(Host, { key: 'a9b487fd43e785b1f14d0599ad0145a248b35f5d', style: fontStyles }, h("div", { key: '950ab383346b288ab17c2a1bbdfcfcd240e0f4d8', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
15205
15294
|
}
|
|
15206
15295
|
get element() { return getElement(this); }
|
|
15207
15296
|
static get watchers() { return {
|
|
@@ -15235,6 +15324,12 @@ const Chart$1 = class Chart {
|
|
|
15235
15324
|
"measureScale": [{
|
|
15236
15325
|
"validateMeasureScale": 0
|
|
15237
15326
|
}],
|
|
15327
|
+
"dataFormatDigitsDecimal": [{
|
|
15328
|
+
"validateDataFormatDigitsDecimal": 0
|
|
15329
|
+
}],
|
|
15330
|
+
"dataFormatDigitsPercent": [{
|
|
15331
|
+
"validateDataFormatDigitsPercent": 0
|
|
15332
|
+
}],
|
|
15238
15333
|
"stack": [{
|
|
15239
15334
|
"validateStack": 0
|
|
15240
15335
|
}],
|
|
@@ -16944,11 +17039,11 @@ let Needle$1 = class Needle {
|
|
|
16944
17039
|
(_a = this.label) === null || _a === void 0 ? void 0 : _a.updateGroup(newGroup);
|
|
16945
17040
|
return this;
|
|
16946
17041
|
}
|
|
16947
|
-
draw() {
|
|
17042
|
+
draw(dataFormatDigits = { percent: 2, decimal: 1 }) {
|
|
16948
17043
|
var _a, _b, _c;
|
|
16949
17044
|
if (((_a = this.dataPoint) === null || _a === void 0 ? void 0 : _a.value) === undefined) {
|
|
16950
17045
|
// reference 0: the label says "n/a", there is no pin
|
|
16951
|
-
(_b = this.label) === null || _b === void 0 ? void 0 : _b.draw();
|
|
17046
|
+
(_b = this.label) === null || _b === void 0 ? void 0 : _b.draw(dataFormatDigits);
|
|
16952
17047
|
return this;
|
|
16953
17048
|
}
|
|
16954
17049
|
if (this.isEmpty()) {
|
|
@@ -16978,7 +17073,7 @@ let Needle$1 = class Needle {
|
|
|
16978
17073
|
.stroke(strokeStyle)
|
|
16979
17074
|
.cy(this.dimensions.yPos)
|
|
16980
17075
|
.x(this.dimensions.xPos);
|
|
16981
|
-
(_c = this.label) === null || _c === void 0 ? void 0 : _c.draw();
|
|
17076
|
+
(_c = this.label) === null || _c === void 0 ? void 0 : _c.draw(dataFormatDigits);
|
|
16982
17077
|
}
|
|
16983
17078
|
createDimensions(position, dataPoint, index) {
|
|
16984
17079
|
if (dataPoint.getScaledPercentUnit() < 0) {
|
|
@@ -18192,7 +18287,7 @@ class StructureChart {
|
|
|
18192
18287
|
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
18193
18288
|
dataModel.forEach((elements, index) => {
|
|
18194
18289
|
if (elements["type"] === VarianceType$1.RELATIVE) {
|
|
18195
|
-
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw();
|
|
18290
|
+
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits);
|
|
18196
18291
|
}
|
|
18197
18292
|
else {
|
|
18198
18293
|
scenarioFactory.createVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
@@ -18504,10 +18599,12 @@ class DataFormatDigits {
|
|
|
18504
18599
|
class DataFormatDigitsAdapter {
|
|
18505
18600
|
adapt(data) {
|
|
18506
18601
|
const prefix = new DataFormatDigits();
|
|
18507
|
-
|
|
18602
|
+
// Intl.NumberFormat throws outside 0 to 100
|
|
18603
|
+
const valid = (value) => CompareUtil.isNumber(value) && Number.isInteger(value) && value >= 0 && value <= 100;
|
|
18604
|
+
if (valid(data.percent)) {
|
|
18508
18605
|
prefix.percent = data.percent;
|
|
18509
18606
|
}
|
|
18510
|
-
if (
|
|
18607
|
+
if (valid(data.decimal)) {
|
|
18511
18608
|
prefix.decimal = data.decimal;
|
|
18512
18609
|
}
|
|
18513
18610
|
return prefix;
|
|
@@ -18835,7 +18932,7 @@ const Chart = class {
|
|
|
18835
18932
|
}
|
|
18836
18933
|
validateScenario(newValue) {
|
|
18837
18934
|
const errId = "WARN_scenarios";
|
|
18838
|
-
if (isInheritedValue(newValue)) {
|
|
18935
|
+
if (isInheritedValue(newValue) || isNoScenarios(newValue)) {
|
|
18839
18936
|
this.errors.remove(errId);
|
|
18840
18937
|
return;
|
|
18841
18938
|
}
|
|
@@ -19023,6 +19120,51 @@ const Chart = class {
|
|
|
19023
19120
|
this.errors.remove(errId);
|
|
19024
19121
|
}
|
|
19025
19122
|
}
|
|
19123
|
+
validateDataFormatDigitsDecimal(newValue) {
|
|
19124
|
+
this.validateDigits("dataFormatDigitsDecimal", newValue);
|
|
19125
|
+
}
|
|
19126
|
+
validateDataFormatDigitsPercent(newValue) {
|
|
19127
|
+
this.validateDigits("dataFormatDigitsPercent", newValue);
|
|
19128
|
+
}
|
|
19129
|
+
validateDigits(name, value) {
|
|
19130
|
+
const errId = `WARN_${name}`;
|
|
19131
|
+
if (!isValidInteger(value) || Number(value) < 0 || Number(value) > 100) {
|
|
19132
|
+
this.errors.addOrReplace({
|
|
19133
|
+
id: errId,
|
|
19134
|
+
type: "warning",
|
|
19135
|
+
message: name + ": invalid value '" + value + "' is not supported.",
|
|
19136
|
+
});
|
|
19137
|
+
}
|
|
19138
|
+
else {
|
|
19139
|
+
this.errors.remove(errId);
|
|
19140
|
+
}
|
|
19141
|
+
}
|
|
19142
|
+
validateAxisLabelsStep(newValue) {
|
|
19143
|
+
const errId = "WARN_axisLabelsStep";
|
|
19144
|
+
if (!isValidInteger(newValue) || Number(newValue) < 1) {
|
|
19145
|
+
this.errors.addOrReplace({
|
|
19146
|
+
id: errId,
|
|
19147
|
+
type: "warning",
|
|
19148
|
+
message: "axisLabelsStep: invalid value '" + newValue + "' is not supported.",
|
|
19149
|
+
});
|
|
19150
|
+
}
|
|
19151
|
+
else {
|
|
19152
|
+
this.errors.remove(errId);
|
|
19153
|
+
}
|
|
19154
|
+
}
|
|
19155
|
+
validateAxisTitlePosition(newValue) {
|
|
19156
|
+
const errId = "WARN_axisTitlePosition";
|
|
19157
|
+
if (!isBlankInput(newValue) && !["left", "right", "none"].includes(newValue.trim().toLowerCase())) {
|
|
19158
|
+
this.errors.addOrReplace({
|
|
19159
|
+
id: errId,
|
|
19160
|
+
type: "warning",
|
|
19161
|
+
message: "axisTitlePosition: invalid value '" + newValue + "' is not supported.",
|
|
19162
|
+
});
|
|
19163
|
+
}
|
|
19164
|
+
else {
|
|
19165
|
+
this.errors.remove(errId);
|
|
19166
|
+
}
|
|
19167
|
+
}
|
|
19026
19168
|
constructor(hostRef) {
|
|
19027
19169
|
registerInstance(this, hostRef);
|
|
19028
19170
|
/** Active dataset name (the last subscribed dataset to fire `onUpdate`). */
|
|
@@ -19161,6 +19303,35 @@ const Chart = class {
|
|
|
19161
19303
|
* measureUnit displayed in table.
|
|
19162
19304
|
*/
|
|
19163
19305
|
this.measureUnit = "";
|
|
19306
|
+
/**
|
|
19307
|
+
* Number of decimal digits of the value labels
|
|
19308
|
+
*/
|
|
19309
|
+
this.dataFormatDigitsDecimal = 1;
|
|
19310
|
+
/**
|
|
19311
|
+
* Number of decimal digits of the percent labels (relative variances)
|
|
19312
|
+
*/
|
|
19313
|
+
this.dataFormatDigitsPercent = 2;
|
|
19314
|
+
/**
|
|
19315
|
+
* Prints only every n-th category label, starting with the first period.
|
|
19316
|
+
* 2 labels every second period. Bar mode only.
|
|
19317
|
+
*/
|
|
19318
|
+
this.axisLabelsStep = 1;
|
|
19319
|
+
/**
|
|
19320
|
+
* For a series that changes its scenario along the time axis, for example
|
|
19321
|
+
* AC up to this year and PL after it. In a period where the first scenario
|
|
19322
|
+
* has no value, the next scenario with a value is drawn in its place with
|
|
19323
|
+
* its value label. A vertical line marks the change, and the scenario names
|
|
19324
|
+
* stand under the axis. Variances with the same reference and type share
|
|
19325
|
+
* one row. Bar mode without stack only.
|
|
19326
|
+
*/
|
|
19327
|
+
this.scenarioSwitch = false;
|
|
19328
|
+
/**
|
|
19329
|
+
* Where the axis title stands (the chart title, or the name of a variance).
|
|
19330
|
+
* <br /><br />
|
|
19331
|
+
* values:<br />
|
|
19332
|
+
* ```left // right // none```
|
|
19333
|
+
*/
|
|
19334
|
+
this.axisTitlePosition = "left";
|
|
19164
19335
|
this.pixelPerUnitGroupMap = new Map();
|
|
19165
19336
|
this._autoScaleGuard = false;
|
|
19166
19337
|
this._lastObservedWidth = 0;
|
|
@@ -19239,6 +19410,10 @@ const Chart = class {
|
|
|
19239
19410
|
this.validateMaxBars(this.maxBars);
|
|
19240
19411
|
this.validateStack(this.stack);
|
|
19241
19412
|
this.validateScaling(this.scale);
|
|
19413
|
+
this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal);
|
|
19414
|
+
this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent);
|
|
19415
|
+
this.validateAxisLabelsStep(this.axisLabelsStep);
|
|
19416
|
+
this.validateAxisTitlePosition(this.axisTitlePosition);
|
|
19242
19417
|
}
|
|
19243
19418
|
/**
|
|
19244
19419
|
* Content width from the rendered SVG width attributes (segments stack
|
|
@@ -19452,14 +19627,14 @@ const Chart = class {
|
|
|
19452
19627
|
prepareDimension() {
|
|
19453
19628
|
const parent = getParentDimensions(this.element);
|
|
19454
19629
|
const scenariosList = this.prepareScenarios();
|
|
19455
|
-
const
|
|
19456
|
-
this.canvasWidthSegmented = parent.width / (scenariosList.length +
|
|
19630
|
+
const segments = this.prepareSegments();
|
|
19631
|
+
this.canvasWidthSegmented = parent.width / (scenariosList.length + this.prepareVariances().length || 1);
|
|
19457
19632
|
this._lastAppliedHeight = parent.height;
|
|
19458
19633
|
// The base chart and each variance render as vertically stacked segments
|
|
19459
19634
|
// (see render()), so each one may only claim its share of the height.
|
|
19460
19635
|
// The measure-scale footer (first segment only) renders below its SVG:
|
|
19461
19636
|
// reserve roughly one em for it so the fitted charts leave it room.
|
|
19462
|
-
const segmentCount = 1
|
|
19637
|
+
const segmentCount = Math.max(1, segments.length);
|
|
19463
19638
|
const footerAllowance = this.showMeasureScale ? this.getEffectiveFontPx() : 0;
|
|
19464
19639
|
return { width: this.canvasWidthSegmented, height: Math.max(0, parent.height - footerAllowance) / segmentCount };
|
|
19465
19640
|
}
|
|
@@ -19470,6 +19645,10 @@ const Chart = class {
|
|
|
19470
19645
|
this.errors.remove("AUTO_scenarios");
|
|
19471
19646
|
return scenarios.value.split(",").map((entry) => entry.trim());
|
|
19472
19647
|
}
|
|
19648
|
+
if (isNoScenarios(scenarios.value)) {
|
|
19649
|
+
this.errors.remove("AUTO_scenarios");
|
|
19650
|
+
return [];
|
|
19651
|
+
}
|
|
19473
19652
|
const isAuto = ((_a = scenarios.value) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
19474
19653
|
if (isBlankInput(scenarios.value) || isAuto) {
|
|
19475
19654
|
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
@@ -19491,6 +19670,40 @@ const Chart = class {
|
|
|
19491
19670
|
this.errors.remove("AUTO_scenarios");
|
|
19492
19671
|
return (_d = scenarios.value) === null || _d === void 0 ? void 0 : _d.split(",").map((entry) => entry.trim());
|
|
19493
19672
|
}
|
|
19673
|
+
/** `scenarios="none"`: the chart draws its variances only. */
|
|
19674
|
+
hidesScenarios() {
|
|
19675
|
+
const scenarios = this.resolveInherited("scenarios", this.scenarios);
|
|
19676
|
+
return !scenarios.inherited && isNoScenarios(scenarios.value);
|
|
19677
|
+
}
|
|
19678
|
+
/**
|
|
19679
|
+
* The stacked segments, bottom to top: `[]` is the base chart, else the
|
|
19680
|
+
* variances of one row. With `scenarioSwitch`, variances of one type over
|
|
19681
|
+
* the same reference share a row.
|
|
19682
|
+
*/
|
|
19683
|
+
prepareSegments() {
|
|
19684
|
+
const rows = this.hidesScenarios() ? [] : [[]];
|
|
19685
|
+
const rowByKey = new Map();
|
|
19686
|
+
for (const variance of this.prepareVariances()) {
|
|
19687
|
+
const parsed = new VarianceScenario(variance);
|
|
19688
|
+
const key = `${parsed.type}:${parsed.delta}`;
|
|
19689
|
+
const row = this.scenarioSwitch && parsed.isValid ? rowByKey.get(key) : undefined;
|
|
19690
|
+
if (row) {
|
|
19691
|
+
row.push(variance);
|
|
19692
|
+
continue;
|
|
19693
|
+
}
|
|
19694
|
+
const created = [variance];
|
|
19695
|
+
rows.push(created);
|
|
19696
|
+
if (parsed.isValid) {
|
|
19697
|
+
rowByKey.set(key, created);
|
|
19698
|
+
}
|
|
19699
|
+
}
|
|
19700
|
+
return rows;
|
|
19701
|
+
}
|
|
19702
|
+
prepareAxisTitlePosition() {
|
|
19703
|
+
var _a;
|
|
19704
|
+
const position = (_a = this.axisTitlePosition) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase();
|
|
19705
|
+
return position === "right" || position === "none" ? position : "left";
|
|
19706
|
+
}
|
|
19494
19707
|
prepareAvg() {
|
|
19495
19708
|
return this.showOverlayAvg;
|
|
19496
19709
|
}
|
|
@@ -19521,7 +19734,7 @@ const Chart = class {
|
|
|
19521
19734
|
}
|
|
19522
19735
|
}
|
|
19523
19736
|
}
|
|
19524
|
-
if (scenarios.length > 0 && missing.length > 0) {
|
|
19737
|
+
if (!this.hidesScenarios() && scenarios.length > 0 && missing.length > 0) {
|
|
19525
19738
|
this.errors.addOrReplace({
|
|
19526
19739
|
id: errId,
|
|
19527
19740
|
type: "warning",
|
|
@@ -19536,7 +19749,7 @@ const Chart = class {
|
|
|
19536
19749
|
return idx >= 1 || !this.showCategories;
|
|
19537
19750
|
}
|
|
19538
19751
|
prepareI18n() {
|
|
19539
|
-
const i18nMetaLabelsLocal = ["no-data"];
|
|
19752
|
+
const i18nMetaLabelsLocal = ["no-data", "date-format-short-year"];
|
|
19540
19753
|
const i18nMetaLabelsGlobal = globalLabelKeys;
|
|
19541
19754
|
const i18nMapLocal = new Map(i18nMetaLabelsLocal.map((key) => [key, this.t(".".concat(key))]));
|
|
19542
19755
|
const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
|
|
@@ -19646,14 +19859,17 @@ const Chart = class {
|
|
|
19646
19859
|
if (this.syncSpaceLeft > -1) {
|
|
19647
19860
|
return this.syncSpaceLeft;
|
|
19648
19861
|
}
|
|
19649
|
-
|
|
19862
|
+
// without a title on the left only the scenario names stand there
|
|
19863
|
+
const titles = this.prepareAxisTitlePosition() === "left" ? [...this.prepareVariances(), this.chartTitle] : [];
|
|
19864
|
+
const leftSideOffset = Formatter.getMaxWidthOfArrayItems([...titles, ...this.prepareScenarios()], preparedI18n, preparedStyle);
|
|
19650
19865
|
//if(leftSideOffset < this.syncSpaceLeft) {
|
|
19651
19866
|
// return this.syncSpaceLeft;
|
|
19652
19867
|
//}
|
|
19653
19868
|
return leftSideOffset;
|
|
19654
19869
|
}
|
|
19655
19870
|
prepareChartTitle(idx) {
|
|
19656
|
-
|
|
19871
|
+
// a variance keeps its own name as title
|
|
19872
|
+
if (idx >= 1 || this.hidesScenarios()) {
|
|
19657
19873
|
return "";
|
|
19658
19874
|
}
|
|
19659
19875
|
return this.chartTitle;
|
|
@@ -19805,16 +20021,18 @@ const Chart = class {
|
|
|
19805
20021
|
prepareMaxBars() {
|
|
19806
20022
|
return Math.floor(Number(this.maxBars) || 28);
|
|
19807
20023
|
}
|
|
19808
|
-
chartTemplate(
|
|
20024
|
+
chartTemplate(segmentVariances, idx) {
|
|
19809
20025
|
const preparedI18n = this.prepareI18n();
|
|
19810
20026
|
const preparedStyle = this.prepareStyle();
|
|
19811
20027
|
const fullParentWidth = getParentDimensions(this.element).width;
|
|
19812
20028
|
const ppu = this.preparePixelPerUnit();
|
|
19813
20029
|
const ppp = this.preparePixelPerPercentage();
|
|
19814
20030
|
const stackConfig = this.prepareStackConfig();
|
|
19815
|
-
const
|
|
19816
|
-
const
|
|
19817
|
-
|
|
20031
|
+
const isBase = segmentVariances.length === 0;
|
|
20032
|
+
const scenarios = this.hidesScenarios() ? variancesScenarios(segmentVariances) : this.prepareScenarios();
|
|
20033
|
+
// only the base chart draws a stack, a variance needs both of its scenarios
|
|
20034
|
+
const effectiveScenarios = isBase && (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
20035
|
+
return (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() }));
|
|
19818
20036
|
}
|
|
19819
20037
|
/**
|
|
19820
20038
|
* The line this chart wants to be aligned on, in CSS px from the host's
|
|
@@ -19841,7 +20059,7 @@ const Chart = class {
|
|
|
19841
20059
|
const factor = Number.isFinite(rawFactor) && rawFactor > 0 ? rawFactor : 1;
|
|
19842
20060
|
const fontSizePx = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * factor;
|
|
19843
20061
|
const variances = this.prepareVariances();
|
|
19844
|
-
const layout = collectChartFacadeLayout(this.element, "bn-chart-time-renderer",
|
|
20062
|
+
const layout = collectChartFacadeLayout(this.element, "bn-chart-time-renderer", this.prepareSegments().map((segment) => (segment.length > 0 ? segment.join(",") : "base")), origins, detail);
|
|
19845
20063
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19846
20064
|
const firstInner = (_b = this.element.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("bn-chart-time-renderer");
|
|
19847
20065
|
const state = {
|
|
@@ -19933,14 +20151,20 @@ const Chart = class {
|
|
|
19933
20151
|
});
|
|
19934
20152
|
}
|
|
19935
20153
|
render() {
|
|
19936
|
-
|
|
19937
|
-
const
|
|
19938
|
-
|
|
19939
|
-
|
|
19940
|
-
|
|
20154
|
+
this.checkVarianceScenarios(this.prepareVariances());
|
|
20155
|
+
const segments = this.prepareSegments();
|
|
20156
|
+
if (segments.length === 0) {
|
|
20157
|
+
this.errors.addOrReplace({
|
|
20158
|
+
id: "WARN_scenarios_none",
|
|
20159
|
+
type: "warning",
|
|
20160
|
+
message: "scenarios: none needs at least one variance, the chart is empty.",
|
|
20161
|
+
});
|
|
20162
|
+
}
|
|
20163
|
+
else {
|
|
20164
|
+
this.errors.remove("WARN_scenarios_none");
|
|
19941
20165
|
}
|
|
19942
20166
|
const fontStyles = this.getFontStyles();
|
|
19943
|
-
return (h(Host, { key: '
|
|
20167
|
+
return (h(Host, { key: '530c7c27c23afc339ca03506f2cb608774e8a7ed', style: fontStyles }, h("div", { key: '99bbe8fa9d17ef14bbb6a3b5e2dce21025cdc40c', class: "container" }, segments.map(this.chartTemplate))));
|
|
19944
20168
|
}
|
|
19945
20169
|
get element() { return getElement(this); }
|
|
19946
20170
|
static get watchers() { return {
|
|
@@ -19982,6 +20206,18 @@ const Chart = class {
|
|
|
19982
20206
|
}],
|
|
19983
20207
|
"measureScale": [{
|
|
19984
20208
|
"validateMeasureScale": 0
|
|
20209
|
+
}],
|
|
20210
|
+
"dataFormatDigitsDecimal": [{
|
|
20211
|
+
"validateDataFormatDigitsDecimal": 0
|
|
20212
|
+
}],
|
|
20213
|
+
"dataFormatDigitsPercent": [{
|
|
20214
|
+
"validateDataFormatDigitsPercent": 0
|
|
20215
|
+
}],
|
|
20216
|
+
"axisLabelsStep": [{
|
|
20217
|
+
"validateAxisLabelsStep": 0
|
|
20218
|
+
}],
|
|
20219
|
+
"axisTitlePosition": [{
|
|
20220
|
+
"validateAxisTitlePosition": 0
|
|
19985
20221
|
}]
|
|
19986
20222
|
}; }
|
|
19987
20223
|
};
|
|
@@ -20420,6 +20656,8 @@ class CustomPattern {
|
|
|
20420
20656
|
*/
|
|
20421
20657
|
class DataPoint {
|
|
20422
20658
|
constructor(value, scenario, pixelPerUnit, variance) {
|
|
20659
|
+
/** Relative variances beyond this fraction are cut. Infinity when the chart has room for the full pin. */
|
|
20660
|
+
this.percentClamp = DataPoint.PERCENT_CLAMP;
|
|
20423
20661
|
this.value = value;
|
|
20424
20662
|
this.scenario = scenario;
|
|
20425
20663
|
this.pixelPerUnit = pixelPerUnit || 1;
|
|
@@ -20446,7 +20684,7 @@ class DataPoint {
|
|
|
20446
20684
|
return this.value * this.pixelPerUnit;
|
|
20447
20685
|
}
|
|
20448
20686
|
/**
|
|
20449
|
-
* Returns the percentage value scaled to pixel height, clipped at +/-145
|
|
20687
|
+
* Returns the percentage value scaled to pixel height, clipped at +/-145% unless the clamp is lifted.
|
|
20450
20688
|
*
|
|
20451
20689
|
* Values beyond +/-1.45 (145%) are clamped to prevent extreme bars from
|
|
20452
20690
|
* distorting the chart layout. Use {@link isClipped} to check if clipping occurred.
|
|
@@ -20455,11 +20693,11 @@ class DataPoint {
|
|
|
20455
20693
|
if (this.value == null) {
|
|
20456
20694
|
return 0;
|
|
20457
20695
|
}
|
|
20458
|
-
if (this.value >
|
|
20459
|
-
return
|
|
20696
|
+
if (this.value > this.percentClamp) {
|
|
20697
|
+
return this.percentClamp * this.pixelPerUnit;
|
|
20460
20698
|
}
|
|
20461
|
-
if (this.value < -
|
|
20462
|
-
return -
|
|
20699
|
+
if (this.value < -this.percentClamp) {
|
|
20700
|
+
return -this.percentClamp * this.pixelPerUnit;
|
|
20463
20701
|
}
|
|
20464
20702
|
return this.value * this.pixelPerUnit;
|
|
20465
20703
|
}
|
|
@@ -20490,7 +20728,7 @@ class DataPoint {
|
|
|
20490
20728
|
if (this.value == null) {
|
|
20491
20729
|
return false;
|
|
20492
20730
|
}
|
|
20493
|
-
return Math.abs(this.value) >
|
|
20731
|
+
return Math.abs(this.value) > this.percentClamp;
|
|
20494
20732
|
}
|
|
20495
20733
|
/** Returns the fixed display value (145) shown on clipped percentage bars. */
|
|
20496
20734
|
getClippedValue() {
|
|
@@ -20502,6 +20740,7 @@ class DataPoint {
|
|
|
20502
20740
|
return (_a = this.scenario) === null || _a === void 0 ? void 0 : _a.slice(0, 2);
|
|
20503
20741
|
}
|
|
20504
20742
|
}
|
|
20743
|
+
DataPoint.PERCENT_CLAMP = 1.45;
|
|
20505
20744
|
|
|
20506
20745
|
// import { IAdapter } from "../../../../utils/helper/IAdapter";
|
|
20507
20746
|
// import { CompareUtil } from "../../../../utils/helper/CompareUtil";
|
|
@@ -20764,6 +21003,7 @@ class Axis {
|
|
|
20764
21003
|
this.scenarioType = axis.scenarioType;
|
|
20765
21004
|
this.labelText = axis.labelText || null;
|
|
20766
21005
|
this.isRelative = axis.isRelative || false;
|
|
21006
|
+
this.titlePosition = axis.titlePosition || "left";
|
|
20767
21007
|
this.position = position;
|
|
20768
21008
|
this.svgGroup = svgParentGroup.group().id(this.ID_AXIS);
|
|
20769
21009
|
}
|
|
@@ -20771,12 +21011,19 @@ class Axis {
|
|
|
20771
21011
|
if (null == text) {
|
|
20772
21012
|
text = "";
|
|
20773
21013
|
}
|
|
21014
|
+
if (this.titlePosition === "right") {
|
|
21015
|
+
group
|
|
21016
|
+
.text(text)
|
|
21017
|
+
.addClass(this.CSS_AXIS_TITLE)
|
|
21018
|
+
.move(this.position.getAxisEndPositionX() + this.position.spacings.labelToColumn, this.position.getAxisTitlePositionY(true, this.isRelative));
|
|
21019
|
+
return;
|
|
21020
|
+
}
|
|
20774
21021
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20775
21022
|
const title = group.text(text).addClass(this.CSS_AXIS_TITLE).attr("text-anchor", "middle");
|
|
20776
21023
|
title.move(this.position.getAxisTitlePositionX(group), this.position.getAxisTitlePositionY(true, this.isRelative));
|
|
20777
21024
|
}
|
|
20778
21025
|
draw() {
|
|
20779
|
-
if (this.labelText) {
|
|
21026
|
+
if (this.labelText && this.titlePosition !== "none") {
|
|
20780
21027
|
this.drawAxisTitle(this.svgGroup, this.labelText);
|
|
20781
21028
|
}
|
|
20782
21029
|
this.svgGroup
|
|
@@ -20861,16 +21108,22 @@ class Column {
|
|
|
20861
21108
|
return this;
|
|
20862
21109
|
}
|
|
20863
21110
|
draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
|
|
20864
|
-
var _a;
|
|
21111
|
+
var _a, _b, _c;
|
|
20865
21112
|
// TODE: JHE: Remove DataFOrmatDigits Type Duplicates
|
|
20866
21113
|
if (this.isEmpty()) {
|
|
20867
21114
|
return this;
|
|
20868
21115
|
}
|
|
20869
21116
|
const scenarioStyle = this.getScenarioStyle();
|
|
20870
|
-
|
|
20871
|
-
|
|
21117
|
+
let strokeStyle = this.convertToSVGStyle(scenarioStyle, "stroke");
|
|
21118
|
+
let fillStyle = this.getFillStyle(scenarioStyle);
|
|
21119
|
+
if (this.isVarianceColumn && this.dataPoint.notation === "pl") {
|
|
21120
|
+
// outlined like a plan column: the colour of the variance on the edge only
|
|
21121
|
+
const planWidth = Number((_b = (_a = this.columnBarStyles) === null || _a === void 0 ? void 0 : _a.pl) === null || _b === void 0 ? void 0 : _b.width);
|
|
21122
|
+
strokeStyle = { color: (scenarioStyle === null || scenarioStyle === void 0 ? void 0 : scenarioStyle.fill) || this.FALLBACK_COLOUR, width: planWidth > 0 ? planWidth : 1 };
|
|
21123
|
+
fillStyle = this.styles.fontStyles.background || "#ffffff";
|
|
21124
|
+
}
|
|
20872
21125
|
this.scenarioGroup.attr(dataPointAttributes(this.dataPoint.key));
|
|
20873
|
-
(
|
|
21126
|
+
(_c = this.columnGroup) === null || _c === void 0 ? void 0 : _c.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
20874
21127
|
if (this.columnGroup != null) {
|
|
20875
21128
|
if (this.isOverflowing && this.overflowConfig) {
|
|
20876
21129
|
this.drawOverdriveBar(fillStyle, strokeStyle);
|
|
@@ -21237,11 +21490,11 @@ class Needle {
|
|
|
21237
21490
|
(_a = this.dataLabel) === null || _a === void 0 ? void 0 : _a.updateGroup(newGroup);
|
|
21238
21491
|
return this;
|
|
21239
21492
|
}
|
|
21240
|
-
draw() {
|
|
21493
|
+
draw(dataFormatDigits = { percent: 2, decimal: 1 }) {
|
|
21241
21494
|
var _a, _b, _c;
|
|
21242
21495
|
if (((_a = this.dataPoint) === null || _a === void 0 ? void 0 : _a.value) === undefined) {
|
|
21243
21496
|
// reference 0: the label says "n/a", there is no pin
|
|
21244
|
-
(_b = this.dataLabel) === null || _b === void 0 ? void 0 : _b.draw();
|
|
21497
|
+
(_b = this.dataLabel) === null || _b === void 0 ? void 0 : _b.draw(true, dataFormatDigits);
|
|
21245
21498
|
return this;
|
|
21246
21499
|
}
|
|
21247
21500
|
if (this.isEmpty()) {
|
|
@@ -21261,6 +21514,12 @@ class Needle {
|
|
|
21261
21514
|
fillStyle = polygonPattern.pattern;
|
|
21262
21515
|
}
|
|
21263
21516
|
}
|
|
21517
|
+
if (this.dataPoint.notation === "pl") {
|
|
21518
|
+
// outlined like a plan column: the colour of the variance on the edge only
|
|
21519
|
+
strokeStyle.color = (scenarioStyle === null || scenarioStyle === void 0 ? void 0 : scenarioStyle.fill) || strokeStyle.color;
|
|
21520
|
+
strokeStyle.width = Math.max(1, Number(strokeStyle.width) || 0);
|
|
21521
|
+
fillStyle = this.styles.fontStyles.background || "#ffffff";
|
|
21522
|
+
}
|
|
21264
21523
|
if (this.dimensions.clipped) {
|
|
21265
21524
|
this.createClippedNeedleHead(fillStyle, strokeStyle);
|
|
21266
21525
|
}
|
|
@@ -21273,7 +21532,7 @@ class Needle {
|
|
|
21273
21532
|
.y(this.dimensions.yPos)
|
|
21274
21533
|
.fill(fillStyle)
|
|
21275
21534
|
.stroke(strokeStyle);
|
|
21276
|
-
(_c = this.dataLabel) === null || _c === void 0 ? void 0 : _c.draw();
|
|
21535
|
+
(_c = this.dataLabel) === null || _c === void 0 ? void 0 : _c.draw(true, dataFormatDigits);
|
|
21277
21536
|
}
|
|
21278
21537
|
createDimensions(position, dataPoint, index) {
|
|
21279
21538
|
if (dataPoint.getScaledPercentUnit() < 0) {
|
|
@@ -21988,12 +22247,12 @@ class ScenarioFactory {
|
|
|
21988
22247
|
}
|
|
21989
22248
|
return new Line(this.position, this.styles, dataPoint, previousDataPoint, index, isPrimaryColumn, columnGroup, lineLabel).updateLabelGroup(labelGroup);
|
|
21990
22249
|
}
|
|
21991
|
-
createPrimaryBar(dataPoint, index) {
|
|
22250
|
+
createPrimaryBar(dataPoint, index, withScenarioLabel = true) {
|
|
21992
22251
|
const isPrimaryColumn = true;
|
|
21993
22252
|
const columnGroup = this.svgGroups.scenario1.group().id("" + index);
|
|
21994
22253
|
const labelGroup = this.svgGroups.scenario1Label.group().id("" + index);
|
|
21995
22254
|
let columnLabel = null;
|
|
21996
|
-
if (this.isLastDataPoint(index)) {
|
|
22255
|
+
if (withScenarioLabel && this.isLastDataPoint(index)) {
|
|
21997
22256
|
columnLabel = `${this.i18n.get(dataPoint.scenario) || dataPoint.scenario}`;
|
|
21998
22257
|
}
|
|
21999
22258
|
return new Column(this.position, this.styles, dataPoint, index, isPrimaryColumn, columnGroup, columnLabel, this.overflowConfig).updateLabelGroup(labelGroup);
|
|
@@ -22216,6 +22475,11 @@ class TimeChart {
|
|
|
22216
22475
|
this.availableWidth = 0;
|
|
22217
22476
|
this.overflowConfig = null;
|
|
22218
22477
|
this.lastScenarios = [];
|
|
22478
|
+
this.axisLabelsStep = 1;
|
|
22479
|
+
this.scenarioSwitch = false;
|
|
22480
|
+
this.axisTitlePosition = "left";
|
|
22481
|
+
/** Periods in which more than one variance of a shared row has a value. */
|
|
22482
|
+
this.varianceOverlaps = 0;
|
|
22219
22483
|
this.db = db;
|
|
22220
22484
|
this.tableName = tableName;
|
|
22221
22485
|
this.ruleSet = ruleSet || new IBCSRuleSet();
|
|
@@ -22270,7 +22534,8 @@ class TimeChart {
|
|
|
22270
22534
|
this.position.padding.top +
|
|
22271
22535
|
this.position.padding.bottom +
|
|
22272
22536
|
this.position.spacings.labelToAxis +
|
|
22273
|
-
fontSize
|
|
22537
|
+
fontSize + // axis labels approximate height
|
|
22538
|
+
this.switchNamesHeight();
|
|
22274
22539
|
const overdriveZoneHeight = fontSize * 1.5;
|
|
22275
22540
|
const breakGap = fontSize * 0.3;
|
|
22276
22541
|
const cutHeight = availableHeight - nonBarOverhead - overdriveZoneHeight - breakGap;
|
|
@@ -22294,7 +22559,7 @@ class TimeChart {
|
|
|
22294
22559
|
};
|
|
22295
22560
|
}
|
|
22296
22561
|
setConfig(config) {
|
|
22297
|
-
var _a;
|
|
22562
|
+
var _a, _b, _c, _d;
|
|
22298
22563
|
this.state = FactoryState$1.DIRTY;
|
|
22299
22564
|
// Must precede setSource/populateModel: the locale is baked into the
|
|
22300
22565
|
// normalizeDate() SQL as well as into the axis date labels.
|
|
@@ -22307,11 +22572,14 @@ class TimeChart {
|
|
|
22307
22572
|
this.pixelPerPercentage = config.pixelPerPercentage;
|
|
22308
22573
|
this.axisLabelsMode = config.axisLabelsMode;
|
|
22309
22574
|
this.intervalSpanLimit = config.intervalSpanLimit;
|
|
22575
|
+
this.axisLabelsStep = (_a = config.axisLabelsStep) !== null && _a !== void 0 ? _a : 1;
|
|
22576
|
+
this.scenarioSwitch = (_b = config.scenarioSwitch) !== null && _b !== void 0 ? _b : false;
|
|
22577
|
+
this.axisTitlePosition = (_c = config.axisTitlePosition) !== null && _c !== void 0 ? _c : "left";
|
|
22310
22578
|
this.dateInterval = this.findDateInterval(config.dateInterval);
|
|
22311
22579
|
this.dataModel = this.populateModel(scenarios, this.dateInterval);
|
|
22312
22580
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
22313
22581
|
this.configTitle = config.title;
|
|
22314
|
-
this.configVariances = (
|
|
22582
|
+
this.configVariances = (_d = config === null || config === void 0 ? void 0 : config.variances) !== null && _d !== void 0 ? _d : [];
|
|
22315
22583
|
this.updateTitle();
|
|
22316
22584
|
this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
|
|
22317
22585
|
this.smallestVarianceDataPointValue = this.findSmallestDataPointValue(this.variancesDataModel);
|
|
@@ -22379,8 +22647,10 @@ class TimeChart {
|
|
|
22379
22647
|
}
|
|
22380
22648
|
/** Derives the variance title from the stored config and the current i18n map. */
|
|
22381
22649
|
updateTitle() {
|
|
22382
|
-
var _a;
|
|
22383
|
-
|
|
22650
|
+
var _a, _b;
|
|
22651
|
+
// variances that share a row have the same reference: the first one names the row
|
|
22652
|
+
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();
|
|
22653
|
+
this.title = this.configTitle || Formatter.translateScenarioLabel(variance, this.i18n);
|
|
22384
22654
|
}
|
|
22385
22655
|
/**
|
|
22386
22656
|
* Resolves the dataset (a table or view in the shared alasql database) and
|
|
@@ -22421,7 +22691,15 @@ class TimeChart {
|
|
|
22421
22691
|
// Also consider bbox-based measurement as a fallback (works for rects)
|
|
22422
22692
|
const bboxWidth = Math.max(this.axisCategoryArea.width, this.scenariosArea.width);
|
|
22423
22693
|
const bboxTotal = bboxWidth > 0 ? bboxWidth + this.position.leftSideLabelLength : 0;
|
|
22424
|
-
|
|
22694
|
+
let titleEnd = 0;
|
|
22695
|
+
if (this.axisTitlePosition === "right" && this.title) {
|
|
22696
|
+
const titleWidth = CalculateSize(this.title, {
|
|
22697
|
+
font: this.styles.fontStyles.font,
|
|
22698
|
+
fontSize: this.styles.fontStyles.size + "px",
|
|
22699
|
+
}).width;
|
|
22700
|
+
titleEnd = axisEnd + this.position.spacings.labelToColumn + titleWidth + this.styles.padding.right;
|
|
22701
|
+
}
|
|
22702
|
+
return Math.max(axisEnd + labelBuffer, bboxTotal, titleEnd);
|
|
22425
22703
|
}
|
|
22426
22704
|
getAllocatedCanvasHeight() {
|
|
22427
22705
|
if (this.smallestVarianceDataPointValue.value == null ||
|
|
@@ -22452,7 +22730,91 @@ class TimeChart {
|
|
|
22452
22730
|
const bboxHeight = isOnSameAxisSide
|
|
22453
22731
|
? this.axisCategoryArea.height + this.scenariosArea.height
|
|
22454
22732
|
: this.scenariosArea.height;
|
|
22455
|
-
return Math.max(analyticalHeight, bboxHeight);
|
|
22733
|
+
return Math.max(analyticalHeight, bboxHeight) + this.switchNamesHeight();
|
|
22734
|
+
}
|
|
22735
|
+
/** Room for the scenario names under the category labels of a series that changes its scenario. */
|
|
22736
|
+
switchNamesHeight() {
|
|
22737
|
+
return !this.hideAxisLabels && this.switchRuns().length > 1 ? this.position.dataLabelHeight : 0;
|
|
22738
|
+
}
|
|
22739
|
+
/** True for a scenario slot that has a value in this period. */
|
|
22740
|
+
static hasValue(dataPoint) {
|
|
22741
|
+
return dataPoint != null && !dataPoint.isEmpty() && dataPoint.value != null && !Number.isNaN(dataPoint.value);
|
|
22742
|
+
}
|
|
22743
|
+
/**
|
|
22744
|
+
* The slots that continue the first scenario: they have values, and only in
|
|
22745
|
+
* periods where the first scenario has none. Empty without `scenarioSwitch`.
|
|
22746
|
+
*/
|
|
22747
|
+
followerSlots() {
|
|
22748
|
+
if (!this.scenarioSwitch || this.stackConfig != null || this.determineEffectiveChartMode() !== ChartMode.BAR) {
|
|
22749
|
+
return [];
|
|
22750
|
+
}
|
|
22751
|
+
return ["scenario2", "scenario3", "scenario4"].filter((slot) => {
|
|
22752
|
+
let values = 0;
|
|
22753
|
+
for (const row of this.dataModel) {
|
|
22754
|
+
if (TimeChart.hasValue(row[slot])) {
|
|
22755
|
+
if (TimeChart.hasValue(row.scenario1)) {
|
|
22756
|
+
return false;
|
|
22757
|
+
}
|
|
22758
|
+
values++;
|
|
22759
|
+
}
|
|
22760
|
+
}
|
|
22761
|
+
return values > 0;
|
|
22762
|
+
});
|
|
22763
|
+
}
|
|
22764
|
+
/** The slot drawn as the column of a period: the first scenario, else the first follower with a value. */
|
|
22765
|
+
visibleSlot(row, followers) {
|
|
22766
|
+
var _a;
|
|
22767
|
+
if (TimeChart.hasValue(row.scenario1)) {
|
|
22768
|
+
return "scenario1";
|
|
22769
|
+
}
|
|
22770
|
+
return (_a = followers.find((slot) => TimeChart.hasValue(row[slot]))) !== null && _a !== void 0 ? _a : null;
|
|
22771
|
+
}
|
|
22772
|
+
/** Runs of periods with the same visible scenario. A period without a value belongs to the run before it. */
|
|
22773
|
+
switchRuns() {
|
|
22774
|
+
const followers = this.followerSlots();
|
|
22775
|
+
if (followers.length === 0) {
|
|
22776
|
+
return [];
|
|
22777
|
+
}
|
|
22778
|
+
const runs = [];
|
|
22779
|
+
this.dataModel.forEach((row, index) => {
|
|
22780
|
+
const slot = this.visibleSlot(row, followers);
|
|
22781
|
+
const scenario = slot ? row[slot].scenario : null;
|
|
22782
|
+
const last = runs[runs.length - 1];
|
|
22783
|
+
if (scenario == null || (last === null || last === void 0 ? void 0 : last.scenario) === scenario) {
|
|
22784
|
+
if (last)
|
|
22785
|
+
last.to = index;
|
|
22786
|
+
return;
|
|
22787
|
+
}
|
|
22788
|
+
runs.push({ scenario, from: index, to: index });
|
|
22789
|
+
});
|
|
22790
|
+
return runs;
|
|
22791
|
+
}
|
|
22792
|
+
/** Number of periods where variances of one row overlap. The component warns about it. */
|
|
22793
|
+
getVarianceOverlaps() {
|
|
22794
|
+
return this.varianceOverlaps;
|
|
22795
|
+
}
|
|
22796
|
+
/**
|
|
22797
|
+
* Lifts the 145 % cut of relative variances when the uncut pins fit into
|
|
22798
|
+
* `availableHeight`. Only for a fixed percentage scale: the author chose it,
|
|
22799
|
+
* so a long pin is cut for lack of room only.
|
|
22800
|
+
*/
|
|
22801
|
+
fitRelativeVariances(availableHeight) {
|
|
22802
|
+
const points = this.variancesDataModel
|
|
22803
|
+
.filter((entry) => entry.type === VarianceType.RELATIVE)
|
|
22804
|
+
.map((entry) => entry.scenario1);
|
|
22805
|
+
if (points.length === 0 || !points.some((point) => point.isClipped())) {
|
|
22806
|
+
return;
|
|
22807
|
+
}
|
|
22808
|
+
const setClamp = (clamp) => {
|
|
22809
|
+
points.forEach((point) => (point.percentClamp = clamp));
|
|
22810
|
+
this.updatePosition(this.lastScenarios);
|
|
22811
|
+
};
|
|
22812
|
+
setClamp(Number.POSITIVE_INFINITY);
|
|
22813
|
+
this.layout();
|
|
22814
|
+
// an unknown height on either side keeps the cut
|
|
22815
|
+
if (!(availableHeight > 0) || !(this.getAllocatedCanvasHeight() <= availableHeight)) {
|
|
22816
|
+
setClamp(DataPoint.PERCENT_CLAMP);
|
|
22817
|
+
}
|
|
22456
22818
|
}
|
|
22457
22819
|
/**
|
|
22458
22820
|
* Total column extent (data units) proportional to pixelPerUnit, covering
|
|
@@ -22955,6 +23317,11 @@ class TimeChart {
|
|
|
22955
23317
|
if (dataModel != null && dataModel.length > 0) {
|
|
22956
23318
|
firstRow = dataModel[0];
|
|
22957
23319
|
}
|
|
23320
|
+
this.varianceOverlaps = 0;
|
|
23321
|
+
const parsed = variancesConfig.map((variance) => new VarianceScenario(variance));
|
|
23322
|
+
if (this.scenarioSwitch && parsed.filter((variance) => variance.isValid).length > 1) {
|
|
23323
|
+
return this.populateSharedVarianceRow(variancesConfig, parsed, dataModel, firstRow);
|
|
23324
|
+
}
|
|
22958
23325
|
for (const varianceScenario in variancesConfig) {
|
|
22959
23326
|
const scenarios = new VarianceScenario(variancesConfig[varianceScenario]);
|
|
22960
23327
|
if (scenarios.isValid) {
|
|
@@ -22984,6 +23351,47 @@ class TimeChart {
|
|
|
22984
23351
|
}
|
|
22985
23352
|
return varianceModel;
|
|
22986
23353
|
}
|
|
23354
|
+
/**
|
|
23355
|
+
* One row for several variances over the same reference: each period shows
|
|
23356
|
+
* the first variance that has a value there, in the notation of its scenario.
|
|
23357
|
+
*/
|
|
23358
|
+
populateSharedVarianceRow(variancesConfig, parsed, dataModel, firstRow) {
|
|
23359
|
+
const varianceModel = [];
|
|
23360
|
+
const valid = parsed.map((variance, index) => ({ variance, name: variancesConfig[index] }));
|
|
23361
|
+
const candidates = valid.filter((entry) => entry.variance.isValid);
|
|
23362
|
+
const isRelative = candidates[0].variance.type === "dr";
|
|
23363
|
+
const pixelPerUnit = isRelative ? this.pixelPerPercentage : this.pixelPerUnit;
|
|
23364
|
+
dataModel.forEach((row, index) => {
|
|
23365
|
+
let point = null;
|
|
23366
|
+
let values = 0;
|
|
23367
|
+
for (const { variance, name } of candidates) {
|
|
23368
|
+
const value = this.calculateVariance(variance, row, this.mapScenarios(variance, firstRow));
|
|
23369
|
+
if (value === null || Number.isNaN(value)) {
|
|
23370
|
+
continue;
|
|
23371
|
+
}
|
|
23372
|
+
values++;
|
|
23373
|
+
if (point == null) {
|
|
23374
|
+
point = new DataPoint(value, variance.delta, pixelPerUnit, variance.direction);
|
|
23375
|
+
point.notation = variance.base.slice(0, 2);
|
|
23376
|
+
point.key = { date: TimeChart.pointDate(row.date), scenario: name };
|
|
23377
|
+
}
|
|
23378
|
+
}
|
|
23379
|
+
if (values > 1) {
|
|
23380
|
+
this.varianceOverlaps++;
|
|
23381
|
+
}
|
|
23382
|
+
varianceModel.push({
|
|
23383
|
+
id: index,
|
|
23384
|
+
category: row.category,
|
|
23385
|
+
type: isRelative ? VarianceType.RELATIVE : VarianceType.ABSOLUTE,
|
|
23386
|
+
date: row.date,
|
|
23387
|
+
scenario1: point !== null && point !== void 0 ? point : new DataPoint(null, candidates[0].variance.delta, pixelPerUnit, candidates[0].variance.direction),
|
|
23388
|
+
scenario2: new DataPoint(null, null, null, null),
|
|
23389
|
+
scenario3: new DataPoint(null, null, null, null),
|
|
23390
|
+
scenario4: new DataPoint(null, null, null, null),
|
|
23391
|
+
});
|
|
23392
|
+
});
|
|
23393
|
+
return varianceModel;
|
|
23394
|
+
}
|
|
22987
23395
|
calculateVariance(scenarios, element, scenarioMap) {
|
|
22988
23396
|
const scenarioBase = scenarioMap.get(scenarios.base);
|
|
22989
23397
|
const scenarioDelta = scenarioMap.get(scenarios.delta);
|
|
@@ -23026,6 +23434,11 @@ class TimeChart {
|
|
|
23026
23434
|
createDateFactory() {
|
|
23027
23435
|
const factory = new DateStringFactory();
|
|
23028
23436
|
factory.setLocale(this.locale);
|
|
23437
|
+
// a Luxon pattern from the translations, for example ’yy
|
|
23438
|
+
const shortYear = this.i18n.get("date-format-short-year");
|
|
23439
|
+
if (typeof shortYear === "string" && /y/.test(shortYear) && !shortYear.includes("date-format")) {
|
|
23440
|
+
factory.patchDateFormatShort({ year: shortYear });
|
|
23441
|
+
}
|
|
23029
23442
|
return factory;
|
|
23030
23443
|
}
|
|
23031
23444
|
/**
|
|
@@ -23070,6 +23483,12 @@ class TimeChart {
|
|
|
23070
23483
|
if (elements["type"] === VarianceType.RELATIVE) {
|
|
23071
23484
|
isRelative = true;
|
|
23072
23485
|
}
|
|
23486
|
+
// in smart mode a period that starts a year or month carries that part alone, so it is never skipped
|
|
23487
|
+
const carriesBoundary = this.axisLabelsMode === AxisLabelsMode.SMART &&
|
|
23488
|
+
dateStringFactory.isSmartBoundary(elements.date, this.dateInterval);
|
|
23489
|
+
if (index % this.axisLabelsStep !== 0 && !carriesBoundary) {
|
|
23490
|
+
return;
|
|
23491
|
+
}
|
|
23073
23492
|
let datelabel = dateStringFactory.getDateString(elements.date, this.dateInterval);
|
|
23074
23493
|
if (this.axisLabelsMode === AxisLabelsMode.SMART) {
|
|
23075
23494
|
datelabel = dateStringFactory.getSmartDateString(elements.date, this.dateInterval);
|
|
@@ -23093,6 +23512,7 @@ class TimeChart {
|
|
|
23093
23512
|
scenarioType: this.axisScenario,
|
|
23094
23513
|
labelText: this.title,
|
|
23095
23514
|
isRelative: isRelative,
|
|
23515
|
+
titlePosition: this.axisTitlePosition,
|
|
23096
23516
|
}, this.position, axisLabelGroup).draw();
|
|
23097
23517
|
// svg.js's width()/height() getters each default to their own bbox() call,
|
|
23098
23518
|
// so reading both measures the group twice. Measure once.
|
|
@@ -23101,17 +23521,65 @@ class TimeChart {
|
|
|
23101
23521
|
height: axisBox.height,
|
|
23102
23522
|
width: axisBox.width,
|
|
23103
23523
|
};
|
|
23524
|
+
this.drawScenarioSwitch(svgContainer);
|
|
23525
|
+
}
|
|
23526
|
+
/**
|
|
23527
|
+
* A vertical line where the visible scenario of the series changes, and the
|
|
23528
|
+
* scenario names under the category labels. Drawn after the axis is
|
|
23529
|
+
* measured, so it does not change the allocated size by itself.
|
|
23530
|
+
*/
|
|
23531
|
+
drawScenarioSwitch(svgContainer) {
|
|
23532
|
+
const runs = this.switchRuns();
|
|
23533
|
+
if (runs.length < 2) {
|
|
23534
|
+
return;
|
|
23535
|
+
}
|
|
23536
|
+
const group = svgContainer.group().id("ScenarioSwitch");
|
|
23537
|
+
const namesHeight = this.switchNamesHeight();
|
|
23538
|
+
const height = this.getAllocatedCanvasHeight();
|
|
23539
|
+
const bottom = namesHeight > 0 ? height - this.styles.padding.bottom : height;
|
|
23540
|
+
const lineWidth = Math.max(1, this.position.spacings.auxiliaryLineWidth);
|
|
23541
|
+
runs.slice(1).forEach((run) => {
|
|
23542
|
+
const x = (this.position.getColumnCenterPositionX(run.from - 1) + this.position.getColumnCenterPositionX(run.from)) / 2;
|
|
23543
|
+
group
|
|
23544
|
+
.line(x, 0, x, bottom)
|
|
23545
|
+
.stroke({ color: this.styles.fontStyles.color || "#000000", width: lineWidth })
|
|
23546
|
+
.addClass("scenario-switch");
|
|
23547
|
+
});
|
|
23548
|
+
if (namesHeight === 0) {
|
|
23549
|
+
return;
|
|
23550
|
+
}
|
|
23551
|
+
runs.forEach((run) => {
|
|
23552
|
+
const center = (this.position.getColumnCenterPositionX(run.from) + this.position.getColumnCenterPositionX(run.to)) / 2;
|
|
23553
|
+
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();
|
|
23554
|
+
});
|
|
23104
23555
|
}
|
|
23105
23556
|
drawScenarios(dataModel, svgContainer) {
|
|
23106
23557
|
const columnGroup = svgContainer.group().id("Scenarios");
|
|
23107
23558
|
const scenarioFactory = new ScenarioFactory(this.position, columnGroup, this.scenarioStyles(), dataModel.length, this.i18n);
|
|
23108
23559
|
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
23109
23560
|
let hasValidPrim = false;
|
|
23561
|
+
const followers = this.followerSlots();
|
|
23110
23562
|
dataModel.forEach((elements, index) => {
|
|
23111
|
-
|
|
23112
|
-
|
|
23113
|
-
|
|
23114
|
-
|
|
23563
|
+
// a follower takes the place of the first scenario: full column with value label, named under the axis
|
|
23564
|
+
const visible = followers.length > 0 ? this.visibleSlot(elements, followers) : "scenario1";
|
|
23565
|
+
if (visible != null && visible !== "scenario1") {
|
|
23566
|
+
scenarioFactory
|
|
23567
|
+
.createPrimaryBar(elements[visible], index, false)
|
|
23568
|
+
.draw(this.dataFormatDigits, this.measureScale);
|
|
23569
|
+
hasValidPrim = true;
|
|
23570
|
+
}
|
|
23571
|
+
else {
|
|
23572
|
+
scenarioFactory.createPrimaryBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
23573
|
+
}
|
|
23574
|
+
if (visible !== "scenario2") {
|
|
23575
|
+
scenarioFactory.createSecondaryBar(elements["scenario2"], index).draw();
|
|
23576
|
+
}
|
|
23577
|
+
if (visible !== "scenario3") {
|
|
23578
|
+
scenarioFactory.createPrimaryMarker(elements["scenario3"], index).draw();
|
|
23579
|
+
}
|
|
23580
|
+
if (visible !== "scenario4") {
|
|
23581
|
+
scenarioFactory.createSecondaryMarker(elements["scenario4"], index).draw();
|
|
23582
|
+
}
|
|
23115
23583
|
if (elements["scenario1"].isEmpty() === false) {
|
|
23116
23584
|
hasValidPrim = true;
|
|
23117
23585
|
}
|
|
@@ -23303,7 +23771,7 @@ class TimeChart {
|
|
|
23303
23771
|
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
23304
23772
|
dataModel.forEach((elements, index) => {
|
|
23305
23773
|
if (elements["type"] === VarianceType.RELATIVE) {
|
|
23306
|
-
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw();
|
|
23774
|
+
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits);
|
|
23307
23775
|
}
|
|
23308
23776
|
else {
|
|
23309
23777
|
scenarioFactory.createVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
@@ -23743,6 +24211,12 @@ class TimeChartComponentConfig {
|
|
|
23743
24211
|
this.stackConfig = null;
|
|
23744
24212
|
/** When true, line charts extend to the full width of the chart area. */
|
|
23745
24213
|
this.lineFullWidth = true;
|
|
24214
|
+
/** Print every n-th category label only. */
|
|
24215
|
+
this.axisLabelsStep = 1;
|
|
24216
|
+
/** One series that changes its scenario along the time axis, see `bn-chart-time`. */
|
|
24217
|
+
this.scenarioSwitch = false;
|
|
24218
|
+
/** Side of the axis title: left, right or none. */
|
|
24219
|
+
this.axisTitlePosition = "left";
|
|
23746
24220
|
/** Locale used for date-axis labels and SQL date normalization; set from the bn-context locale. */
|
|
23747
24221
|
this.locale = "de";
|
|
23748
24222
|
}
|
|
@@ -23825,6 +24299,15 @@ class TimeChartComponentConfigAdapter {
|
|
|
23825
24299
|
if (CompareUtil.isBoolean(data.lineFullWidth)) {
|
|
23826
24300
|
config.lineFullWidth = data.lineFullWidth;
|
|
23827
24301
|
}
|
|
24302
|
+
if (CompareUtil.isNumber(data.axisLabelsStep) && data.axisLabelsStep >= 1) {
|
|
24303
|
+
config.axisLabelsStep = data.axisLabelsStep;
|
|
24304
|
+
}
|
|
24305
|
+
if (CompareUtil.isBoolean(data.scenarioSwitch)) {
|
|
24306
|
+
config.scenarioSwitch = data.scenarioSwitch;
|
|
24307
|
+
}
|
|
24308
|
+
if (CompareUtil.isString(data.axisTitlePosition)) {
|
|
24309
|
+
config.axisTitlePosition = data.axisTitlePosition;
|
|
24310
|
+
}
|
|
23828
24311
|
if (CompareUtil.isString(data.locale)) {
|
|
23829
24312
|
config.locale = data.locale;
|
|
23830
24313
|
}
|
|
@@ -23838,6 +24321,13 @@ class TimeChartComponentConfigAdapter {
|
|
|
23838
24321
|
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}`;
|
|
23839
24322
|
|
|
23840
24323
|
const BnChartTimeRenderer = class {
|
|
24324
|
+
disconnectedCallback() {
|
|
24325
|
+
var _a;
|
|
24326
|
+
if (this.overlapErrId) {
|
|
24327
|
+
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.remove(this.overlapErrId);
|
|
24328
|
+
this.overlapErrId = undefined;
|
|
24329
|
+
}
|
|
24330
|
+
}
|
|
23841
24331
|
constructor(hostRef) {
|
|
23842
24332
|
registerInstance(this, hostRef);
|
|
23843
24333
|
/**
|
|
@@ -23895,6 +24385,12 @@ const BnChartTimeRenderer = class {
|
|
|
23895
24385
|
/** @internal */
|
|
23896
24386
|
this.dataFormatDigits = { percent: 2, decimal: 1 };
|
|
23897
24387
|
/** @internal */
|
|
24388
|
+
this.axisLabelsStep = 1;
|
|
24389
|
+
/** @internal */
|
|
24390
|
+
this.scenarioSwitch = false;
|
|
24391
|
+
/** @internal */
|
|
24392
|
+
this.axisTitlePosition = "left";
|
|
24393
|
+
/** @internal */
|
|
23898
24394
|
this.parentDimensions = { width: 0, height: 0 };
|
|
23899
24395
|
withComponentStatus(this);
|
|
23900
24396
|
}
|
|
@@ -23916,12 +24412,29 @@ const BnChartTimeRenderer = class {
|
|
|
23916
24412
|
}
|
|
23917
24413
|
/** Reports a failed query as the wrapper's `ERR_sql` item. Without it the chart would only show "No Data". */
|
|
23918
24414
|
syncQueryError() {
|
|
23919
|
-
var _a, _b;
|
|
24415
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
23920
24416
|
this.queryError = (_a = this.measureScaleError) !== null && _a !== void 0 ? _a : (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getQueryError();
|
|
23921
24417
|
reportQueryError(this.errors, this.queryError);
|
|
24418
|
+
const errId = `WARN_variances_overlap_${this.variances.join("_")}`;
|
|
24419
|
+
const overlaps = (_d = (_c = this.chart) === null || _c === void 0 ? void 0 : _c.getVarianceOverlaps()) !== null && _d !== void 0 ? _d : 0;
|
|
24420
|
+
// the row can get other variances: the warning of the old list has to go
|
|
24421
|
+
if (this.overlapErrId && this.overlapErrId !== errId) {
|
|
24422
|
+
(_e = this.errors) === null || _e === void 0 ? void 0 : _e.remove(this.overlapErrId);
|
|
24423
|
+
}
|
|
24424
|
+
this.overlapErrId = overlaps > 0 ? errId : undefined;
|
|
24425
|
+
if (overlaps > 0) {
|
|
24426
|
+
(_f = this.errors) === null || _f === void 0 ? void 0 : _f.addOrReplace({
|
|
24427
|
+
id: errId,
|
|
24428
|
+
type: "warning",
|
|
24429
|
+
message: `scenarioSwitch: the variances ${this.variances.join(", ")} share a row, but ${overlaps} period(s) have more than one value. The first variance wins there.`,
|
|
24430
|
+
});
|
|
24431
|
+
}
|
|
24432
|
+
else {
|
|
24433
|
+
(_g = this.errors) === null || _g === void 0 ? void 0 : _g.remove(errId);
|
|
24434
|
+
}
|
|
23922
24435
|
}
|
|
23923
24436
|
async componentWillLoad() {
|
|
23924
|
-
var _a;
|
|
24437
|
+
var _a, _b;
|
|
23925
24438
|
const config = this.prepareConfig();
|
|
23926
24439
|
const styles = this.prepareStyle();
|
|
23927
24440
|
const availableWidth = this.containerWidth || 0;
|
|
@@ -23933,14 +24446,18 @@ const BnChartTimeRenderer = class {
|
|
|
23933
24446
|
// fitted chart fits by construction, and the overdrive's rough overhead
|
|
23934
24447
|
// estimate would falsely re-engage on it.
|
|
23935
24448
|
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
24449
|
+
const percentWasAuto = config.pixelPerPercentage <= 0;
|
|
23936
24450
|
this.autoFitScaling(config, styles);
|
|
23937
24451
|
this.chart.setAvailableHeight(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
24452
|
+
if (!percentWasAuto) {
|
|
24453
|
+
this.chart.fitRelativeVariances(((_b = this.parentDimensions) === null || _b === void 0 ? void 0 : _b.height) || 0);
|
|
24454
|
+
}
|
|
23938
24455
|
this.pattern = new CustomPattern(this.chart.styles);
|
|
23939
24456
|
this.chart.setPattern("hatched", this.pattern.getFCPolygonPattern());
|
|
23940
24457
|
this.syncQueryError();
|
|
23941
24458
|
}
|
|
23942
24459
|
async componentWillUpdate() {
|
|
23943
|
-
var _a;
|
|
24460
|
+
var _a, _b;
|
|
23944
24461
|
if (this.chart == null) {
|
|
23945
24462
|
return;
|
|
23946
24463
|
}
|
|
@@ -23953,8 +24470,12 @@ const BnChartTimeRenderer = class {
|
|
|
23953
24470
|
this.chart.setConfig(config);
|
|
23954
24471
|
// See componentWillLoad: no broken-bar overdrive for auto-fitted scaling
|
|
23955
24472
|
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
24473
|
+
const percentWasAuto = config.pixelPerPercentage <= 0;
|
|
23956
24474
|
this.autoFitScaling(config, styles);
|
|
23957
24475
|
this.chart.setAvailableHeight(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
24476
|
+
if (!percentWasAuto) {
|
|
24477
|
+
this.chart.fitRelativeVariances(((_b = this.parentDimensions) === null || _b === void 0 ? void 0 : _b.height) || 0);
|
|
24478
|
+
}
|
|
23958
24479
|
this.pattern = new CustomPattern(this.chart.styles);
|
|
23959
24480
|
this.chart.setPattern("hatched", this.pattern.getFCPolygonPattern());
|
|
23960
24481
|
this.syncQueryError();
|
|
@@ -24140,6 +24661,9 @@ const BnChartTimeRenderer = class {
|
|
|
24140
24661
|
maxBars: this.maxBars,
|
|
24141
24662
|
stackConfig: this.stackConfig,
|
|
24142
24663
|
lineFullWidth: this.lineFullWidth,
|
|
24664
|
+
axisLabelsStep: this.axisLabelsStep,
|
|
24665
|
+
scenarioSwitch: this.scenarioSwitch,
|
|
24666
|
+
axisTitlePosition: this.axisTitlePosition,
|
|
24143
24667
|
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",
|
|
24144
24668
|
});
|
|
24145
24669
|
}
|
|
@@ -25977,6 +26501,7 @@ const LayoutCard = class {
|
|
|
25977
26501
|
this.cardShowBorder = true;
|
|
25978
26502
|
withComponentStatus(this);
|
|
25979
26503
|
this.errors = withHasError(this);
|
|
26504
|
+
this.componentStyle = withComponentStyle(this);
|
|
25980
26505
|
this.resolveInherited = withInheritedProps(this, [
|
|
25981
26506
|
{ propName: "titleScenarios", ancestorAttr: "title-scenarios" },
|
|
25982
26507
|
{ propName: "titleVariances", ancestorAttr: "title-variances" },
|
|
@@ -26080,7 +26605,7 @@ const LayoutCard = class {
|
|
|
26080
26605
|
var _a;
|
|
26081
26606
|
const style = this.getLayoutStyle();
|
|
26082
26607
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
26083
|
-
return (h("bn-card", { key: '
|
|
26608
|
+
return (h("bn-card", { key: '3db479047905de01ac517491f2d68a9bd0a3a576', styles: this.styles, "selected-style": this.selectedStyle, class: this.setCardClass() }, h("div", { key: 'fd9948acd84ce55badf87a7e03d733d1e75a1bea', class: "cardtitle" }, 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 !== "" ? (h("img", { class: "image", src: this.prepareTitleImage(this.titleImage) })) : ("")), h("bn-body", { key: 'c5b1957822ff216d33084154afdf6deb3e4426cc' }, h("div", { key: 'bc17f6f73825894641f775137eaefd5059a25cf6', style: style, "data-bn-fit-content": this.cardFitToContent ? String(this.getRowCount(this.cardLayout)) : null }, this.getSlots(arrOfSlots))), h("bn-footer", { key: 'cfbeba76eaf11358e92002d309cafae19d2525e2', text: this.footerText, "page-number": "0", "display-page-number": "false" })));
|
|
26084
26609
|
}
|
|
26085
26610
|
get element() { return getElement(this); }
|
|
26086
26611
|
};
|
|
@@ -26316,7 +26841,7 @@ const LayoutPage = class {
|
|
|
26316
26841
|
const style = this.getLayoutStyle();
|
|
26317
26842
|
const arrOfSlots = this.extractSlotNames(style["grid-template-areas"]);
|
|
26318
26843
|
const rotation = this.rotation();
|
|
26319
|
-
return (h(Host, { key: '
|
|
26844
|
+
return (h(Host, { key: '2ec4b279578c40e0aa56ec89ede269abb4d2951b', style: rotation === null || rotation === void 0 ? void 0 : rotation.host }, 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 }, h("bn-message", { key: '17e10377a10a257417acc50460cc2a66e1010abd', text: this.messageText, image: this.messageImage }), 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 }), h("bn-body", { key: '8ef72077b8656469db320af429a1226453866558' }, h("div", { key: '99b22034f2c6edbe7e25e1a3cb6873f2af287178', style: style, "data-bn-fit-content": this.pageFitToContent ? String(this.getRowCount(this.pageLayout)) : null }, this.getSlots(arrOfSlots)), h("slot", { key: '918b8f2c8991d801a0033748f37250500cf2d2e9', name: "annotations" })), h("bn-footer", { key: 'a77e27405f7fbc68c90a95c563628ddc2d708e02', text: this.footerText, "page-number": this.pageNumber, "display-page-number": this.footerDisplayPageNumber }))));
|
|
26320
26845
|
}
|
|
26321
26846
|
get element() { return getElement(this); }
|
|
26322
26847
|
};
|
|
@@ -32789,7 +33314,7 @@ const Title$1 = class Title {
|
|
|
32789
33314
|
var _a, _b, _c, _d;
|
|
32790
33315
|
return ({
|
|
32791
33316
|
"--bn-font-family": ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
32792
|
-
"--bn-font-size": `${((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
|
|
33317
|
+
"--bn-font-size": `${this.titleFontSize > 0 ? this.titleFontSize : ((_b = $["global"]) === null || _b === void 0 ? void 0 : _b["fontSizePx"]) || 13.3333}px`,
|
|
32793
33318
|
"--bn-font-color": ((_c = $["global"]) === null || _c === void 0 ? void 0 : _c["fontColor"]) || "#000000",
|
|
32794
33319
|
"--bn-font-background": ((_d = $["global"]) === null || _d === void 0 ? void 0 : _d["fontBackgroundColor"]) || "#ffffff",
|
|
32795
33320
|
});
|
|
@@ -32797,7 +33322,7 @@ const Title$1 = class Title {
|
|
|
32797
33322
|
}
|
|
32798
33323
|
render() {
|
|
32799
33324
|
const fontStyles = this.getFontStyles();
|
|
32800
|
-
return (h(Host, { key: '
|
|
33325
|
+
return (h(Host, { key: '2f19926cf90c8e8738c335088f6d814be7221f05', style: fontStyles }, 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 })));
|
|
32801
33326
|
}
|
|
32802
33327
|
get element() { return getElement(this); }
|
|
32803
33328
|
static get watchers() { return {
|
|
@@ -33119,7 +33644,7 @@ class TimePeriodAdapter {
|
|
|
33119
33644
|
}
|
|
33120
33645
|
}
|
|
33121
33646
|
|
|
33122
|
-
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}`;
|
|
33647
|
+
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}`;
|
|
33123
33648
|
|
|
33124
33649
|
const BnTitleRenderer = class {
|
|
33125
33650
|
constructor(hostRef) {
|
|
@@ -33150,7 +33675,7 @@ const BnTitleRenderer = class {
|
|
|
33150
33675
|
withComponentStatus(this);
|
|
33151
33676
|
}
|
|
33152
33677
|
render() {
|
|
33153
|
-
return (h("div", { key: '
|
|
33678
|
+
return (h("div", { key: 'd32015c18f77cc23ace9a26d8bb0820acdce543a', class: this.titleId ? "with-id" : undefined }, this.titleId ? h("div", { class: "title-id" }, this.titleId) : null, h("div", { key: 'c3151be4218ff1720402865ffa4b972c974fea67', innerHTML: sanitizeHtml(this.title.unit) }), h("div", { key: '0a03e44bd5ec8d0177801bce8d1cf938a24daabb' }, this.title.measures.map((measure, index) => (h("span", null, this.isFirstElement(index) ? this.title.i18n.get("SEPARATOR_WS") : "", h("span", { class: "measure" }, measure.name), " ", measure.unit ? this.title.i18n.get("in") : "", " ", measure.unit)))), h("div", { key: 'ab32e07b35e1cc02ec26137ce392946c8f94ac73' }, this.title.dimension)));
|
|
33154
33679
|
}
|
|
33155
33680
|
componentWillLoad() {
|
|
33156
33681
|
const config = this.prepareConfig();
|
|
@@ -34313,7 +34838,10 @@ const ChartTree = class {
|
|
|
34313
34838
|
if (!this.treeConfig || !this.layout) {
|
|
34314
34839
|
return null;
|
|
34315
34840
|
}
|
|
34316
|
-
return Array.from(this.treeConfig.allNodes).map((nodeId) => (
|
|
34841
|
+
return Array.from(this.treeConfig.allNodes).map((nodeId) => (
|
|
34842
|
+
// data-bn-fit-content: a node is as high as its content, so no height in it is a limit
|
|
34843
|
+
// for that content (see findConstrainedHeight in utils/parentDimensions)
|
|
34844
|
+
h("div", { key: nodeId, class: "tree-node", "data-bn-fit-content": "", style: this.getSlotStyle(nodeId) }, h("slot", { name: nodeId }))));
|
|
34317
34845
|
}
|
|
34318
34846
|
getFontStyles() {
|
|
34319
34847
|
return this.componentStyle(($) => {
|