@bino-bi/bn-template-engine 1.0.0-next.48 → 1.0.0-next.49

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 (108) hide show
  1. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  2. package/dist/bn-template-engine/{p-b3f5eba0.entry.js → p-2de524d0.entry.js} +1 -1
  3. package/dist/bn-template-engine/{p-a6017fce.entry.js → p-510d2ee6.entry.js} +1 -1
  4. package/dist/bn-template-engine/{p-6ab684a9.entry.js → p-8fc90dc8.entry.js} +1 -1
  5. package/dist/bn-template-engine/p-BFl7OwcC.js +1 -0
  6. package/dist/bn-template-engine/{p-3ktFZb1x.js → p-Bxa4pX1M.js} +1 -1
  7. package/dist/bn-template-engine/p-c1d679af.entry.js +1 -0
  8. package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +628 -108
  9. package/dist/cjs/bn-grid.cjs.entry.js +1 -1
  10. package/dist/cjs/bn-image.cjs.entry.js +1 -1
  11. package/dist/cjs/bn-text.cjs.entry.js +2 -2
  12. package/dist/cjs/{withStyled-DHKHBdRb.js → withStyled-pkdctrK9.js} +18 -1
  13. package/dist/cjs/{withTranslation-CLwC9a8V.js → withTranslation-BIzTNYZM.js} +1 -1
  14. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.css +19 -0
  15. package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +65 -8
  16. package/dist/collection/components/bn-annotation-layer/utils/marks.js +85 -5
  17. package/dist/collection/components/bn-annotation-layer/utils/matchPoint.js +7 -1
  18. package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +20 -6
  19. package/dist/collection/components/bn-chart-time/bn-chart-time.js +55 -23
  20. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +329 -53
  21. package/dist/collection/components/bn-chart-time/utils/elements/Column.js +4 -1
  22. package/dist/collection/components/bn-chart-time/utils/elements/Label.js +2 -1
  23. package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +53 -11
  24. package/dist/collection/utils/annotations.js +1 -1
  25. package/dist/collection/utils/constants.js +2 -0
  26. package/dist/collection/utils/layoutState/svgChartElements.js +10 -0
  27. package/dist/collection/utils/validate.js +16 -1
  28. package/dist/components/bn-annotation-layer.js +1 -1
  29. package/dist/components/bn-annotation-list.js +1 -1
  30. package/dist/components/bn-chart-bubble-renderer.js +1 -1
  31. package/dist/components/bn-chart-bubble.js +1 -1
  32. package/dist/components/bn-chart-bullet-renderer.js +1 -1
  33. package/dist/components/bn-chart-bullet.js +1 -1
  34. package/dist/components/bn-chart-scatter-renderer.js +1 -1
  35. package/dist/components/bn-chart-scatter.js +1 -1
  36. package/dist/components/bn-chart-structure-renderer.js +1 -1
  37. package/dist/components/bn-chart-structure.js +1 -1
  38. package/dist/components/bn-chart-time-renderer.js +1 -1
  39. package/dist/components/bn-chart-time.js +1 -1
  40. package/dist/components/bn-grid.js +1 -1
  41. package/dist/components/bn-image.js +1 -1
  42. package/dist/components/bn-layout-card.js +1 -1
  43. package/dist/components/bn-layout-page.js +1 -1
  44. package/dist/components/bn-page.js +1 -1
  45. package/dist/components/bn-table-renderer.js +1 -1
  46. package/dist/components/bn-table.js +1 -1
  47. package/dist/components/bn-text.js +1 -1
  48. package/dist/components/bn-title-renderer.js +1 -1
  49. package/dist/components/bn-title.js +1 -1
  50. package/dist/components/bn-tree.js +1 -1
  51. package/dist/components/{p-CLjuZoiT.js → p-B11cXOLy.js} +1 -1
  52. package/dist/components/p-BBdzTx8V.js +1 -0
  53. package/dist/components/{p-B1_wkOLx.js → p-BVNOmHh4.js} +1 -1
  54. package/dist/components/p-BXP6aagM.js +1 -0
  55. package/dist/components/{p-CG-iY7pQ.js → p-Blre9f28.js} +1 -1
  56. package/dist/components/p-CHJ6WE0l.js +1 -0
  57. package/dist/components/{p-Do4GqlMV.js → p-CHhxQoF9.js} +1 -1
  58. package/dist/components/{p-C-3TOa6K.js → p-CJ0-xdfZ.js} +1 -1
  59. package/dist/components/{p-BFoRIqDi.js → p-CO6bgquz.js} +1 -1
  60. package/dist/components/{p-CytMTBFu.js → p-CSJCkHEL.js} +1 -1
  61. package/dist/components/p-CVfmhtEW.js +1 -0
  62. package/dist/components/{p-Zuxd3z0q.js → p-Cc0gaLwp.js} +1 -1
  63. package/dist/components/p-CuUfiEu0.js +1 -0
  64. package/dist/components/{p-DUZCLRVu.js → p-D362XOg2.js} +1 -1
  65. package/dist/components/p-DBj1Yd3M.js +1 -0
  66. package/dist/components/{p-BjgkgCAQ.js → p-DHX92KDP.js} +1 -1
  67. package/dist/components/p-DHloMyxV.js +1 -0
  68. package/dist/components/{p-Uc0zvXcQ.js → p-Dd1QOWDV.js} +1 -1
  69. package/dist/components/p-DguYWLBj.js +1 -0
  70. package/dist/components/p-Do-IGHJk.js +1 -0
  71. package/dist/components/{p-DDo-fu3v.js → p-DsC0ew4j.js} +1 -1
  72. package/dist/components/p-HVN8BNWN.js +1 -0
  73. package/dist/components/{p-Dyzb4ika.js → p-YSRTB0jS.js} +1 -1
  74. package/dist/components/{p-CrZ_O3DT.js → p-k7heRDPP.js} +1 -1
  75. package/dist/components/{p-dO0utE8m.js → p-keKnrAVS.js} +1 -1
  76. package/dist/components/p-x0W2_FAX.js +1 -0
  77. package/dist/components/p-y12CmIFS.js +1 -0
  78. package/dist/esm/bn-annotation-layer_30.entry.js +628 -108
  79. package/dist/esm/bn-grid.entry.js +1 -1
  80. package/dist/esm/bn-image.entry.js +1 -1
  81. package/dist/esm/bn-text.entry.js +2 -2
  82. package/dist/esm/{withStyled-CTZFjg4L.js → withStyled-B62R20Zx.js} +18 -1
  83. package/dist/esm/{withTranslation-BESW5BNq.js → withTranslation-BEseMLQ6.js} +1 -1
  84. package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +48 -0
  85. package/dist/types/components/bn-annotation-layer/utils/matchPoint.d.ts +4 -0
  86. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +29 -6
  87. package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +51 -2
  88. package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +5 -1
  89. package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +6 -0
  90. package/dist/types/components.d.ts +6 -6
  91. package/dist/types/utils/annotations.d.ts +11 -1
  92. package/dist/types/utils/constants.d.ts +3 -1
  93. package/dist/types/utils/layoutState/types.d.ts +2 -0
  94. package/package.json +1 -1
  95. package/dist/bn-template-engine/p-203e7d6a.entry.js +0 -1
  96. package/dist/bn-template-engine/p-DXtYQE4s.js +0 -1
  97. package/dist/components/p-6gET6YXc.js +0 -1
  98. package/dist/components/p-BFWvVe7v.js +0 -1
  99. package/dist/components/p-C8rpOS5t.js +0 -1
  100. package/dist/components/p-CUoPUIej.js +0 -1
  101. package/dist/components/p-ChpAMqbN.js +0 -1
  102. package/dist/components/p-D3hr9wra.js +0 -1
  103. package/dist/components/p-DFybNETX.js +0 -1
  104. package/dist/components/p-DRmphEA0.js +0 -1
  105. package/dist/components/p-D_K7tYhY.js +0 -1
  106. package/dist/components/p-Dw3rv_Y9.js +0 -1
  107. package/dist/components/p-TNX3alPU.js +0 -1
  108. package/dist/components/p-j42D1yrQ.js +0 -1
@@ -2,7 +2,7 @@ import { r as registerInstance, h, a as Host, g as getElement } from './index-Gs
2
2
  import { L as LAYOUT_STATE_VERSION } from './types-DY5fMUX8.js';
3
3
  import { l as localFrameOf, o as originsFor, r as readDiagnostics, m as measure, a as resolveStandaloneId } from './localFrame-WNu1bAPm.js';
4
4
  import { w as withComponentStatus, a as withHasError } from './withHasError-BDWEBrrb.js';
5
- import { w as withStyled, a as withComponentStyle } from './withStyled-CTZFjg4L.js';
5
+ import { w as withStyled, a as withComponentStyle } from './withStyled-B62R20Zx.js';
6
6
 
7
7
  /**
8
8
  * Header configuration types and parsing utilities for bn-grid component.
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h, a as Host, g as getElement } from './index-GstO_GU5.js';
2
- import { w as withStyled, a as withComponentStyle } from './withStyled-CTZFjg4L.js';
2
+ import { w as withStyled, a as withComponentStyle } from './withStyled-B62R20Zx.js';
3
3
  import { w as withComponentStatus, a as withHasError, g as getStores } from './withHasError-BDWEBrrb.js';
4
4
 
5
5
  const bnImageCss = () => `:host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}`;
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, f as forceUpdate, h, a as Host, g as getElement } from './index-GstO_GU5.js';
2
- import { w as withTranslation, a as withDataset, g as getParentDimensions, p as parseScaling, s as sanitizeHtml } from './withTranslation-BESW5BNq.js';
2
+ import { w as withTranslation, a as withDataset, g as getParentDimensions, p as parseScaling, s as sanitizeHtml } from './withTranslation-BEseMLQ6.js';
3
3
  import { w as withComponentStatus, a as withHasError } from './withHasError-BDWEBrrb.js';
4
- import { w as withStyled, a as withComponentStyle } from './withStyled-CTZFjg4L.js';
4
+ import { w as withStyled, a as withComponentStyle } from './withStyled-B62R20Zx.js';
5
5
 
6
6
  const NAME = "[A-Za-z_$\\u00C0-\\uFFFF][\\w$\\u00C0-\\uFFFF]*";
7
7
  const STRING = `'[^'\\\\]*'|"[^"\\\\]*"`;
@@ -261,12 +261,14 @@ var AggregationLevel;
261
261
  * - SMART: abbreviated labels with parent period shown at boundary crossings (e.g. "Jan" normally, "Jan 2024" at year boundary)
262
262
  * - LONG: full date format for every label
263
263
  * - SHORT: abbreviated format for every label
264
+ * - TWO_ROW: abbreviated labels, and the parent period (the year of a month) in a second row where it starts
264
265
  */
265
266
  var AxisLabelsMode;
266
267
  (function (AxisLabelsMode) {
267
268
  AxisLabelsMode["SMART"] = "smart";
268
269
  AxisLabelsMode["LONG"] = "long";
269
270
  AxisLabelsMode["SHORT"] = "short";
271
+ AxisLabelsMode["TWO_ROW"] = "two-row";
270
272
  })(AxisLabelsMode || (AxisLabelsMode = {}));
271
273
  /**
272
274
  * Visual representation type for chart series.
@@ -1358,7 +1360,7 @@ function isValidDateFormat(value) {
1358
1360
  return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in DateDistance;
1359
1361
  }
1360
1362
  function isValidAxisLabelsMode(value) {
1361
- return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in AxisLabelsMode;
1363
+ return (value === null || value === void 0 ? void 0 : value.toUpperCase().replace("-", "_")) in AxisLabelsMode;
1362
1364
  }
1363
1365
  function isValidDataFormat(value) {
1364
1366
  if (isBlankInput(value)) {
@@ -1490,6 +1492,21 @@ function validateStackConfig(value) {
1490
1492
  errors.push(`stack: 'order' must be one of: ${validOrders.join(", ")}`);
1491
1493
  }
1492
1494
  }
1495
+ if (config.hasOwnProperty("notation")) {
1496
+ const validNotations = ["none", "scenario"];
1497
+ if (!validNotations.includes(config.notation)) {
1498
+ errors.push(`stack: 'notation' must be one of: ${validNotations.join(", ")}`);
1499
+ }
1500
+ }
1501
+ if (config.hasOwnProperty("legend")) {
1502
+ const validLegends = ["left", "right", "both", "none"];
1503
+ if (!validLegends.includes(config.legend)) {
1504
+ errors.push(`stack: 'legend' must be one of: ${validLegends.join(", ")}`);
1505
+ }
1506
+ }
1507
+ if (config.hasOwnProperty("percentMark") && typeof config.percentMark !== "boolean") {
1508
+ errors.push("stack: 'percentMark' must be true or false");
1509
+ }
1493
1510
  return errors;
1494
1511
  }
1495
1512
  catch (_e) {
@@ -1,6 +1,6 @@
1
1
  import { g as getStores, r as runIfExisits, c as clearStoresCache, R as RENAMED_I18N_KEYS } from './withHasError-BDWEBrrb.js';
2
2
  import { g as getElement, f as forceUpdate } from './index-GstO_GU5.js';
3
- import { i as isBlankInput } from './withStyled-CTZFjg4L.js';
3
+ import { i as isBlankInput } from './withStyled-B62R20Zx.js';
4
4
 
5
5
  const ALLOWED_TAGS = new Set([
6
6
  "br",
@@ -30,6 +30,12 @@ export type DrawnMark = {
30
30
  rx: number;
31
31
  ry: number;
32
32
  badge?: Badge;
33
+ /** The text the frame goes around, when the item brings its own. */
34
+ caption?: {
35
+ x: number;
36
+ y: number;
37
+ text: string;
38
+ };
33
39
  } | {
34
40
  kind: "arrow";
35
41
  color?: string;
@@ -39,6 +45,33 @@ export type DrawnMark = {
39
45
  y2: number;
40
46
  head: string;
41
47
  badge?: Badge;
48
+ } | {
49
+ kind: "difference";
50
+ color?: string;
51
+ /** The levels of the two values, drawn to the bar. */
52
+ lines: {
53
+ x1: number;
54
+ y1: number;
55
+ x2: number;
56
+ y2: number;
57
+ }[];
58
+ bar: Box;
59
+ text: {
60
+ x: number;
61
+ y: number;
62
+ anchor: "start" | "end";
63
+ value: string;
64
+ percent?: string;
65
+ };
66
+ /** Around the relative difference. */
67
+ frame?: {
68
+ x: number;
69
+ y: number;
70
+ width: number;
71
+ height: number;
72
+ r: number;
73
+ };
74
+ badge?: Badge;
42
75
  };
43
76
  export interface MarkOptions {
44
77
  /** The box is a component and not one of its data points. */
@@ -49,6 +82,8 @@ export interface MarkOptions {
49
82
  text?: Box;
50
83
  /** What a marker next to a text must not cover: the texts of the other cells. */
51
84
  obstacles?: Box[];
85
+ /** The box is a segment of a stack: a marker sits on its right edge and leaves the value label free. */
86
+ stacked?: boolean;
52
87
  }
53
88
  /** Where the line from the centre of a box to `towards` leaves the box. */
54
89
  export declare function boxEdge(box: Box, towards: {
@@ -58,6 +93,19 @@ export declare function boxEdge(box: Box, towards: {
58
93
  x: number;
59
94
  y: number;
60
95
  };
96
+ /**
97
+ * The difference of two values of a chart. `box` and `toBox` are the bars of
98
+ * the two values, and the upper edge of each is its level. A thin line runs
99
+ * from each level to a bar behind the second value, which spans the
100
+ * difference. The label is `to - from`, and with `percent` also relative to
101
+ * `from`. A difference in the good direction has the colour `positive`, else
102
+ * `negative`. Without two values there is nothing to print. `levels` gives
103
+ * the y of the two values when it is not the upper edge of the boxes.
104
+ */
105
+ export declare function buildDifference(item: AnnotationLayerItem, box: Box, toBox: Box, fromValue: number | undefined, toValue: number | undefined, em: number, levels?: {
106
+ from: number;
107
+ to: number;
108
+ }): DrawnMark | undefined;
61
109
  /**
62
110
  * The geometry of one item. On a whole component a marker sits in the top-right
63
111
  * corner, and on a table cell next to the number. A frame goes around the text
@@ -5,6 +5,10 @@ export interface MatchedPoint {
5
5
  rect: DualRect;
6
6
  content?: DualRect;
7
7
  contentSign?: number;
8
+ /** The value of a bar, when its chart writes it. */
9
+ value?: number;
10
+ /** A segment of a stack: its value label stands in its middle. */
11
+ stacked?: boolean;
8
12
  }
9
13
  /** A point without a field, or no point at all, means the component as a whole. */
10
14
  export declare function isWholeComponent(point: AnnotationPoint | undefined): boolean;
@@ -177,14 +177,22 @@ export declare class Chart {
177
177
  * {
178
178
  * "by": "scenarios" | "dimensions",
179
179
  * "mode": "absolute" | "relative" | "absolute-relative",
180
- * "order": "asc" | "desc" | "dataset"
180
+ * "order": "asc" | "desc" | "dataset",
181
+ * "notation": "none" | "scenario",
182
+ * "legend": "left" | "right" | "both" | "none",
183
+ * "percentMark": true | false
181
184
  * }
182
185
  * ```
183
186
  *
184
187
  * - `by` (required): What a stack is made of.
185
- * - `"scenarios"` - stack the scenarios from the `scenarios` prop as layers.
186
- * - `"dimensions"` - only the first scenario is drawn. A time chart has one
187
- * value per period, so each stack has one segment.
188
+ * - `"scenarios"` - stack the scenarios from the `scenarios` prop as layers,
189
+ * four at most.
190
+ * - `"dimensions"` - one segment per value of the `category` column of the
191
+ * dataset, ordered by `categoryIndex`, else by first appearance. There is
192
+ * no limit on the number of series, and a series keeps its colour in
193
+ * every period. The first scenario is drawn. With `scenario-switch` the
194
+ * scenario that has values in the period is drawn, so one axis can go
195
+ * from AC to FC to PL.
188
196
  * - `mode` (optional, default `"absolute"`):
189
197
  * - `"absolute"` - additive stacking, axis shows absolute units.
190
198
  * - `"relative"` - 100% stacking, axis shows 0%-100%. `unit-scaling` is
@@ -195,6 +203,17 @@ export declare class Chart {
195
203
  * - `order` (optional, default `"dataset"`): Segment order within each stack.
196
204
  * `"asc"` / `"desc"` sort segments by value; `"dataset"` preserves the
197
205
  * original data/scenario order.
206
+ * - `notation` (optional, default `"none"`): with `"scenario"` a segment takes
207
+ * the look of its scenario. A forecast segment is hatched over the shade of
208
+ * its series, a plan segment is outlined, and the first series takes the
209
+ * fill of the scenario from `barStyles`.
210
+ * - `legend` (optional, default `"left"`): where the series names stand. Left
211
+ * of the first column, right of the last column with a value, at both, or
212
+ * nowhere.
213
+ * - `percentMark` (optional, default `false`): for `mode: "relative"`. The
214
+ * shares are plain numbers without the % sign, with
215
+ * `data-format-digits-percent` digits, and one `100%` mark stands at the
216
+ * upper end of the stack, on the side of the series names.
198
217
  *
199
218
  * @default '' (empty - no stacking)
200
219
  *
@@ -229,9 +248,12 @@ export declare class Chart {
229
248
  * long, and short mode uses the long an short styles for the date
230
249
  * smart only displays relevant information if a change/ transition occured
231
250
  * (eg. only on 1.Jan the year is displayed)
251
+ * two-row prints short labels and puts the parent period (the year of a
252
+ * month, quarter or week) in a second row, under the first period and where
253
+ * it changes. With scenario-switch the scenario names stand in the same row.
232
254
  * <br /><br />
233
255
  * values:<br />
234
- * ```smart // long // short```
256
+ * ```smart // long // short // two-row```
235
257
  */
236
258
  axisLabelsMode: string;
237
259
  validateAxisLabelsMode(newValue: string): void;
@@ -316,7 +338,8 @@ export declare class Chart {
316
338
  * has no value, the next scenario with a value is drawn in its place with
317
339
  * its value label. A vertical line marks the change, and the scenario names
318
340
  * stand under the axis. Variances with the same reference and type share
319
- * one row. Bar mode without stack only.
341
+ * one row. A chart with one scenario gets the name of that scenario under
342
+ * the axis. Bar mode, without a stack or with a stack by dimensions.
320
343
  */
321
344
  scenarioSwitch: boolean;
322
345
  /**
@@ -22,6 +22,13 @@ type TimeChartDataModelEntry = {
22
22
  scenario2: DataPoint;
23
23
  scenario3: DataPoint;
24
24
  scenario4: DataPoint;
25
+ /** Stack by dimension: the series of the period, in the same order in every period. */
26
+ series?: StackSeries[];
27
+ };
28
+ /** One series of a stack by dimension: its value per scenario slot in one period. */
29
+ type StackSeries = {
30
+ key: string;
31
+ points: Record<string, DataPoint>;
25
32
  };
26
33
  /**
27
34
  * Orchestrates the full rendering pipeline for an IBCS time series chart.
@@ -133,8 +140,20 @@ export declare class TimeChart {
133
140
  private failQuery;
134
141
  getAllocatedCanvasWidth(): number;
135
142
  getAllocatedCanvasHeight(): number;
136
- /** Room for the scenario names under the category labels of a series that changes its scenario. */
143
+ /**
144
+ * Room for the second row under the category labels: the scenario names of a
145
+ * `scenarioSwitch` chart, and in `two-row` mode the parent periods.
146
+ */
137
147
  private switchNamesHeight;
148
+ /** The parent period of a period in `two-row` mode: the year of a month, quarter or week, the month of a day. */
149
+ private parentPeriodLabel;
150
+ /**
151
+ * The texts of the second row under the category labels. `two-row` mode: the
152
+ * parent period under the first period and where it changes, joined with the
153
+ * scenario name where a run starts, each under its period. Else the scenario
154
+ * names alone, each under the middle of its run.
155
+ */
156
+ private contextRow;
138
157
  /** True for a scenario slot that has a value in this period. */
139
158
  private static hasValue;
140
159
  /**
@@ -146,6 +165,12 @@ export declare class TimeChart {
146
165
  private visibleSlot;
147
166
  /** Runs of periods with the same visible scenario. A period without a value belongs to the run before it. */
148
167
  private switchRuns;
168
+ /**
169
+ * Stack by dimensions with `scenarioSwitch`: the scenarios with values that
170
+ * are not drawn, because they have values in periods of the first scenario
171
+ * or because the chart is a stacked area. The component warns about them.
172
+ */
173
+ getIgnoredSwitchScenarios(): string[];
149
174
  /** Number of periods where variances of one row overlap. The component warns about it. */
150
175
  getVarianceOverlaps(): number;
151
176
  /**
@@ -208,6 +233,11 @@ export declare class TimeChart {
208
233
  private scenarioStyles;
209
234
  private setAxisScenario;
210
235
  private populateModel;
236
+ /**
237
+ * Stack by dimension: one series per `category`, ordered by `categoryIndex`, else by first appearance.
238
+ * Every period gets every series, so a series keeps its place and colour when a value is missing.
239
+ */
240
+ private populateSeries;
211
241
  private detectNaNCells;
212
242
  private findDateInterval;
213
243
  /** Distinct dates of the filtered rows. Min and max are taken in JS: alasql MIN/MAX skip ISO strings. */
@@ -265,13 +295,28 @@ export declare class TimeChart {
265
295
  * Positive segments stack above the axis, negative segments below it.
266
296
  */
267
297
  private drawStackedScenarios;
298
+ /** True for a 100 % stack that prints plain shares and one `100%` mark. */
299
+ private hasPercentMark;
300
+ /** The side of the `100%` mark: with the series names, at the left when they stand on both sides or nowhere. */
301
+ private percentMarkSide;
302
+ /** The name of a series of a stack by dimension. A translation of the category wins. */
303
+ private seriesName;
304
+ /**
305
+ * Width of the widest text the stack writes on one side of the columns, 0 when
306
+ * there is none. The names of a stack by scenario at the left are part of the
307
+ * left offset the component hands in, so they do not count here.
308
+ */
309
+ private legendWidth;
268
310
  /**
269
311
  * Draw column headers next to stacked columns showing what each group/segment represents.
270
312
  * For overlay mode (multiple scenario types): shows one header per group.
271
313
  * For single-group: shows individual segment headers.
272
- * The headers take their place from the first period.
314
+ * The headers at the left take their place from the first period, the ones at
315
+ * the right from the last period with a value.
273
316
  */
274
317
  private drawStackedHeaders;
318
+ /** The `100%` label with a pointer at the upper end of a 100 % stack, on the side of the series names. */
319
+ private drawPercentMark;
275
320
  /**
276
321
  * Draw stacked area chart (line mode with stack).
277
322
  * Computes cumulative y-values and draws AreaFill paths between layers.
@@ -289,6 +334,8 @@ export declare function tranformToAvgDataModel(dataModel: TimeChartDataModelEntr
289
334
  scenario2: DataPoint;
290
335
  scenario3: DataPoint;
291
336
  scenario4: DataPoint;
337
+ /** Stack by dimension: the series of the period, in the same order in every period. */
338
+ series?: StackSeries[];
292
339
  }[];
293
340
  export declare function tranformToMedianDataModel(dataModel: TimeChartDataModelEntry[]): {
294
341
  scenario1: DataPoint;
@@ -299,5 +346,7 @@ export declare function tranformToMedianDataModel(dataModel: TimeChartDataModelE
299
346
  scenario2: DataPoint;
300
347
  scenario3: DataPoint;
301
348
  scenario4: DataPoint;
349
+ /** Stack by dimension: the series of the period, in the same order in every period. */
350
+ series?: StackSeries[];
302
351
  }[];
303
352
  export {};
@@ -22,6 +22,8 @@ import { DataPointKey } from "../../../../utils/layoutState/types";
22
22
  * The last segment can draw the total label of the full stack via drawTotalLabel().
23
23
  */
24
24
  export declare class StackedColumn {
25
+ private readonly notation;
26
+ private readonly plainShares;
25
27
  private readonly position;
26
28
  private readonly styles;
27
29
  private readonly group;
@@ -33,8 +35,10 @@ export declare class StackedColumn {
33
35
  private readonly stackMode;
34
36
  private readonly stack;
35
37
  private hasData;
36
- constructor(position: ElementPositions, styles: TimeChartStyle, dataPoint: DataPoint, index: number, segment: StackSegment, _segmentLabel: string | null, segmentIndex: number, stackMode: StackMode, stack: StackLayout, _isScenarioStack: boolean, parentGroup: G);
38
+ constructor(position: ElementPositions, styles: TimeChartStyle, dataPoint: DataPoint, index: number, segment: StackSegment, _segmentLabel: string | null, segmentIndex: number, stackMode: StackMode, stack: StackLayout, _isScenarioStack: boolean, parentGroup: G, notation?: boolean, plainShares?: boolean);
37
39
  draw(dataFormatDigits?: DataFormatDigits, measureScale?: SiPrefix): void;
40
+ /** The hatching of a forecast over the shade of the series. One pattern per shade in the SVG. */
41
+ private hatchPattern;
38
42
  /**
39
43
  * Draw the signed total of the stack: above the positive side, or below the negative side for a negative total.
40
44
  */
@@ -11,6 +11,12 @@ export interface StackConfigParsed {
11
11
  by: StackBy;
12
12
  mode: StackMode;
13
13
  order: StackOrder;
14
+ /** `scenario`: a segment takes the look of its scenario (FC hatched, PL outlined). */
15
+ notation: "none" | "scenario";
16
+ /** Where the series names stand: at the first column, at the last one, at both, or nowhere. */
17
+ legend: "left" | "right" | "both" | "none";
18
+ /** 100 % stack: shares as plain numbers and one `100%` mark on the legend side. */
19
+ percentMark: boolean;
14
20
  }
15
21
  /**
16
22
  * Configuration for an IBCS time-series chart component.
@@ -909,7 +909,7 @@ export namespace Components {
909
909
  */
910
910
  interface BnChartTime {
911
911
  /**
912
- * Axis Labels Mode defines in which mode the labels are rendered. long, and short mode uses the long an short styles for the date smart only displays relevant information if a change/ transition occured (eg. only on 1.Jan the year is displayed) <br /><br /> values:<br /> ```smart // long // short```
912
+ * Axis Labels Mode defines in which mode the labels are rendered. long, and short mode uses the long an short styles for the date smart only displays relevant information if a change/ transition occured (eg. only on 1.Jan the year is displayed) two-row prints short labels and puts the parent period (the year of a month, quarter or week) in a second row, under the first period and where it changes. With scenario-switch the scenario names stand in the same row. <br /><br /> values:<br /> ```smart // long // short // two-row```
913
913
  */
914
914
  "axisLabelsMode": string;
915
915
  /**
@@ -1008,7 +1008,7 @@ export namespace Components {
1008
1008
  */
1009
1009
  "scale"?: string;
1010
1010
  /**
1011
- * For a series that changes its scenario along the time axis, for example AC up to this year and PL after it. In a period where the first scenario has no value, the next scenario with a value is drawn in its place with its value label. A vertical line marks the change, and the scenario names stand under the axis. Variances with the same reference and type share one row. Bar mode without stack only.
1011
+ * For a series that changes its scenario along the time axis, for example AC up to this year and PL after it. In a period where the first scenario has no value, the next scenario with a value is drawn in its place with its value label. A vertical line marks the change, and the scenario names stand under the axis. Variances with the same reference and type share one row. A chart with one scenario gets the name of that scenario under the axis. Bar mode, without a stack or with a stack by dimensions.
1012
1012
  * @default false
1013
1013
  */
1014
1014
  "scenarioSwitch": boolean;
@@ -1038,7 +1038,7 @@ export namespace Components {
1038
1038
  */
1039
1039
  "showOverlayMedian": boolean;
1040
1040
  /**
1041
- * Stacking configuration for the chart as a JSON string. When set, bars/columns are drawn stacked (additive layers) instead of side-by-side. In line mode (`chart-mode="line"`), stacking produces a stacked area chart with filled regions between cumulative lines. **JSON schema:** ```json { "by": "scenarios" | "dimensions", "mode": "absolute" | "relative" | "absolute-relative", "order": "asc" | "desc" | "dataset" } ``` - `by` (required): What a stack is made of. - `"scenarios"` - stack the scenarios from the `scenarios` prop as layers. - `"dimensions"` - only the first scenario is drawn. A time chart has one value per period, so each stack has one segment. - `mode` (optional, default `"absolute"`): - `"absolute"` - additive stacking, axis shows absolute units. - `"relative"` - 100% stacking, axis shows 0%-100%. `unit-scaling` is interpreted as pixels per percentage point (e.g. `0.4` → 40px full stack); `"auto"` fits the stack to the available height as usual. - `"absolute-relative"` - bar height is absolute (real value), but segment labels inside show percentages. - `order` (optional, default `"dataset"`): Segment order within each stack. `"asc"` / `"desc"` sort segments by value; `"dataset"` preserves the original data/scenario order.
1041
+ * Stacking configuration for the chart as a JSON string. When set, bars/columns are drawn stacked (additive layers) instead of side-by-side. In line mode (`chart-mode="line"`), stacking produces a stacked area chart with filled regions between cumulative lines. **JSON schema:** ```json { "by": "scenarios" | "dimensions", "mode": "absolute" | "relative" | "absolute-relative", "order": "asc" | "desc" | "dataset", "notation": "none" | "scenario", "legend": "left" | "right" | "both" | "none", "percentMark": true | false } ``` - `by` (required): What a stack is made of. - `"scenarios"` - stack the scenarios from the `scenarios` prop as layers, four at most. - `"dimensions"` - one segment per value of the `category` column of the dataset, ordered by `categoryIndex`, else by first appearance. There is no limit on the number of series, and a series keeps its colour in every period. The first scenario is drawn. With `scenario-switch` the scenario that has values in the period is drawn, so one axis can go from AC to FC to PL. - `mode` (optional, default `"absolute"`): - `"absolute"` - additive stacking, axis shows absolute units. - `"relative"` - 100% stacking, axis shows 0%-100%. `unit-scaling` is interpreted as pixels per percentage point (e.g. `0.4` → 40px full stack); `"auto"` fits the stack to the available height as usual. - `"absolute-relative"` - bar height is absolute (real value), but segment labels inside show percentages. - `order` (optional, default `"dataset"`): Segment order within each stack. `"asc"` / `"desc"` sort segments by value; `"dataset"` preserves the original data/scenario order. - `notation` (optional, default `"none"`): with `"scenario"` a segment takes the look of its scenario. A forecast segment is hatched over the shade of its series, a plan segment is outlined, and the first series takes the fill of the scenario from `barStyles`. - `legend` (optional, default `"left"`): where the series names stand. Left of the first column, right of the last column with a value, at both, or nowhere. - `percentMark` (optional, default `false`): for `mode: "relative"`. The shares are plain numbers without the % sign, with `data-format-digits-percent` digits, and one `100%` mark stands at the upper end of the stack, on the side of the series names.
1042
1042
  * @default '' (empty - no stacking)
1043
1043
  * @example // Stack scenarios stack='{"by":"scenarios"}'
1044
1044
  * @example // Stack scenarios, relative mode stack='{"by":"scenarios","mode":"relative"}'
@@ -3240,7 +3240,7 @@ declare namespace LocalJSX {
3240
3240
  */
3241
3241
  interface BnChartTime {
3242
3242
  /**
3243
- * Axis Labels Mode defines in which mode the labels are rendered. long, and short mode uses the long an short styles for the date smart only displays relevant information if a change/ transition occured (eg. only on 1.Jan the year is displayed) <br /><br /> values:<br /> ```smart // long // short```
3243
+ * Axis Labels Mode defines in which mode the labels are rendered. long, and short mode uses the long an short styles for the date smart only displays relevant information if a change/ transition occured (eg. only on 1.Jan the year is displayed) two-row prints short labels and puts the parent period (the year of a month, quarter or week) in a second row, under the first period and where it changes. With scenario-switch the scenario names stand in the same row. <br /><br /> values:<br /> ```smart // long // short // two-row```
3244
3244
  */
3245
3245
  "axisLabelsMode": string;
3246
3246
  /**
@@ -3330,7 +3330,7 @@ declare namespace LocalJSX {
3330
3330
  */
3331
3331
  "scale"?: string;
3332
3332
  /**
3333
- * For a series that changes its scenario along the time axis, for example AC up to this year and PL after it. In a period where the first scenario has no value, the next scenario with a value is drawn in its place with its value label. A vertical line marks the change, and the scenario names stand under the axis. Variances with the same reference and type share one row. Bar mode without stack only.
3333
+ * For a series that changes its scenario along the time axis, for example AC up to this year and PL after it. In a period where the first scenario has no value, the next scenario with a value is drawn in its place with its value label. A vertical line marks the change, and the scenario names stand under the axis. Variances with the same reference and type share one row. A chart with one scenario gets the name of that scenario under the axis. Bar mode, without a stack or with a stack by dimensions.
3334
3334
  * @default false
3335
3335
  */
3336
3336
  "scenarioSwitch"?: boolean;
@@ -3360,7 +3360,7 @@ declare namespace LocalJSX {
3360
3360
  */
3361
3361
  "showOverlayMedian"?: boolean;
3362
3362
  /**
3363
- * Stacking configuration for the chart as a JSON string. When set, bars/columns are drawn stacked (additive layers) instead of side-by-side. In line mode (`chart-mode="line"`), stacking produces a stacked area chart with filled regions between cumulative lines. **JSON schema:** ```json { "by": "scenarios" | "dimensions", "mode": "absolute" | "relative" | "absolute-relative", "order": "asc" | "desc" | "dataset" } ``` - `by` (required): What a stack is made of. - `"scenarios"` - stack the scenarios from the `scenarios` prop as layers. - `"dimensions"` - only the first scenario is drawn. A time chart has one value per period, so each stack has one segment. - `mode` (optional, default `"absolute"`): - `"absolute"` - additive stacking, axis shows absolute units. - `"relative"` - 100% stacking, axis shows 0%-100%. `unit-scaling` is interpreted as pixels per percentage point (e.g. `0.4` → 40px full stack); `"auto"` fits the stack to the available height as usual. - `"absolute-relative"` - bar height is absolute (real value), but segment labels inside show percentages. - `order` (optional, default `"dataset"`): Segment order within each stack. `"asc"` / `"desc"` sort segments by value; `"dataset"` preserves the original data/scenario order.
3363
+ * Stacking configuration for the chart as a JSON string. When set, bars/columns are drawn stacked (additive layers) instead of side-by-side. In line mode (`chart-mode="line"`), stacking produces a stacked area chart with filled regions between cumulative lines. **JSON schema:** ```json { "by": "scenarios" | "dimensions", "mode": "absolute" | "relative" | "absolute-relative", "order": "asc" | "desc" | "dataset", "notation": "none" | "scenario", "legend": "left" | "right" | "both" | "none", "percentMark": true | false } ``` - `by` (required): What a stack is made of. - `"scenarios"` - stack the scenarios from the `scenarios` prop as layers, four at most. - `"dimensions"` - one segment per value of the `category` column of the dataset, ordered by `categoryIndex`, else by first appearance. There is no limit on the number of series, and a series keeps its colour in every period. The first scenario is drawn. With `scenario-switch` the scenario that has values in the period is drawn, so one axis can go from AC to FC to PL. - `mode` (optional, default `"absolute"`): - `"absolute"` - additive stacking, axis shows absolute units. - `"relative"` - 100% stacking, axis shows 0%-100%. `unit-scaling` is interpreted as pixels per percentage point (e.g. `0.4` → 40px full stack); `"auto"` fits the stack to the available height as usual. - `"absolute-relative"` - bar height is absolute (real value), but segment labels inside show percentages. - `order` (optional, default `"dataset"`): Segment order within each stack. `"asc"` / `"desc"` sort segments by value; `"dataset"` preserves the original data/scenario order. - `notation` (optional, default `"none"`): with `"scenario"` a segment takes the look of its scenario. A forecast segment is hatched over the shade of its series, a plan segment is outlined, and the first series takes the fill of the scenario from `barStyles`. - `legend` (optional, default `"left"`): where the series names stand. Left of the first column, right of the last column with a value, at both, or nowhere. - `percentMark` (optional, default `false`): for `mode: "relative"`. The shares are plain numbers without the % sign, with `data-format-digits-percent` digits, and one `100%` mark stands at the upper end of the stack, on the side of the series names.
3364
3364
  * @default '' (empty - no stacking)
3365
3365
  * @example // Stack scenarios stack='{"by":"scenarios"}'
3366
3366
  * @example // Stack scenarios, relative mode stack='{"by":"scenarios","mode":"relative"}'
@@ -14,7 +14,7 @@ export interface AnnotationPoint {
14
14
  export interface AnnotationLayerItem {
15
15
  /** Number on the mark. Absent when the annotation has none. */
16
16
  label?: string;
17
- mark?: "marker" | "frame" | "arrow";
17
+ mark?: "marker" | "frame" | "arrow" | "difference";
18
18
  /** Named colour, see {@link annotationColor}. */
19
19
  color?: string;
20
20
  /** `data-bino-annotation-target` of the slot that holds the component. */
@@ -22,6 +22,16 @@ export interface AnnotationLayerItem {
22
22
  point?: AnnotationPoint;
23
23
  to?: string;
24
24
  toPoint?: AnnotationPoint;
25
+ /** `frame`: a text the frame is drawn around, on the target. `difference`: not used. */
26
+ text?: string;
27
+ /** `difference`: also print the relative difference, in brackets. */
28
+ percent?: boolean;
29
+ /** `difference`: digits of the absolute difference, 1 by default. */
30
+ digits?: number;
31
+ /** `difference`: `good-down` when a lower value is the good one. */
32
+ sentiment?: "good-up" | "good-down";
33
+ /** `difference`: a frame around the relative difference. */
34
+ highlight?: boolean;
25
35
  }
26
36
  /** One entry of the `items` attribute of `bn-annotation-list`. */
27
37
  export interface AnnotationListItem {
@@ -113,11 +113,13 @@ export declare enum AggregationLevel {
113
113
  * - SMART: abbreviated labels with parent period shown at boundary crossings (e.g. "Jan" normally, "Jan 2024" at year boundary)
114
114
  * - LONG: full date format for every label
115
115
  * - SHORT: abbreviated format for every label
116
+ * - TWO_ROW: abbreviated labels, and the parent period (the year of a month) in a second row where it starts
116
117
  */
117
118
  export declare enum AxisLabelsMode {
118
119
  SMART = "smart",
119
120
  LONG = "long",
120
- SHORT = "short"
121
+ SHORT = "short",
122
+ TWO_ROW = "two-row"
121
123
  }
122
124
  /**
123
125
  * Visual representation type for chart series.
@@ -98,6 +98,8 @@ export interface BarElement extends LayoutElementBase {
98
98
  /** Ordinal of the bar's category within the segment. */
99
99
  index: number;
100
100
  point?: LayoutPoint;
101
+ /** The value the bar stands for, when the chart writes it (`data-bn-value`). */
102
+ value?: number;
101
103
  }
102
104
  export interface LabelElement extends LayoutElementBase {
103
105
  kind: "label";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bino-bi/bn-template-engine",
3
- "version": "1.0.0-next.48",
3
+ "version": "1.0.0-next.49",
4
4
  "description": "IBCS-compliant web components for business intelligence tables and charts",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",