@bino-bi/bn-template-engine 1.0.0-next.45 → 1.0.0-next.47
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/index.esm.js +1 -1
- package/dist/bn-template-engine/{p-DVE0-sOv.js → p-3ktFZb1x.js} +1 -1
- package/dist/bn-template-engine/p-444a231f.entry.js +1 -0
- package/dist/bn-template-engine/{p-48871742.entry.js → p-6ab684a9.entry.js} +1 -1
- package/dist/bn-template-engine/p-7pLJBHT2.js +1 -0
- package/dist/bn-template-engine/{p-5a64f90f.entry.js → p-9a24e486.entry.js} +1 -1
- package/dist/bn-template-engine/p-BL07yV8P.js +1 -0
- package/dist/bn-template-engine/p-DXtYQE4s.js +1 -0
- package/dist/bn-template-engine/p-DY5fMUX8.js +1 -0
- package/dist/bn-template-engine/{p-qpZjVnX5.js → p-Dvlw60RF.js} +1 -1
- package/dist/bn-template-engine/p-GstO_GU5.js +2 -0
- package/dist/bn-template-engine/p-a6017fce.entry.js +1 -0
- package/dist/bn-template-engine/{p-8b28c9bd.entry.js → p-b3f5eba0.entry.js} +1 -1
- package/dist/bn-template-engine/p-ddc1b2a9.entry.js +1 -0
- package/dist/bn-template-engine/p-hV2evPFR.js +1 -0
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +657 -114
- package/dist/cjs/bn-grid.cjs.entry.js +164 -37
- package/dist/cjs/bn-image.cjs.entry.js +3 -3
- package/dist/cjs/bn-internationalization.cjs.entry.js +3 -3
- package/dist/cjs/bn-ruleset.cjs.entry.js +3 -3
- package/dist/cjs/bn-template-engine.cjs.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +4 -4
- package/dist/cjs/index-CM6022qm.js +66 -0
- package/dist/cjs/{index-DGis1BzT.js → index-DwBbheYB.js} +2 -1
- package/dist/cjs/index.cjs.js +6 -14
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{localFrame-U3Qs0psw.js → localFrame-C4RBw_zT.js} +1 -1
- package/dist/cjs/types-BngAWYMW.js +17 -0
- package/dist/cjs/{withBodyObserver-S-FGHpAX.js → withBodyObserver-CIGVLQEB.js} +2 -2
- package/dist/cjs/{withHasError-BkBrsCpI.js → withHasError-CZFrIJw0.js} +12 -6
- package/dist/cjs/{withStyled-BZb6snOx.js → withStyled-DHKHBdRb.js} +41 -6
- package/dist/cjs/{withTranslation-1qTs5Fi7.js → withTranslation-CLwC9a8V.js} +3 -3
- 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 +224 -14
- package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +1 -9
- 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/LineSeries.js +1 -6
- 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-context/bn-context.js +86 -1
- 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/index.js +1 -0
- 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/notation.js +56 -0
- package/dist/collection/utils/validate.js +4 -0
- package/dist/collection/utils/withComponentStyle.js +14 -4
- 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/index.js +1 -1
- package/dist/components/{p-fKJx8WtW.js → p-2t-lysdb.js} +1 -1
- package/dist/components/{p-2eicD9rF.js → p-4xaxuPVU.js} +1 -1
- package/dist/components/p-6242qMx1.js +1 -0
- package/dist/components/p-6gET6YXc.js +1 -0
- package/dist/components/p-BFWvVe7v.js +1 -0
- package/dist/components/{p-CyfGkLMh.js → p-BFoRIqDi.js} +1 -1
- package/dist/components/p-BP2sJ8k9.js +1 -0
- package/dist/components/{p-B4L069XF.js → p-BgdoWKFY.js} +1 -1
- package/dist/components/{p-BzjGUtYh.js → p-BjgkgCAQ.js} +1 -1
- package/dist/components/p-BnmylmXF.js +2 -0
- package/dist/components/p-Bp5Xj4-s.js +1 -0
- package/dist/components/{p-Dq9dG0Kr.js → p-BrQCbmG0.js} +1 -1
- package/dist/components/{p-NBaq67dL.js → p-C-3TOa6K.js} +1 -1
- package/dist/components/{p-M2k_I8lv.js → p-C8rpOS5t.js} +1 -1
- package/dist/components/{p-BfUdaxZ9.js → p-CG-iY7pQ.js} +1 -1
- package/dist/components/{p-B2bvM2Ig.js → p-CLjuZoiT.js} +1 -1
- package/dist/components/p-CUoPUIej.js +1 -0
- package/dist/components/p-CZzlLTQc.js +1 -0
- package/dist/components/p-CmvpJzLd.js +1 -0
- package/dist/components/{p-CvEdUq8i.js → p-CrZ_O3DT.js} +1 -1
- package/dist/components/{p-eWxolPDU.js → p-CytMTBFu.js} +1 -1
- package/dist/components/{p-4vVbchX2.js → p-D32TsLzd.js} +1 -1
- package/dist/components/p-D3hr9wra.js +1 -0
- package/dist/components/{p-BXg3v5AO.js → p-DDo-fu3v.js} +1 -1
- package/dist/components/{p-B5tixDPM.js → p-DFybNETX.js} +1 -1
- package/dist/components/p-DJSj3oQq.js +1 -0
- package/dist/components/p-DMAaBt7n.js +1 -0
- package/dist/components/{p-Cel0a6ma.js → p-DRU71K0s.js} +1 -1
- package/dist/components/p-DRmphEA0.js +1 -0
- package/dist/components/{p-9mUU4itF.js → p-DUZCLRVu.js} +1 -1
- package/dist/components/p-DY5fMUX8.js +1 -0
- package/dist/components/p-D_K7tYhY.js +1 -0
- package/dist/components/{p-DaOm9YwQ.js → p-DdvG1D18.js} +1 -1
- package/dist/components/p-Do4GqlMV.js +1 -0
- package/dist/components/p-Dw3rv_Y9.js +1 -0
- package/dist/components/{p-BXXjh6We.js → p-Dyzb4ika.js} +1 -1
- package/dist/components/p-JG4Sx1lE.js +1 -0
- package/dist/components/p-TNX3alPU.js +1 -0
- package/dist/components/p-Uc0zvXcQ.js +1 -0
- package/dist/components/p-VtNvNyZK.js +1 -0
- package/dist/components/{p-Y9bth2Y_.js → p-Zuxd3z0q.js} +1 -1
- package/dist/components/{p-7ieJFBUk.js → p-dO0utE8m.js} +1 -1
- package/dist/components/{p-16rjcQ0t.js → p-j42D1yrQ.js} +1 -1
- package/dist/components/p-ja0FCkHB.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +646 -103
- package/dist/esm/bn-grid.entry.js +163 -36
- package/dist/esm/bn-image.entry.js +3 -3
- package/dist/esm/bn-internationalization.entry.js +3 -3
- package/dist/esm/bn-ruleset.entry.js +3 -3
- package/dist/esm/bn-template-engine.js +3 -3
- package/dist/esm/bn-text.entry.js +4 -4
- package/dist/esm/index-DZHir0Ol.js +60 -0
- package/dist/esm/{index-CCZcKl0Q.js → index-GstO_GU5.js} +2 -2
- package/dist/esm/index.js +2 -15
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{localFrame-BNWPPaQa.js → localFrame-WNu1bAPm.js} +1 -1
- package/dist/esm/types-DY5fMUX8.js +15 -0
- package/dist/esm/{withBodyObserver-AHQAUV85.js → withBodyObserver-wJgSN1Pj.js} +2 -2
- package/dist/esm/{withHasError-B6Lvj9Cq.js → withHasError-BDWEBrrb.js} +12 -6
- package/dist/esm/{withStyled-CzzXg64f.js → withStyled-CTZFjg4L.js} +40 -7
- package/dist/esm/{withTranslation-C1gL7wSU.js → withTranslation-BESW5BNq.js} +3 -3
- 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-context/bn-context.d.ts +25 -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 +199 -6
- package/dist/types/index.d.ts +2 -0
- 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/notation.d.ts +78 -0
- package/dist/types/utils/validate.d.ts +2 -0
- package/dist/types/utils/withComponentStyle.d.ts +6 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-1b002bd5.entry.js +0 -1
- package/dist/bn-template-engine/p-750b2c82.entry.js +0 -1
- package/dist/bn-template-engine/p-CCZcKl0Q.js +0 -2
- 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-b0dfc113.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-BPGLOHUe.js +0 -1
- package/dist/components/p-BiSytXUy.js +0 -1
- package/dist/components/p-C2ycO60j.js +0 -1
- package/dist/components/p-C3gYq-HU.js +0 -1
- package/dist/components/p-CEf5X8MZ.js +0 -1
- package/dist/components/p-Chuj-LpI.js +0 -1
- package/dist/components/p-CniN8ALm.js +0 -1
- package/dist/components/p-D40Am1Ap.js +0 -1
- package/dist/components/p-D6YGOYV1.js +0 -2
- package/dist/components/p-DDvWTgk1.js +0 -1
- package/dist/components/p-DJUffGeB.js +0 -1
- package/dist/components/p-DQl2K2Xl.js +0 -1
- package/dist/components/p-DjPWZfry.js +0 -1
- package/dist/components/p-DnDL1pPc.js +0 -1
- package/dist/components/p-Do4oPrkE.js +0 -1
- package/dist/components/p-DwuXVo2h.js +0 -1
- package/dist/components/p-sLbQ7yZ1.js +0 -1
- package/dist/components/p-xIWChKGS.js +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { forceUpdate, h, Host, writeTask } from "@stencil/core";
|
|
2
2
|
import { hasInlineJs } from "../../context/scopedDb";
|
|
3
|
-
import { isBlankInput, isValidDirection, isValidInteger, isValidLevel, isValidMeasureScale, validateOrderList, validateScenarioList, validateStackConfig, validateVariancesList, } from "../../utils/validate";
|
|
3
|
+
import { isBlankInput, isNoScenarios, isValidDirection, isValidInteger, isValidLevel, isValidMeasureScale, validateOrderList, validateScenarioList, validateStackConfig, validateVariancesList, } from "../../utils/validate";
|
|
4
|
+
import { variancesScenarios } from "../../utils/model/VarianceScenario";
|
|
4
5
|
import withDataset from "../../utils/withDataset";
|
|
5
6
|
import withComponentStatus from "../../utils/withComponentStatus";
|
|
6
7
|
import withTranslation from "../../utils/withTranslation";
|
|
@@ -45,7 +46,7 @@ export class Chart {
|
|
|
45
46
|
}
|
|
46
47
|
validateScenario(newValue) {
|
|
47
48
|
const errId = "WARN_scenarios";
|
|
48
|
-
if (isInheritedValue(newValue)) {
|
|
49
|
+
if (isInheritedValue(newValue) || isNoScenarios(newValue)) {
|
|
49
50
|
this.errors.remove(errId);
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
@@ -191,6 +192,25 @@ export class Chart {
|
|
|
191
192
|
this.errors.remove(errId);
|
|
192
193
|
}
|
|
193
194
|
}
|
|
195
|
+
validateDataFormatDigitsDecimal(newValue) {
|
|
196
|
+
this.validateDigits("dataFormatDigitsDecimal", newValue);
|
|
197
|
+
}
|
|
198
|
+
validateDataFormatDigitsPercent(newValue) {
|
|
199
|
+
this.validateDigits("dataFormatDigitsPercent", newValue);
|
|
200
|
+
}
|
|
201
|
+
validateDigits(name, value) {
|
|
202
|
+
const errId = `WARN_${name}`;
|
|
203
|
+
if (!isValidInteger(value) || Number(value) < 0 || Number(value) > 100) {
|
|
204
|
+
this.errors.addOrReplace({
|
|
205
|
+
id: errId,
|
|
206
|
+
type: "warning",
|
|
207
|
+
message: name + ": invalid value '" + value + "' is not supported.",
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this.errors.remove(errId);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
194
214
|
validateStack(newValue) {
|
|
195
215
|
const errId = "WARN_stack";
|
|
196
216
|
const errors = validateStackConfig(newValue);
|
|
@@ -295,6 +315,14 @@ export class Chart {
|
|
|
295
315
|
* @example measure-unit="EUR"
|
|
296
316
|
*/
|
|
297
317
|
this.measureUnit = "";
|
|
318
|
+
/**
|
|
319
|
+
* Number of decimal digits of the value labels
|
|
320
|
+
*/
|
|
321
|
+
this.dataFormatDigitsDecimal = 1;
|
|
322
|
+
/**
|
|
323
|
+
* Number of decimal digits of the percent labels (relative variances, shares of a 100 % stack)
|
|
324
|
+
*/
|
|
325
|
+
this.dataFormatDigitsPercent = 2;
|
|
298
326
|
/**
|
|
299
327
|
* Stacking configuration as a JSON string. When set, bars are drawn as
|
|
300
328
|
* stacked segments instead of side-by-side.
|
|
@@ -387,6 +415,8 @@ export class Chart {
|
|
|
387
415
|
componentWillLoad() {
|
|
388
416
|
this.validateFilter(this.filter);
|
|
389
417
|
this.validateScenario(this.scenarios);
|
|
418
|
+
this.validateDataFormatDigitsDecimal(this.dataFormatDigitsDecimal);
|
|
419
|
+
this.validateDataFormatDigitsPercent(this.dataFormatDigitsPercent);
|
|
390
420
|
this.validateVariances(this.variances);
|
|
391
421
|
this.validateUnitScaling(this.unitScaling);
|
|
392
422
|
//this.validateSelectedStyle(this.selectedStyle);
|
|
@@ -566,8 +596,7 @@ export class Chart {
|
|
|
566
596
|
}
|
|
567
597
|
prepareDimension() {
|
|
568
598
|
const parent = getParentDimensions(this.element);
|
|
569
|
-
const
|
|
570
|
-
const segmentCount = 1 + variancesList.length;
|
|
599
|
+
const segmentCount = Math.max(1, this.prepareSegments().length);
|
|
571
600
|
this.canvasWidthSegmented = parent.width / segmentCount;
|
|
572
601
|
return { width: this.canvasWidthSegmented, height: parent.height };
|
|
573
602
|
}
|
|
@@ -578,6 +607,10 @@ export class Chart {
|
|
|
578
607
|
this.errors.remove("AUTO_scenarios");
|
|
579
608
|
return scenarios.value.split(",").map((entry) => entry.trim());
|
|
580
609
|
}
|
|
610
|
+
if (isNoScenarios(scenarios.value)) {
|
|
611
|
+
this.errors.remove("AUTO_scenarios");
|
|
612
|
+
return [];
|
|
613
|
+
}
|
|
581
614
|
const isAuto = ((_a = scenarios.value) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === "auto";
|
|
582
615
|
if (isBlankInput(scenarios.value) || isAuto) {
|
|
583
616
|
if (((_c = (_b = this.datasetMeta) === null || _b === void 0 ? void 0 : _b.availableScenarios) === null || _c === void 0 ? void 0 : _c.length) > 0) {
|
|
@@ -606,6 +639,15 @@ export class Chart {
|
|
|
606
639
|
}
|
|
607
640
|
return variances === null || variances === void 0 ? void 0 : variances.split(",").map((entry) => entry.trim());
|
|
608
641
|
}
|
|
642
|
+
/** `scenarios="none"`: the chart draws its variances only. */
|
|
643
|
+
hidesScenarios() {
|
|
644
|
+
const scenarios = this.resolveInherited("scenarios", this.scenarios);
|
|
645
|
+
return !scenarios.inherited && isNoScenarios(scenarios.value);
|
|
646
|
+
}
|
|
647
|
+
/** The segments side by side: `""` is the base chart, else one variance. */
|
|
648
|
+
prepareSegments() {
|
|
649
|
+
return this.hidesScenarios() ? this.prepareVariances() : ["", ...this.prepareVariances()];
|
|
650
|
+
}
|
|
609
651
|
prepareHideCategories(idx) {
|
|
610
652
|
return idx >= 1 || !this.showCategories;
|
|
611
653
|
}
|
|
@@ -774,7 +816,8 @@ export class Chart {
|
|
|
774
816
|
});
|
|
775
817
|
}
|
|
776
818
|
prepareChartTitle(idx) {
|
|
777
|
-
|
|
819
|
+
// a variance keeps its own name as title
|
|
820
|
+
if (idx >= 1 || this.hidesScenarios()) {
|
|
778
821
|
return "";
|
|
779
822
|
}
|
|
780
823
|
return this.chartTitle;
|
|
@@ -884,10 +927,11 @@ export class Chart {
|
|
|
884
927
|
const ppu = this.preparePixelPerUnit();
|
|
885
928
|
const ppp = this.preparePixelPerPercentage();
|
|
886
929
|
const stackConfig = this.prepareStackConfig();
|
|
887
|
-
const
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
930
|
+
const isBase = localScenarioString === "";
|
|
931
|
+
const scenarios = this.hidesScenarios() ? variancesScenarios([localScenarioString]) : this.prepareScenarios();
|
|
932
|
+
// Dimension stacking uses only the first scenario. Only the base chart draws a stack, a variance needs both of its scenarios
|
|
933
|
+
const effectiveScenarios = isBase && (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
934
|
+
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() }));
|
|
891
935
|
}
|
|
892
936
|
/**
|
|
893
937
|
* The line this chart wants to be aligned on, in CSS px from the host's
|
|
@@ -914,7 +958,7 @@ export class Chart {
|
|
|
914
958
|
const factor = Number.isFinite(rawFactor) && rawFactor > 0 ? rawFactor : 1;
|
|
915
959
|
const fontSizePx = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * factor;
|
|
916
960
|
const variances = this.prepareVariances();
|
|
917
|
-
const layout = collectChartFacadeLayout(this.element, "bn-chart-structure-renderer",
|
|
961
|
+
const layout = collectChartFacadeLayout(this.element, "bn-chart-structure-renderer", this.prepareSegments().map((segment) => segment || "base"), origins, detail);
|
|
918
962
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
919
963
|
const firstInner = (_b = this.element.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector("bn-chart-structure-renderer");
|
|
920
964
|
const state = {
|
|
@@ -1005,13 +1049,19 @@ export class Chart {
|
|
|
1005
1049
|
});
|
|
1006
1050
|
}
|
|
1007
1051
|
render() {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1052
|
+
const scenariosArray = this.prepareSegments();
|
|
1053
|
+
if (scenariosArray.length === 0) {
|
|
1054
|
+
this.errors.addOrReplace({
|
|
1055
|
+
id: "WARN_scenarios_none",
|
|
1056
|
+
type: "warning",
|
|
1057
|
+
message: "scenarios: none needs at least one variance, the chart is empty.",
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
else {
|
|
1061
|
+
this.errors.remove("WARN_scenarios_none");
|
|
1012
1062
|
}
|
|
1013
1063
|
const fontStyles = this.getFontStyles();
|
|
1014
|
-
return (h(Host, { key: '
|
|
1064
|
+
return (h(Host, { key: 'a9b487fd43e785b1f14d0599ad0145a248b35f5d', style: fontStyles }, h("div", { key: '950ab383346b288ab17c2a1bbdfcfcd240e0f4d8', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
1015
1065
|
}
|
|
1016
1066
|
static get is() { return "bn-chart-structure"; }
|
|
1017
1067
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1164,7 +1214,7 @@ export class Chart {
|
|
|
1164
1214
|
"name": "example",
|
|
1165
1215
|
"text": "scenarios=\"ac1,pp1,pl1\""
|
|
1166
1216
|
}],
|
|
1167
|
-
"text": "Comma-separated list of scenario columns to display as bars.\nUp to 4 scenarios are supported; additional values are ignored.\n\nValid scenario names: `ac1`-`ac4`, `fc1`-`fc4`, `pp1`-`pp4`, `pl1`-`pl4`.\n\n| Value | Behavior |\n|---------------|-------------------------------------------------------------|\n| `\"ac1,fc1\"` | Show the listed scenarios |\n| `\"auto\"` | Auto-detect from dataset metadata (no warning) |\n| not set / `\"\"` | Auto-detect from dataset metadata (emits `AUTO_scenarios` warning) |"
|
|
1217
|
+
"text": "Comma-separated list of scenario columns to display as bars.\nUp to 4 scenarios are supported; additional values are ignored.\n\nValid scenario names: `ac1`-`ac4`, `fc1`-`fc4`, `pp1`-`pp4`, `pl1`-`pl4`.\n\n| Value | Behavior |\n|---------------|-------------------------------------------------------------|\n| `\"ac1,fc1\"` | Show the listed scenarios |\n| `\"auto\"` | Auto-detect from dataset metadata (no warning) |\n| not set / `\"\"` | Auto-detect from dataset metadata (emits `AUTO_scenarios` warning) |\n| `\"none\"` | Draw no scenario: the chart shows only its variances, the first one carries the categories |"
|
|
1168
1218
|
},
|
|
1169
1219
|
"getter": false,
|
|
1170
1220
|
"setter": false,
|
|
@@ -1448,6 +1498,46 @@ export class Chart {
|
|
|
1448
1498
|
"attribute": "measure-unit",
|
|
1449
1499
|
"defaultValue": "\"\""
|
|
1450
1500
|
},
|
|
1501
|
+
"dataFormatDigitsDecimal": {
|
|
1502
|
+
"type": "number",
|
|
1503
|
+
"mutable": false,
|
|
1504
|
+
"complexType": {
|
|
1505
|
+
"original": "number",
|
|
1506
|
+
"resolved": "number",
|
|
1507
|
+
"references": {}
|
|
1508
|
+
},
|
|
1509
|
+
"required": false,
|
|
1510
|
+
"optional": false,
|
|
1511
|
+
"docs": {
|
|
1512
|
+
"tags": [],
|
|
1513
|
+
"text": "Number of decimal digits of the value labels"
|
|
1514
|
+
},
|
|
1515
|
+
"getter": false,
|
|
1516
|
+
"setter": false,
|
|
1517
|
+
"reflect": false,
|
|
1518
|
+
"attribute": "data-format-digits-decimal",
|
|
1519
|
+
"defaultValue": "1"
|
|
1520
|
+
},
|
|
1521
|
+
"dataFormatDigitsPercent": {
|
|
1522
|
+
"type": "number",
|
|
1523
|
+
"mutable": false,
|
|
1524
|
+
"complexType": {
|
|
1525
|
+
"original": "number",
|
|
1526
|
+
"resolved": "number",
|
|
1527
|
+
"references": {}
|
|
1528
|
+
},
|
|
1529
|
+
"required": false,
|
|
1530
|
+
"optional": false,
|
|
1531
|
+
"docs": {
|
|
1532
|
+
"tags": [],
|
|
1533
|
+
"text": "Number of decimal digits of the percent labels (relative variances, shares of a 100 % stack)"
|
|
1534
|
+
},
|
|
1535
|
+
"getter": false,
|
|
1536
|
+
"setter": false,
|
|
1537
|
+
"reflect": false,
|
|
1538
|
+
"attribute": "data-format-digits-percent",
|
|
1539
|
+
"defaultValue": "2"
|
|
1540
|
+
},
|
|
1451
1541
|
"stack": {
|
|
1452
1542
|
"type": "string",
|
|
1453
1543
|
"mutable": false,
|
|
@@ -1601,6 +1691,12 @@ export class Chart {
|
|
|
1601
1691
|
}, {
|
|
1602
1692
|
"propName": "measureScale",
|
|
1603
1693
|
"methodName": "validateMeasureScale"
|
|
1694
|
+
}, {
|
|
1695
|
+
"propName": "dataFormatDigitsDecimal",
|
|
1696
|
+
"methodName": "validateDataFormatDigitsDecimal"
|
|
1697
|
+
}, {
|
|
1698
|
+
"propName": "dataFormatDigitsPercent",
|
|
1699
|
+
"methodName": "validateDataFormatDigitsPercent"
|
|
1604
1700
|
}, {
|
|
1605
1701
|
"propName": "stack",
|
|
1606
1702
|
"methodName": "validateStack"
|
|
@@ -834,7 +834,7 @@ export class StructureChart {
|
|
|
834
834
|
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
835
835
|
dataModel.forEach((elements, index) => {
|
|
836
836
|
if (elements["type"] === VarianceType.RELATIVE) {
|
|
837
|
-
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw();
|
|
837
|
+
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits);
|
|
838
838
|
}
|
|
839
839
|
else {
|
|
840
840
|
scenarioFactory.createVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
@@ -57,11 +57,11 @@ export class Needle {
|
|
|
57
57
|
(_a = this.label) === null || _a === void 0 ? void 0 : _a.updateGroup(newGroup);
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
|
-
draw() {
|
|
60
|
+
draw(dataFormatDigits = { percent: 2, decimal: 1 }) {
|
|
61
61
|
var _a, _b, _c;
|
|
62
62
|
if (((_a = this.dataPoint) === null || _a === void 0 ? void 0 : _a.value) === undefined) {
|
|
63
63
|
// reference 0: the label says "n/a", there is no pin
|
|
64
|
-
(_b = this.label) === null || _b === void 0 ? void 0 : _b.draw();
|
|
64
|
+
(_b = this.label) === null || _b === void 0 ? void 0 : _b.draw(dataFormatDigits);
|
|
65
65
|
return this;
|
|
66
66
|
}
|
|
67
67
|
if (this.isEmpty()) {
|
|
@@ -91,7 +91,7 @@ export class Needle {
|
|
|
91
91
|
.stroke(strokeStyle)
|
|
92
92
|
.cy(this.dimensions.yPos)
|
|
93
93
|
.x(this.dimensions.xPos);
|
|
94
|
-
(_c = this.label) === null || _c === void 0 ? void 0 : _c.draw();
|
|
94
|
+
(_c = this.label) === null || _c === void 0 ? void 0 : _c.draw(dataFormatDigits);
|
|
95
95
|
}
|
|
96
96
|
createDimensions(position, dataPoint, index) {
|
|
97
97
|
if (dataPoint.getScaledPercentUnit() < 0) {
|
package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js
CHANGED
|
@@ -22,6 +22,13 @@ import { SVGStyleGroupAdapter } from "../../../utils/model/styles/SVGStyleGroup"
|
|
|
22
22
|
import { SVGVariancesStyleGroupAdapter } from "../../../utils/model/styles/SVGVariancesStyleGroup";
|
|
23
23
|
/** @internal */
|
|
24
24
|
export class BnChartTimeRenderer {
|
|
25
|
+
disconnectedCallback() {
|
|
26
|
+
var _a;
|
|
27
|
+
if (this.overlapErrId) {
|
|
28
|
+
(_a = this.errors) === null || _a === void 0 ? void 0 : _a.remove(this.overlapErrId);
|
|
29
|
+
this.overlapErrId = undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
25
32
|
constructor() {
|
|
26
33
|
/**
|
|
27
34
|
* Name of the dataset (table or view in the shared alasql database).
|
|
@@ -78,6 +85,12 @@ export class BnChartTimeRenderer {
|
|
|
78
85
|
/** @internal */
|
|
79
86
|
this.dataFormatDigits = { percent: 2, decimal: 1 };
|
|
80
87
|
/** @internal */
|
|
88
|
+
this.axisLabelsStep = 1;
|
|
89
|
+
/** @internal */
|
|
90
|
+
this.scenarioSwitch = false;
|
|
91
|
+
/** @internal */
|
|
92
|
+
this.axisTitlePosition = "left";
|
|
93
|
+
/** @internal */
|
|
81
94
|
this.parentDimensions = { width: 0, height: 0 };
|
|
82
95
|
withComponentStatus(this);
|
|
83
96
|
}
|
|
@@ -99,12 +112,29 @@ export class BnChartTimeRenderer {
|
|
|
99
112
|
}
|
|
100
113
|
/** Reports a failed query as the wrapper's `ERR_sql` item. Without it the chart would only show "No Data". */
|
|
101
114
|
syncQueryError() {
|
|
102
|
-
var _a, _b;
|
|
115
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
103
116
|
this.queryError = (_a = this.measureScaleError) !== null && _a !== void 0 ? _a : (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getQueryError();
|
|
104
117
|
reportQueryError(this.errors, this.queryError);
|
|
118
|
+
const errId = `WARN_variances_overlap_${this.variances.join("_")}`;
|
|
119
|
+
const overlaps = (_d = (_c = this.chart) === null || _c === void 0 ? void 0 : _c.getVarianceOverlaps()) !== null && _d !== void 0 ? _d : 0;
|
|
120
|
+
// the row can get other variances: the warning of the old list has to go
|
|
121
|
+
if (this.overlapErrId && this.overlapErrId !== errId) {
|
|
122
|
+
(_e = this.errors) === null || _e === void 0 ? void 0 : _e.remove(this.overlapErrId);
|
|
123
|
+
}
|
|
124
|
+
this.overlapErrId = overlaps > 0 ? errId : undefined;
|
|
125
|
+
if (overlaps > 0) {
|
|
126
|
+
(_f = this.errors) === null || _f === void 0 ? void 0 : _f.addOrReplace({
|
|
127
|
+
id: errId,
|
|
128
|
+
type: "warning",
|
|
129
|
+
message: `scenarioSwitch: the variances ${this.variances.join(", ")} share a row, but ${overlaps} period(s) have more than one value. The first variance wins there.`,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
(_g = this.errors) === null || _g === void 0 ? void 0 : _g.remove(errId);
|
|
134
|
+
}
|
|
105
135
|
}
|
|
106
136
|
async componentWillLoad() {
|
|
107
|
-
var _a;
|
|
137
|
+
var _a, _b;
|
|
108
138
|
const config = this.prepareConfig();
|
|
109
139
|
const styles = this.prepareStyle();
|
|
110
140
|
const availableWidth = this.containerWidth || 0;
|
|
@@ -116,14 +146,18 @@ export class BnChartTimeRenderer {
|
|
|
116
146
|
// fitted chart fits by construction, and the overdrive's rough overhead
|
|
117
147
|
// estimate would falsely re-engage on it.
|
|
118
148
|
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
149
|
+
const percentWasAuto = config.pixelPerPercentage <= 0;
|
|
119
150
|
this.autoFitScaling(config, styles);
|
|
120
151
|
this.chart.setAvailableHeight(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
152
|
+
if (!percentWasAuto) {
|
|
153
|
+
this.chart.fitRelativeVariances(((_b = this.parentDimensions) === null || _b === void 0 ? void 0 : _b.height) || 0);
|
|
154
|
+
}
|
|
121
155
|
this.pattern = new CustomPattern(this.chart.styles);
|
|
122
156
|
this.chart.setPattern("hatched", this.pattern.getFCPolygonPattern());
|
|
123
157
|
this.syncQueryError();
|
|
124
158
|
}
|
|
125
159
|
async componentWillUpdate() {
|
|
126
|
-
var _a;
|
|
160
|
+
var _a, _b;
|
|
127
161
|
if (this.chart == null) {
|
|
128
162
|
return;
|
|
129
163
|
}
|
|
@@ -136,8 +170,12 @@ export class BnChartTimeRenderer {
|
|
|
136
170
|
this.chart.setConfig(config);
|
|
137
171
|
// See componentWillLoad: no broken-bar overdrive for auto-fitted scaling
|
|
138
172
|
const unitWasAuto = config.pixelPerUnit <= 0;
|
|
173
|
+
const percentWasAuto = config.pixelPerPercentage <= 0;
|
|
139
174
|
this.autoFitScaling(config, styles);
|
|
140
175
|
this.chart.setAvailableHeight(unitWasAuto ? 0 : ((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height) || 0);
|
|
176
|
+
if (!percentWasAuto) {
|
|
177
|
+
this.chart.fitRelativeVariances(((_b = this.parentDimensions) === null || _b === void 0 ? void 0 : _b.height) || 0);
|
|
178
|
+
}
|
|
141
179
|
this.pattern = new CustomPattern(this.chart.styles);
|
|
142
180
|
this.chart.setPattern("hatched", this.pattern.getFCPolygonPattern());
|
|
143
181
|
this.syncQueryError();
|
|
@@ -323,6 +361,9 @@ export class BnChartTimeRenderer {
|
|
|
323
361
|
maxBars: this.maxBars,
|
|
324
362
|
stackConfig: this.stackConfig,
|
|
325
363
|
lineFullWidth: this.lineFullWidth,
|
|
364
|
+
axisLabelsStep: this.axisLabelsStep,
|
|
365
|
+
scenarioSwitch: this.scenarioSwitch,
|
|
366
|
+
axisTitlePosition: this.axisTitlePosition,
|
|
326
367
|
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",
|
|
327
368
|
});
|
|
328
369
|
}
|
|
@@ -1031,6 +1072,75 @@ export class BnChartTimeRenderer {
|
|
|
1031
1072
|
"setter": false,
|
|
1032
1073
|
"defaultValue": "{ percent: 2, decimal: 1 }"
|
|
1033
1074
|
},
|
|
1075
|
+
"axisLabelsStep": {
|
|
1076
|
+
"type": "number",
|
|
1077
|
+
"mutable": false,
|
|
1078
|
+
"complexType": {
|
|
1079
|
+
"original": "number",
|
|
1080
|
+
"resolved": "number",
|
|
1081
|
+
"references": {}
|
|
1082
|
+
},
|
|
1083
|
+
"required": false,
|
|
1084
|
+
"optional": false,
|
|
1085
|
+
"docs": {
|
|
1086
|
+
"tags": [{
|
|
1087
|
+
"name": "internal",
|
|
1088
|
+
"text": undefined
|
|
1089
|
+
}],
|
|
1090
|
+
"text": ""
|
|
1091
|
+
},
|
|
1092
|
+
"getter": false,
|
|
1093
|
+
"setter": false,
|
|
1094
|
+
"reflect": false,
|
|
1095
|
+
"attribute": "axis-labels-step",
|
|
1096
|
+
"defaultValue": "1"
|
|
1097
|
+
},
|
|
1098
|
+
"scenarioSwitch": {
|
|
1099
|
+
"type": "boolean",
|
|
1100
|
+
"mutable": false,
|
|
1101
|
+
"complexType": {
|
|
1102
|
+
"original": "boolean",
|
|
1103
|
+
"resolved": "boolean",
|
|
1104
|
+
"references": {}
|
|
1105
|
+
},
|
|
1106
|
+
"required": false,
|
|
1107
|
+
"optional": false,
|
|
1108
|
+
"docs": {
|
|
1109
|
+
"tags": [{
|
|
1110
|
+
"name": "internal",
|
|
1111
|
+
"text": undefined
|
|
1112
|
+
}],
|
|
1113
|
+
"text": ""
|
|
1114
|
+
},
|
|
1115
|
+
"getter": false,
|
|
1116
|
+
"setter": false,
|
|
1117
|
+
"reflect": false,
|
|
1118
|
+
"attribute": "scenario-switch",
|
|
1119
|
+
"defaultValue": "false"
|
|
1120
|
+
},
|
|
1121
|
+
"axisTitlePosition": {
|
|
1122
|
+
"type": "string",
|
|
1123
|
+
"mutable": false,
|
|
1124
|
+
"complexType": {
|
|
1125
|
+
"original": "string",
|
|
1126
|
+
"resolved": "string",
|
|
1127
|
+
"references": {}
|
|
1128
|
+
},
|
|
1129
|
+
"required": false,
|
|
1130
|
+
"optional": false,
|
|
1131
|
+
"docs": {
|
|
1132
|
+
"tags": [{
|
|
1133
|
+
"name": "internal",
|
|
1134
|
+
"text": undefined
|
|
1135
|
+
}],
|
|
1136
|
+
"text": ""
|
|
1137
|
+
},
|
|
1138
|
+
"getter": false,
|
|
1139
|
+
"setter": false,
|
|
1140
|
+
"reflect": false,
|
|
1141
|
+
"attribute": "axis-title-position",
|
|
1142
|
+
"defaultValue": "\"left\""
|
|
1143
|
+
},
|
|
1034
1144
|
"parentDimensions": {
|
|
1035
1145
|
"type": "unknown",
|
|
1036
1146
|
"mutable": false,
|