@bino-bi/bn-template-engine 1.0.0-next.48 → 1.0.0-next.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/{p-b3f5eba0.entry.js → p-2de524d0.entry.js} +1 -1
- package/dist/bn-template-engine/{p-a6017fce.entry.js → p-510d2ee6.entry.js} +1 -1
- package/dist/bn-template-engine/{p-6ab684a9.entry.js → p-8fc90dc8.entry.js} +1 -1
- package/dist/bn-template-engine/p-BFl7OwcC.js +1 -0
- package/dist/bn-template-engine/{p-3ktFZb1x.js → p-Bxa4pX1M.js} +1 -1
- package/dist/bn-template-engine/p-c1d679af.entry.js +1 -0
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +628 -108
- package/dist/cjs/bn-grid.cjs.entry.js +1 -1
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/{withStyled-DHKHBdRb.js → withStyled-pkdctrK9.js} +18 -1
- package/dist/cjs/{withTranslation-CLwC9a8V.js → withTranslation-BIzTNYZM.js} +1 -1
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.css +19 -0
- package/dist/collection/components/bn-annotation-layer/bn-annotation-layer.js +65 -8
- package/dist/collection/components/bn-annotation-layer/utils/marks.js +85 -5
- package/dist/collection/components/bn-annotation-layer/utils/matchPoint.js +7 -1
- package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +20 -6
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +55 -23
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +329 -53
- package/dist/collection/components/bn-chart-time/utils/elements/Column.js +4 -1
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +2 -1
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +53 -11
- package/dist/collection/utils/annotations.js +1 -1
- package/dist/collection/utils/constants.js +2 -0
- package/dist/collection/utils/layoutState/svgChartElements.js +10 -0
- package/dist/collection/utils/validate.js +16 -1
- package/dist/components/bn-annotation-layer.js +1 -1
- package/dist/components/bn-annotation-list.js +1 -1
- package/dist/components/bn-chart-bubble-renderer.js +1 -1
- package/dist/components/bn-chart-bubble.js +1 -1
- package/dist/components/bn-chart-bullet-renderer.js +1 -1
- package/dist/components/bn-chart-bullet.js +1 -1
- package/dist/components/bn-chart-scatter-renderer.js +1 -1
- package/dist/components/bn-chart-scatter.js +1 -1
- package/dist/components/bn-chart-structure-renderer.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time-renderer.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-page.js +1 -1
- package/dist/components/bn-table-renderer.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title-renderer.js +1 -1
- package/dist/components/bn-title.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/{p-CLjuZoiT.js → p-B11cXOLy.js} +1 -1
- package/dist/components/p-BBdzTx8V.js +1 -0
- package/dist/components/{p-B1_wkOLx.js → p-BVNOmHh4.js} +1 -1
- package/dist/components/p-BXP6aagM.js +1 -0
- package/dist/components/{p-CG-iY7pQ.js → p-Blre9f28.js} +1 -1
- package/dist/components/p-CHJ6WE0l.js +1 -0
- package/dist/components/{p-Do4GqlMV.js → p-CHhxQoF9.js} +1 -1
- package/dist/components/{p-C-3TOa6K.js → p-CJ0-xdfZ.js} +1 -1
- package/dist/components/{p-BFoRIqDi.js → p-CO6bgquz.js} +1 -1
- package/dist/components/{p-CytMTBFu.js → p-CSJCkHEL.js} +1 -1
- package/dist/components/p-CVfmhtEW.js +1 -0
- package/dist/components/{p-Zuxd3z0q.js → p-Cc0gaLwp.js} +1 -1
- package/dist/components/p-CuUfiEu0.js +1 -0
- package/dist/components/{p-DUZCLRVu.js → p-D362XOg2.js} +1 -1
- package/dist/components/p-DBj1Yd3M.js +1 -0
- package/dist/components/{p-BjgkgCAQ.js → p-DHX92KDP.js} +1 -1
- package/dist/components/p-DHloMyxV.js +1 -0
- package/dist/components/{p-Uc0zvXcQ.js → p-Dd1QOWDV.js} +1 -1
- package/dist/components/p-DguYWLBj.js +1 -0
- package/dist/components/p-Do-IGHJk.js +1 -0
- package/dist/components/{p-DDo-fu3v.js → p-DsC0ew4j.js} +1 -1
- package/dist/components/p-HVN8BNWN.js +1 -0
- package/dist/components/{p-Dyzb4ika.js → p-YSRTB0jS.js} +1 -1
- package/dist/components/{p-CrZ_O3DT.js → p-k7heRDPP.js} +1 -1
- package/dist/components/{p-dO0utE8m.js → p-keKnrAVS.js} +1 -1
- package/dist/components/p-x0W2_FAX.js +1 -0
- package/dist/components/p-y12CmIFS.js +1 -0
- package/dist/esm/bn-annotation-layer_30.entry.js +628 -108
- package/dist/esm/bn-grid.entry.js +1 -1
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/{withStyled-CTZFjg4L.js → withStyled-B62R20Zx.js} +18 -1
- package/dist/esm/{withTranslation-BESW5BNq.js → withTranslation-BEseMLQ6.js} +1 -1
- package/dist/schemas/stack.schema.json +22 -0
- package/dist/types/components/bn-annotation-layer/utils/marks.d.ts +48 -0
- package/dist/types/components/bn-annotation-layer/utils/matchPoint.d.ts +4 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +29 -6
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +51 -2
- package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +5 -1
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +6 -0
- package/dist/types/components.d.ts +6 -6
- package/dist/types/schemas.d.ts +6 -0
- package/dist/types/utils/annotations.d.ts +11 -1
- package/dist/types/utils/constants.d.ts +3 -1
- package/dist/types/utils/layoutState/types.d.ts +2 -0
- package/package.json +1 -1
- package/dist/bn-template-engine/p-203e7d6a.entry.js +0 -1
- package/dist/bn-template-engine/p-DXtYQE4s.js +0 -1
- package/dist/components/p-6gET6YXc.js +0 -1
- package/dist/components/p-BFWvVe7v.js +0 -1
- package/dist/components/p-C8rpOS5t.js +0 -1
- package/dist/components/p-CUoPUIej.js +0 -1
- package/dist/components/p-ChpAMqbN.js +0 -1
- package/dist/components/p-D3hr9wra.js +0 -1
- package/dist/components/p-DFybNETX.js +0 -1
- package/dist/components/p-DRmphEA0.js +0 -1
- package/dist/components/p-D_K7tYhY.js +0 -1
- package/dist/components/p-Dw3rv_Y9.js +0 -1
- package/dist/components/p-TNX3alPU.js +0 -1
- package/dist/components/p-j42D1yrQ.js +0 -1
|
@@ -4,7 +4,7 @@ var index = require('./index-DwBbheYB.js');
|
|
|
4
4
|
var types = require('./types-BngAWYMW.js');
|
|
5
5
|
var localFrame = require('./localFrame-C4RBw_zT.js');
|
|
6
6
|
var withHasError = require('./withHasError-CZFrIJw0.js');
|
|
7
|
-
var withStyled = require('./withStyled-
|
|
7
|
+
var withStyled = require('./withStyled-pkdctrK9.js');
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Header configuration types and parsing utilities for bn-grid component.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DwBbheYB.js');
|
|
4
|
-
var withStyled = require('./withStyled-
|
|
4
|
+
var withStyled = require('./withStyled-pkdctrK9.js');
|
|
5
5
|
var withHasError = require('./withHasError-CZFrIJw0.js');
|
|
6
6
|
|
|
7
7
|
const bnImageCss = () => `:host{display:inline-block;position:relative;overflow:hidden}img{max-width:100%;height:auto}`;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var index = require('./index-DwBbheYB.js');
|
|
4
|
-
var withTranslation = require('./withTranslation-
|
|
4
|
+
var withTranslation = require('./withTranslation-BIzTNYZM.js');
|
|
5
5
|
var withHasError = require('./withHasError-CZFrIJw0.js');
|
|
6
|
-
var withStyled = require('./withStyled-
|
|
6
|
+
var withStyled = require('./withStyled-pkdctrK9.js');
|
|
7
7
|
|
|
8
8
|
const NAME = "[A-Za-z_$\\u00C0-\\uFFFF][\\w$\\u00C0-\\uFFFF]*";
|
|
9
9
|
const STRING = `'[^'\\\\]*'|"[^"\\\\]*"`;
|
|
@@ -263,12 +263,14 @@ exports.AggregationLevel = void 0;
|
|
|
263
263
|
* - SMART: abbreviated labels with parent period shown at boundary crossings (e.g. "Jan" normally, "Jan 2024" at year boundary)
|
|
264
264
|
* - LONG: full date format for every label
|
|
265
265
|
* - SHORT: abbreviated format for every label
|
|
266
|
+
* - TWO_ROW: abbreviated labels, and the parent period (the year of a month) in a second row where it starts
|
|
266
267
|
*/
|
|
267
268
|
exports.AxisLabelsMode = void 0;
|
|
268
269
|
(function (AxisLabelsMode) {
|
|
269
270
|
AxisLabelsMode["SMART"] = "smart";
|
|
270
271
|
AxisLabelsMode["LONG"] = "long";
|
|
271
272
|
AxisLabelsMode["SHORT"] = "short";
|
|
273
|
+
AxisLabelsMode["TWO_ROW"] = "two-row";
|
|
272
274
|
})(exports.AxisLabelsMode || (exports.AxisLabelsMode = {}));
|
|
273
275
|
/**
|
|
274
276
|
* Visual representation type for chart series.
|
|
@@ -1360,7 +1362,7 @@ function isValidDateFormat(value) {
|
|
|
1360
1362
|
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in exports.DateDistance;
|
|
1361
1363
|
}
|
|
1362
1364
|
function isValidAxisLabelsMode(value) {
|
|
1363
|
-
return (value === null || value === void 0 ? void 0 : value.toUpperCase()) in exports.AxisLabelsMode;
|
|
1365
|
+
return (value === null || value === void 0 ? void 0 : value.toUpperCase().replace("-", "_")) in exports.AxisLabelsMode;
|
|
1364
1366
|
}
|
|
1365
1367
|
function isValidDataFormat(value) {
|
|
1366
1368
|
if (isBlankInput(value)) {
|
|
@@ -1492,6 +1494,21 @@ function validateStackConfig(value) {
|
|
|
1492
1494
|
errors.push(`stack: 'order' must be one of: ${validOrders.join(", ")}`);
|
|
1493
1495
|
}
|
|
1494
1496
|
}
|
|
1497
|
+
if (config.hasOwnProperty("notation")) {
|
|
1498
|
+
const validNotations = ["none", "scenario"];
|
|
1499
|
+
if (!validNotations.includes(config.notation)) {
|
|
1500
|
+
errors.push(`stack: 'notation' must be one of: ${validNotations.join(", ")}`);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
if (config.hasOwnProperty("legend")) {
|
|
1504
|
+
const validLegends = ["left", "right", "both", "none"];
|
|
1505
|
+
if (!validLegends.includes(config.legend)) {
|
|
1506
|
+
errors.push(`stack: 'legend' must be one of: ${validLegends.join(", ")}`);
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1509
|
+
if (config.hasOwnProperty("percentMark") && typeof config.percentMark !== "boolean") {
|
|
1510
|
+
errors.push("stack: 'percentMark' must be true or false");
|
|
1511
|
+
}
|
|
1495
1512
|
return errors;
|
|
1496
1513
|
}
|
|
1497
1514
|
catch (_e) {
|
|
@@ -21,4 +21,23 @@ svg {
|
|
|
21
21
|
font-weight: bold;
|
|
22
22
|
text-anchor: middle;
|
|
23
23
|
dominant-baseline: central;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.mark-text {
|
|
27
|
+
fill: #000000;
|
|
28
|
+
dominant-baseline: central;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.mark-text.caption {
|
|
32
|
+
text-anchor: middle;
|
|
33
|
+
font-size: 0.9em;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.mark-text .percent {
|
|
37
|
+
font-size: 0.85em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.difference-line {
|
|
41
|
+
stroke: #000000;
|
|
42
|
+
stroke-width: 0.75;
|
|
24
43
|
}
|
|
@@ -5,7 +5,7 @@ import { ComponentRegister } from "../../utils/componentRegister";
|
|
|
5
5
|
import withComponentStatus from "../../utils/withComponentStatus";
|
|
6
6
|
import withComponentStyle from "../../utils/withComponentStyle";
|
|
7
7
|
import withHasError from "../../utils/withHasError";
|
|
8
|
-
import { buildMark } from "./utils/marks";
|
|
8
|
+
import { buildDifference, buildMark } from "./utils/marks";
|
|
9
9
|
import { isWholeComponent, matchPoint } from "./utils/matchPoint";
|
|
10
10
|
/** A chart can draw its data late: a point without a match is reported when the page has been quiet for two checks. */
|
|
11
11
|
const REPORT_CHECK_MS = 200;
|
|
@@ -162,7 +162,7 @@ export class AnnotationLayer {
|
|
|
162
162
|
this.parsedItems = items !== null && items !== void 0 ? items : [];
|
|
163
163
|
}
|
|
164
164
|
async place() {
|
|
165
|
-
var _a;
|
|
165
|
+
var _a, _b;
|
|
166
166
|
const run = ++this.run;
|
|
167
167
|
if (!this.element.isConnected || !this.svg)
|
|
168
168
|
return;
|
|
@@ -223,7 +223,7 @@ export class AnnotationLayer {
|
|
|
223
223
|
}
|
|
224
224
|
const content = found[0].content;
|
|
225
225
|
if (!state.table)
|
|
226
|
-
return { box, whole: false };
|
|
226
|
+
return { box, whole: false, stacked: found[0].stacked };
|
|
227
227
|
const cells = ((_a = state.elements) !== null && _a !== void 0 ? _a : []).flatMap((element) => element.kind === "cell" && element.content
|
|
228
228
|
? [{ box: onScreen(element.content), sign: element.contentSign }]
|
|
229
229
|
: []);
|
|
@@ -234,6 +234,38 @@ export class AnnotationLayer {
|
|
|
234
234
|
obstacles: cells,
|
|
235
235
|
};
|
|
236
236
|
};
|
|
237
|
+
// a difference takes all bars of a point: the segments of a stack together are its sum
|
|
238
|
+
const sumOf = (id, point) => {
|
|
239
|
+
const visual = id != null ? targets.get(id) : undefined;
|
|
240
|
+
if (!visual)
|
|
241
|
+
return { problem: `no target "${id}" on this page` };
|
|
242
|
+
const state = states.get(visual);
|
|
243
|
+
const found = state && point ? matchPoint(state, Object.assign(Object.assign({}, point), { part: "element" })) : [];
|
|
244
|
+
const bars = found.filter((match) => match.value != null);
|
|
245
|
+
if (bars.length === 0) {
|
|
246
|
+
return { problem: `no bar with a value matches the point ${JSON.stringify(point)} in "${id}"` };
|
|
247
|
+
}
|
|
248
|
+
// bars side by side or behind each other are no sum: the point must name one of them
|
|
249
|
+
if (bars.length > 1 && !bars.every((bar) => bar.stacked)) {
|
|
250
|
+
return { problem: `${bars.length} elements match the point ${JSON.stringify(point)} in "${id}"` };
|
|
251
|
+
}
|
|
252
|
+
const host = visual.getBoundingClientRect();
|
|
253
|
+
const left = Math.min(...bars.map((bar) => bar.rect.component.x));
|
|
254
|
+
const top = Math.min(...bars.map((bar) => bar.rect.component.y));
|
|
255
|
+
const right = Math.max(...bars.map((bar) => bar.rect.component.x + bar.rect.component.width));
|
|
256
|
+
const bottom = Math.max(...bars.map((bar) => bar.rect.component.y + bar.rect.component.height));
|
|
257
|
+
const screen = (rect) => ({
|
|
258
|
+
x: host.left + rect.x,
|
|
259
|
+
y: host.top + rect.y,
|
|
260
|
+
width: rect.width,
|
|
261
|
+
height: rect.height,
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
box: { x: host.left + left, y: host.top + top, width: right - left, height: bottom - top },
|
|
265
|
+
negatives: bars.filter((bar) => bar.value < 0).map((bar) => screen(bar.rect.component)),
|
|
266
|
+
value: bars.reduce((sum, bar) => sum + bar.value, 0),
|
|
267
|
+
};
|
|
268
|
+
};
|
|
237
269
|
const toLocal = this.toLocalSpace();
|
|
238
270
|
// here the text runs along x and a layout px is a px, also on a rotated or scaled page
|
|
239
271
|
const textToLocal = ({ box, sign = 0 }) => {
|
|
@@ -246,6 +278,26 @@ export class AnnotationLayer {
|
|
|
246
278
|
const marks = [];
|
|
247
279
|
const problems = [];
|
|
248
280
|
for (const item of this.parsedItems) {
|
|
281
|
+
if (item.mark === "difference") {
|
|
282
|
+
const first = sumOf(item.target, item.point);
|
|
283
|
+
const second = sumOf((_a = item.to) !== null && _a !== void 0 ? _a : item.target, item.toPoint);
|
|
284
|
+
const failed = "problem" in first ? first : "problem" in second ? second : undefined;
|
|
285
|
+
if (failed) {
|
|
286
|
+
problems.push({ item, problem: failed.problem });
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
const [a, b] = [first, second];
|
|
290
|
+
// the level of a sum: the top for positive values, and below it by the length of the negative ones.
|
|
291
|
+
// Measured in the space of the layer, so it holds on a turned page too.
|
|
292
|
+
const levelOf = (anchor) => toLocal(anchor.box).y + anchor.negatives.reduce((sum, bar) => sum + toLocal(bar).height, 0);
|
|
293
|
+
const mark = buildDifference(item, toLocal(a.box), toLocal(b.box), a.value, b.value, em, {
|
|
294
|
+
from: levelOf(a),
|
|
295
|
+
to: levelOf(b),
|
|
296
|
+
});
|
|
297
|
+
if (mark)
|
|
298
|
+
marks.push(mark);
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
249
301
|
const from = anchorOf(item.target, item.point);
|
|
250
302
|
const to = item.mark === "arrow" ? anchorOf(item.to, item.toPoint) : undefined;
|
|
251
303
|
const failed = "problem" in from ? from : to && "problem" in to ? to : undefined;
|
|
@@ -259,7 +311,8 @@ export class AnnotationLayer {
|
|
|
259
311
|
whole: start.whole,
|
|
260
312
|
area,
|
|
261
313
|
text: start.text && textToLocal(start.text),
|
|
262
|
-
obstacles: (
|
|
314
|
+
obstacles: (_b = start.obstacles) === null || _b === void 0 ? void 0 : _b.map(textToLocal),
|
|
315
|
+
stacked: start.stacked,
|
|
263
316
|
});
|
|
264
317
|
if (mark) {
|
|
265
318
|
marks.push(mark);
|
|
@@ -379,18 +432,22 @@ export class AnnotationLayer {
|
|
|
379
432
|
return (h("g", null, h("circle", { cx: badge.cx, cy: badge.cy, r: badge.r, style: { fill: color } }), badge.label != null ? (h("text", { class: "badge-text", x: badge.cx, y: badge.cy, style: { fontSize: `${badge.r * 1.1}px` } }, badge.label)) : null));
|
|
380
433
|
}
|
|
381
434
|
renderMark(mark) {
|
|
382
|
-
var _a, _b;
|
|
435
|
+
var _a, _b, _c;
|
|
383
436
|
const color = annotationColor(mark.color, this.componentStyle(($) => $["bn-annotation"]));
|
|
384
437
|
if (mark.kind === "marker") {
|
|
385
438
|
return (h("g", { class: "mark marker", "data-label": mark.badge.label }, this.renderBadge(mark.badge, color)));
|
|
386
439
|
}
|
|
387
440
|
if (mark.kind === "frame") {
|
|
388
|
-
return (h("g", { class: "mark frame", "data-label": (_a = mark.badge) === null || _a === void 0 ? void 0 : _a.label }, h("rect", { x: mark.x, y: mark.y, width: mark.width, height: mark.height, rx: mark.rx, ry: mark.ry, style: { fill: "none", stroke: color, strokeWidth: "1.5" } }), this.renderBadge(mark.badge, color)));
|
|
441
|
+
return (h("g", { class: "mark frame", "data-label": (_a = mark.badge) === null || _a === void 0 ? void 0 : _a.label }, h("rect", { x: mark.x, y: mark.y, width: mark.width, height: mark.height, rx: mark.rx, ry: mark.ry, style: { fill: mark.caption ? "#ffffff" : "none", stroke: color, strokeWidth: "1.5" } }), mark.caption ? (h("text", { class: "mark-text caption", x: mark.caption.x, y: mark.caption.y }, mark.caption.text)) : null, this.renderBadge(mark.badge, color)));
|
|
442
|
+
}
|
|
443
|
+
if (mark.kind === "difference") {
|
|
444
|
+
const main = annotationColor(undefined, this.componentStyle(($) => $["bn-annotation"]));
|
|
445
|
+
return (h("g", { class: "mark difference", "data-label": (_b = mark.badge) === null || _b === void 0 ? void 0 : _b.label }, mark.lines.map((line) => (h("line", { class: "difference-line", x1: line.x1, y1: line.y1, x2: line.x2, y2: line.y2 }))), h("rect", { x: mark.bar.x, y: mark.bar.y, width: mark.bar.width, height: mark.bar.height, style: { fill: color } }), h("text", { class: "mark-text", x: mark.text.x, y: mark.text.y, style: { textAnchor: mark.text.anchor } }, mark.text.value, mark.text.percent ? (h("tspan", { class: "percent", dx: "0.35em" }, mark.text.percent)) : null), mark.frame ? (h("rect", { x: mark.frame.x, y: mark.frame.y, width: mark.frame.width, height: mark.frame.height, rx: mark.frame.r, ry: mark.frame.r, style: { fill: "none", stroke: main, strokeWidth: "1.5" } })) : null, this.renderBadge(mark.badge, main)));
|
|
389
446
|
}
|
|
390
|
-
return (h("g", { class: "mark arrow", "data-label": (
|
|
447
|
+
return (h("g", { class: "mark arrow", "data-label": (_c = mark.badge) === null || _c === void 0 ? void 0 : _c.label }, h("line", { x1: mark.x1, y1: mark.y1, x2: mark.x2, y2: mark.y2, style: { stroke: color, strokeWidth: "1.5" } }), h("polygon", { points: mark.head, style: { fill: color } }), this.renderBadge(mark.badge, color)));
|
|
391
448
|
}
|
|
392
449
|
render() {
|
|
393
|
-
return (h(Host, { key: '
|
|
450
|
+
return (h(Host, { key: 'f2864246b86078e97a15f58cab7f46a792e6d300' }, h("svg", { key: '52f932a7f8dff3e00773f8f827c82ec62848cb34', ref: (el) => (this.svg = el) }, this.marks.map((mark) => this.renderMark(mark)))));
|
|
394
451
|
}
|
|
395
452
|
static get is() { return "bn-annotation-layer"; }
|
|
396
453
|
static get encapsulation() { return "shadow"; }
|
|
@@ -53,6 +53,71 @@ function besideText(text, r, unit, options) {
|
|
|
53
53
|
// the number in the circle must stay readable
|
|
54
54
|
return { x, y, r: Math.min(r, Math.max(wider / 2, 0.3 * unit)) };
|
|
55
55
|
}
|
|
56
|
+
/** A text cannot be measured here: the width of the digits and signs of a number, close enough for a frame. */
|
|
57
|
+
const textWidth = (text, em) => text.length * 0.6 * em;
|
|
58
|
+
const signed = (value, digits) => (value < 0 ? "-" : "+") + Math.abs(value).toFixed(digits);
|
|
59
|
+
/**
|
|
60
|
+
* The difference of two values of a chart. `box` and `toBox` are the bars of
|
|
61
|
+
* the two values, and the upper edge of each is its level. A thin line runs
|
|
62
|
+
* from each level to a bar behind the second value, which spans the
|
|
63
|
+
* difference. The label is `to - from`, and with `percent` also relative to
|
|
64
|
+
* `from`. A difference in the good direction has the colour `positive`, else
|
|
65
|
+
* `negative`. Without two values there is nothing to print. `levels` gives
|
|
66
|
+
* the y of the two values when it is not the upper edge of the boxes.
|
|
67
|
+
*/
|
|
68
|
+
export function buildDifference(item, box, toBox, fromValue, toValue, em, levels) {
|
|
69
|
+
var _a, _b, _c;
|
|
70
|
+
if (fromValue == null || toValue == null)
|
|
71
|
+
return undefined;
|
|
72
|
+
const difference = toValue - fromValue;
|
|
73
|
+
const digits = Number.isInteger(item.digits) && item.digits >= 0 ? item.digits : 1;
|
|
74
|
+
const good = item.sentiment === "good-down" ? difference <= 0 : difference >= 0;
|
|
75
|
+
// the bar stands behind the second value, away from the first one
|
|
76
|
+
const direction = toBox.x + toBox.width / 2 >= box.x + box.width / 2 ? 1 : -1;
|
|
77
|
+
const edge = (of) => (direction === 1 ? of.x + of.width : of.x);
|
|
78
|
+
const barX = edge(toBox) + direction * 0.9 * em;
|
|
79
|
+
const lineEnd = barX + direction * 0.125 * em;
|
|
80
|
+
// the upper edge is the level of a positive value only: the caller knows better for a negative one
|
|
81
|
+
const fromY = (_a = levels === null || levels === void 0 ? void 0 : levels.from) !== null && _a !== void 0 ? _a : box.y;
|
|
82
|
+
const toY = (_b = levels === null || levels === void 0 ? void 0 : levels.to) !== null && _b !== void 0 ? _b : toBox.y;
|
|
83
|
+
const barWidth = 0.25 * em;
|
|
84
|
+
const percent = item.percent && fromValue !== 0 ? `(${signed((difference / Math.abs(fromValue)) * 100, 0)}%)` : undefined;
|
|
85
|
+
const value = signed(difference, digits);
|
|
86
|
+
const textX = barX + direction * 0.6 * em;
|
|
87
|
+
const textY = (fromY + toY) / 2;
|
|
88
|
+
const percentWidth = percent ? textWidth(percent, 0.85 * em) : 0;
|
|
89
|
+
// digits and signs alone are narrower than a text with a percent sign
|
|
90
|
+
const valueWidth = value.length * 0.5 * em;
|
|
91
|
+
// the percent is the last part of the text, which ends at textX when it stands at the left
|
|
92
|
+
const percentX = direction === 1 ? textX + valueWidth + 0.35 * em : textX - percentWidth;
|
|
93
|
+
return {
|
|
94
|
+
kind: "difference",
|
|
95
|
+
color: (_c = item.color) !== null && _c !== void 0 ? _c : (good ? "positive" : "negative"),
|
|
96
|
+
lines: [
|
|
97
|
+
{ x1: edge(box), y1: fromY, x2: lineEnd, y2: fromY },
|
|
98
|
+
{ x1: edge(toBox), y1: toY, x2: lineEnd, y2: toY },
|
|
99
|
+
],
|
|
100
|
+
bar: {
|
|
101
|
+
x: barX - barWidth / 2,
|
|
102
|
+
y: Math.min(fromY, toY),
|
|
103
|
+
width: barWidth,
|
|
104
|
+
height: Math.max(Math.abs(toY - fromY), 1),
|
|
105
|
+
},
|
|
106
|
+
text: { x: textX, y: textY, anchor: direction === 1 ? "start" : "end", value, percent },
|
|
107
|
+
frame: percent && item.highlight
|
|
108
|
+
? {
|
|
109
|
+
x: percentX - 0.25 * em,
|
|
110
|
+
y: textY - 0.65 * em,
|
|
111
|
+
width: percentWidth + 0.5 * em,
|
|
112
|
+
height: 1.3 * em,
|
|
113
|
+
r: 0.65 * em,
|
|
114
|
+
}
|
|
115
|
+
: undefined,
|
|
116
|
+
badge: item.label != null
|
|
117
|
+
? { cx: barX, cy: Math.min(fromY, toY) - 0.9 * em, r: 0.65 * em, label: item.label }
|
|
118
|
+
: undefined,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
56
121
|
/**
|
|
57
122
|
* The geometry of one item. On a whole component a marker sits in the top-right
|
|
58
123
|
* corner, and on a table cell next to the number. A frame goes around the text
|
|
@@ -61,7 +126,7 @@ function besideText(text, r, unit, options) {
|
|
|
61
126
|
* two boxes with the same centre has no direction and gives `undefined`.
|
|
62
127
|
*/
|
|
63
128
|
export function buildMark(item, box, toBox, em, options = {}) {
|
|
64
|
-
var _a;
|
|
129
|
+
var _a, _b, _c, _d;
|
|
65
130
|
const { label, color } = item;
|
|
66
131
|
const { whole, area, text } = options;
|
|
67
132
|
// a table row has no text of its own, but the same font
|
|
@@ -105,9 +170,19 @@ export function buildMark(item, box, toBox, em, options = {}) {
|
|
|
105
170
|
};
|
|
106
171
|
}
|
|
107
172
|
if (item.mark === "frame") {
|
|
108
|
-
|
|
109
|
-
const
|
|
110
|
-
|
|
173
|
+
// a text of its own stands in the upper part of the target, above a value label in its middle
|
|
174
|
+
const caption = item.text != null && !whole
|
|
175
|
+
? { x: box.x + box.width / 2, y: box.y + Math.min(box.height / 2, Math.max(0.9 * em, 0.3 * box.height)) }
|
|
176
|
+
: undefined;
|
|
177
|
+
const captionBox = caption && {
|
|
178
|
+
x: caption.x - textWidth(item.text, em) / 2,
|
|
179
|
+
y: caption.y - 0.6 * em,
|
|
180
|
+
width: textWidth(item.text, em),
|
|
181
|
+
height: 1.2 * em,
|
|
182
|
+
};
|
|
183
|
+
const around = (_a = captionBox !== null && captionBox !== void 0 ? captionBox : text) !== null && _a !== void 0 ? _a : box;
|
|
184
|
+
const part = (_b = item.point) === null || _b === void 0 ? void 0 : _b.part;
|
|
185
|
+
const oval = !whole && (captionBox != null || text != null || part === "label" || part === "total");
|
|
111
186
|
const paddingX = (oval ? 0.45 : 0.2) * unit;
|
|
112
187
|
const paddingY = (oval ? 0.1 : 0.2) * unit;
|
|
113
188
|
// a single digit gets a circle and not a narrow upright oval
|
|
@@ -138,6 +213,7 @@ export function buildMark(item, box, toBox, em, options = {}) {
|
|
|
138
213
|
badge: label != null
|
|
139
214
|
? keepInside({ cx: x2 - rx * curve + outside, cy: top + ry * curve - outside, r: badgeR, label }, area)
|
|
140
215
|
: undefined,
|
|
216
|
+
caption: caption && Object.assign(Object.assign({}, caption), { text: item.text }),
|
|
141
217
|
};
|
|
142
218
|
}
|
|
143
219
|
// without a number the circle is only a dot
|
|
@@ -147,7 +223,11 @@ export function buildMark(item, box, toBox, em, options = {}) {
|
|
|
147
223
|
}
|
|
148
224
|
const size = (label == null ? 0.4 : 0.75) * unit;
|
|
149
225
|
const r = isRow ? Math.min(size, box.height / 2) : size;
|
|
150
|
-
|
|
226
|
+
let at = whole ? { x: box.x + box.width - r, y: box.y + r } : centre(box);
|
|
227
|
+
if (!whole && options.stacked && ((_c = item.point) === null || _c === void 0 ? void 0 : _c.part) !== "label" && ((_d = item.point) === null || _d === void 0 ? void 0 : _d.part) !== "total") {
|
|
228
|
+
// on the upper right corner: the label in the middle and a name beside the segment stay free
|
|
229
|
+
at = { x: box.x + box.width, y: box.y + Math.min(0.5 * r, box.height / 2) };
|
|
230
|
+
}
|
|
151
231
|
if (isRow) {
|
|
152
232
|
// the middle of a row is free in a wide table. In a narrow one it is a number: then next to that number
|
|
153
233
|
const circle = { x: at.x - r, y: at.y - r, width: 2 * r, height: 2 * r };
|
|
@@ -21,5 +21,11 @@ export function matchPoint(state, point) {
|
|
|
21
21
|
const noThereof = state.table != null && point.subCategory == null;
|
|
22
22
|
return candidates
|
|
23
23
|
.filter((candidate) => matches(candidate.point, point) && !(noThereof && candidate.point.subCategory != null))
|
|
24
|
-
.map(({ rect, content, contentSign }) => ({
|
|
24
|
+
.map(({ rect, content, contentSign, value, scenario }) => ({
|
|
25
|
+
rect,
|
|
26
|
+
content,
|
|
27
|
+
contentSign,
|
|
28
|
+
value,
|
|
29
|
+
stacked: typeof scenario === "string" && scenario.startsWith("stack:"),
|
|
30
|
+
}));
|
|
25
31
|
}
|
package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js
CHANGED
|
@@ -112,25 +112,39 @@ export class BnChartTimeRenderer {
|
|
|
112
112
|
}
|
|
113
113
|
/** Reports a failed query as the wrapper's `ERR_sql` item. Without it the chart would only show "No Data". */
|
|
114
114
|
syncQueryError() {
|
|
115
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
115
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
116
116
|
this.queryError = (_a = this.measureScaleError) !== null && _a !== void 0 ? _a : (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getQueryError();
|
|
117
117
|
reportQueryError(this.errors, this.queryError);
|
|
118
|
+
// the renderers of the variance rows share the error store: only the base chart reports
|
|
119
|
+
if (this.variances.every((variance) => variance === "")) {
|
|
120
|
+
const ignored = (_d = (_c = this.chart) === null || _c === void 0 ? void 0 : _c.getIgnoredSwitchScenarios()) !== null && _d !== void 0 ? _d : [];
|
|
121
|
+
if (ignored.length > 0) {
|
|
122
|
+
(_e = this.errors) === null || _e === void 0 ? void 0 : _e.addOrReplace({
|
|
123
|
+
id: "WARN_stack_switch_ignored",
|
|
124
|
+
type: "warning",
|
|
125
|
+
message: `stack by dimensions with scenarioSwitch: ${ignored.join(", ")} is not drawn. A scenario continues the first one only where the first one has no value, and only in bar mode.`,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
(_f = this.errors) === null || _f === void 0 ? void 0 : _f.remove("WARN_stack_switch_ignored");
|
|
130
|
+
}
|
|
131
|
+
}
|
|
118
132
|
const errId = `WARN_variances_overlap_${this.variances.join("_")}`;
|
|
119
|
-
const overlaps = (
|
|
133
|
+
const overlaps = (_h = (_g = this.chart) === null || _g === void 0 ? void 0 : _g.getVarianceOverlaps()) !== null && _h !== void 0 ? _h : 0;
|
|
120
134
|
// the row can get other variances: the warning of the old list has to go
|
|
121
135
|
if (this.overlapErrId && this.overlapErrId !== errId) {
|
|
122
|
-
(
|
|
136
|
+
(_j = this.errors) === null || _j === void 0 ? void 0 : _j.remove(this.overlapErrId);
|
|
123
137
|
}
|
|
124
138
|
this.overlapErrId = overlaps > 0 ? errId : undefined;
|
|
125
139
|
if (overlaps > 0) {
|
|
126
|
-
(
|
|
140
|
+
(_k = this.errors) === null || _k === void 0 ? void 0 : _k.addOrReplace({
|
|
127
141
|
id: errId,
|
|
128
142
|
type: "warning",
|
|
129
143
|
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
144
|
});
|
|
131
145
|
}
|
|
132
146
|
else {
|
|
133
|
-
(
|
|
147
|
+
(_l = this.errors) === null || _l === void 0 ? void 0 : _l.remove(errId);
|
|
134
148
|
}
|
|
135
149
|
}
|
|
136
150
|
async componentWillLoad() {
|
|
@@ -754,7 +768,7 @@ export class BnChartTimeRenderer {
|
|
|
754
768
|
"mutable": false,
|
|
755
769
|
"complexType": {
|
|
756
770
|
"original": "AxisLabelsMode",
|
|
757
|
-
"resolved": "AxisLabelsMode.LONG | AxisLabelsMode.SHORT | AxisLabelsMode.SMART",
|
|
771
|
+
"resolved": "AxisLabelsMode.LONG | AxisLabelsMode.SHORT | AxisLabelsMode.SMART | AxisLabelsMode.TWO_ROW",
|
|
758
772
|
"references": {
|
|
759
773
|
"AxisLabelsMode": {
|
|
760
774
|
"location": "import",
|
|
@@ -325,14 +325,22 @@ export class Chart {
|
|
|
325
325
|
* {
|
|
326
326
|
* "by": "scenarios" | "dimensions",
|
|
327
327
|
* "mode": "absolute" | "relative" | "absolute-relative",
|
|
328
|
-
* "order": "asc" | "desc" | "dataset"
|
|
328
|
+
* "order": "asc" | "desc" | "dataset",
|
|
329
|
+
* "notation": "none" | "scenario",
|
|
330
|
+
* "legend": "left" | "right" | "both" | "none",
|
|
331
|
+
* "percentMark": true | false
|
|
329
332
|
* }
|
|
330
333
|
* ```
|
|
331
334
|
*
|
|
332
335
|
* - `by` (required): What a stack is made of.
|
|
333
|
-
* - `"scenarios"` - stack the scenarios from the `scenarios` prop as layers
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
+
* - `"scenarios"` - stack the scenarios from the `scenarios` prop as layers,
|
|
337
|
+
* four at most.
|
|
338
|
+
* - `"dimensions"` - one segment per value of the `category` column of the
|
|
339
|
+
* dataset, ordered by `categoryIndex`, else by first appearance. There is
|
|
340
|
+
* no limit on the number of series, and a series keeps its colour in
|
|
341
|
+
* every period. The first scenario is drawn. With `scenario-switch` the
|
|
342
|
+
* scenario that has values in the period is drawn, so one axis can go
|
|
343
|
+
* from AC to FC to PL.
|
|
336
344
|
* - `mode` (optional, default `"absolute"`):
|
|
337
345
|
* - `"absolute"` - additive stacking, axis shows absolute units.
|
|
338
346
|
* - `"relative"` - 100% stacking, axis shows 0%-100%. `unit-scaling` is
|
|
@@ -343,6 +351,17 @@ export class Chart {
|
|
|
343
351
|
* - `order` (optional, default `"dataset"`): Segment order within each stack.
|
|
344
352
|
* `"asc"` / `"desc"` sort segments by value; `"dataset"` preserves the
|
|
345
353
|
* original data/scenario order.
|
|
354
|
+
* - `notation` (optional, default `"none"`): with `"scenario"` a segment takes
|
|
355
|
+
* the look of its scenario. A forecast segment is hatched over the shade of
|
|
356
|
+
* its series, a plan segment is outlined, and the first series takes the
|
|
357
|
+
* fill of the scenario from `barStyles`.
|
|
358
|
+
* - `legend` (optional, default `"left"`): where the series names stand. Left
|
|
359
|
+
* of the first column, right of the last column with a value, at both, or
|
|
360
|
+
* nowhere.
|
|
361
|
+
* - `percentMark` (optional, default `false`): for `mode: "relative"`. The
|
|
362
|
+
* shares are plain numbers without the % sign, with
|
|
363
|
+
* `data-format-digits-percent` digits, and one `100%` mark stands at the
|
|
364
|
+
* upper end of the stack, on the side of the series names.
|
|
346
365
|
*
|
|
347
366
|
* @default '' (empty - no stacking)
|
|
348
367
|
*
|
|
@@ -436,7 +455,8 @@ export class Chart {
|
|
|
436
455
|
* has no value, the next scenario with a value is drawn in its place with
|
|
437
456
|
* its value label. A vertical line marks the change, and the scenario names
|
|
438
457
|
* stand under the axis. Variances with the same reference and type share
|
|
439
|
-
* one row.
|
|
458
|
+
* one row. A chart with one scenario gets the name of that scenario under
|
|
459
|
+
* the axis. Bar mode, without a stack or with a stack by dimensions.
|
|
440
460
|
*/
|
|
441
461
|
this.scenarioSwitch = false;
|
|
442
462
|
/**
|
|
@@ -1016,7 +1036,7 @@ export class Chart {
|
|
|
1016
1036
|
}
|
|
1017
1037
|
prepareAxisLabelsMode() {
|
|
1018
1038
|
var _a;
|
|
1019
|
-
return AxisLabelsMode[(_a = this.axisLabelsMode) === null || _a === void 0 ? void 0 : _a.toUpperCase()];
|
|
1039
|
+
return AxisLabelsMode[(_a = this.axisLabelsMode) === null || _a === void 0 ? void 0 : _a.toUpperCase().replace("-", "_")];
|
|
1020
1040
|
}
|
|
1021
1041
|
prepareFilter() {
|
|
1022
1042
|
if (this.filter.length === 0) {
|
|
@@ -1085,36 +1105,48 @@ export class Chart {
|
|
|
1085
1105
|
prepareStackConfig() {
|
|
1086
1106
|
if (isBlankInput(this.stack)) {
|
|
1087
1107
|
this.errors.remove("WARN_stack_dimensions_scenarios");
|
|
1108
|
+
this.errors.remove("WARN_stack_scenarios_max");
|
|
1088
1109
|
return null;
|
|
1089
1110
|
}
|
|
1090
1111
|
try {
|
|
1091
1112
|
const parsed = JSON.parse(this.stack);
|
|
1092
1113
|
const by = parsed.by;
|
|
1093
1114
|
const errId = "WARN_stack_dimensions_scenarios";
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
})
|
|
1102
|
-
}
|
|
1103
|
-
else {
|
|
1104
|
-
this.errors.remove(errId);
|
|
1105
|
-
}
|
|
1115
|
+
const maxId = "WARN_stack_scenarios_max";
|
|
1116
|
+
const scenarios = this.prepareScenarios();
|
|
1117
|
+
// with scenarioSwitch the further scenarios continue the first one along the time axis
|
|
1118
|
+
if (by === StackBy.DIMENSIONS && scenarios.length > 1 && !this.scenarioSwitch) {
|
|
1119
|
+
this.errors.addOrReplace({
|
|
1120
|
+
id: errId,
|
|
1121
|
+
type: "warning",
|
|
1122
|
+
message: `stack by dimensions: only the first scenario "${scenarios[0]}" is used, the rest (${scenarios.slice(1).join(", ")}) are discarded.`,
|
|
1123
|
+
});
|
|
1106
1124
|
}
|
|
1107
1125
|
else {
|
|
1108
1126
|
this.errors.remove(errId);
|
|
1109
1127
|
}
|
|
1128
|
+
if (by === StackBy.SCENARIOS && scenarios.length > 4) {
|
|
1129
|
+
this.errors.addOrReplace({
|
|
1130
|
+
id: maxId,
|
|
1131
|
+
type: "warning",
|
|
1132
|
+
message: `stack by scenarios: at most four scenarios are stacked, the rest (${scenarios.slice(4).join(", ")}) are discarded. Use stack by dimensions for more series.`,
|
|
1133
|
+
});
|
|
1134
|
+
}
|
|
1135
|
+
else {
|
|
1136
|
+
this.errors.remove(maxId);
|
|
1137
|
+
}
|
|
1110
1138
|
return {
|
|
1111
1139
|
by,
|
|
1112
1140
|
mode: parsed.mode || StackMode.ABSOLUTE,
|
|
1113
1141
|
order: parsed.order || StackOrder.DATASET,
|
|
1142
|
+
notation: parsed.notation === "scenario" ? "scenario" : "none",
|
|
1143
|
+
legend: ["right", "both", "none"].includes(parsed.legend) ? parsed.legend : "left",
|
|
1144
|
+
percentMark: parsed.percentMark === true,
|
|
1114
1145
|
};
|
|
1115
1146
|
}
|
|
1116
1147
|
catch (_a) {
|
|
1117
1148
|
this.errors.remove("WARN_stack_dimensions_scenarios");
|
|
1149
|
+
this.errors.remove("WARN_stack_scenarios_max");
|
|
1118
1150
|
return null;
|
|
1119
1151
|
}
|
|
1120
1152
|
}
|
|
@@ -1145,7 +1177,7 @@ export class Chart {
|
|
|
1145
1177
|
const isBase = segmentVariances.length === 0;
|
|
1146
1178
|
const scenarios = this.hidesScenarios() ? variancesScenarios(segmentVariances) : this.prepareScenarios();
|
|
1147
1179
|
// only the base chart draws a stack, a variance needs both of its scenarios
|
|
1148
|
-
const effectiveScenarios = isBase && (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
1180
|
+
const effectiveScenarios = isBase && (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS && !this.scenarioSwitch ? scenarios.slice(0, 1) : scenarios;
|
|
1149
1181
|
return (h("bn-chart-time-renderer", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: segmentVariances.length > 0 ? segmentVariances : [""], hideAxisLabels: this.prepareHideAxisLabels(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, errors: this.errors, leftSideOffsetForHorizontalSync: this.prepareLeftSideOffset(preparedI18n, preparedStyle), styles: preparedStyle, i18n: preparedI18n, dateInterval: this.prepareDateInterval(), intervalSpanLimit: this.prepareIntervalSpanLimit(), axisLabelsMode: this.prepareAxisLabelsMode(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showOverlayAvg: this.prepareAvg(), showOverlayMedian: this.prepareMedian(), showMeasureScale: this.prepareShowMeasureScale(idx), chartMode: this.prepareChartMode(), maxBars: this.prepareMaxBars(), stackConfig: stackConfig, lineFullWidth: this.prepareLineFullWidth(), dataFormatDigits: { percent: this.dataFormatDigitsPercent, decimal: this.dataFormatDigitsDecimal }, axisLabelsStep: Math.max(1, Math.floor(Number(this.axisLabelsStep) || 1)), scenarioSwitch: this.scenarioSwitch, axisTitlePosition: this.prepareAxisTitlePosition(), containerWidth: fullParentWidth, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
|
|
1150
1182
|
}
|
|
1151
1183
|
/**
|
|
@@ -1278,7 +1310,7 @@ export class Chart {
|
|
|
1278
1310
|
this.errors.remove("WARN_scenarios_none");
|
|
1279
1311
|
}
|
|
1280
1312
|
const fontStyles = this.getFontStyles();
|
|
1281
|
-
return (h(Host, { key: '
|
|
1313
|
+
return (h(Host, { key: 'c998214052bad19811135a7c48e669d6ebfdb8cc', style: fontStyles }, h("div", { key: '8c877fda1575246a4cecc5610aa3b66d6b6f60ce', class: "container" }, segments.map(this.chartTemplate))));
|
|
1282
1314
|
}
|
|
1283
1315
|
static get is() { return "bn-chart-time"; }
|
|
1284
1316
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1601,7 +1633,7 @@ export class Chart {
|
|
|
1601
1633
|
"name": "example",
|
|
1602
1634
|
"text": "// Stack scenarios, relative mode\nstack='{\"by\":\"scenarios\",\"mode\":\"relative\"}'"
|
|
1603
1635
|
}],
|
|
1604
|
-
"text": "Stacking configuration for the chart as a JSON string.\n\nWhen set, bars/columns are drawn stacked (additive layers) instead of\nside-by-side. In line mode (`chart-mode=\"line\"`), stacking produces a\nstacked area chart with filled regions between cumulative lines.\n\n**JSON schema:**\n```json\n{\n \"by\": \"scenarios\" | \"dimensions\",\n \"mode\": \"absolute\" | \"relative\" | \"absolute-relative\",\n \"order\": \"asc\" | \"desc\" | \"dataset\"\n}\n```\n\n- `by` (required): What a stack is made of.\n - `\"scenarios\"` - stack the scenarios from the `scenarios` prop as layers.\n - `\"dimensions\"` -
|
|
1636
|
+
"text": "Stacking configuration for the chart as a JSON string.\n\nWhen set, bars/columns are drawn stacked (additive layers) instead of\nside-by-side. In line mode (`chart-mode=\"line\"`), stacking produces a\nstacked area chart with filled regions between cumulative lines.\n\n**JSON schema:**\n```json\n{\n \"by\": \"scenarios\" | \"dimensions\",\n \"mode\": \"absolute\" | \"relative\" | \"absolute-relative\",\n \"order\": \"asc\" | \"desc\" | \"dataset\",\n \"notation\": \"none\" | \"scenario\",\n \"legend\": \"left\" | \"right\" | \"both\" | \"none\",\n \"percentMark\": true | false\n}\n```\n\n- `by` (required): What a stack is made of.\n - `\"scenarios\"` - stack the scenarios from the `scenarios` prop as layers,\n four at most.\n - `\"dimensions\"` - one segment per value of the `category` column of the\n dataset, ordered by `categoryIndex`, else by first appearance. There is\n no limit on the number of series, and a series keeps its colour in\n every period. The first scenario is drawn. With `scenario-switch` the\n scenario that has values in the period is drawn, so one axis can go\n from AC to FC to PL.\n- `mode` (optional, default `\"absolute\"`):\n - `\"absolute\"` - additive stacking, axis shows absolute units.\n - `\"relative\"` - 100% stacking, axis shows 0%-100%. `unit-scaling` is\n interpreted as pixels per percentage point (e.g. `0.4` \u2192 40px full\n stack); `\"auto\"` fits the stack to the available height as usual.\n - `\"absolute-relative\"` - bar height is absolute (real value), but\n segment labels inside show percentages.\n- `order` (optional, default `\"dataset\"`): Segment order within each stack.\n `\"asc\"` / `\"desc\"` sort segments by value; `\"dataset\"` preserves the\n original data/scenario order.\n- `notation` (optional, default `\"none\"`): with `\"scenario\"` a segment takes\n the look of its scenario. A forecast segment is hatched over the shade of\n its series, a plan segment is outlined, and the first series takes the\n fill of the scenario from `barStyles`.\n- `legend` (optional, default `\"left\"`): where the series names stand. Left\n of the first column, right of the last column with a value, at both, or\n nowhere.\n- `percentMark` (optional, default `false`): for `mode: \"relative\"`. The\n shares are plain numbers without the % sign, with\n `data-format-digits-percent` digits, and one `100%` mark stands at the\n upper end of the stack, on the side of the series names."
|
|
1605
1637
|
},
|
|
1606
1638
|
"getter": false,
|
|
1607
1639
|
"setter": false,
|
|
@@ -1660,7 +1692,7 @@ export class Chart {
|
|
|
1660
1692
|
"optional": false,
|
|
1661
1693
|
"docs": {
|
|
1662
1694
|
"tags": [],
|
|
1663
|
-
"text": "Axis Labels Mode defines in which mode the labels are rendered.\nlong, and short mode uses the long an short styles for the date\nsmart only displays relevant information if a change/ transition occured\n(eg. only on 1.Jan the year is displayed)\n<br /><br />\nvalues:<br />\n```smart // long // short```"
|
|
1695
|
+
"text": "Axis Labels Mode defines in which mode the labels are rendered.\nlong, and short mode uses the long an short styles for the date\nsmart only displays relevant information if a change/ transition occured\n(eg. only on 1.Jan the year is displayed)\ntwo-row prints short labels and puts the parent period (the year of a\nmonth, quarter or week) in a second row, under the first period and where\nit changes. With scenario-switch the scenario names stand in the same row.\n<br /><br />\nvalues:<br />\n```smart // long // short // two-row```"
|
|
1664
1696
|
},
|
|
1665
1697
|
"getter": false,
|
|
1666
1698
|
"setter": false,
|
|
@@ -1879,7 +1911,7 @@ export class Chart {
|
|
|
1879
1911
|
"optional": false,
|
|
1880
1912
|
"docs": {
|
|
1881
1913
|
"tags": [],
|
|
1882
|
-
"text": "For a series that changes its scenario along the time axis, for example\nAC up to this year and PL after it. In a period where the first scenario\nhas no value, the next scenario with a value is drawn in its place with\nits value label. A vertical line marks the change, and the scenario names\nstand under the axis. Variances with the same reference and type share\none row. Bar mode without stack
|
|
1914
|
+
"text": "For a series that changes its scenario along the time axis, for example\nAC up to this year and PL after it. In a period where the first scenario\nhas no value, the next scenario with a value is drawn in its place with\nits value label. A vertical line marks the change, and the scenario names\nstand under the axis. Variances with the same reference and type share\none row. A chart with one scenario gets the name of that scenario under\nthe axis. Bar mode, without a stack or with a stack by dimensions."
|
|
1883
1915
|
},
|
|
1884
1916
|
"getter": false,
|
|
1885
1917
|
"setter": false,
|