@bino-bi/bn-template-engine 1.0.0-alpha.3 → 1.0.0-alpha.4

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 (195) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/p-1265d8d3.entry.js +1 -0
  3. package/dist/bn-template-engine/p-15516dac.entry.js +1 -0
  4. package/dist/bn-template-engine/p-1c716641.entry.js +1 -0
  5. package/dist/bn-template-engine/p-27cc8dc0.entry.js +1 -0
  6. package/dist/bn-template-engine/p-4426d484.entry.js +1 -0
  7. package/dist/bn-template-engine/p-51f8dc9e.entry.js +1 -0
  8. package/dist/bn-template-engine/p-53d4e690.entry.js +1 -0
  9. package/dist/bn-template-engine/p-5KQYRQLK.js +1 -0
  10. package/dist/bn-template-engine/p-745f4596.entry.js +1 -0
  11. package/dist/bn-template-engine/{p-0f1504f3.entry.js → p-75e97c87.entry.js} +1 -1
  12. package/dist/bn-template-engine/p-7a560278.entry.js +1 -0
  13. package/dist/bn-template-engine/p-7ea7c325.entry.js +1 -0
  14. package/dist/bn-template-engine/p-945cc95d.entry.js +1 -0
  15. package/dist/bn-template-engine/p-BYBpC0EO.js +1 -0
  16. package/dist/bn-template-engine/p-BfXY5dsy.js +1 -0
  17. package/dist/bn-template-engine/p-BgnHJQ9Q.js +1 -0
  18. package/dist/bn-template-engine/{p-B4ySv9KQ.js → p-Bhd_WSML.js} +1 -1
  19. package/dist/bn-template-engine/p-Bka-Z6jo.js +1 -0
  20. package/dist/bn-template-engine/p-Bnhh02CF.js +1 -0
  21. package/dist/bn-template-engine/p-C7dQL8CS.js +1 -0
  22. package/dist/bn-template-engine/p-CL1RYuNU.js +1 -0
  23. package/dist/bn-template-engine/p-CYwd_ZNM.js +1 -0
  24. package/dist/bn-template-engine/p-ChlK-T9I.js +1 -0
  25. package/dist/bn-template-engine/p-DHezf8pZ.js +1 -0
  26. package/dist/bn-template-engine/{p-DVMu6dEy.js → p-DlppAFq9.js} +1 -1
  27. package/dist/bn-template-engine/p-DvDDgmcV.js +1 -0
  28. package/dist/bn-template-engine/p-DvvwfRQG.js +1 -0
  29. package/dist/bn-template-engine/{p-DG-1MR_T.js → p-P7pGJBgc.js} +1 -1
  30. package/dist/bn-template-engine/p-b34eaf86.entry.js +1 -0
  31. package/dist/bn-template-engine/p-bdb8b44c.entry.js +1 -0
  32. package/dist/bn-template-engine/p-c44fcb8e.entry.js +1 -0
  33. package/dist/bn-template-engine/p-c7e1a49b.entry.js +1 -0
  34. package/dist/bn-template-engine/p-d9003041.entry.js +1 -0
  35. package/dist/bn-template-engine/p-daa7ffa3.entry.js +1 -0
  36. package/dist/bn-template-engine/p-e084f50a.entry.js +1 -0
  37. package/dist/bn-template-engine/p-eaba6658.entry.js +1 -0
  38. package/dist/bn-template-engine/{p-C0yAPzJz.js → p-u8igQLRZ.js} +1 -1
  39. package/dist/cjs/{DataFormatDigits-DAmZzqbD.js → DataFormatDigits-DKcOeLNK.js} +1 -1
  40. package/dist/cjs/{DateStringFactory-CcluhpGI.js → DateStringFactory-CSKvbS8K.js} +1 -1
  41. package/dist/cjs/{Order-BKoDS21t.js → Order-iG11HI4R.js} +8 -5
  42. package/dist/cjs/{SVGVariancesStyleGroup-DYYAU-81.js → SVGVariancesStyleGroup-K-Tw6lOD.js} +1 -14
  43. package/dist/cjs/bn-asset.cjs.entry.js +5 -4
  44. package/dist/cjs/bn-body_4.cjs.entry.js +15 -13
  45. package/dist/cjs/bn-card.cjs.entry.js +5 -4
  46. package/dist/cjs/{ibcs-chart-structure.cjs.entry.js → bn-chart-structure_5.cjs.entry.js} +1058 -28
  47. package/dist/cjs/bn-chart-time.cjs.entry.js +38 -12
  48. package/dist/cjs/bn-component-style.cjs.entry.js +5 -4
  49. package/dist/cjs/bn-dataset.cjs.entry.js +38 -9
  50. package/dist/cjs/bn-grid.cjs.entry.js +9 -7
  51. package/dist/cjs/bn-image.cjs.entry.js +9 -7
  52. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -4
  53. package/dist/cjs/bn-layout-card.cjs.entry.js +3 -2
  54. package/dist/cjs/bn-layout-page.cjs.entry.js +2 -1
  55. package/dist/cjs/bn-message.cjs.entry.js +5 -4
  56. package/dist/cjs/bn-table.cjs.entry.js +979 -0
  57. package/dist/cjs/bn-template-engine.cjs.js +1 -1
  58. package/dist/cjs/bn-template.cjs.entry.js +3 -2
  59. package/dist/cjs/bn-text.cjs.entry.js +11 -9
  60. package/dist/cjs/bn-tree.cjs.entry.js +9 -7
  61. package/dist/cjs/contentDecoder-JxOldq1e.js +419 -0
  62. package/dist/cjs/{context-protocol-CRPmux5D.js → context-protocol-DRQWrwsA.js} +2 -0
  63. package/dist/cjs/editor-companion.cjs.entry.js +1 -1
  64. package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +57 -0
  65. package/dist/cjs/ibcs-chart-time.cjs.entry.js +22 -18
  66. package/dist/cjs/{bn-context_5.cjs.entry.js → ibcs-table.cjs.entry.js} +122 -1293
  67. package/dist/cjs/{StringAdapter-Bneo8T4k.js → ibcsRuleSet-DgUoXOfd.js} +10 -10
  68. package/dist/cjs/index-Dm85hG6t.js +65 -0
  69. package/dist/cjs/loader.cjs.js +1 -1
  70. package/dist/cjs/{scaling-D8sIIKft.js → scaling-9Tz595RQ.js} +7 -7
  71. package/dist/cjs/{withHasError-B8gHkfV2.js → utils-CwHIVbbL.js} +1 -69
  72. package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-CKpSD8UT.js} +3 -3
  73. package/dist/cjs/{withComponentStatus-_x4LQZ0N.js → withComponentStatus-Bw70BhO0.js} +5 -5
  74. package/dist/cjs/{withComponentStyle-DMtic_9Y.js → withComponentStyle-aIbTCtfj.js} +5 -5
  75. package/dist/cjs/withHasError-D7ue5vAv.js +72 -0
  76. package/dist/cjs/{withStyled-CW30Bh6c.js → withStyled-CS1Yp4sv.js} +8 -61
  77. package/dist/cjs/{withTranslation-CWPAIRjh.js → withTranslation-rwgyITqe.js} +5 -5
  78. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +226 -99
  79. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +13 -3
  80. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +94 -11
  81. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +3 -4
  82. package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +4 -0
  83. package/dist/collection/components/bn-chart-time/bn-chart-time.js +28 -4
  84. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +3 -3
  85. package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -4
  86. package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +4 -0
  87. package/dist/collection/components/bn-dataset/bn-dataset.js +49 -2
  88. package/dist/collection/components/bn-datasource/bn-datasource.js +46 -3
  89. package/dist/collection/components/bn-table/bn-table.js +9 -12
  90. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +58 -41
  91. package/dist/collection/stores/componentStyles.js +2 -0
  92. package/dist/collection/utils/constants.js +8 -5
  93. package/dist/collection/utils/contentDecoder.js +28 -0
  94. package/dist/collection/utils/stackColors.js +2 -2
  95. package/dist/collection/utils/validate.js +1 -1
  96. package/dist/components/DataFormatDigits.js +1 -1
  97. package/dist/components/Order.js +1 -1
  98. package/dist/components/SVGVariancesStyleGroup.js +1 -1
  99. package/dist/components/bn-chart-structure.js +1 -1
  100. package/dist/components/bn-chart-time.js +1 -1
  101. package/dist/components/bn-dataset.js +1 -1
  102. package/dist/components/bn-datasource.js +1 -1
  103. package/dist/components/bn-table.js +1 -1
  104. package/dist/components/contentDecoder.js +1 -0
  105. package/dist/components/context-protocol.js +1 -1
  106. package/dist/components/emotion-hash.esm.js +1 -0
  107. package/dist/components/ibcs-chart-structure2.js +1 -1
  108. package/dist/components/ibcs-chart-time2.js +1 -1
  109. package/dist/components/ibcs-table2.js +1 -1
  110. package/dist/components/ibcs-title2.js +1 -1
  111. package/dist/components/ibcsRuleSet.js +1 -1
  112. package/dist/components/validate.js +1 -1
  113. package/dist/components/withStyled.js +1 -1
  114. package/dist/esm/{DataFormatDigits--qIbKvXa.js → DataFormatDigits-oSZ1hBKE.js} +1 -1
  115. package/dist/esm/{DateStringFactory-XWdUjsn8.js → DateStringFactory-CSGz6TDk.js} +1 -1
  116. package/dist/esm/{Order-sqjrku2z.js → Order-Bnhh02CF.js} +9 -6
  117. package/dist/esm/{SVGVariancesStyleGroup-ibg3sLjM.js → SVGVariancesStyleGroup-CqTjrZYg.js} +2 -13
  118. package/dist/esm/bn-asset.entry.js +5 -4
  119. package/dist/esm/bn-body_4.entry.js +11 -9
  120. package/dist/esm/bn-card.entry.js +5 -4
  121. package/dist/esm/{ibcs-chart-structure.entry.js → bn-chart-structure_5.entry.js} +1048 -22
  122. package/dist/esm/bn-chart-time.entry.js +38 -12
  123. package/dist/esm/bn-component-style.entry.js +5 -4
  124. package/dist/esm/bn-dataset.entry.js +35 -6
  125. package/dist/esm/bn-grid.entry.js +9 -7
  126. package/dist/esm/bn-image.entry.js +9 -7
  127. package/dist/esm/bn-internationalization.entry.js +5 -4
  128. package/dist/esm/bn-layout-card.entry.js +3 -2
  129. package/dist/esm/bn-layout-page.entry.js +2 -1
  130. package/dist/esm/bn-message.entry.js +5 -4
  131. package/dist/esm/bn-table.entry.js +977 -0
  132. package/dist/esm/bn-template-engine.js +1 -1
  133. package/dist/esm/bn-template.entry.js +3 -2
  134. package/dist/esm/bn-text.entry.js +11 -9
  135. package/dist/esm/bn-tree.entry.js +9 -7
  136. package/dist/esm/contentDecoder-oMmxz6nJ.js +416 -0
  137. package/dist/esm/{context-protocol-Bz5klD-F.js → context-protocol-BHnQsVsr.js} +2 -0
  138. package/dist/esm/editor-companion.entry.js +1 -1
  139. package/dist/esm/emotion-hash.esm-BYBpC0EO.js +55 -0
  140. package/dist/esm/ibcs-chart-time.entry.js +15 -11
  141. package/dist/esm/{bn-context_5.entry.js → ibcs-table.entry.js} +68 -1235
  142. package/dist/esm/{StringAdapter-BCLJpQQ8.js → ibcsRuleSet-K4ytuA1f.js} +10 -10
  143. package/dist/esm/index-DHezf8pZ.js +65 -0
  144. package/dist/esm/loader.js +1 -1
  145. package/dist/esm/{scaling-C6K8FYSF.js → scaling-Cehc74IE.js} +2 -2
  146. package/dist/esm/{withHasError-B3QX2emi.js → utils-DvvwfRQG.js} +1 -69
  147. package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-FQ8NwCIz.js} +1 -1
  148. package/dist/esm/{withComponentStatus-DodoSXe-.js → withComponentStatus-DWjDYtZ7.js} +1 -1
  149. package/dist/esm/{withComponentStyle-BerJY64r.js → withComponentStyle-9uP_hcDq.js} +2 -2
  150. package/dist/esm/withHasError-FyY5mQ_3.js +70 -0
  151. package/dist/esm/{withStyled-D1fAWJ3g.js → withStyled--qQWquTH.js} +6 -59
  152. package/dist/esm/{withTranslation-mimbJdER.js → withTranslation-BqD0Kp7b.js} +2 -2
  153. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +155 -109
  154. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +7 -0
  155. package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +1 -0
  156. package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +1 -0
  157. package/dist/types/components/bn-dataset/bn-dataset.d.ts +6 -0
  158. package/dist/types/components/bn-datasource/bn-datasource.d.ts +8 -0
  159. package/dist/types/components/bn-table/bn-table.d.ts +3 -3
  160. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +0 -2
  161. package/dist/types/components.d.ts +100 -36
  162. package/dist/types/stores/componentStyles.d.ts +2 -0
  163. package/dist/types/utils/constants.d.ts +8 -5
  164. package/dist/types/utils/contentDecoder.d.ts +12 -0
  165. package/package.json +2 -1
  166. package/dist/bn-template-engine/p-05a82a77.entry.js +0 -1
  167. package/dist/bn-template-engine/p-1970906d.entry.js +0 -1
  168. package/dist/bn-template-engine/p-1dbd339c.entry.js +0 -1
  169. package/dist/bn-template-engine/p-2e68cf09.entry.js +0 -1
  170. package/dist/bn-template-engine/p-31cc6a2d.entry.js +0 -1
  171. package/dist/bn-template-engine/p-37881d05.entry.js +0 -1
  172. package/dist/bn-template-engine/p-3b894997.entry.js +0 -1
  173. package/dist/bn-template-engine/p-50e49732.entry.js +0 -1
  174. package/dist/bn-template-engine/p-6c7c0455.entry.js +0 -1
  175. package/dist/bn-template-engine/p-6da93eae.entry.js +0 -1
  176. package/dist/bn-template-engine/p-701e1578.entry.js +0 -1
  177. package/dist/bn-template-engine/p-8tsCnxIz.js +0 -1
  178. package/dist/bn-template-engine/p-997b2fe4.entry.js +0 -1
  179. package/dist/bn-template-engine/p-BL8gyUwE.js +0 -1
  180. package/dist/bn-template-engine/p-BSfqOkN_.js +0 -1
  181. package/dist/bn-template-engine/p-CRLgp9-v.js +0 -1
  182. package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
  183. package/dist/bn-template-engine/p-DRikHQE-.js +0 -1
  184. package/dist/bn-template-engine/p-DtdQCMzj.js +0 -1
  185. package/dist/bn-template-engine/p-a90f1cbe.entry.js +0 -1
  186. package/dist/bn-template-engine/p-b7bec050.entry.js +0 -1
  187. package/dist/bn-template-engine/p-d7f0cbaf.entry.js +0 -1
  188. package/dist/bn-template-engine/p-dfb61aa5.entry.js +0 -1
  189. package/dist/bn-template-engine/p-ece17f84.entry.js +0 -1
  190. package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
  191. package/dist/bn-template-engine/p-fd427179.entry.js +0 -1
  192. package/dist/bn-template-engine/p-sqjrku2z.js +0 -1
  193. package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
  194. package/dist/cjs/bn-chart-structure.cjs.entry.js +0 -700
  195. package/dist/esm/bn-chart-structure.entry.js +0 -698
@@ -9,7 +9,7 @@ import withComponentStyle from "../../utils/withComponentStyle";
9
9
  import withHasError from "../../utils/withHasError";
10
10
  import { getParentDimensions } from "../../utils/parentDimensions";
11
11
  import { parseScaling } from "../../utils/scaling";
12
- import { AggregationLevel, StackMode, StackOrder } from "../../utils/constants";
12
+ import { AggregationLevel, StackBy, StackMode, StackOrder } from "../../utils/constants";
13
13
  import { OrderColumn, OrderDirection } from "../../utils/model/Order";
14
14
  /**
15
15
  * SVG structure (categorical) bar chart following IBCS standards.
@@ -204,81 +204,96 @@ export class Chart {
204
204
  this.datasetMeta = null;
205
205
  this.appliedScaleFactor = 1;
206
206
  /**
207
- * Custom chart title
207
+ * Title displayed above the chart. When empty, the title is derived
208
+ * from the variance scenario labels (if variances are configured).
209
+ *
210
+ * @example chart-title="Revenue by Category"
208
211
  */
209
212
  this.chartTitle = "";
210
213
  /**
211
214
  * AlaSQL WHERE clause fragment injected into the data query to filter
212
- * rows before rendering (e.g. `"rowGroup = 'Revenue'"`).
215
+ * rows before rendering.
216
+ *
217
+ * @example filter="rowGroup = 'Revenue'"
213
218
  */
214
219
  this.filter = "";
215
- /** set translaton mode.
216
- * <br /><br />
217
- * values:<br />
218
- * ``` all // none // meta ```
219
- */
220
220
  /**
221
- * Set the maximum number of bars for each
222
- * group. The value 0 means *no limit*
223
- * <br /><br />
224
- * rows wich where cut by the limit are cumulated as REST
221
+ * Maximum number of bars to display. Excess rows are aggregated into
222
+ * a "REST" summary bar. `0` means no limit (all rows are shown).
225
223
  *
224
+ * @default 0
225
+ * @example limit="5"
226
226
  */
227
227
  this.limit = 0;
228
+ /**
229
+ * Whether to display category labels on the left side of the chart.
230
+ *
231
+ * Values: `"true"` | `"false"`.
232
+ *
233
+ * @default "true"
234
+ * @example show-categories="false"
235
+ */
228
236
  this.showCategories = "true";
229
237
  /**
230
- * Sets the SiPrefix of the Mesaurements and converts the
231
- * original value.
232
- * <br /><br />
233
- * values: <br />
234
- * ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p // P // f // a // z // y // GREATEST // LEAST```
235
- * <br /><br />
236
- * SiPrefix overview:
237
- * ``` "Y": 1E+24,```<br />
238
- * ``` "Z": 1E+21,```<br />
239
- * ``` "E": 1E+18,```<br />
240
- * ``` "P": 1E+15,```<br />
241
- * ``` "T": 1E+12,```<br />
242
- * ``` "G": 1000000000,```<br />
243
- * ``` "M": 1000000,```<br />
244
- * ``` "k": 1000,```<br />
245
- * <br />
246
- * ``` "m": 0.001,```<br />
247
- * ``` "μ": 0.000001,```<br />
248
- * ``` "n": 0.000000001,```<br />
249
- * ``` "p": 0.000000000001,```<br />
250
- * ``` "f": 0.000000000000001,```<br />
251
- * ``` "a": 0.000000000000000001,```<br />
252
- * ``` "z": 0.000000000000000000001,```<br />
253
- * ``` "y": 0.000000000000000000000001,```<br />
254
- * <br /><br />
255
- * Special modes:
256
- * ```GREATEST``` seaches for the bigest (farest to zero) Value in the dataset and sets this value to SiPrefix<br />
257
- * ```LEAST``` searches for smallest (closest to zero) Value in the dataset and sets this value to SiPrefix<br />
258
- *<br /><br />
259
- * ```_``` is the value for no SiPrefix the value is displayed as in the dataset stored.
238
+ * SI prefix applied to data values, dividing them for display
239
+ * (e.g. `"k"` divides by 1 000, showing 14 000 as "14").
240
+ *
241
+ * Common prefixes: `"k"` (×10³), `"M"` (×10⁶), `"G"` (×10⁹), `"T"` (×10¹²).
242
+ * Use `"_"` for no prefix (raw values).
260
243
  *
244
+ * | Special value | Behavior |
245
+ * |---------------|--------------------------------------------------------------|
246
+ * | `"GREATEST"` | Auto-select prefix based on the largest value in the dataset |
247
+ * | `"LEAST"` | Auto-select prefix based on the smallest value |
261
248
  *
249
+ * The selected prefix is shown in the chart footer when `show-measure-scale` is enabled.
250
+ *
251
+ * @default "greatest"
252
+ * @example measure-scale="k"
262
253
  */
263
254
  this.measureScale = "greatest";
264
255
  /**
265
- * Toggles display of measure units in table header
266
- * <br /><br />
267
- * values: <br />
268
- * ```true // false```
256
+ * Toggles display of the SI prefix and unit label in the chart footer
257
+ * (e.g. "k EUR").
258
+ *
259
+ * Values: `"true"` | `"false"`.
260
+ *
261
+ * @default "false"
262
+ * @example show-measure-scale="true"
269
263
  */
270
264
  this.showMeasureScale = "false";
271
265
  /**
272
- * measureUnit displayed in table.
266
+ * Unit label displayed alongside the SI prefix in the chart footer
267
+ * (e.g. "EUR", "USD", "pcs"). Only visible when `show-measure-scale` is `"true"`.
268
+ *
269
+ * @default ""
270
+ * @example measure-unit="EUR"
273
271
  */
274
272
  this.measureUnit = "";
275
273
  /**
276
- * Stacking configuration for the chart as a JSON string.
274
+ * Stacking configuration as a JSON string. When set, bars are drawn as
275
+ * stacked segments instead of side-by-side.
276
+ *
277
+ * **Properties:**
278
+ *
279
+ * | Key | Values | Description |
280
+ * |---------|-----------------------------------------------|----------------------------------------------------|
281
+ * | `by` | `"scenarios"` \| `"dimensions"` | **Required.** What to stack. |
282
+ * | `mode` | `"absolute"` \| `"relative"` \| `"absolute-relative"` | Stacking mode. Default: `"absolute"`. |
283
+ * | `order` | `"asc"` \| `"desc"` \| `"dataset"` | Segment sort order. Default: `"dataset"`. |
284
+ *
285
+ * - `by: "scenarios"` — stacks the scenarios listed in the `scenarios` prop end-to-end.
286
+ * - `by: "dimensions"` — stacks by the next-lower hierarchy level derived from `level`
287
+ * (e.g. level `"rowGroup"` stacks by category). Only the first scenario is used;
288
+ * extra scenarios trigger a `WARN_stack_dimensions_scenarios` warning.
289
+ * - `mode: "relative"` — normalizes each bar to 100%, showing proportions.
290
+ * - `mode: "absolute-relative"` — absolute bars with percentage labels.
277
291
  *
278
- * When set, bars are drawn stacked (additive layers) instead of side-by-side.
292
+ * Segment colors are configurable via the `stackColors` array in component styles.
279
293
  *
280
- * @default '' (empty — no stacking)
281
- * @example stack='{"by":"scenario"}'
294
+ * @default "" (no stacking)
295
+ * @example stack='{"by":"scenarios","mode":"absolute"}'
296
+ * @example stack='{"by":"dimensions","mode":"relative"}'
282
297
  */
283
298
  this.stack = "";
284
299
  this.scenariosArray = [""];
@@ -315,29 +330,20 @@ export class Chart {
315
330
  const { mode } = parseScaling(this.scale);
316
331
  if (mode !== "auto" && mode !== "empty") {
317
332
  this._autoScaleGuard = false;
318
- // Keep existing width-based overflow warning for non-auto modes
319
- const parent = getParentDimensions(this.element);
320
- const errId = "WARN_overflow";
321
- if (parent.width > 0 && this.element.scrollWidth > parent.width + 1) {
322
- this.errors.addOrReplace({
323
- id: errId,
324
- type: "warning",
325
- message: "Chart exceeds available space and will be cut off. Check unit-scaling value.",
326
- });
327
- }
328
- else {
329
- this.errors.remove(errId);
330
- }
333
+ this.checkWidthOverflow();
331
334
  return;
332
335
  }
333
336
  if (this._autoScaleGuard) {
334
337
  this._autoScaleGuard = false;
338
+ this.checkWidthOverflow();
335
339
  return;
336
340
  }
337
341
  const host = this.element;
338
342
  const { height: parentHeight } = getParentDimensions(host);
339
- if (parentHeight <= 0)
343
+ if (parentHeight <= 0) {
344
+ this.checkWidthOverflow();
340
345
  return;
346
+ }
341
347
  // Measure at base (unscaled) font size to get true content height
342
348
  const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
343
349
  host.style.setProperty("--bn-font-size", `${baseFontSize}px`);
@@ -350,6 +356,7 @@ export class Chart {
350
356
  this._autoScaleGuard = true;
351
357
  this.appliedScaleFactor = 1;
352
358
  }
359
+ this.checkWidthOverflow();
353
360
  return;
354
361
  }
355
362
  const computedFactor = (parentHeight - 1) / unscaledHeight;
@@ -368,6 +375,33 @@ export class Chart {
368
375
  this._autoScaleGuard = true;
369
376
  this.appliedScaleFactor = computedFactor;
370
377
  }
378
+ this.checkWidthOverflow();
379
+ }
380
+ /**
381
+ * Emits an error when a custom unit-scaling value causes the chart to exceed its container width.
382
+ * Skipped for auto/unset unit-scaling since auto-fit handles width.
383
+ */
384
+ checkWidthOverflow() {
385
+ var _a;
386
+ const errId = "WARN_overflow";
387
+ const us = String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "")
388
+ .trim()
389
+ .toLowerCase();
390
+ if (us === "" || us === "auto") {
391
+ this.errors.remove(errId);
392
+ return;
393
+ }
394
+ const parent = getParentDimensions(this.element);
395
+ if (parent.width > 0 && this.element.scrollWidth > parent.width + 1) {
396
+ this.errors.addOrReplace({
397
+ id: errId,
398
+ type: "error",
399
+ message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px). Reduce unit-scaling or set to "auto".`,
400
+ });
401
+ }
402
+ else {
403
+ this.errors.remove(errId);
404
+ }
371
405
  }
372
406
  prepareDimension() {
373
407
  const parent = getParentDimensions(this.element);
@@ -544,17 +578,37 @@ export class Chart {
544
578
  }
545
579
  prepareStackConfig() {
546
580
  if (isBlankInput(this.stack)) {
581
+ this.errors.remove("WARN_stack_dimensions_scenarios");
547
582
  return null;
548
583
  }
549
584
  try {
550
585
  const parsed = JSON.parse(this.stack);
586
+ const by = parsed.by;
587
+ const errId = "WARN_stack_dimensions_scenarios";
588
+ if (by === StackBy.DIMENSIONS) {
589
+ const scenarios = this.prepareScenarios();
590
+ if (scenarios.length > 1) {
591
+ this.errors.addOrReplace({
592
+ id: errId,
593
+ type: "warning",
594
+ message: `stack by dimensions: only the first scenario "${scenarios[0]}" is used, the rest (${scenarios.slice(1).join(", ")}) are discarded.`,
595
+ });
596
+ }
597
+ else {
598
+ this.errors.remove(errId);
599
+ }
600
+ }
601
+ else {
602
+ this.errors.remove(errId);
603
+ }
551
604
  return {
552
- by: parsed.by,
605
+ by,
553
606
  mode: parsed.mode || StackMode.ABSOLUTE,
554
607
  order: parsed.order || StackOrder.DATASET,
555
608
  };
556
609
  }
557
610
  catch (_a) {
611
+ this.errors.remove("WARN_stack_dimensions_scenarios");
558
612
  return null;
559
613
  }
560
614
  }
@@ -627,7 +681,11 @@ export class Chart {
627
681
  const effectiveFactor = this.getEffectiveScaleFactor();
628
682
  const ppu = this.preparePixelPerUnit();
629
683
  const ppp = this.preparePixelPerPercentage();
630
- return (h("ibcs-chart-structure", { data: this.data, chartTitle: this.prepareChartTitle(idx), scenarios: this.prepareScenarios(), variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu > 0 ? ppu * effectiveFactor : 0, pixelPerPercentage: ppp > 0 ? ppp * effectiveFactor : 0, 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: this.prepareStackConfig(), parentDimensions: this.prepareDimension() }));
684
+ const stackConfig = this.prepareStackConfig();
685
+ const scenarios = this.prepareScenarios();
686
+ // Dimension stacking uses only the first scenario
687
+ const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
688
+ return (h("ibcs-chart-structure", { data: this.data, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu > 0 ? ppu * effectiveFactor : 0, pixelPerPercentage: ppp > 0 ? ppp * effectiveFactor : 0, 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() }));
631
689
  }
632
690
  getEffectiveScaleFactor() {
633
691
  const { mode, factor } = parseScaling(this.scale);
@@ -657,7 +715,7 @@ export class Chart {
657
715
  scenariosArray = [...scenariosArray, ...variancesArray];
658
716
  }
659
717
  const fontStyles = this.getFontStyles();
660
- return (h(Host, { key: 'c8ad939fbe92ab4a01af1e5ce17e097dbb5eab56', style: fontStyles }, h("div", { key: 'd786c49dd808c2dd9093ede7100e16ac52f50689', class: "container" }, scenariosArray.map(this.chartTemplate))));
718
+ return (h(Host, { key: '570fb741ddf481be0f3055d346314ad39a455361', style: fontStyles }, h("div", { key: 'e84cfe2e00dd2f960f038844e00449431efa6ce0', class: "container" }, scenariosArray.map(this.chartTemplate))));
661
719
  }
662
720
  static get is() { return "bn-chart-structure"; }
663
721
  static get encapsulation() { return "shadow"; }
@@ -684,8 +742,11 @@ export class Chart {
684
742
  "required": false,
685
743
  "optional": false,
686
744
  "docs": {
687
- "tags": [],
688
- "text": "Custom chart title"
745
+ "tags": [{
746
+ "name": "example",
747
+ "text": "chart-title=\"Revenue by Category\""
748
+ }],
749
+ "text": "Title displayed above the chart. When empty, the title is derived\nfrom the variance scenario labels (if variances are configured)."
689
750
  },
690
751
  "getter": false,
691
752
  "setter": false,
@@ -704,8 +765,11 @@ export class Chart {
704
765
  "required": false,
705
766
  "optional": false,
706
767
  "docs": {
707
- "tags": [],
708
- "text": "AlaSQL WHERE clause fragment injected into the data query to filter\nrows before rendering (e.g. `\"rowGroup = 'Revenue'\"`)."
768
+ "tags": [{
769
+ "name": "example",
770
+ "text": "filter=\"rowGroup = 'Revenue'\""
771
+ }],
772
+ "text": "AlaSQL WHERE clause fragment injected into the data query to filter\nrows before rendering."
709
773
  },
710
774
  "getter": false,
711
775
  "setter": false,
@@ -724,8 +788,11 @@ export class Chart {
724
788
  "required": true,
725
789
  "optional": false,
726
790
  "docs": {
727
- "tags": [],
728
- "text": "List of Scenarios Map.\n<br /> <br />\nper chart there are up to 4 different scenarios supported.\nThe first 4 scenarios in the list are used, the rest ignored.\n\n<br /> <br />\n values:<br /> ```ac // fc // pp // pl [1-4] // auto```\n example:<br /> ```ac1,ac2,ac3,ac4```\n<br /> <br />\n When set to ```auto```, scenarios are detected from the dataset silently.\n When left blank, scenarios are detected from the dataset with a warning."
791
+ "tags": [{
792
+ "name": "example",
793
+ "text": "scenarios=\"ac1,pp1,pl1\""
794
+ }],
795
+ "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`\u2013`ac4`, `fc1`\u2013`fc4`, `pp1`\u2013`pp4`, `pl1`\u2013`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) |"
729
796
  },
730
797
  "getter": false,
731
798
  "setter": false,
@@ -743,8 +810,14 @@ export class Chart {
743
810
  "required": true,
744
811
  "optional": false,
745
812
  "docs": {
746
- "tags": [],
747
- "text": "List of Variance Map.\n<br /> <br />\n Variance chart can be added by seperating the scenarios\n of each chart with ```;```<br />\n The additonal variances which\n are calculated form the given scenarios.\n the scenarios used in the variances have also\n be defined in the *scenarios* property.\n<br /> <br />\n the variance is defiend as (Scenario A - ScenarioB)\n neu. neg and pos post fix defines which value is *good*\n a negative or a positive value.\n<br /> <br />\n if empty variance charts are hidden\n<br /> <br />\n each variance creates a chart\n<br /> <br />\n pattern:<br /> ```d<scenarioB>_<scenarioA>_[pos/neg/neu]```\n\n example: <br />```'dpp1_ac1_neg,dfc1_ac1_neg'```"
813
+ "tags": [{
814
+ "name": "example",
815
+ "text": "variances=\"dpp1_ac1_neg,dfc1_ac1_neg\""
816
+ }, {
817
+ "name": "example",
818
+ "text": "variances=\"drac1_pl1_pos\""
819
+ }],
820
+ "text": "Comma-separated list of variance definitions. Each variance adds\na separate sub-chart next to the main bar chart.\n\n**Pattern:** `d<base>_<comparison>_<sentiment>` (absolute)\nor `dr<base>_<comparison>_<sentiment>` (relative / percentage).\n\n- `base` / `comparison`: scenario names that must also appear in `scenarios`.\n- `sentiment`: `pos` (positive is good), `neg` (negative is good), `neu` (neutral).\n\nWhen empty, no variance charts are shown."
748
821
  },
749
822
  "getter": false,
750
823
  "setter": false,
@@ -762,8 +835,14 @@ export class Chart {
762
835
  "required": true,
763
836
  "optional": false,
764
837
  "docs": {
765
- "tags": [],
766
- "text": "Name of the 'scaling-group' which the chart uses\nscaling groups are maintained globally\n<br /> <br />\nalternatively a number which represent the\npixel per measure unit."
838
+ "tags": [{
839
+ "name": "example",
840
+ "text": "unit-scaling=\"auto\""
841
+ }, {
842
+ "name": "example",
843
+ "text": "unit-scaling=\"0.05\""
844
+ }],
845
+ "text": "Controls horizontal bar scaling (pixels per data unit).\n\n| Value | Behavior |\n|----------------|-----------------------------------------------------------------|\n| `\"auto\"` | Auto-fit bars to fill the available container width (no warning) |\n| not set / `\"\"` | Same as auto, but emits `AUTO_unitScaling` warning |\n| `\"0.03\"`, `1` | Explicit pixels-per-unit value; bars scale proportionally |\n| group name | References a shared scaling group for synchronized charts |\n\nWhen using a custom value that causes the chart to exceed its container,\na `WARN_overflow` error is emitted."
767
846
  },
768
847
  "getter": false,
769
848
  "setter": false,
@@ -781,8 +860,11 @@ export class Chart {
781
860
  "required": true,
782
861
  "optional": false,
783
862
  "docs": {
784
- "tags": [],
785
- "text": "Name of the 'scaling-group' which the chart uses\nscaling groups are maintained globally\n<br /> <br />\nalternatively a number which represent the\npixel per percentage."
863
+ "tags": [{
864
+ "name": "example",
865
+ "text": "percentage-scaling=\"50\""
866
+ }],
867
+ "text": "Controls scaling of relative variance bars (pixels per percentage point).\n\n| Value | Behavior |\n|----------------|---------------------------------------------------------------|\n| `\"auto\"` | Auto-fit to available width |\n| not set / `\"\"` | Same as auto with warning |\n| `\"50\"`, `1.5` | Explicit pixels-per-percentage-point value |\n| group name | References a shared scaling group for synchronized charts |"
786
868
  },
787
869
  "getter": false,
788
870
  "setter": false,
@@ -800,8 +882,11 @@ export class Chart {
800
882
  "required": true,
801
883
  "optional": false,
802
884
  "docs": {
803
- "tags": [],
804
- "text": "Determines level on which the chart is aggregated on.\n<br /> <br />\n\nvalues:<br/>\n``` rowcategory // category // subcategory // auto```\n<br /> <br />\n When set to ```auto```, level is detected from the dataset silently.\n When left blank, level is detected from the dataset with a warning."
885
+ "tags": [{
886
+ "name": "example",
887
+ "text": "level=\"category\""
888
+ }],
889
+ "text": "Aggregation level that determines which hierarchy dimension each bar represents.\n\n| Value | Bars represent |\n|--------------------|---------------------------|\n| `\"rowGroup\"` | Row groups |\n| `\"rowGroupIndex\"` | Row groups (dataset order)|\n| `\"category\"` | Categories |\n| `\"categoryIndex\"` | Categories (dataset order)|\n| `\"subCategory\"` | Sub-categories |\n| `\"subCategoryIndex\"` | Sub-categories (dataset order)|\n| `\"auto\"` | Auto-detect from dataset metadata (no warning) |\n| not set / `\"\"` | Auto-detect with `AUTO_level` warning |\n\nIndex variants preserve the original dataset order instead of sorting alphabetically.\nWhen `stack.by` is `\"dimensions\"`, the chart automatically stacks by the next-lower\nlevel (e.g. level `\"rowGroup\"` stacks by category)."
805
890
  },
806
891
  "getter": false,
807
892
  "setter": false,
@@ -819,8 +904,11 @@ export class Chart {
819
904
  "required": true,
820
905
  "optional": false,
821
906
  "docs": {
822
- "tags": [],
823
- "text": "List of the primary scenarios on which the order direction are applied valid scenarios are\nIf order is set to a scenario it has also exists in scenariolist\n<br /><br />\nvalues:<br />\n``` category // categoryindex // rowgroup // rowgroup // rowgroupindex // ac[1-4] // fc[1-4] // py[1-4] // pl[1-4] // auto```\n<br /><br />\nWhen set to ```auto```, order is detected from the dataset silently.\nWhen left blank, order is detected from the dataset with a warning."
907
+ "tags": [{
908
+ "name": "example",
909
+ "text": "order=\"ac1\""
910
+ }],
911
+ "text": "Comma-separated list of columns that define the sort order of bars.\nWhen ordering by a scenario column, that scenario must also be listed in `scenarios`.\n\nValid values: `category`, `categoryIndex`, `rowGroup`, `rowGroupIndex`,\n`subCategory`, `subCategoryIndex`, `ac1`\u2013`ac4`, `fc1`\u2013`fc4`, `pp1`\u2013`pp4`, `pl1`\u2013`pl4`.\n\n| Value | Behavior |\n|----------------|-----------------------------------------------------|\n| `\"ac1\"` | Sort bars by the ac1 scenario values |\n| `\"category\"` | Sort bars alphabetically by category name |\n| `\"auto\"` | Auto-detect from dataset metadata (no warning) |\n| not set / `\"\"` | Auto-detect with `AUTO_order` warning |"
824
912
  },
825
913
  "getter": false,
826
914
  "setter": false,
@@ -838,8 +926,14 @@ export class Chart {
838
926
  "required": true,
839
927
  "optional": false,
840
928
  "docs": {
841
- "tags": [],
842
- "text": "set sorting order direction\n<br /><br />\nvalues:<br />\n```asc // desc```"
929
+ "tags": [{
930
+ "name": "default",
931
+ "text": "\"asc\""
932
+ }, {
933
+ "name": "example",
934
+ "text": "order-direction=\"desc\""
935
+ }],
936
+ "text": "Sort direction applied to the columns specified in `order`.\n\nValues: `\"asc\"` (ascending) | `\"desc\"` (descending)."
843
937
  },
844
938
  "getter": false,
845
939
  "setter": false,
@@ -857,8 +951,14 @@ export class Chart {
857
951
  "required": false,
858
952
  "optional": false,
859
953
  "docs": {
860
- "tags": [],
861
- "text": "Set the maximum number of bars for each\ngroup. The value 0 means *no limit*\n<br /><br />\nrows wich where cut by the limit are cumulated as REST"
954
+ "tags": [{
955
+ "name": "default",
956
+ "text": "0"
957
+ }, {
958
+ "name": "example",
959
+ "text": "limit=\"5\""
960
+ }],
961
+ "text": "Maximum number of bars to display. Excess rows are aggregated into\na \"REST\" summary bar. `0` means no limit (all rows are shown)."
862
962
  },
863
963
  "getter": false,
864
964
  "setter": false,
@@ -877,8 +977,14 @@ export class Chart {
877
977
  "required": false,
878
978
  "optional": false,
879
979
  "docs": {
880
- "tags": [],
881
- "text": ""
980
+ "tags": [{
981
+ "name": "default",
982
+ "text": "\"true\""
983
+ }, {
984
+ "name": "example",
985
+ "text": "show-categories=\"false\""
986
+ }],
987
+ "text": "Whether to display category labels on the left side of the chart.\n\nValues: `\"true\"` | `\"false\"`."
882
988
  },
883
989
  "getter": false,
884
990
  "setter": false,
@@ -897,8 +1003,14 @@ export class Chart {
897
1003
  "required": false,
898
1004
  "optional": false,
899
1005
  "docs": {
900
- "tags": [],
901
- "text": "Sets the SiPrefix of the Mesaurements and converts the\noriginal value.\n<br /><br />\nvalues: <br />\n```_ // k // M // G // T // P // E // Z // Y // m // \u03BC // n // p // P // f // a // z // y // GREATEST // LEAST```\n<br /><br />\nSiPrefix overview:\n``` \"Y\": 1E+24,```<br />\n``` \"Z\": 1E+21,```<br />\n``` \"E\": 1E+18,```<br />\n``` \"P\": 1E+15,```<br />\n``` \"T\": 1E+12,```<br />\n``` \"G\": 1000000000,```<br />\n``` \"M\": 1000000,```<br />\n``` \"k\": 1000,```<br />\n<br />\n``` \"m\": 0.001,```<br />\n``` \"\u03BC\": 0.000001,```<br />\n``` \"n\": 0.000000001,```<br />\n``` \"p\": 0.000000000001,```<br />\n``` \"f\": 0.000000000000001,```<br />\n``` \"a\": 0.000000000000000001,```<br />\n``` \"z\": 0.000000000000000000001,```<br />\n``` \"y\": 0.000000000000000000000001,```<br />\n<br /><br />\nSpecial modes:\n```GREATEST``` seaches for the bigest (farest to zero) Value in the dataset and sets this value to SiPrefix<br />\n```LEAST``` searches for smallest (closest to zero) Value in the dataset and sets this value to SiPrefix<br />\n<br /><br />\n```_``` is the value for no SiPrefix the value is displayed as in the dataset stored."
1006
+ "tags": [{
1007
+ "name": "default",
1008
+ "text": "\"greatest\""
1009
+ }, {
1010
+ "name": "example",
1011
+ "text": "measure-scale=\"k\""
1012
+ }],
1013
+ "text": "SI prefix applied to data values, dividing them for display\n(e.g. `\"k\"` divides by 1 000, showing 14 000 as \"14\").\n\nCommon prefixes: `\"k\"` (\u00D710\u00B3), `\"M\"` (\u00D710\u2076), `\"G\"` (\u00D710\u2079), `\"T\"` (\u00D710\u00B9\u00B2).\nUse `\"_\"` for no prefix (raw values).\n\n| Special value | Behavior |\n|---------------|--------------------------------------------------------------|\n| `\"GREATEST\"` | Auto-select prefix based on the largest value in the dataset |\n| `\"LEAST\"` | Auto-select prefix based on the smallest value |\n\nThe selected prefix is shown in the chart footer when `show-measure-scale` is enabled."
902
1014
  },
903
1015
  "getter": false,
904
1016
  "setter": false,
@@ -917,8 +1029,14 @@ export class Chart {
917
1029
  "required": false,
918
1030
  "optional": false,
919
1031
  "docs": {
920
- "tags": [],
921
- "text": "Toggles display of measure units in table header\n<br /><br />\nvalues: <br />\n```true // false```"
1032
+ "tags": [{
1033
+ "name": "default",
1034
+ "text": "\"false\""
1035
+ }, {
1036
+ "name": "example",
1037
+ "text": "show-measure-scale=\"true\""
1038
+ }],
1039
+ "text": "Toggles display of the SI prefix and unit label in the chart footer\n(e.g. \"k EUR\").\n\nValues: `\"true\"` | `\"false\"`."
922
1040
  },
923
1041
  "getter": false,
924
1042
  "setter": false,
@@ -937,8 +1055,14 @@ export class Chart {
937
1055
  "required": false,
938
1056
  "optional": false,
939
1057
  "docs": {
940
- "tags": [],
941
- "text": "measureUnit displayed in table."
1058
+ "tags": [{
1059
+ "name": "default",
1060
+ "text": "\"\""
1061
+ }, {
1062
+ "name": "example",
1063
+ "text": "measure-unit=\"EUR\""
1064
+ }],
1065
+ "text": "Unit label displayed alongside the SI prefix in the chart footer\n(e.g. \"EUR\", \"USD\", \"pcs\"). Only visible when `show-measure-scale` is `\"true\"`."
942
1066
  },
943
1067
  "getter": false,
944
1068
  "setter": false,
@@ -959,12 +1083,15 @@ export class Chart {
959
1083
  "docs": {
960
1084
  "tags": [{
961
1085
  "name": "default",
962
- "text": "'' (empty \u2014 no stacking)"
1086
+ "text": "\"\" (no stacking)"
1087
+ }, {
1088
+ "name": "example",
1089
+ "text": "stack='{\"by\":\"scenarios\",\"mode\":\"absolute\"}'"
963
1090
  }, {
964
1091
  "name": "example",
965
- "text": "stack='{\"by\":\"scenario\"}'"
1092
+ "text": "stack='{\"by\":\"dimensions\",\"mode\":\"relative\"}'"
966
1093
  }],
967
- "text": "Stacking configuration for the chart as a JSON string.\n\nWhen set, bars are drawn stacked (additive layers) instead of side-by-side."
1094
+ "text": "Stacking configuration as a JSON string. When set, bars are drawn as\nstacked segments instead of side-by-side.\n\n**Properties:**\n\n| Key | Values | Description |\n|---------|-----------------------------------------------|----------------------------------------------------|\n| `by` | `\"scenarios\"` \\| `\"dimensions\"` | **Required.** What to stack. |\n| `mode` | `\"absolute\"` \\| `\"relative\"` \\| `\"absolute-relative\"` | Stacking mode. Default: `\"absolute\"`. |\n| `order` | `\"asc\"` \\| `\"desc\"` \\| `\"dataset\"` | Segment sort order. Default: `\"dataset\"`. |\n\n- `by: \"scenarios\"` \u2014 stacks the scenarios listed in the `scenarios` prop end-to-end.\n- `by: \"dimensions\"` \u2014 stacks by the next-lower hierarchy level derived from `level`\n (e.g. level `\"rowGroup\"` stacks by category). Only the first scenario is used;\n extra scenarios trigger a `WARN_stack_dimensions_scenarios` warning.\n- `mode: \"relative\"` \u2014 normalizes each bar to 100%, showing proportions.\n- `mode: \"absolute-relative\"` \u2014 absolute bars with percentage labels.\n\nSegment colors are configurable via the `stackColors` array in component styles."
968
1095
  },
969
1096
  "getter": false,
970
1097
  "setter": false,
@@ -101,7 +101,7 @@ export class IbcsChartStructure {
101
101
  this.chart.setI18n(this.i18n);
102
102
  return;
103
103
  }
104
- // First pass with pixelPerUnit=1 to measure the real SVG width
104
+ // First pass with pixelPerUnit=1 to measure total width and bar extent
105
105
  config.pixelPerUnit = 1;
106
106
  this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
107
107
  this.chart.setI18n(this.i18n);
@@ -110,8 +110,18 @@ export class IbcsChartStructure {
110
110
  if (svgWidth <= 0) {
111
111
  return;
112
112
  }
113
- // Scale so the chart fits in ~90% of the available width
114
- config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
113
+ // Separate fixed parts (labels, padding, spacing) from variable part (bar extent).
114
+ // totalWidth(ppu) = fixedWidth + maxBarValue * ppu
115
+ // Solving for ppu: ppu = (targetWidth - fixedWidth) / maxBarValue
116
+ const maxBarValue = this.chart.getMaxBarValue();
117
+ if (maxBarValue > 0) {
118
+ const fixedWidth = svgWidth - maxBarValue; // at ppu=1, barExtent = maxBarValue * 1
119
+ config.pixelPerUnit = Math.max(0.001, (targetWidth - fixedWidth) / maxBarValue);
120
+ }
121
+ else {
122
+ // Fallback (e.g. relative variance charts)
123
+ config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
124
+ }
115
125
  // Second pass with the corrected scaling
116
126
  this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
117
127
  this.chart.setI18n(this.i18n);