@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.
Files changed (218) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/index.esm.js +1 -1
  3. package/dist/bn-template-engine/{p-DVE0-sOv.js → p-3ktFZb1x.js} +1 -1
  4. package/dist/bn-template-engine/p-444a231f.entry.js +1 -0
  5. package/dist/bn-template-engine/{p-48871742.entry.js → p-6ab684a9.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-7pLJBHT2.js +1 -0
  7. package/dist/bn-template-engine/{p-5a64f90f.entry.js → p-9a24e486.entry.js} +1 -1
  8. package/dist/bn-template-engine/p-BL07yV8P.js +1 -0
  9. package/dist/bn-template-engine/p-DXtYQE4s.js +1 -0
  10. package/dist/bn-template-engine/p-DY5fMUX8.js +1 -0
  11. package/dist/bn-template-engine/{p-qpZjVnX5.js → p-Dvlw60RF.js} +1 -1
  12. package/dist/bn-template-engine/p-GstO_GU5.js +2 -0
  13. package/dist/bn-template-engine/p-a6017fce.entry.js +1 -0
  14. package/dist/bn-template-engine/{p-8b28c9bd.entry.js → p-b3f5eba0.entry.js} +1 -1
  15. package/dist/bn-template-engine/p-ddc1b2a9.entry.js +1 -0
  16. package/dist/bn-template-engine/p-hV2evPFR.js +1 -0
  17. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +657 -114
  18. package/dist/cjs/bn-grid.cjs.entry.js +164 -37
  19. package/dist/cjs/bn-image.cjs.entry.js +3 -3
  20. package/dist/cjs/bn-internationalization.cjs.entry.js +3 -3
  21. package/dist/cjs/bn-ruleset.cjs.entry.js +3 -3
  22. package/dist/cjs/bn-template-engine.cjs.js +2 -2
  23. package/dist/cjs/bn-text.cjs.entry.js +4 -4
  24. package/dist/cjs/index-CM6022qm.js +66 -0
  25. package/dist/cjs/{index-DGis1BzT.js → index-DwBbheYB.js} +2 -1
  26. package/dist/cjs/index.cjs.js +6 -14
  27. package/dist/cjs/loader.cjs.js +2 -2
  28. package/dist/cjs/{localFrame-U3Qs0psw.js → localFrame-C4RBw_zT.js} +1 -1
  29. package/dist/cjs/types-BngAWYMW.js +17 -0
  30. package/dist/cjs/{withBodyObserver-S-FGHpAX.js → withBodyObserver-CIGVLQEB.js} +2 -2
  31. package/dist/cjs/{withHasError-BkBrsCpI.js → withHasError-CZFrIJw0.js} +12 -6
  32. package/dist/cjs/{withStyled-BZb6snOx.js → withStyled-DHKHBdRb.js} +41 -6
  33. package/dist/cjs/{withTranslation-1qTs5Fi7.js → withTranslation-CLwC9a8V.js} +3 -3
  34. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +33 -2
  35. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +112 -16
  36. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +1 -1
  37. package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +3 -3
  38. package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +113 -3
  39. package/dist/collection/components/bn-chart-time/bn-chart-time.js +261 -22
  40. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +224 -14
  41. package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +1 -9
  42. package/dist/collection/components/bn-chart-time/utils/elements/Axis.js +9 -1
  43. package/dist/collection/components/bn-chart-time/utils/elements/Column.js +10 -4
  44. package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +1 -6
  45. package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +9 -3
  46. package/dist/collection/components/bn-chart-time/utils/factories/ScenarioFactory.js +2 -2
  47. package/dist/collection/components/bn-chart-time/utils/model/DataPoint.js +9 -6
  48. package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +15 -0
  49. package/dist/collection/components/bn-context/bn-context.js +86 -1
  50. package/dist/collection/components/bn-grid/bn-grid.js +118 -24
  51. package/dist/collection/components/bn-grid/utils/cellLayout.js +55 -9
  52. package/dist/collection/components/bn-layout-card/bn-layout-card.js +4 -2
  53. package/dist/collection/components/bn-layout-page/bn-layout-page.js +23 -1
  54. package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.css +10 -0
  55. package/dist/collection/components/bn-title/bn-title-renderer/bn-title-renderer.js +23 -1
  56. package/dist/collection/components/bn-title/bn-title.js +40 -2
  57. package/dist/collection/index.js +1 -0
  58. package/dist/collection/stores/componentStyles.js +9 -3
  59. package/dist/collection/stores/internationalization.js +2 -2
  60. package/dist/collection/utils/DateStringFactory.js +19 -0
  61. package/dist/collection/utils/model/DataFormatDigits.js +4 -2
  62. package/dist/collection/utils/model/VarianceScenario.js +13 -0
  63. package/dist/collection/utils/notation.js +56 -0
  64. package/dist/collection/utils/validate.js +4 -0
  65. package/dist/collection/utils/withComponentStyle.js +14 -4
  66. package/dist/components/bn-annotation-layer.js +1 -1
  67. package/dist/components/bn-annotation-list.js +1 -1
  68. package/dist/components/bn-asset.js +1 -1
  69. package/dist/components/bn-body.js +1 -1
  70. package/dist/components/bn-card.js +1 -1
  71. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  72. package/dist/components/bn-chart-bubble.js +1 -1
  73. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  74. package/dist/components/bn-chart-bullet.js +1 -1
  75. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  76. package/dist/components/bn-chart-scatter.js +1 -1
  77. package/dist/components/bn-chart-structure-renderer.js +1 -1
  78. package/dist/components/bn-chart-structure.js +1 -1
  79. package/dist/components/bn-chart-time-renderer.js +1 -1
  80. package/dist/components/bn-chart-time.js +1 -1
  81. package/dist/components/bn-component-style.js +1 -1
  82. package/dist/components/bn-context.js +1 -1
  83. package/dist/components/bn-dataset.js +1 -1
  84. package/dist/components/bn-datasource.js +1 -1
  85. package/dist/components/bn-footer.js +1 -1
  86. package/dist/components/bn-grid.js +1 -1
  87. package/dist/components/bn-image.js +1 -1
  88. package/dist/components/bn-internationalization.js +1 -1
  89. package/dist/components/bn-layout-card.js +1 -1
  90. package/dist/components/bn-layout-page.js +1 -1
  91. package/dist/components/bn-message.js +1 -1
  92. package/dist/components/bn-page.js +1 -1
  93. package/dist/components/bn-ruleset.js +1 -1
  94. package/dist/components/bn-scaling-group.js +1 -1
  95. package/dist/components/bn-table-renderer.js +1 -1
  96. package/dist/components/bn-table.js +1 -1
  97. package/dist/components/bn-text.js +1 -1
  98. package/dist/components/bn-title-renderer.js +1 -1
  99. package/dist/components/bn-title.js +1 -1
  100. package/dist/components/bn-tree.js +1 -1
  101. package/dist/components/index.js +1 -1
  102. package/dist/components/{p-fKJx8WtW.js → p-2t-lysdb.js} +1 -1
  103. package/dist/components/{p-2eicD9rF.js → p-4xaxuPVU.js} +1 -1
  104. package/dist/components/p-6242qMx1.js +1 -0
  105. package/dist/components/p-6gET6YXc.js +1 -0
  106. package/dist/components/p-BFWvVe7v.js +1 -0
  107. package/dist/components/{p-CyfGkLMh.js → p-BFoRIqDi.js} +1 -1
  108. package/dist/components/p-BP2sJ8k9.js +1 -0
  109. package/dist/components/{p-B4L069XF.js → p-BgdoWKFY.js} +1 -1
  110. package/dist/components/{p-BzjGUtYh.js → p-BjgkgCAQ.js} +1 -1
  111. package/dist/components/p-BnmylmXF.js +2 -0
  112. package/dist/components/p-Bp5Xj4-s.js +1 -0
  113. package/dist/components/{p-Dq9dG0Kr.js → p-BrQCbmG0.js} +1 -1
  114. package/dist/components/{p-NBaq67dL.js → p-C-3TOa6K.js} +1 -1
  115. package/dist/components/{p-M2k_I8lv.js → p-C8rpOS5t.js} +1 -1
  116. package/dist/components/{p-BfUdaxZ9.js → p-CG-iY7pQ.js} +1 -1
  117. package/dist/components/{p-B2bvM2Ig.js → p-CLjuZoiT.js} +1 -1
  118. package/dist/components/p-CUoPUIej.js +1 -0
  119. package/dist/components/p-CZzlLTQc.js +1 -0
  120. package/dist/components/p-CmvpJzLd.js +1 -0
  121. package/dist/components/{p-CvEdUq8i.js → p-CrZ_O3DT.js} +1 -1
  122. package/dist/components/{p-eWxolPDU.js → p-CytMTBFu.js} +1 -1
  123. package/dist/components/{p-4vVbchX2.js → p-D32TsLzd.js} +1 -1
  124. package/dist/components/p-D3hr9wra.js +1 -0
  125. package/dist/components/{p-BXg3v5AO.js → p-DDo-fu3v.js} +1 -1
  126. package/dist/components/{p-B5tixDPM.js → p-DFybNETX.js} +1 -1
  127. package/dist/components/p-DJSj3oQq.js +1 -0
  128. package/dist/components/p-DMAaBt7n.js +1 -0
  129. package/dist/components/{p-Cel0a6ma.js → p-DRU71K0s.js} +1 -1
  130. package/dist/components/p-DRmphEA0.js +1 -0
  131. package/dist/components/{p-9mUU4itF.js → p-DUZCLRVu.js} +1 -1
  132. package/dist/components/p-DY5fMUX8.js +1 -0
  133. package/dist/components/p-D_K7tYhY.js +1 -0
  134. package/dist/components/{p-DaOm9YwQ.js → p-DdvG1D18.js} +1 -1
  135. package/dist/components/p-Do4GqlMV.js +1 -0
  136. package/dist/components/p-Dw3rv_Y9.js +1 -0
  137. package/dist/components/{p-BXXjh6We.js → p-Dyzb4ika.js} +1 -1
  138. package/dist/components/p-JG4Sx1lE.js +1 -0
  139. package/dist/components/p-TNX3alPU.js +1 -0
  140. package/dist/components/p-Uc0zvXcQ.js +1 -0
  141. package/dist/components/p-VtNvNyZK.js +1 -0
  142. package/dist/components/{p-Y9bth2Y_.js → p-Zuxd3z0q.js} +1 -1
  143. package/dist/components/{p-7ieJFBUk.js → p-dO0utE8m.js} +1 -1
  144. package/dist/components/{p-16rjcQ0t.js → p-j42D1yrQ.js} +1 -1
  145. package/dist/components/p-ja0FCkHB.js +1 -0
  146. package/dist/esm/bn-annotation-layer_30.entry.js +646 -103
  147. package/dist/esm/bn-grid.entry.js +163 -36
  148. package/dist/esm/bn-image.entry.js +3 -3
  149. package/dist/esm/bn-internationalization.entry.js +3 -3
  150. package/dist/esm/bn-ruleset.entry.js +3 -3
  151. package/dist/esm/bn-template-engine.js +3 -3
  152. package/dist/esm/bn-text.entry.js +4 -4
  153. package/dist/esm/index-DZHir0Ol.js +60 -0
  154. package/dist/esm/{index-CCZcKl0Q.js → index-GstO_GU5.js} +2 -2
  155. package/dist/esm/index.js +2 -15
  156. package/dist/esm/loader.js +3 -3
  157. package/dist/esm/{localFrame-BNWPPaQa.js → localFrame-WNu1bAPm.js} +1 -1
  158. package/dist/esm/types-DY5fMUX8.js +15 -0
  159. package/dist/esm/{withBodyObserver-AHQAUV85.js → withBodyObserver-wJgSN1Pj.js} +2 -2
  160. package/dist/esm/{withHasError-B6Lvj9Cq.js → withHasError-BDWEBrrb.js} +12 -6
  161. package/dist/esm/{withStyled-CzzXg64f.js → withStyled-CTZFjg4L.js} +40 -7
  162. package/dist/esm/{withTranslation-C1gL7wSU.js → withTranslation-BESW5BNq.js} +3 -3
  163. package/dist/schemas/theme.schema.json +18 -0
  164. package/dist/types/components/bn-annotation-layer/bn-annotation-layer.d.ts +11 -0
  165. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +16 -0
  166. package/dist/types/components/bn-chart-structure/utils/elements/Needle.d.ts +2 -1
  167. package/dist/types/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.d.ts +8 -0
  168. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +46 -1
  169. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +37 -0
  170. package/dist/types/components/bn-chart-time/utils/elements/Axis.d.ts +2 -0
  171. package/dist/types/components/bn-chart-time/utils/elements/Needle.d.ts +2 -1
  172. package/dist/types/components/bn-chart-time/utils/factories/ScenarioFactory.d.ts +1 -1
  173. package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +6 -1
  174. package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +6 -0
  175. package/dist/types/components/bn-context/bn-context.d.ts +25 -0
  176. package/dist/types/components/bn-grid/bn-grid.d.ts +23 -0
  177. package/dist/types/components/bn-grid/utils/cellLayout.d.ts +39 -3
  178. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +3 -1
  179. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +9 -0
  180. package/dist/types/components/bn-title/bn-title-renderer/bn-title-renderer.d.ts +2 -0
  181. package/dist/types/components/bn-title/bn-title.d.ts +10 -0
  182. package/dist/types/components.d.ts +199 -6
  183. package/dist/types/index.d.ts +2 -0
  184. package/dist/types/stores/componentStyles.d.ts +8 -0
  185. package/dist/types/utils/DateStringFactory.d.ts +4 -0
  186. package/dist/types/utils/layoutState/types.d.ts +3 -0
  187. package/dist/types/utils/model/VarianceScenario.d.ts +2 -0
  188. package/dist/types/utils/notation.d.ts +78 -0
  189. package/dist/types/utils/validate.d.ts +2 -0
  190. package/dist/types/utils/withComponentStyle.d.ts +6 -0
  191. package/package.json +1 -1
  192. package/dist/bn-template-engine/p-1b002bd5.entry.js +0 -1
  193. package/dist/bn-template-engine/p-750b2c82.entry.js +0 -1
  194. package/dist/bn-template-engine/p-CCZcKl0Q.js +0 -2
  195. package/dist/bn-template-engine/p-D0tNATZq.js +0 -1
  196. package/dist/bn-template-engine/p-DF9sfwBN.js +0 -1
  197. package/dist/bn-template-engine/p-EcC0qLtU.js +0 -1
  198. package/dist/bn-template-engine/p-b0dfc113.entry.js +0 -1
  199. package/dist/components/p-1B_s8oPY.js +0 -1
  200. package/dist/components/p-AwH1w8Mu.js +0 -1
  201. package/dist/components/p-BPGLOHUe.js +0 -1
  202. package/dist/components/p-BiSytXUy.js +0 -1
  203. package/dist/components/p-C2ycO60j.js +0 -1
  204. package/dist/components/p-C3gYq-HU.js +0 -1
  205. package/dist/components/p-CEf5X8MZ.js +0 -1
  206. package/dist/components/p-Chuj-LpI.js +0 -1
  207. package/dist/components/p-CniN8ALm.js +0 -1
  208. package/dist/components/p-D40Am1Ap.js +0 -1
  209. package/dist/components/p-D6YGOYV1.js +0 -2
  210. package/dist/components/p-DDvWTgk1.js +0 -1
  211. package/dist/components/p-DJUffGeB.js +0 -1
  212. package/dist/components/p-DQl2K2Xl.js +0 -1
  213. package/dist/components/p-DjPWZfry.js +0 -1
  214. package/dist/components/p-DnDL1pPc.js +0 -1
  215. package/dist/components/p-Do4oPrkE.js +0 -1
  216. package/dist/components/p-DwuXVo2h.js +0 -1
  217. package/dist/components/p-sLbQ7yZ1.js +0 -1
  218. 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 variancesList = this.prepareVariances();
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
- if (idx >= 1) {
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 scenarios = this.prepareScenarios();
888
- // Dimension stacking uses only the first scenario
889
- const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
890
- 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, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
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", ["base", ...variances], origins, detail);
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
- let scenariosArray = [""];
1009
- const variancesArray = this.prepareVariances();
1010
- if (variancesArray.length > 0) {
1011
- scenariosArray = [...scenariosArray, ...variancesArray];
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: '467a851c6547b300c71a38e812bfea4718f27775', style: fontStyles }, h("div", { key: '4b5078608132e047a9404987c65c46f43037c043', class: "container" }, scenariosArray.map(this.chartTemplate))));
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) {
@@ -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,