@bino-bi/bn-template-engine 1.0.0-next.59 → 1.0.0-next.60
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-2dd8ff68.entry.js +1 -0
- package/dist/cjs/bn-annotation-layer_30.cjs.entry.js +311 -26
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.js +26 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +95 -10
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +173 -11
- package/dist/collection/components/bn-chart-time/utils/elements/Column.js +10 -0
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +8 -2
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +8 -0
- package/dist/collection/components/bn-chart-time/utils/factories/ScenarioFactory.js +2 -2
- package/dist/collection/components/bn-chart-time/utils/helper/hatch.js +17 -0
- package/dist/collection/components/bn-chart-time/utils/helper/heightBonus.js +23 -0
- package/dist/collection/components/bn-chart-time/utils/helper/index.js +1 -0
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +5 -0
- package/dist/collection/utils/model/DataFormatDigits.js +7 -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.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.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/{p-BQD7EWUn.js → p-B8Y6IQ1l.js} +1 -1
- package/dist/components/{p-keKnrAVS.js → p-BLeLZ2QH.js} +1 -1
- package/dist/components/{p-OR6uR6gy.js → p-BcTq1zVT.js} +1 -1
- package/dist/components/{p-Dmsa7xm_.js → p-Bknb6p4l.js} +1 -1
- package/dist/components/p-CFW5n3j6.js +1 -0
- package/dist/components/{p-CU9CdEBF.js → p-CpUADUdN.js} +1 -1
- package/dist/components/{p-CcfvGlBq.js → p-DG0UTzyc.js} +1 -1
- package/dist/components/p-DGGVUpL3.js +1 -0
- package/dist/components/{p-LB2R8XbL.js → p-DQgEenqx.js} +1 -1
- package/dist/components/p-DXs4E5PY.js +1 -0
- package/dist/components/{p-Q6JHDy4s.js → p-DiGJKipb.js} +1 -1
- package/dist/components/{p-BAvpRnjI.js → p-VHA3zzQU.js} +1 -1
- package/dist/components/{p-D7pKezNW.js → p-f0-k8Eae.js} +1 -1
- package/dist/components/{p-ChMe_jnA.js → p-rZ7jIcOY.js} +1 -1
- package/dist/esm/bn-annotation-layer_30.entry.js +311 -26
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/bn-chart-time/bn-chart-time-renderer/bn-chart-time-renderer.d.ts +2 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +27 -1
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +24 -0
- package/dist/types/components/bn-chart-time/utils/factories/ScenarioFactory.d.ts +1 -1
- package/dist/types/components/bn-chart-time/utils/helper/hatch.d.ts +3 -0
- package/dist/types/components/bn-chart-time/utils/helper/heightBonus.d.ts +12 -0
- package/dist/types/components/bn-chart-time/utils/helper/index.d.ts +1 -0
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +2 -0
- package/dist/types/components.d.ts +24 -0
- package/dist/types/utils/model/DataFormatDigits.d.ts +5 -1
- package/package.json +1 -1
- package/dist/bn-template-engine/p-bc538e7d.entry.js +0 -1
- package/dist/components/p-BpyLanO3.js +0 -1
- package/dist/components/p-CFF7b9FT.js +0 -1
- package/dist/components/p-DLmQ_mi7.js +0 -1
|
@@ -10010,9 +10010,15 @@ let Label$1 = class Label {
|
|
|
10010
10010
|
scale = measureScale.value;
|
|
10011
10011
|
type = "decimal";
|
|
10012
10012
|
}
|
|
10013
|
-
|
|
10013
|
+
// without the percent sign the share prints as a plain number: the same in every locale
|
|
10014
|
+
const plain = this.isRelativeLabel && this.isVarianceLabel && dataFormatDigits.percentSign === false;
|
|
10015
|
+
const print = (number) => plain
|
|
10016
|
+
? // 0.145 * 100 is 14.499999999999998: cut the noise, so the label rounds like the percent format
|
|
10017
|
+
Formatter.number(Number((number * 100).toPrecision(15)), "decimal", digits, digitsMin, 1, this.styles.locale)
|
|
10018
|
+
: Formatter.number(number, type, digits, digitsMin, scale, this.styles.locale);
|
|
10019
|
+
valueStr = print(Number(value));
|
|
10014
10020
|
// a value that rounds to zero prints without a sign
|
|
10015
|
-
const zeroStr =
|
|
10021
|
+
const zeroStr = print(0);
|
|
10016
10022
|
if (this.isVarianceLabel && Number(this.value) > 0 && valueStr !== zeroStr) {
|
|
10017
10023
|
prefix = "+";
|
|
10018
10024
|
}
|
|
@@ -19812,9 +19818,12 @@ class StructureChart {
|
|
|
19812
19818
|
|
|
19813
19819
|
/** Decimal precision configuration: separate digit counts for percent columns vs absolute (decimal) columns. */
|
|
19814
19820
|
class DataFormatDigits {
|
|
19815
|
-
constructor(percent = 2, decimal = 1
|
|
19821
|
+
constructor(percent = 2, decimal = 1,
|
|
19822
|
+
/** False: a relative variance prints as a plain number, the unit stands in the title of its row. */
|
|
19823
|
+
percentSign) {
|
|
19816
19824
|
this.percent = percent;
|
|
19817
19825
|
this.decimal = decimal;
|
|
19826
|
+
this.percentSign = percentSign;
|
|
19818
19827
|
}
|
|
19819
19828
|
}
|
|
19820
19829
|
class DataFormatDigitsAdapter {
|
|
@@ -19828,6 +19837,9 @@ class DataFormatDigitsAdapter {
|
|
|
19828
19837
|
if (valid(data.decimal)) {
|
|
19829
19838
|
prefix.decimal = data.decimal;
|
|
19830
19839
|
}
|
|
19840
|
+
if (data.percentSign === false) {
|
|
19841
|
+
prefix.percentSign = false;
|
|
19842
|
+
}
|
|
19831
19843
|
return prefix;
|
|
19832
19844
|
}
|
|
19833
19845
|
default() {
|
|
@@ -20156,6 +20168,30 @@ const BnChartStructureRenderer = class {
|
|
|
20156
20168
|
};
|
|
20157
20169
|
BnChartStructureRenderer.style = bnChartStructureCss();
|
|
20158
20170
|
|
|
20171
|
+
/**
|
|
20172
|
+
* Height the base segment of a chart gets on top of its share: what the drawn
|
|
20173
|
+
* variance segments leave of their shares, minus what others take beyond
|
|
20174
|
+
* theirs. A segment that is not drawn yet (height 0) keeps its share.
|
|
20175
|
+
*/
|
|
20176
|
+
function measureHeightBonus(share, heights) {
|
|
20177
|
+
let bonus = 0;
|
|
20178
|
+
for (const height of heights) {
|
|
20179
|
+
if (height > 0) {
|
|
20180
|
+
bonus += share - height;
|
|
20181
|
+
}
|
|
20182
|
+
}
|
|
20183
|
+
return Math.max(0, bonus);
|
|
20184
|
+
}
|
|
20185
|
+
/**
|
|
20186
|
+
* The bonus to apply after a measurement. A smaller bonus always counts,
|
|
20187
|
+
* else the chart is higher than its parent. A bonus that grows by a few
|
|
20188
|
+
* pixels is jitter and must not cause a re-render.
|
|
20189
|
+
*/
|
|
20190
|
+
function settleHeightBonus(current, measured) {
|
|
20191
|
+
const delta = measured - current;
|
|
20192
|
+
return delta < -1 || delta > 8 ? measured : current;
|
|
20193
|
+
}
|
|
20194
|
+
|
|
20159
20195
|
const bnChartTimeCss = () => `:host(.no-data){display:block;box-sizing:border-box;width:100%;height:100%}:host(.no-data)>div{float:none;width:100%;height:100%}:host(.no-data) .no-data~.no-data{display:none}.empty-state{box-sizing:border-box;display:flex;align-items:center;justify-content:center;float:none;width:100%;height:100%;min-height:3em;margin:0;padding:0.5em;overflow:hidden;border:0.1em dashed #ddd;color:#808080;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);font-style:normal;text-align:center}:host{display:inline-block;position:relative;overflow:hidden;font-family:var(--bn-font-family, "Noto Sans", sans-serif);font-size:var(--bn-font-size, 13.3333px);color:var(--bn-font-color, #000000)}.container{display:flex;flex-direction:column-reverse}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}`;
|
|
20160
20196
|
|
|
20161
20197
|
const Chart = class {
|
|
@@ -20572,6 +20608,11 @@ const Chart = class {
|
|
|
20572
20608
|
* Number of decimal digits of the percent labels (relative variances)
|
|
20573
20609
|
*/
|
|
20574
20610
|
this.dataFormatDigitsPercent = 2;
|
|
20611
|
+
/**
|
|
20612
|
+
* `false` prints the labels of relative variances without the percent sign (`+11.6`).
|
|
20613
|
+
* The title of the row (`ΔPY%`) still names the unit.
|
|
20614
|
+
*/
|
|
20615
|
+
this.dataFormatPercentSign = true;
|
|
20575
20616
|
/**
|
|
20576
20617
|
* Prints only every n-th category label, starting with the first period.
|
|
20577
20618
|
* 2 labels every second period. Bar mode only.
|
|
@@ -20599,6 +20640,12 @@ const Chart = class {
|
|
|
20599
20640
|
this._lastObservedWidth = 0;
|
|
20600
20641
|
this._settleTimer = null;
|
|
20601
20642
|
this._lastAppliedHeight = 0;
|
|
20643
|
+
/**
|
|
20644
|
+
* Height that the variance segments leave of their shares. With a fixed
|
|
20645
|
+
* `unitScaling` the base segment gets it on top of its own share, so a
|
|
20646
|
+
* column is cut only when the whole chart has no room for it.
|
|
20647
|
+
*/
|
|
20648
|
+
this._baseHeightBonus = 0;
|
|
20602
20649
|
this.autoUnitWarningActive = false;
|
|
20603
20650
|
this.autoPctWarningActive = false;
|
|
20604
20651
|
/**
|
|
@@ -20761,6 +20808,10 @@ const Chart = class {
|
|
|
20761
20808
|
}
|
|
20762
20809
|
componentDidRender() {
|
|
20763
20810
|
syncEmptyState(this.element, "bn-chart-time-renderer");
|
|
20811
|
+
const bonusChanged = this.updateBaseHeightBonus();
|
|
20812
|
+
if (bonusChanged && !this._autoScaleGuard) {
|
|
20813
|
+
index.forceUpdate(this);
|
|
20814
|
+
}
|
|
20764
20815
|
const { mode } = withTranslation.parseScaling(this.scale);
|
|
20765
20816
|
if (mode !== "auto" && mode !== "empty") {
|
|
20766
20817
|
this._autoScaleGuard = false;
|
|
@@ -20770,6 +20821,10 @@ const Chart = class {
|
|
|
20770
20821
|
if (this._autoScaleGuard) {
|
|
20771
20822
|
this._autoScaleGuard = false;
|
|
20772
20823
|
this.checkOverflow();
|
|
20824
|
+
if (bonusChanged) {
|
|
20825
|
+
// the guard render did not use the new bonus yet
|
|
20826
|
+
index.forceUpdate(this);
|
|
20827
|
+
}
|
|
20773
20828
|
return;
|
|
20774
20829
|
}
|
|
20775
20830
|
const host = this.element;
|
|
@@ -20886,19 +20941,41 @@ const Chart = class {
|
|
|
20886
20941
|
this._settleTimer = null;
|
|
20887
20942
|
}
|
|
20888
20943
|
}
|
|
20889
|
-
|
|
20944
|
+
/** Measures the drawn variance segments. True when the bonus of the base segment changed. */
|
|
20945
|
+
updateBaseHeightBonus() {
|
|
20946
|
+
var _a, _b;
|
|
20947
|
+
const segments = this.prepareSegments();
|
|
20948
|
+
const fixedUnit = withTranslation.resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind === "value";
|
|
20949
|
+
let measured = 0;
|
|
20950
|
+
if (fixedUnit && segments.length > 1 && segments[0].length === 0) {
|
|
20951
|
+
const renderers = Array.from((_b = (_a = this.element.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("bn-chart-time-renderer")) !== null && _b !== void 0 ? _b : []);
|
|
20952
|
+
measured = measureHeightBonus(this.segmentShare(this._lastAppliedHeight, segments.length), renderers.slice(1).map((renderer) => renderer.offsetHeight));
|
|
20953
|
+
}
|
|
20954
|
+
const bonus = settleHeightBonus(this._baseHeightBonus, measured);
|
|
20955
|
+
if (bonus === this._baseHeightBonus) {
|
|
20956
|
+
return false;
|
|
20957
|
+
}
|
|
20958
|
+
this._baseHeightBonus = bonus;
|
|
20959
|
+
return true;
|
|
20960
|
+
}
|
|
20961
|
+
/**
|
|
20962
|
+
* The base chart and each variance render as vertically stacked segments
|
|
20963
|
+
* (see render()), so each one may only claim its share of the height.
|
|
20964
|
+
* The measure-scale footer (first segment only) renders below its SVG:
|
|
20965
|
+
* reserve roughly one em for it so the fitted charts leave it room.
|
|
20966
|
+
*/
|
|
20967
|
+
segmentShare(parentHeight, segmentCount) {
|
|
20968
|
+
const footerAllowance = this.showMeasureScale ? this.getEffectiveFontPx() : 0;
|
|
20969
|
+
return Math.max(0, parentHeight - footerAllowance) / Math.max(1, segmentCount);
|
|
20970
|
+
}
|
|
20971
|
+
prepareDimension(isBase = false) {
|
|
20890
20972
|
const parent = withTranslation.getParentDimensions(this.element);
|
|
20891
20973
|
const scenariosList = this.prepareScenarios();
|
|
20892
20974
|
const segments = this.prepareSegments();
|
|
20893
20975
|
this.canvasWidthSegmented = parent.width / (scenariosList.length + this.prepareVariances().length || 1);
|
|
20894
20976
|
this._lastAppliedHeight = parent.height;
|
|
20895
|
-
|
|
20896
|
-
|
|
20897
|
-
// The measure-scale footer (first segment only) renders below its SVG:
|
|
20898
|
-
// reserve roughly one em for it so the fitted charts leave it room.
|
|
20899
|
-
const segmentCount = Math.max(1, segments.length);
|
|
20900
|
-
const footerAllowance = this.showMeasureScale ? this.getEffectiveFontPx() : 0;
|
|
20901
|
-
return { width: this.canvasWidthSegmented, height: Math.max(0, parent.height - footerAllowance) / segmentCount };
|
|
20977
|
+
const share = this.segmentShare(parent.height, segments.length);
|
|
20978
|
+
return { width: this.canvasWidthSegmented, height: share + (isBase ? this._baseHeightBonus : 0) };
|
|
20902
20979
|
}
|
|
20903
20980
|
prepareScenarios() {
|
|
20904
20981
|
var _a, _b, _c, _d;
|
|
@@ -21306,7 +21383,11 @@ const Chart = class {
|
|
|
21306
21383
|
const scenarios = this.hidesScenarios() ? variancesScenarios(segmentVariances) : this.prepareScenarios();
|
|
21307
21384
|
// only the base chart draws a stack, a variance needs both of its scenarios
|
|
21308
21385
|
const effectiveScenarios = isBase && (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === withStyled.StackBy.DIMENSIONS && !this.scenarioSwitch ? scenarios.slice(0, 1) : scenarios;
|
|
21309
|
-
return (index.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: {
|
|
21386
|
+
return (index.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: {
|
|
21387
|
+
percent: this.dataFormatDigitsPercent,
|
|
21388
|
+
decimal: this.dataFormatDigitsDecimal,
|
|
21389
|
+
percentSign: this.dataFormatPercentSign !== false,
|
|
21390
|
+
}, axisLabelsStep: Math.max(1, Math.floor(Number(this.axisLabelsStep) || 1)), scalingIndicator: isBase ? Number(this.scalingIndicator) || 0 : 0, scenarioSwitch: this.scenarioSwitch, axisTitlePosition: this.prepareAxisTitlePosition(), containerWidth: fullParentWidth, parentDimensions: this.prepareDimension(isBase), ruleSetConfig: this.ruleSetConfig() }));
|
|
21310
21391
|
}
|
|
21311
21392
|
/**
|
|
21312
21393
|
* The line this chart wants to be aligned on, in CSS px from the host's
|
|
@@ -21438,7 +21519,7 @@ const Chart = class {
|
|
|
21438
21519
|
this.errors.remove("WARN_scenarios_none");
|
|
21439
21520
|
}
|
|
21440
21521
|
const fontStyles = this.getFontStyles();
|
|
21441
|
-
return (index.h(index.Host, { key: '
|
|
21522
|
+
return (index.h(index.Host, { key: 'bad256e2ea57b44384ef5097d89a53e3969862e0', style: fontStyles }, index.h("div", { key: '9adeab9b10b66acb30f47e4f77e871e1ad8b5eb5', class: "container" }, segments.map(this.chartTemplate))));
|
|
21442
21523
|
}
|
|
21443
21524
|
get element() { return index.getElement(this); }
|
|
21444
21525
|
static get watchers() { return {
|
|
@@ -21918,6 +21999,24 @@ class CustomPattern {
|
|
|
21918
21999
|
}
|
|
21919
22000
|
}
|
|
21920
22001
|
|
|
22002
|
+
/** A hatching in `color` on `background`, defined once per chart and colour. Null for a group that is not in a chart yet. */
|
|
22003
|
+
function hatchPattern(group, color, background) {
|
|
22004
|
+
const root = group.root();
|
|
22005
|
+
if (!root)
|
|
22006
|
+
return null;
|
|
22007
|
+
const id = `pattern-hatch-${color}-${background}`.replace(/[^a-zA-Z0-9-]/g, "");
|
|
22008
|
+
const existing = root.findOne(`#${id}`);
|
|
22009
|
+
if (existing)
|
|
22010
|
+
return existing;
|
|
22011
|
+
return root
|
|
22012
|
+
.pattern(10, 10, (add) => {
|
|
22013
|
+
add.rect(10, 10).fill(background);
|
|
22014
|
+
add.line(0, 5, 5, 0).stroke({ width: 1, color, linecap: "square" });
|
|
22015
|
+
add.line(5, 10, 10, 5).stroke({ width: 1, color, linecap: "square" });
|
|
22016
|
+
})
|
|
22017
|
+
.id(id);
|
|
22018
|
+
}
|
|
22019
|
+
|
|
21921
22020
|
/**
|
|
21922
22021
|
* A single renderable data point in a time-series chart.
|
|
21923
22022
|
*
|
|
@@ -22396,6 +22495,15 @@ class Column {
|
|
|
22396
22495
|
strokeStyle = { color: (scenarioStyle === null || scenarioStyle === void 0 ? void 0 : scenarioStyle.fill) || this.FALLBACK_COLOUR, width: planWidth > 0 ? planWidth : 1 };
|
|
22397
22496
|
fillStyle = this.styles.fontStyles.background || "#ffffff";
|
|
22398
22497
|
}
|
|
22498
|
+
if (this.isVarianceColumn && this.dataPoint.notation === "fc") {
|
|
22499
|
+
// hatched like a forecast column, in the colour of the variance
|
|
22500
|
+
const color = (scenarioStyle === null || scenarioStyle === void 0 ? void 0 : scenarioStyle.fill) || this.FALLBACK_COLOUR;
|
|
22501
|
+
const hatch = hatchPattern(this.scenarioGroup, color, this.styles.fontStyles.background || "#ffffff");
|
|
22502
|
+
if (hatch) {
|
|
22503
|
+
strokeStyle = { color, width: 1 };
|
|
22504
|
+
fillStyle = hatch;
|
|
22505
|
+
}
|
|
22506
|
+
}
|
|
22399
22507
|
this.scenarioGroup.attr(dataPointAttributes(this.dataPoint.key));
|
|
22400
22508
|
(_c = this.columnGroup) === null || _c === void 0 ? void 0 : _c.attr(dataPointAttributes(this.dataPoint.key, "element"));
|
|
22401
22509
|
if (this.dataPoint.key && Number.isFinite(this.dataPoint.value)) {
|
|
@@ -22800,6 +22908,12 @@ class Needle {
|
|
|
22800
22908
|
if (this.dimensions.clipped) {
|
|
22801
22909
|
this.createClippedNeedleHead(fillStyle, strokeStyle);
|
|
22802
22910
|
}
|
|
22911
|
+
else if (this.dataPoint.notation === "fc") {
|
|
22912
|
+
// the head of a forecast pin is hatched like a forecast column
|
|
22913
|
+
const background = this.styles.fontStyles.background || "#ffffff";
|
|
22914
|
+
const hatch = hatchPattern(this.barGroup, strokeStyleHead.color, background);
|
|
22915
|
+
this.createNeedleHead(hatch !== null && hatch !== void 0 ? hatch : strokeStyleHead, { color: strokeStyleHead.color, width: 1 });
|
|
22916
|
+
}
|
|
22803
22917
|
else {
|
|
22804
22918
|
this.createNeedleHead(strokeStyleHead, fillStyleHead);
|
|
22805
22919
|
}
|
|
@@ -22856,6 +22970,7 @@ class Needle {
|
|
|
22856
22970
|
head.flip("y");
|
|
22857
22971
|
}
|
|
22858
22972
|
}
|
|
22973
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22859
22974
|
createNeedleHead(strokeStyleHead, fillStyleHead) {
|
|
22860
22975
|
this.barGroup
|
|
22861
22976
|
.rect(2 * this.position.getNeedleWidth(), this.position.getNeedleHeadWidth())
|
|
@@ -23577,11 +23692,11 @@ class ScenarioFactory {
|
|
|
23577
23692
|
const labelGroup = this.svgGroups.scenario1Label.group().id("" + index);
|
|
23578
23693
|
return new Needle(this.position, this.styles, dataPoint, index, needleGroup).updateLabelGroup(labelGroup);
|
|
23579
23694
|
}
|
|
23580
|
-
createSecondaryBar(dataPoint, index) {
|
|
23695
|
+
createSecondaryBar(dataPoint, index, withScenarioLabel = true) {
|
|
23581
23696
|
const isPrimaryBar = false;
|
|
23582
23697
|
const barGroup = this.svgGroups.scenario2.group().id("" + index);
|
|
23583
23698
|
let columnLabel = null;
|
|
23584
|
-
if (this.isFirstDataPoint(index)) {
|
|
23699
|
+
if (withScenarioLabel && this.isFirstDataPoint(index)) {
|
|
23585
23700
|
columnLabel = `${this.i18n.get(dataPoint.scenario) || dataPoint.scenario}`;
|
|
23586
23701
|
}
|
|
23587
23702
|
return new Column(this.position, this.styles, dataPoint, index, isPrimaryBar, barGroup, columnLabel, this.overflowConfig);
|
|
@@ -23716,6 +23831,8 @@ var VarianceType;
|
|
|
23716
23831
|
VarianceType["ABSOLUTE"] = "d";
|
|
23717
23832
|
VarianceType["NONE"] = "";
|
|
23718
23833
|
})(VarianceType || (VarianceType = {}));
|
|
23834
|
+
/** Fill of the scaling indicator band, the light blue of the IBCS templates. */
|
|
23835
|
+
const SCALING_INDICATOR_FILL = "#c5dbf2";
|
|
23719
23836
|
/**
|
|
23720
23837
|
* Orchestrates the full rendering pipeline for an IBCS time series chart.
|
|
23721
23838
|
*
|
|
@@ -23779,6 +23896,8 @@ class TimeChart {
|
|
|
23779
23896
|
this.overflowConfig = null;
|
|
23780
23897
|
this.lastScenarios = [];
|
|
23781
23898
|
this.axisLabelsStep = 1;
|
|
23899
|
+
this.scalingIndicator = 0;
|
|
23900
|
+
this.highestColumnDataPointValue = new DataPoint(0, "default", 0, Scenario.NEU);
|
|
23782
23901
|
this.scenarioSwitch = false;
|
|
23783
23902
|
this.axisTitlePosition = "left";
|
|
23784
23903
|
/** Periods in which more than one variance of a shared row has a value. */
|
|
@@ -23826,7 +23945,7 @@ class TimeChart {
|
|
|
23826
23945
|
}
|
|
23827
23946
|
}
|
|
23828
23947
|
calculateOverflowConfig(availableHeight) {
|
|
23829
|
-
const highest = this.isVarianceChart() ? this.highestVarianceDataPointValue : this.
|
|
23948
|
+
const highest = this.isVarianceChart() ? this.highestVarianceDataPointValue : this.highestColumnDataPointValue;
|
|
23830
23949
|
const highestScaledUnit = highest.getScaledUnit();
|
|
23831
23950
|
if (highestScaledUnit <= 0)
|
|
23832
23951
|
return null;
|
|
@@ -23862,7 +23981,7 @@ class TimeChart {
|
|
|
23862
23981
|
};
|
|
23863
23982
|
}
|
|
23864
23983
|
setConfig(config) {
|
|
23865
|
-
var _a, _b, _c, _d;
|
|
23984
|
+
var _a, _b, _c, _d, _e, _f;
|
|
23866
23985
|
this.state = FactoryState$1.DIRTY;
|
|
23867
23986
|
// Must precede setSource/populateModel: the locale is baked into the
|
|
23868
23987
|
// normalizeDate() SQL as well as into the axis date labels.
|
|
@@ -23876,16 +23995,16 @@ class TimeChart {
|
|
|
23876
23995
|
this.axisLabelsMode = config.axisLabelsMode;
|
|
23877
23996
|
this.intervalSpanLimit = config.intervalSpanLimit;
|
|
23878
23997
|
this.axisLabelsStep = (_a = config.axisLabelsStep) !== null && _a !== void 0 ? _a : 1;
|
|
23879
|
-
this.
|
|
23880
|
-
this.
|
|
23998
|
+
this.scalingIndicator = (_b = config.scalingIndicator) !== null && _b !== void 0 ? _b : 0;
|
|
23999
|
+
this.scenarioSwitch = (_c = config.scenarioSwitch) !== null && _c !== void 0 ? _c : false;
|
|
24000
|
+
this.axisTitlePosition = (_d = config.axisTitlePosition) !== null && _d !== void 0 ? _d : "left";
|
|
23881
24001
|
this.dateInterval = this.findDateInterval(config.dateInterval);
|
|
23882
24002
|
// the model of a stack by dimension holds the series
|
|
23883
24003
|
this.stackConfig = config.stackConfig;
|
|
23884
24004
|
this.dataModel = this.populateModel(scenarios, this.dateInterval);
|
|
23885
24005
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
23886
24006
|
this.configTitle = config.title;
|
|
23887
|
-
this.configVariances = (
|
|
23888
|
-
this.updateTitle();
|
|
24007
|
+
this.configVariances = (_e = config === null || config === void 0 ? void 0 : config.variances) !== null && _e !== void 0 ? _e : [];
|
|
23889
24008
|
this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
|
|
23890
24009
|
this.smallestVarianceDataPointValue = this.findSmallestDataPointValue(this.variancesDataModel);
|
|
23891
24010
|
this.highestDataPointValue = this.findHighestDataPointValue(this.dataModel);
|
|
@@ -23909,10 +24028,30 @@ class TimeChart {
|
|
|
23909
24028
|
layouts.push(...this.stackGroups(row).map((group) => group.layout));
|
|
23910
24029
|
}
|
|
23911
24030
|
const sides = stackExtent(layouts);
|
|
24031
|
+
const { reference } = this.seriesSlots();
|
|
24032
|
+
if (reference) {
|
|
24033
|
+
// the column behind the stack can be the highest element
|
|
24034
|
+
for (const row of this.dataModel) {
|
|
24035
|
+
const value = (_f = row[reference]) === null || _f === void 0 ? void 0 : _f.value;
|
|
24036
|
+
if (Number.isFinite(value)) {
|
|
24037
|
+
sides.positive = Math.max(sides.positive, value);
|
|
24038
|
+
sides.negative = Math.max(sides.negative, -value);
|
|
24039
|
+
}
|
|
24040
|
+
}
|
|
24041
|
+
}
|
|
23912
24042
|
const { scenario, variance } = this.highestDataPointValue;
|
|
23913
24043
|
this.highestDataPointValue = new DataPoint(sides.positive, scenario, this.pixelPerUnit, variance);
|
|
23914
24044
|
this.smallestDataPointValue = new DataPoint(0 - sides.negative, scenario, this.pixelPerUnit, variance);
|
|
23915
24045
|
}
|
|
24046
|
+
// the highest column: a break mark is for a column that does not fit, not for the band
|
|
24047
|
+
this.highestColumnDataPointValue = this.highestDataPointValue;
|
|
24048
|
+
if (this.hasScalingIndicator() && this.scalingIndicator > Number(this.highestDataPointValue.value)) {
|
|
24049
|
+
// the band is part of the chart: it can be higher than every column
|
|
24050
|
+
const { scenario, variance } = this.highestDataPointValue;
|
|
24051
|
+
this.highestDataPointValue = new DataPoint(this.scalingIndicator, scenario, this.pixelPerUnit, variance);
|
|
24052
|
+
}
|
|
24053
|
+
// the name of a shared variance row needs the scenarios of the series
|
|
24054
|
+
this.updateTitle();
|
|
23916
24055
|
this.updatePosition(scenarios);
|
|
23917
24056
|
}
|
|
23918
24057
|
getFooter() {
|
|
@@ -23952,9 +24091,19 @@ class TimeChart {
|
|
|
23952
24091
|
}
|
|
23953
24092
|
/** Derives the variance title from the stored config and the current i18n map. */
|
|
23954
24093
|
updateTitle() {
|
|
23955
|
-
var _a, _b;
|
|
24094
|
+
var _a, _b, _c;
|
|
23956
24095
|
// variances that share a row have the same reference: the first one names the row
|
|
23957
|
-
|
|
24096
|
+
let variance = this.scenarioSwitch ? (_a = this.configVariances) === null || _a === void 0 ? void 0 : _a[0] : (_b = this.configVariances) === null || _b === void 0 ? void 0 : _b.toString();
|
|
24097
|
+
if (this.scenarioSwitch && variance) {
|
|
24098
|
+
// the row holds the variances of every scenario of the series, so its name is the reference only
|
|
24099
|
+
// only for a variance of the series itself: of the first scenario or of one that follows it
|
|
24100
|
+
const parsed = new VarianceScenario(variance);
|
|
24101
|
+
const row = (_c = this.dataModel) === null || _c === void 0 ? void 0 : _c[0];
|
|
24102
|
+
const slot = ["scenario1", "scenario2", "scenario3", "scenario4"].find((key) => { var _a; return ((_a = row === null || row === void 0 ? void 0 : row[key]) === null || _a === void 0 ? void 0 : _a.scenario) === parsed.base; });
|
|
24103
|
+
if (parsed.isValid && slot != null && (slot === "scenario1" || this.followerSlots().includes(slot))) {
|
|
24104
|
+
variance = `${parsed.type}ac1_${parsed.delta}_${parsed.direction}`;
|
|
24105
|
+
}
|
|
24106
|
+
}
|
|
23958
24107
|
this.title = this.configTitle || Formatter.translateScenarioLabel(variance, this.i18n);
|
|
23959
24108
|
}
|
|
23960
24109
|
/**
|
|
@@ -24006,7 +24155,15 @@ class TimeChart {
|
|
|
24006
24155
|
}
|
|
24007
24156
|
const legendWidth = this.legendWidth("right");
|
|
24008
24157
|
const legendEnd = legendWidth > 0 ? axisEnd + this.position.spacings.labelToColumn + legendWidth + this.styles.padding.right : 0;
|
|
24009
|
-
|
|
24158
|
+
let indicatorEnd = 0;
|
|
24159
|
+
if (this.hasScalingIndicator()) {
|
|
24160
|
+
const textWidth = CalculateSize(this.scalingIndicatorText(), {
|
|
24161
|
+
font: this.styles.fontStyles.font,
|
|
24162
|
+
fontSize: this.styles.fontStyles.size + "px",
|
|
24163
|
+
}).width;
|
|
24164
|
+
indicatorEnd = this.scalingIndicatorLabelX() + textWidth + this.styles.padding.right;
|
|
24165
|
+
}
|
|
24166
|
+
return Math.max(axisEnd + labelBuffer, bboxTotal, titleEnd, legendEnd, indicatorEnd);
|
|
24010
24167
|
}
|
|
24011
24168
|
getAllocatedCanvasHeight() {
|
|
24012
24169
|
if (this.smallestVarianceDataPointValue.value == null ||
|
|
@@ -24109,6 +24266,10 @@ class TimeChart {
|
|
|
24109
24266
|
static hasValue(dataPoint) {
|
|
24110
24267
|
return dataPoint != null && !dataPoint.isEmpty() && dataPoint.value != null && !Number.isNaN(dataPoint.value);
|
|
24111
24268
|
}
|
|
24269
|
+
/** True for a point of a series with a value other than 0. A dataset often has 0 where a scenario has no value. */
|
|
24270
|
+
static hasAmount(point) {
|
|
24271
|
+
return point != null && Number.isFinite(point.value) && point.value !== 0;
|
|
24272
|
+
}
|
|
24112
24273
|
/**
|
|
24113
24274
|
* The slots that continue the first scenario: they have values, and only in
|
|
24114
24275
|
* periods where the first scenario has none. Empty without `scenarioSwitch`.
|
|
@@ -24165,6 +24326,51 @@ class TimeChart {
|
|
|
24165
24326
|
});
|
|
24166
24327
|
return runs;
|
|
24167
24328
|
}
|
|
24329
|
+
/**
|
|
24330
|
+
* Stack by dimensions with `scenarioSwitch`: the roles of the scenarios that
|
|
24331
|
+
* have values in the periods of the first one. A `fill` scenario has values
|
|
24332
|
+
* only for series where the visible scenario has none, so it fills these
|
|
24333
|
+
* segments (the forecast part on top of the actual part). The first other
|
|
24334
|
+
* scenario is the `reference`: the column behind the stack, from the total
|
|
24335
|
+
* of its period.
|
|
24336
|
+
*/
|
|
24337
|
+
seriesSlots() {
|
|
24338
|
+
var _a, _b, _c;
|
|
24339
|
+
const none = { fill: [], reference: null };
|
|
24340
|
+
if (!this.scenarioSwitch ||
|
|
24341
|
+
((_a = this.stackConfig) === null || _a === void 0 ? void 0 : _a.by) !== withStyled.StackBy.DIMENSIONS ||
|
|
24342
|
+
this.determineEffectiveChartMode() !== withStyled.ChartMode.BAR) {
|
|
24343
|
+
return none;
|
|
24344
|
+
}
|
|
24345
|
+
const followers = this.followerSlots();
|
|
24346
|
+
const finite = (point) => TimeChart.hasAmount(point);
|
|
24347
|
+
const fill = [];
|
|
24348
|
+
let reference = null;
|
|
24349
|
+
for (const slot of ["scenario2", "scenario3", "scenario4"]) {
|
|
24350
|
+
if (followers.includes(slot))
|
|
24351
|
+
continue;
|
|
24352
|
+
let values = 0;
|
|
24353
|
+
let shared = false;
|
|
24354
|
+
for (const row of this.dataModel) {
|
|
24355
|
+
const visible = (_b = this.visibleSlot(row, followers)) !== null && _b !== void 0 ? _b : "scenario1";
|
|
24356
|
+
for (const entry of (_c = row.series) !== null && _c !== void 0 ? _c : []) {
|
|
24357
|
+
if (finite(entry.points[slot])) {
|
|
24358
|
+
values++;
|
|
24359
|
+
shared = shared || finite(entry.points[visible]);
|
|
24360
|
+
}
|
|
24361
|
+
}
|
|
24362
|
+
}
|
|
24363
|
+
if (values === 0)
|
|
24364
|
+
continue;
|
|
24365
|
+
if (!shared) {
|
|
24366
|
+
fill.push(slot);
|
|
24367
|
+
}
|
|
24368
|
+
else if (reference == null && this.stackConfig.mode !== withStyled.StackMode.RELATIVE) {
|
|
24369
|
+
reference = slot;
|
|
24370
|
+
}
|
|
24371
|
+
}
|
|
24372
|
+
return { fill, reference };
|
|
24373
|
+
}
|
|
24168
24374
|
/**
|
|
24169
24375
|
* Stack by dimensions with `scenarioSwitch`: the scenarios with values that
|
|
24170
24376
|
* are not drawn, because they have values in periods of the first scenario
|
|
@@ -24176,8 +24382,10 @@ class TimeChart {
|
|
|
24176
24382
|
return [];
|
|
24177
24383
|
}
|
|
24178
24384
|
const followers = this.followerSlots();
|
|
24385
|
+
const { fill, reference } = this.seriesSlots();
|
|
24386
|
+
const drawn = [...followers, ...fill, reference];
|
|
24179
24387
|
return ["scenario2", "scenario3", "scenario4"]
|
|
24180
|
-
.filter((slot) => !
|
|
24388
|
+
.filter((slot) => !drawn.includes(slot) && this.dataModel.some((row) => TimeChart.hasValue(row[slot])))
|
|
24181
24389
|
.map((slot) => { var _a; return (_a = this.dataModel.find((row) => { var _a; return ((_a = row[slot]) === null || _a === void 0 ? void 0 : _a.scenario) != null; })) === null || _a === void 0 ? void 0 : _a[slot].scenario; });
|
|
24182
24390
|
}
|
|
24183
24391
|
/** Number of periods where variances of one row overlap. The component warns about it. */
|
|
@@ -24303,6 +24511,7 @@ class TimeChart {
|
|
|
24303
24511
|
this.drawStackedScenarios(this.dataModel, svgContainer);
|
|
24304
24512
|
this.drawStackedHeaders(this.dataModel, svgContainer);
|
|
24305
24513
|
this.drawAxisAndLabels(this.dataModel, svgContainer);
|
|
24514
|
+
this.drawScalingIndicator(svgContainer);
|
|
24306
24515
|
}
|
|
24307
24516
|
}
|
|
24308
24517
|
else {
|
|
@@ -24315,9 +24524,58 @@ class TimeChart {
|
|
|
24315
24524
|
this.drawScenarios(this.dataModel, svgContainer);
|
|
24316
24525
|
this.drawOverlayLayer(this.dataModel, svgContainer);
|
|
24317
24526
|
this.drawAxisAndLabels(this.dataModel, svgContainer);
|
|
24527
|
+
this.drawScalingIndicator(svgContainer);
|
|
24318
24528
|
}
|
|
24319
24529
|
}
|
|
24320
24530
|
}
|
|
24531
|
+
/** True for a chart that draws the scaling indicator: columns or an absolute stack, no variance chart. */
|
|
24532
|
+
hasScalingIndicator() {
|
|
24533
|
+
var _a;
|
|
24534
|
+
return (this.scalingIndicator > 0 &&
|
|
24535
|
+
!this.isVarianceChart() &&
|
|
24536
|
+
this.determineEffectiveChartMode() === withStyled.ChartMode.BAR &&
|
|
24537
|
+
((_a = this.stackConfig) === null || _a === void 0 ? void 0 : _a.mode) !== withStyled.StackMode.RELATIVE);
|
|
24538
|
+
}
|
|
24539
|
+
/** The value of the scaling indicator, printed like a value label. */
|
|
24540
|
+
scalingIndicatorText() {
|
|
24541
|
+
var _a, _b, _c;
|
|
24542
|
+
const digits = (_b = (_a = this.dataFormatDigits) === null || _a === void 0 ? void 0 : _a.decimal) !== null && _b !== void 0 ? _b : 1;
|
|
24543
|
+
return Formatter.number(this.scalingIndicator, "decimal", digits, digits, ((_c = this.measureScale) === null || _c === void 0 ? void 0 : _c.value) || 1, this.styles.locale);
|
|
24544
|
+
}
|
|
24545
|
+
/** Where the label of the scaling indicator starts: right of the last column, and of the series names there. */
|
|
24546
|
+
scalingIndicatorLabelX() {
|
|
24547
|
+
const gap = this.position.spacings.labelToColumn;
|
|
24548
|
+
const half = this.position.getColumnWidth() / 2 + this.position.spacings.scenarioOffset;
|
|
24549
|
+
const right = this.position.getColumnCenterPositionX(Math.max(0, this.dataModel.length - 1)) + half;
|
|
24550
|
+
const legendWidth = this.legendWidth("right");
|
|
24551
|
+
return right + gap + (legendWidth > 0 ? legendWidth + gap : 0);
|
|
24552
|
+
}
|
|
24553
|
+
/**
|
|
24554
|
+
* The scaling indicator: a band behind the columns from the axis up to the
|
|
24555
|
+
* value, and the value at its right end.
|
|
24556
|
+
*/
|
|
24557
|
+
drawScalingIndicator(svgContainer) {
|
|
24558
|
+
if (!this.hasScalingIndicator() || this.dataModel.length === 0) {
|
|
24559
|
+
return;
|
|
24560
|
+
}
|
|
24561
|
+
const half = this.position.getColumnWidth() / 2 + this.position.spacings.scenarioOffset;
|
|
24562
|
+
const left = this.position.getColumnCenterPositionX(0) - half;
|
|
24563
|
+
const right = this.position.getColumnCenterPositionX(this.dataModel.length - 1) + half;
|
|
24564
|
+
const axisY = this.position.getColumnPositionY();
|
|
24565
|
+
const height = this.scalingIndicator * this.pixelPerUnit;
|
|
24566
|
+
// columns are cut below the band: a shorter band would show a wrong scale, so there is none
|
|
24567
|
+
if (this.overflowConfig && height > this.overflowConfig.cutHeight) {
|
|
24568
|
+
return;
|
|
24569
|
+
}
|
|
24570
|
+
const group = svgContainer.group().id("ScalingIndicator");
|
|
24571
|
+
group
|
|
24572
|
+
.rect(right - left, height)
|
|
24573
|
+
.x(left)
|
|
24574
|
+
.y(axisY - height)
|
|
24575
|
+
.fill(SCALING_INDICATOR_FILL);
|
|
24576
|
+
group.back();
|
|
24577
|
+
new Label$1(svgContainer.group().id("ScalingIndicatorLabel"), this.scalingIndicatorLabelX(), axisY - height, "SCALING_INDICATOR", this.scalingIndicatorText(), this.styles, HookLocation$1.Center, HookLocation$1.Left).forceStringTypeDraw();
|
|
24578
|
+
}
|
|
24321
24579
|
determineEffectiveChartMode() {
|
|
24322
24580
|
if (this.chartMode === withStyled.ChartMode.LINE) {
|
|
24323
24581
|
return withStyled.ChartMode.LINE;
|
|
@@ -24780,6 +25038,10 @@ class TimeChart {
|
|
|
24780
25038
|
const pixelPerUnit = scenarios.type === "dr" ? this.pixelPerPercentage : this.pixelPerUnit;
|
|
24781
25039
|
for (const index in dataModel) {
|
|
24782
25040
|
const point = new DataPoint(this.calculateVariance(scenarios, dataModel[index], scenariomap), scenarios.delta, pixelPerUnit, directon);
|
|
25041
|
+
if (this.scenarioSwitch) {
|
|
25042
|
+
// as in a shared row: the variance takes the notation of its scenario
|
|
25043
|
+
point.notation = scenarios.base.slice(0, 2);
|
|
25044
|
+
}
|
|
24783
25045
|
if (point.value !== null && !Number.isNaN(point.value)) {
|
|
24784
25046
|
point.key = {
|
|
24785
25047
|
date: TimeChart.pointDate(dataModel[index].date),
|
|
@@ -25279,9 +25541,14 @@ class TimeChart {
|
|
|
25279
25541
|
if (!isScenarioStack && !isArea && row.series) {
|
|
25280
25542
|
// one stack of the scenario that is visible in this period
|
|
25281
25543
|
const slot = (_a = this.visibleSlot(row, this.followerSlots())) !== null && _a !== void 0 ? _a : "scenario1";
|
|
25544
|
+
const { fill } = this.seriesSlots();
|
|
25282
25545
|
const series = [];
|
|
25283
25546
|
row.series.forEach((entry, index) => {
|
|
25284
|
-
|
|
25547
|
+
// a series without a value in the visible scenario takes the scenario that fills it
|
|
25548
|
+
const filling = TimeChart.hasAmount(entry.points[slot])
|
|
25549
|
+
? undefined
|
|
25550
|
+
: fill.find((other) => TimeChart.hasAmount(entry.points[other]));
|
|
25551
|
+
const dataPoint = entry.points[filling !== null && filling !== void 0 ? filling : slot];
|
|
25285
25552
|
if (dataPoint) {
|
|
25286
25553
|
series.push({
|
|
25287
25554
|
value: dataPoint.value,
|
|
@@ -25359,8 +25626,18 @@ class TimeChart {
|
|
|
25359
25626
|
* Positive segments stack above the axis, negative segments below it.
|
|
25360
25627
|
*/
|
|
25361
25628
|
drawStackedScenarios(dataModel, svgContainer) {
|
|
25629
|
+
var _a;
|
|
25362
25630
|
if (!this.stackConfig)
|
|
25363
25631
|
return;
|
|
25632
|
+
const { reference } = this.seriesSlots();
|
|
25633
|
+
if (reference) {
|
|
25634
|
+
// the reference of each period as a column behind its stack
|
|
25635
|
+
const factory = new ScenarioFactory(this.position, svgContainer.group().id("StackReference"), this.scenarioStyles(), dataModel.length, this.i18n);
|
|
25636
|
+
// the name of the reference stands left of the first column, where the names of the series stand too
|
|
25637
|
+
const legend = (_a = this.stackConfig.legend) !== null && _a !== void 0 ? _a : "left";
|
|
25638
|
+
const named = legend !== "left" && legend !== "both";
|
|
25639
|
+
dataModel.forEach((elements, index) => factory.createSecondaryBar(elements[reference], index, named).draw());
|
|
25640
|
+
}
|
|
25364
25641
|
const stackGroup = svgContainer.group().id("StackedScenarios");
|
|
25365
25642
|
const isScenarioStack = this.stackConfig.by === withStyled.StackBy.SCENARIOS;
|
|
25366
25643
|
dataModel.forEach((elements, index) => {
|
|
@@ -25792,6 +26069,8 @@ class TimeChartComponentConfig {
|
|
|
25792
26069
|
this.lineFullWidth = true;
|
|
25793
26070
|
/** Print every n-th category label only. */
|
|
25794
26071
|
this.axisLabelsStep = 1;
|
|
26072
|
+
/** Value of the scaling indicator band, 0 for none. */
|
|
26073
|
+
this.scalingIndicator = 0;
|
|
25795
26074
|
/** One series that changes its scenario along the time axis, see `bn-chart-time`. */
|
|
25796
26075
|
this.scenarioSwitch = false;
|
|
25797
26076
|
/** Side of the axis title: left, right or none. */
|
|
@@ -25881,6 +26160,9 @@ class TimeChartComponentConfigAdapter {
|
|
|
25881
26160
|
if (withStyled.CompareUtil.isNumber(data.axisLabelsStep) && data.axisLabelsStep >= 1) {
|
|
25882
26161
|
config.axisLabelsStep = data.axisLabelsStep;
|
|
25883
26162
|
}
|
|
26163
|
+
if (withStyled.CompareUtil.isNumber(data.scalingIndicator) && data.scalingIndicator > 0) {
|
|
26164
|
+
config.scalingIndicator = data.scalingIndicator;
|
|
26165
|
+
}
|
|
25884
26166
|
if (withStyled.CompareUtil.isBoolean(data.scenarioSwitch)) {
|
|
25885
26167
|
config.scenarioSwitch = data.scenarioSwitch;
|
|
25886
26168
|
}
|
|
@@ -25966,6 +26248,8 @@ const BnChartTimeRenderer = class {
|
|
|
25966
26248
|
/** @internal */
|
|
25967
26249
|
this.axisLabelsStep = 1;
|
|
25968
26250
|
/** @internal */
|
|
26251
|
+
this.scalingIndicator = 0;
|
|
26252
|
+
/** @internal */
|
|
25969
26253
|
this.scenarioSwitch = false;
|
|
25970
26254
|
/** @internal */
|
|
25971
26255
|
this.axisTitlePosition = "left";
|
|
@@ -26255,6 +26539,7 @@ const BnChartTimeRenderer = class {
|
|
|
26255
26539
|
stackConfig: this.stackConfig,
|
|
26256
26540
|
lineFullWidth: this.lineFullWidth,
|
|
26257
26541
|
axisLabelsStep: this.axisLabelsStep,
|
|
26542
|
+
scalingIndicator: this.scalingIndicator,
|
|
26258
26543
|
scenarioSwitch: this.scenarioSwitch,
|
|
26259
26544
|
axisTitlePosition: this.axisTitlePosition,
|
|
26260
26545
|
locale: ((_c = (_b = (_a = this.stores) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.state) === null || _c === void 0 ? void 0 : _c.locale) || "de",
|