@bino-bi/bn-template-engine 1.0.0-next.20 → 1.0.0-next.22
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-99477a27.entry.js → p-445c76cd.entry.js} +1 -1
- package/dist/bn-template-engine/p-7d1083f6.entry.js +1 -0
- package/dist/bn-template-engine/{p-7e9dbc93.entry.js → p-91e5dddf.entry.js} +1 -1
- package/dist/bn-template-engine/{p-b9e94127.entry.js → p-93eaded3.entry.js} +1 -1
- package/dist/bn-template-engine/{p-BpWWgN6k.js → p-D1SJ10zl.js} +1 -1
- package/dist/bn-template-engine/p-D75i_YOP.js +1 -0
- package/dist/bn-template-engine/{p-A8xyE4b1.js → p-Da6p_F4J.js} +1 -1
- package/dist/bn-template-engine/{p-a1380d7c.entry.js → p-c3383557.entry.js} +1 -1
- package/dist/bn-template-engine/{p-ba912130.entry.js → p-cda4322a.entry.js} +1 -1
- package/dist/bn-template-engine/{p-6c7f0076.entry.js → p-e49f9170.entry.js} +1 -1
- package/dist/bn-template-engine/{p-6077155f.entry.js → p-f275b9fe.entry.js} +1 -1
- package/dist/cjs/bn-asset_21.cjs.entry.js +369 -122
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +18 -8
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +3 -3
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +3 -3
- package/dist/cjs/bn-grid.cjs.entry.js +1 -1
- package/dist/cjs/bn-image.cjs.entry.js +1 -1
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +2 -2
- package/dist/cjs/bn-tree.cjs.entry.js +1 -1
- package/dist/cjs/{layoutObserver-DUYYkDMQ.js → layoutObserver-D8leSb4j.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-BIJQ2NV1.js → scaling-B6_M_HWH.js} +82 -0
- package/dist/cjs/{withStyled-Cm9dWQhu.js → withStyled-DuwvaDMp.js} +3 -3
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +15 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +81 -39
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +34 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +80 -35
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +34 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +76 -19
- package/dist/collection/components/bn-table/bn-table.js +111 -45
- package/dist/collection/components/bn-table/ibcs-table.js +37 -2
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +2 -2
- package/dist/collection/utils/dataAnalyzer.js +17 -8
- package/dist/collection/utils/scaling.js +79 -0
- package/dist/collection/utils/validate.js +3 -3
- package/dist/components/DataFormatDigits.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.js +1 -1
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-scaling-group.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/scaling.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withDataset.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/esm/bn-asset_21.entry.js +369 -122
- package/dist/esm/bn-chart-bubble.entry.js +18 -8
- package/dist/esm/bn-chart-bullet.entry.js +3 -3
- package/dist/esm/bn-chart-scatter.entry.js +3 -3
- package/dist/esm/bn-grid.entry.js +1 -1
- package/dist/esm/bn-image.entry.js +1 -1
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-text.entry.js +2 -2
- package/dist/esm/bn-tree.entry.js +1 -1
- package/dist/esm/{layoutObserver-BJBEyhNf.js → layoutObserver-DtZb2vdM.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-BGnpSN1j.js → scaling-Bw8XyrFq.js} +80 -1
- package/dist/esm/{withStyled-2l5Tx3cf.js → withStyled-41rsCSM1.js} +3 -3
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +5 -2
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +33 -16
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +8 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +35 -18
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +8 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +28 -8
- package/dist/types/components/bn-table/bn-table.d.ts +37 -17
- package/dist/types/components/bn-table/ibcs-table.d.ts +8 -0
- package/dist/types/components.d.ts +85 -51
- package/dist/types/utils/dataAnalyzer.d.ts +5 -1
- package/dist/types/utils/scaling.d.ts +63 -0
- package/dist/types/utils/validate.d.ts +2 -2
- package/package.json +1 -1
- package/readme.md +2 -0
- package/dist/bn-template-engine/p-C9i1Xsib.js +0 -1
- package/dist/bn-template-engine/p-b5274369.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forceUpdate, h, Host, writeTask } from "@stencil/core";
|
|
2
|
-
import { isBlankInput, isValidBoolean, isValidDirection, isValidInteger, isValidLevel, isValidMeasureScale,
|
|
2
|
+
import { isBlankInput, isValidBoolean, isValidDirection, isValidInteger, isValidLevel, isValidMeasureScale, validateOrderList, validateScenarioList, validateStackConfig, validateVariancesList, } from "../../utils/validate";
|
|
3
3
|
import withDataset from "../../utils/withDataset";
|
|
4
4
|
import withComponentStatus from "../../utils/withComponentStatus";
|
|
5
5
|
import withTranslation from "../../utils/withTranslation";
|
|
@@ -11,7 +11,7 @@ import withRuleSet from "../../utils/withRuleSet";
|
|
|
11
11
|
import withHasError from "../../utils/withHasError";
|
|
12
12
|
import withInheritedProps, { isInheritedValue } from "../../utils/withInheritedProps";
|
|
13
13
|
import { getParentDimensions } from "../../utils/parentDimensions";
|
|
14
|
-
import { parseScaling } from "../../utils/scaling";
|
|
14
|
+
import { formatScalingValue, parseScaling, resolveScalingValue } from "../../utils/scaling";
|
|
15
15
|
import { observeParentResize } from "../../utils/layoutObserver";
|
|
16
16
|
import { AggregationLevel, StackBy, StackMode, StackOrder } from "../../utils/constants";
|
|
17
17
|
import { OrderColumn, OrderDirection } from "../../utils/model/Order";
|
|
@@ -64,8 +64,7 @@ export class Chart {
|
|
|
64
64
|
}
|
|
65
65
|
validateUnitScaling(newValue) {
|
|
66
66
|
const errId = "ERR_unitScaling";
|
|
67
|
-
|
|
68
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
67
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
69
68
|
this.errors.addOrReplace({
|
|
70
69
|
id: errId,
|
|
71
70
|
type: "warning",
|
|
@@ -78,8 +77,7 @@ export class Chart {
|
|
|
78
77
|
}
|
|
79
78
|
validatePercentageScaling(newValue) {
|
|
80
79
|
const errId = "ERR_percentageScaling";
|
|
81
|
-
|
|
82
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
80
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
83
81
|
this.errors.addOrReplace({
|
|
84
82
|
id: errId,
|
|
85
83
|
type: "warning",
|
|
@@ -326,6 +324,41 @@ export class Chart {
|
|
|
326
324
|
this.stack = "";
|
|
327
325
|
this.pixelPerUnitGroupMap = new Map();
|
|
328
326
|
this._autoScaleGuard = false;
|
|
327
|
+
this.autoUnitWarningActive = false;
|
|
328
|
+
this.autoPctWarningActive = false;
|
|
329
|
+
/**
|
|
330
|
+
* Receives the auto-fitted values from the inner ibcs-chart-structure (px
|
|
331
|
+
* per unit / px per 1.0 fraction) and surfaces them in the AUTO_* warnings,
|
|
332
|
+
* converted back to the attribute's units-per-em form so users can copy
|
|
333
|
+
* them into a bn-scaling-group.
|
|
334
|
+
*/
|
|
335
|
+
this.handleAutoScalingReport = (report) => {
|
|
336
|
+
var _a, _b;
|
|
337
|
+
const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
|
|
338
|
+
const effFontPx = this.getEffectiveFontPx();
|
|
339
|
+
if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
|
|
340
|
+
const unitsPerEm = effFontPx / report.unit;
|
|
341
|
+
if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
|
|
342
|
+
this.lastReportedUnitsPerEm = unitsPerEm;
|
|
343
|
+
this.errors.addOrReplace({
|
|
344
|
+
id: "AUTO_unitScaling",
|
|
345
|
+
type: "warning",
|
|
346
|
+
message: `unit-scaling: ${Chart.describeScalingInput(String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(unitsPerEm)} units.`,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
|
|
351
|
+
const ppPerEm = (100 * effFontPx) / report.percentage;
|
|
352
|
+
if (changed(ppPerEm, this.lastReportedPpPerEm)) {
|
|
353
|
+
this.lastReportedPpPerEm = ppPerEm;
|
|
354
|
+
this.errors.addOrReplace({
|
|
355
|
+
id: "AUTO_percentageScaling",
|
|
356
|
+
type: "warning",
|
|
357
|
+
message: `percentage-scaling: ${Chart.describeScalingInput(String((_b = this.percentageScaling) !== null && _b !== void 0 ? _b : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(ppPerEm)} percentage points.`,
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
};
|
|
329
362
|
withStyled(this);
|
|
330
363
|
withComponentStatus(this);
|
|
331
364
|
withDataset(this, (name, _data) => {
|
|
@@ -464,12 +497,9 @@ export class Chart {
|
|
|
464
497
|
* Skipped for auto/unset unit-scaling since auto-fit handles width.
|
|
465
498
|
*/
|
|
466
499
|
checkWidthOverflow() {
|
|
467
|
-
var _a;
|
|
468
500
|
const errId = "WARN_overflow";
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
.toLowerCase();
|
|
472
|
-
if (us === "" || us === "auto") {
|
|
501
|
+
if (resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap).kind !== "value") {
|
|
502
|
+
// Auto (explicit or fallback) fits the width by construction.
|
|
473
503
|
this.errors.remove(errId);
|
|
474
504
|
return;
|
|
475
505
|
}
|
|
@@ -478,7 +508,7 @@ export class Chart {
|
|
|
478
508
|
this.errors.addOrReplace({
|
|
479
509
|
id: errId,
|
|
480
510
|
type: "error",
|
|
481
|
-
message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px).
|
|
511
|
+
message: `Chart exceeds available width (${this.element.scrollWidth}px > ${Math.round(parent.width)}px). Increase unit-scaling or set to "auto".`,
|
|
482
512
|
});
|
|
483
513
|
}
|
|
484
514
|
else {
|
|
@@ -540,48 +570,56 @@ export class Chart {
|
|
|
540
570
|
const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
|
|
541
571
|
return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
|
|
542
572
|
}
|
|
573
|
+
/** "not set" for blank input, `invalid value "x"` otherwise — for AUTO_* messages. */
|
|
574
|
+
static describeScalingInput(raw) {
|
|
575
|
+
return raw === "" ? "not set" : `invalid value "${raw}"`;
|
|
576
|
+
}
|
|
543
577
|
preparePixelPerUnit() {
|
|
544
|
-
|
|
545
|
-
if (
|
|
578
|
+
const resolved = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
579
|
+
if (resolved.kind === "value") {
|
|
546
580
|
this.errors.remove("AUTO_unitScaling");
|
|
547
|
-
|
|
581
|
+
this.autoUnitWarningActive = false;
|
|
582
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
583
|
+
// The attribute is data units per em; the inner chart expects px for one data unit.
|
|
584
|
+
return this.getEffectiveFontPx() / resolved.value;
|
|
548
585
|
}
|
|
549
586
|
// Explicit 'auto' → auto-calculate silently
|
|
550
|
-
if (
|
|
587
|
+
if (resolved.kind === "auto") {
|
|
551
588
|
this.errors.remove("AUTO_unitScaling");
|
|
589
|
+
this.autoUnitWarningActive = false;
|
|
590
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
552
591
|
return 0;
|
|
553
592
|
}
|
|
554
|
-
const numeric = Number(this.unitScaling);
|
|
555
|
-
if (!isNaN(numeric) && numeric > 0) {
|
|
556
|
-
this.errors.remove("AUTO_unitScaling");
|
|
557
|
-
return numeric;
|
|
558
|
-
}
|
|
559
593
|
// Not set / invalid → auto-calculate with warning
|
|
594
|
+
this.autoUnitWarningActive = true;
|
|
560
595
|
this.errors.addOrReplace({
|
|
561
596
|
id: "AUTO_unitScaling",
|
|
562
597
|
type: "warning",
|
|
563
|
-
message: `unit-scaling:
|
|
598
|
+
message: `unit-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
|
|
564
599
|
});
|
|
565
600
|
return 0;
|
|
566
601
|
}
|
|
567
602
|
preparePixelPerPercentage() {
|
|
568
|
-
|
|
569
|
-
if (
|
|
570
|
-
return this.pixelPerUnitGroupMap.get(this.percentageScaling);
|
|
571
|
-
}
|
|
572
|
-
if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
|
|
603
|
+
const resolved = resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
604
|
+
if (resolved.kind === "value") {
|
|
573
605
|
this.errors.remove("AUTO_percentageScaling");
|
|
574
|
-
|
|
606
|
+
this.autoPctWarningActive = false;
|
|
607
|
+
this.lastReportedPpPerEm = undefined;
|
|
608
|
+
// The attribute is percentage points per em; the inner chart expects
|
|
609
|
+
// px per 1.0 fraction (= per 100 percentage points).
|
|
610
|
+
return (100 * this.getEffectiveFontPx()) / resolved.value;
|
|
575
611
|
}
|
|
576
|
-
|
|
577
|
-
if (!isNaN(numeric) && numeric > 0) {
|
|
612
|
+
if (resolved.kind === "auto") {
|
|
578
613
|
this.errors.remove("AUTO_percentageScaling");
|
|
579
|
-
|
|
614
|
+
this.autoPctWarningActive = false;
|
|
615
|
+
this.lastReportedPpPerEm = undefined;
|
|
616
|
+
return 0;
|
|
580
617
|
}
|
|
618
|
+
this.autoPctWarningActive = true;
|
|
581
619
|
this.errors.addOrReplace({
|
|
582
620
|
id: "AUTO_percentageScaling",
|
|
583
621
|
type: "warning",
|
|
584
|
-
message: `percentage-scaling:
|
|
622
|
+
message: `percentage-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
|
|
585
623
|
});
|
|
586
624
|
return 0;
|
|
587
625
|
}
|
|
@@ -790,14 +828,13 @@ export class Chart {
|
|
|
790
828
|
return this.measureUnit;
|
|
791
829
|
}
|
|
792
830
|
chartTemplate(localScenarioString, idx) {
|
|
793
|
-
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
794
831
|
const ppu = this.preparePixelPerUnit();
|
|
795
832
|
const ppp = this.preparePixelPerPercentage();
|
|
796
833
|
const stackConfig = this.prepareStackConfig();
|
|
797
834
|
const scenarios = this.prepareScenarios();
|
|
798
835
|
// Dimension stacking uses only the first scenario
|
|
799
836
|
const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
800
|
-
return (h("ibcs-chart-structure", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu
|
|
837
|
+
return (h("ibcs-chart-structure", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideCategories: this.prepareHideCategories(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, limit: this.prepareLimit(), styles: this.prepareStyle(), i18n: this.prepareI18n(), order: this.prepareOrder(), level: this.prepareLevel(), filter: this.prepareFilter(), "measure-scale": this.prepareMeasureScale(), "measure-unit": this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(idx), stackConfig: stackConfig, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
|
|
801
838
|
}
|
|
802
839
|
getEffectiveScaleFactor() {
|
|
803
840
|
const { mode, factor } = parseScaling(this.scale);
|
|
@@ -807,6 +844,11 @@ export class Chart {
|
|
|
807
844
|
return this.appliedScaleFactor;
|
|
808
845
|
return 1;
|
|
809
846
|
}
|
|
847
|
+
/** Effective font size in px: base font from the style store × effective scale factor. */
|
|
848
|
+
getEffectiveFontPx() {
|
|
849
|
+
const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
|
|
850
|
+
return baseFontSize * this.getEffectiveScaleFactor();
|
|
851
|
+
}
|
|
810
852
|
getFontStyles() {
|
|
811
853
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
812
854
|
return this.componentStyle(($) => {
|
|
@@ -827,7 +869,7 @@ export class Chart {
|
|
|
827
869
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
828
870
|
}
|
|
829
871
|
const fontStyles = this.getFontStyles();
|
|
830
|
-
return (h(Host, { key: '
|
|
872
|
+
return (h(Host, { key: '8050c526688b5094b630f9646fb0dd141a63beb2', style: fontStyles }, h("div", { key: '771c98ce06779536ac1b701a7cad40becc47738c', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
831
873
|
}
|
|
832
874
|
static get is() { return "bn-chart-structure"; }
|
|
833
875
|
static get encapsulation() { return "shadow"; }
|
|
@@ -971,12 +1013,12 @@ export class Chart {
|
|
|
971
1013
|
"text": "unit-scaling=\"auto\""
|
|
972
1014
|
}, {
|
|
973
1015
|
"name": "example",
|
|
974
|
-
"text": "unit-scaling=\"
|
|
1016
|
+
"text": "unit-scaling=\"1M\""
|
|
975
1017
|
}, {
|
|
976
1018
|
"name": "example",
|
|
977
1019
|
"text": "unit-scaling=\"revenue-scale\""
|
|
978
1020
|
}],
|
|
979
|
-
"text": "
|
|
1021
|
+
"text": "Data units displayed per 1 em of bar length (horizontal bars) \u2014 map-scale\nsemantics: a larger value means smaller bars.\n\n| Value | Behavior |\n|--------------------|-------------------------------------------------------------|\n| `\"auto\"` | Auto-fit bars to fill the available container width |\n| not set / invalid | Same as auto, but emits `AUTO_unitScaling` warning |\n| `\"250000\"`, `\"1M\"` | Units per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |\n\nWhen using a custom value that causes the chart to exceed its container,\na `WARN_overflow` error is emitted."
|
|
980
1022
|
},
|
|
981
1023
|
"getter": false,
|
|
982
1024
|
"setter": false,
|
|
@@ -996,12 +1038,12 @@ export class Chart {
|
|
|
996
1038
|
"docs": {
|
|
997
1039
|
"tags": [{
|
|
998
1040
|
"name": "example",
|
|
999
|
-
"text": "percentage-scaling=\"
|
|
1041
|
+
"text": "percentage-scaling=\"10\""
|
|
1000
1042
|
}, {
|
|
1001
1043
|
"name": "example",
|
|
1002
1044
|
"text": "percentage-scaling=\"pct-scale\""
|
|
1003
1045
|
}],
|
|
1004
|
-
"text": "
|
|
1046
|
+
"text": "Percentage points displayed per 1 em of bar length for relative\nvariances \u2014 a larger value means shorter bars.\n\n| Value | Behavior |\n|-------------------|---------------------------------------------------------------|\n| `\"auto\"` | Auto-fit to available width |\n| not set / invalid | Same as auto with `AUTO_percentageScaling` warning |\n| `\"10\"`, `\"2.5\"` | Percentage points per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |"
|
|
1005
1047
|
},
|
|
1006
1048
|
"getter": false,
|
|
1007
1049
|
"setter": false,
|
|
@@ -109,6 +109,13 @@ export class IbcsChartStructure {
|
|
|
109
109
|
if (!autoUnit && !autoPercent) {
|
|
110
110
|
return; // Both explicit — nothing to auto-fit
|
|
111
111
|
}
|
|
112
|
+
const reportResolved = () => {
|
|
113
|
+
var _a;
|
|
114
|
+
(_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
115
|
+
unit: autoUnit ? config.pixelPerUnit : undefined,
|
|
116
|
+
percentage: autoPercent ? config.pixelPerPercentage : undefined,
|
|
117
|
+
});
|
|
118
|
+
};
|
|
112
119
|
const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
|
|
113
120
|
const db = this.getDb();
|
|
114
121
|
if (!targetWidth || targetWidth <= 0) {
|
|
@@ -118,6 +125,7 @@ export class IbcsChartStructure {
|
|
|
118
125
|
config.pixelPerPercentage = 50;
|
|
119
126
|
this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
|
|
120
127
|
this.chart.setI18n(this.i18n);
|
|
128
|
+
reportResolved();
|
|
121
129
|
return;
|
|
122
130
|
}
|
|
123
131
|
// First pass: set auto values to 1 and measure total width + bar extent
|
|
@@ -130,6 +138,7 @@ export class IbcsChartStructure {
|
|
|
130
138
|
this.chart.toString();
|
|
131
139
|
const svgWidth = this.chart.getAllocatedCanvasWidth();
|
|
132
140
|
if (svgWidth <= 0) {
|
|
141
|
+
reportResolved();
|
|
133
142
|
return;
|
|
134
143
|
}
|
|
135
144
|
// Separate fixed parts (labels, padding, spacing) from variable part (bar extent).
|
|
@@ -152,6 +161,7 @@ export class IbcsChartStructure {
|
|
|
152
161
|
// Second pass with the corrected scaling
|
|
153
162
|
this.chart = new StructureChart(new IBCSRuleSet(this.ruleSetConfig), db, this.tableName, config, styles);
|
|
154
163
|
this.chart.setI18n(this.i18n);
|
|
164
|
+
reportResolved();
|
|
155
165
|
}
|
|
156
166
|
async componentWillRender() {
|
|
157
167
|
// return await (async () => {
|
|
@@ -367,6 +377,30 @@ export class IbcsChartStructure {
|
|
|
367
377
|
"attribute": "pixel-per-percentage",
|
|
368
378
|
"defaultValue": "50"
|
|
369
379
|
},
|
|
380
|
+
"reportAutoScaling": {
|
|
381
|
+
"type": "unknown",
|
|
382
|
+
"mutable": false,
|
|
383
|
+
"complexType": {
|
|
384
|
+
"original": "(report: AutoScalingReport) => void",
|
|
385
|
+
"resolved": "(report: AutoScalingReport) => void",
|
|
386
|
+
"references": {
|
|
387
|
+
"AutoScalingReport": {
|
|
388
|
+
"location": "import",
|
|
389
|
+
"path": "../../utils/scaling",
|
|
390
|
+
"id": "src/utils/scaling.ts::AutoScalingReport",
|
|
391
|
+
"referenceLocation": "AutoScalingReport"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"required": false,
|
|
396
|
+
"optional": true,
|
|
397
|
+
"docs": {
|
|
398
|
+
"tags": [],
|
|
399
|
+
"text": "Internal wrapper channel: called with the auto-fitted values (px for one\ndata unit / px per 1.0 fraction) whenever one of them was auto-resolved, so\nthe outer `bn-chart-structure` can surface them in its AUTO_* warnings.\nNot for end users."
|
|
400
|
+
},
|
|
401
|
+
"getter": false,
|
|
402
|
+
"setter": false
|
|
403
|
+
},
|
|
370
404
|
"limit": {
|
|
371
405
|
"type": "number",
|
|
372
406
|
"mutable": false,
|
|
@@ -11,7 +11,7 @@ import withRuleSet from "../../utils/withRuleSet";
|
|
|
11
11
|
import withHasError from "../../utils/withHasError";
|
|
12
12
|
import withInheritedProps, { isInheritedValue } from "../../utils/withInheritedProps";
|
|
13
13
|
import { getParentDimensions } from "../../utils/parentDimensions";
|
|
14
|
-
import { parseScaling } from "../../utils/scaling";
|
|
14
|
+
import { formatScalingValue, parseScaling, resolveScalingValue } from "../../utils/scaling";
|
|
15
15
|
import { observeParentResize } from "../../utils/layoutObserver";
|
|
16
16
|
import { OrderColumn, OrderDirection } from "../../utils/model/Order";
|
|
17
17
|
import { Formatter } from "../../utils/formatter";
|
|
@@ -101,8 +101,7 @@ export class Chart {
|
|
|
101
101
|
}
|
|
102
102
|
validateUnitScaling(newValue) {
|
|
103
103
|
const errId = "ERR_unitScaling";
|
|
104
|
-
|
|
105
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
104
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
106
105
|
this.errors.addOrReplace({
|
|
107
106
|
id: errId,
|
|
108
107
|
type: "warning",
|
|
@@ -115,8 +114,7 @@ export class Chart {
|
|
|
115
114
|
}
|
|
116
115
|
validatePercentageScaling(newValue) {
|
|
117
116
|
const errId = "ERR_percentageScaling";
|
|
118
|
-
|
|
119
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
117
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
120
118
|
this.errors.addOrReplace({
|
|
121
119
|
id: errId,
|
|
122
120
|
type: "warning",
|
|
@@ -440,7 +438,7 @@ export class Chart {
|
|
|
440
438
|
* original value.
|
|
441
439
|
* <br /><br />
|
|
442
440
|
* values: <br />
|
|
443
|
-
* ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p //
|
|
441
|
+
* ```_ // k // M // G // T // P // E // Z // Y // m // my (μ) // n // p // f // a // z // y // GREATEST // LEAST```
|
|
444
442
|
* <br /><br />
|
|
445
443
|
* SiPrefix overview:
|
|
446
444
|
* ``` "Y": 1E+24,```<br />
|
|
@@ -453,7 +451,7 @@ export class Chart {
|
|
|
453
451
|
* ``` "k": 1000,```<br />
|
|
454
452
|
* <br />
|
|
455
453
|
* ``` "m": 0.001,```<br />
|
|
456
|
-
* ``` "μ
|
|
454
|
+
* ``` "my" (μ): 0.000001,```<br />
|
|
457
455
|
* ``` "n": 0.000000001,```<br />
|
|
458
456
|
* ``` "p": 0.000000000001,```<br />
|
|
459
457
|
* ``` "f": 0.000000000000001,```<br />
|
|
@@ -488,6 +486,41 @@ export class Chart {
|
|
|
488
486
|
this._lastObservedWidth = 0;
|
|
489
487
|
this._settleTimer = null;
|
|
490
488
|
this._lastAppliedHeight = 0;
|
|
489
|
+
this.autoUnitWarningActive = false;
|
|
490
|
+
this.autoPctWarningActive = false;
|
|
491
|
+
/**
|
|
492
|
+
* Receives the auto-fitted values from the inner ibcs-chart-time (px per
|
|
493
|
+
* unit / px per 1.0 fraction) and surfaces them in the AUTO_* warnings,
|
|
494
|
+
* converted back to the attribute's units-per-em form so users can copy
|
|
495
|
+
* them into a bn-scaling-group.
|
|
496
|
+
*/
|
|
497
|
+
this.handleAutoScalingReport = (report) => {
|
|
498
|
+
var _a, _b;
|
|
499
|
+
const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
|
|
500
|
+
const effFontPx = this.getEffectiveFontPx();
|
|
501
|
+
if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
|
|
502
|
+
const unitsPerEm = effFontPx / report.unit;
|
|
503
|
+
if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
|
|
504
|
+
this.lastReportedUnitsPerEm = unitsPerEm;
|
|
505
|
+
this.errors.addOrReplace({
|
|
506
|
+
id: "AUTO_unitScaling",
|
|
507
|
+
type: "warning",
|
|
508
|
+
message: `unit-scaling: ${Chart.describeScalingInput(String((_a = this.unitScaling) !== null && _a !== void 0 ? _a : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(unitsPerEm)} units.`,
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
|
|
513
|
+
const ppPerEm = (100 * effFontPx) / report.percentage;
|
|
514
|
+
if (changed(ppPerEm, this.lastReportedPpPerEm)) {
|
|
515
|
+
this.lastReportedPpPerEm = ppPerEm;
|
|
516
|
+
this.errors.addOrReplace({
|
|
517
|
+
id: "AUTO_percentageScaling",
|
|
518
|
+
type: "warning",
|
|
519
|
+
message: `percentage-scaling: ${Chart.describeScalingInput(String((_b = this.percentageScaling) !== null && _b !== void 0 ? _b : "").trim())}, auto-fitted to 1 em ≈ ${formatScalingValue(ppPerEm)} percentage points.`,
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
};
|
|
491
524
|
withStyled(this);
|
|
492
525
|
withComponentStatus(this);
|
|
493
526
|
withDataset(this, (name, _data) => {
|
|
@@ -721,48 +754,56 @@ export class Chart {
|
|
|
721
754
|
const i18nMapGlobal = new Map(i18nMetaLabelsGlobal.map((key) => [key, this.t("global.".concat(key))]));
|
|
722
755
|
return new Map([...i18nMapGlobal.entries(), ...i18nMapLocal.entries()]);
|
|
723
756
|
}
|
|
757
|
+
/** "not set" for blank input, `invalid value "x"` otherwise — for AUTO_* messages. */
|
|
758
|
+
static describeScalingInput(raw) {
|
|
759
|
+
return raw === "" ? "not set" : `invalid value "${raw}"`;
|
|
760
|
+
}
|
|
724
761
|
preparePixelPerUnit() {
|
|
725
|
-
|
|
726
|
-
if (
|
|
762
|
+
const resolved = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
763
|
+
if (resolved.kind === "value") {
|
|
727
764
|
this.errors.remove("AUTO_unitScaling");
|
|
728
|
-
|
|
765
|
+
this.autoUnitWarningActive = false;
|
|
766
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
767
|
+
// The attribute is data units per em; the inner chart expects px for one data unit.
|
|
768
|
+
return this.getEffectiveFontPx() / resolved.value;
|
|
729
769
|
}
|
|
730
770
|
// Explicit 'auto' → auto-calculate silently
|
|
731
|
-
if (
|
|
771
|
+
if (resolved.kind === "auto") {
|
|
732
772
|
this.errors.remove("AUTO_unitScaling");
|
|
773
|
+
this.autoUnitWarningActive = false;
|
|
774
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
733
775
|
return 0;
|
|
734
776
|
}
|
|
735
|
-
const numeric = Number(this.unitScaling);
|
|
736
|
-
if (!isNaN(numeric) && numeric > 0) {
|
|
737
|
-
this.errors.remove("AUTO_unitScaling");
|
|
738
|
-
return numeric;
|
|
739
|
-
}
|
|
740
777
|
// Not set / invalid → auto-calculate with warning
|
|
778
|
+
this.autoUnitWarningActive = true;
|
|
741
779
|
this.errors.addOrReplace({
|
|
742
780
|
id: "AUTO_unitScaling",
|
|
743
781
|
type: "warning",
|
|
744
|
-
message: `unit-scaling:
|
|
782
|
+
message: `unit-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
|
|
745
783
|
});
|
|
746
784
|
return 0;
|
|
747
785
|
}
|
|
748
786
|
preparePixelPerPercentage() {
|
|
749
|
-
|
|
750
|
-
if (
|
|
751
|
-
return this.pixelPerUnitGroupMap.get(this.percentageScaling);
|
|
752
|
-
}
|
|
753
|
-
if (((_a = this.percentageScaling) === null || _a === void 0 ? void 0 : _a.toString().trim().toLowerCase()) === "auto") {
|
|
787
|
+
const resolved = resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
788
|
+
if (resolved.kind === "value") {
|
|
754
789
|
this.errors.remove("AUTO_percentageScaling");
|
|
755
|
-
|
|
790
|
+
this.autoPctWarningActive = false;
|
|
791
|
+
this.lastReportedPpPerEm = undefined;
|
|
792
|
+
// The attribute is percentage points per em; the inner chart expects
|
|
793
|
+
// px per 1.0 fraction (= per 100 percentage points).
|
|
794
|
+
return (100 * this.getEffectiveFontPx()) / resolved.value;
|
|
756
795
|
}
|
|
757
|
-
|
|
758
|
-
if (!isNaN(numeric) && numeric > 0) {
|
|
796
|
+
if (resolved.kind === "auto") {
|
|
759
797
|
this.errors.remove("AUTO_percentageScaling");
|
|
760
|
-
|
|
798
|
+
this.autoPctWarningActive = false;
|
|
799
|
+
this.lastReportedPpPerEm = undefined;
|
|
800
|
+
return 0;
|
|
761
801
|
}
|
|
802
|
+
this.autoPctWarningActive = true;
|
|
762
803
|
this.errors.addOrReplace({
|
|
763
804
|
id: "AUTO_percentageScaling",
|
|
764
805
|
type: "warning",
|
|
765
|
-
message: `percentage-scaling:
|
|
806
|
+
message: `percentage-scaling: ${Chart.describeScalingInput(resolved.raw)}, auto-calculated to fit available space.`,
|
|
766
807
|
});
|
|
767
808
|
return 0;
|
|
768
809
|
}
|
|
@@ -1032,13 +1073,12 @@ export class Chart {
|
|
|
1032
1073
|
const preparedI18n = this.prepareI18n();
|
|
1033
1074
|
const preparedStyle = this.prepareStyle();
|
|
1034
1075
|
const fullParentWidth = getParentDimensions(this.element).width;
|
|
1035
|
-
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
1036
1076
|
const ppu = this.preparePixelPerUnit();
|
|
1037
1077
|
const ppp = this.preparePixelPerPercentage();
|
|
1038
1078
|
const stackConfig = this.prepareStackConfig();
|
|
1039
1079
|
const scenarios = this.prepareScenarios();
|
|
1040
1080
|
const effectiveScenarios = (stackConfig === null || stackConfig === void 0 ? void 0 : stackConfig.by) === StackBy.DIMENSIONS ? scenarios.slice(0, 1) : scenarios;
|
|
1041
|
-
return (h("ibcs-chart-time", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideAxisLabels: this.prepareHideAxisLabels(idx), pixelPerUnit: ppu
|
|
1081
|
+
return (h("ibcs-chart-time", { tableName: this.datasetName, dataVersion: this.dataVersion, chartTitle: this.prepareChartTitle(idx), scenarios: effectiveScenarios, variances: [localScenarioString], hideAxisLabels: this.prepareHideAxisLabels(idx), pixelPerUnit: ppu, pixelPerPercentage: ppp, reportAutoScaling: this.handleAutoScalingReport, limit: this.prepareLimit(), leftSideOffsetForHorizontalSync: this.prepareLeftSideOffset(preparedI18n, preparedStyle), styles: preparedStyle, i18n: preparedI18n, order: this.prepareOrder(), level: this.prepareLevel(), 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(), containerWidth: fullParentWidth, parentDimensions: this.prepareDimension(), ruleSetConfig: this.ruleSetConfig() }));
|
|
1042
1082
|
}
|
|
1043
1083
|
getEffectiveScaleFactor() {
|
|
1044
1084
|
const { mode, factor } = parseScaling(this.scale);
|
|
@@ -1048,6 +1088,11 @@ export class Chart {
|
|
|
1048
1088
|
return this.appliedScaleFactor;
|
|
1049
1089
|
return 1;
|
|
1050
1090
|
}
|
|
1091
|
+
/** Effective font size in px: base font from the style store × effective scale factor. */
|
|
1092
|
+
getEffectiveFontPx() {
|
|
1093
|
+
const baseFontSize = this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; });
|
|
1094
|
+
return baseFontSize * this.getEffectiveScaleFactor();
|
|
1095
|
+
}
|
|
1051
1096
|
getFontStyles() {
|
|
1052
1097
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
1053
1098
|
return this.componentStyle(($) => {
|
|
@@ -1068,7 +1113,7 @@ export class Chart {
|
|
|
1068
1113
|
scenariosArray = [...scenariosArray, ...variancesArray];
|
|
1069
1114
|
}
|
|
1070
1115
|
const fontStyles = this.getFontStyles();
|
|
1071
|
-
return (h(Host, { key: '
|
|
1116
|
+
return (h(Host, { key: 'a8070cc2333500d65e991851af93f498bd007e74', style: fontStyles }, h("div", { key: 'f54fa6d3db57c652fc6f900be59243925a718aa2', class: "container" }, scenariosArray.map(this.chartTemplate))));
|
|
1072
1117
|
}
|
|
1073
1118
|
static get is() { return "bn-chart-time"; }
|
|
1074
1119
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1237,12 +1282,12 @@ export class Chart {
|
|
|
1237
1282
|
"text": "unit-scaling=\"auto\""
|
|
1238
1283
|
}, {
|
|
1239
1284
|
"name": "example",
|
|
1240
|
-
"text": "unit-scaling=\"
|
|
1285
|
+
"text": "unit-scaling=\"1M\""
|
|
1241
1286
|
}, {
|
|
1242
1287
|
"name": "example",
|
|
1243
1288
|
"text": "unit-scaling=\"revenue-scale\""
|
|
1244
1289
|
}],
|
|
1245
|
-
"text": "
|
|
1290
|
+
"text": "Data units displayed per 1 em of bar length (vertical bars) \u2014 map-scale\nsemantics: a larger value means smaller bars.\n\n| Value | Behavior |\n|--------------------|-------------------------------------------------------------|\n| `\"auto\"` | Auto-fit bars to fill the available container height |\n| not set / invalid | Same as auto, but emits `AUTO_unitScaling` warning |\n| `\"250000\"`, `\"1M\"` | Units per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |"
|
|
1246
1291
|
},
|
|
1247
1292
|
"getter": false,
|
|
1248
1293
|
"setter": false,
|
|
@@ -1262,12 +1307,12 @@ export class Chart {
|
|
|
1262
1307
|
"docs": {
|
|
1263
1308
|
"tags": [{
|
|
1264
1309
|
"name": "example",
|
|
1265
|
-
"text": "percentage-scaling=\"
|
|
1310
|
+
"text": "percentage-scaling=\"10\""
|
|
1266
1311
|
}, {
|
|
1267
1312
|
"name": "example",
|
|
1268
1313
|
"text": "percentage-scaling=\"pct-scale\""
|
|
1269
1314
|
}],
|
|
1270
|
-
"text": "
|
|
1315
|
+
"text": "Percentage points displayed per 1 em of pin/bar length for relative\nvariances \u2014 a larger value means shorter pins.\n\n| Value | Behavior |\n|-------------------|---------------------------------------------------------------|\n| `\"auto\"` | Auto-fit to available height (same two-pass as unit-scaling) |\n| not set / invalid | Same as auto with `AUTO_percentageScaling` warning |\n| `\"10\"`, `\"2.5\"` | Percentage points per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |\n| group name | References a `<bn-scaling-group>` for synchronized scaling |"
|
|
1271
1316
|
},
|
|
1272
1317
|
"getter": false,
|
|
1273
1318
|
"setter": false,
|
|
@@ -1529,7 +1574,7 @@ export class Chart {
|
|
|
1529
1574
|
"optional": false,
|
|
1530
1575
|
"docs": {
|
|
1531
1576
|
"tags": [],
|
|
1532
|
-
"text": "Sets the SiPrefix of the Mesaurements and converts the\noriginal value.\n<br /><br />\nvalues: <br />\n```_ // k // M // G // T // P // E // Z // Y // m // \u03BC // n // p //
|
|
1577
|
+
"text": "Sets the SiPrefix of the Mesaurements and converts the\noriginal value.\n<br /><br />\nvalues: <br />\n```_ // k // M // G // T // P // E // Z // Y // m // my (\u03BC) // n // p // f // a // z // y // GREATEST // LEAST```\n<br /><br />\nSiPrefix overview:\n``` \"Y\": 1E+24,```<br />\n``` \"Z\": 1E+21,```<br />\n``` \"E\": 1E+18,```<br />\n``` \"P\": 1E+15,```<br />\n``` \"T\": 1E+12,```<br />\n``` \"G\": 1000000000,```<br />\n``` \"M\": 1000000,```<br />\n``` \"k\": 1000,```<br />\n<br />\n``` \"m\": 0.001,```<br />\n``` \"my\" (\u03BC): 0.000001,```<br />\n``` \"n\": 0.000000001,```<br />\n``` \"p\": 0.000000000001,```<br />\n``` \"f\": 0.000000000000001,```<br />\n``` \"a\": 0.000000000000000001,```<br />\n``` \"z\": 0.000000000000000000001,```<br />\n``` \"y\": 0.000000000000000000000001,```<br />\n<br /><br />\nSpecial modes:\n```GREATEST``` seaches for the bigest (farest to zero) Value in the dataset and sets this value to SiPrefix<br />\n```LEAST``` searches for smallest (closest to zero) Value in the dataset and sets this value to SiPrefix<br />\n<br /><br />\n```_``` is the value for no SiPrefix the value is displayed as in the dataset stored."
|
|
1533
1578
|
},
|
|
1534
1579
|
"getter": false,
|
|
1535
1580
|
"setter": false,
|
|
@@ -112,6 +112,13 @@ export class IbcsChartTime {
|
|
|
112
112
|
if (!autoUnit && !autoPercent) {
|
|
113
113
|
return; // Both explicit — nothing to auto-fit
|
|
114
114
|
}
|
|
115
|
+
const reportResolved = () => {
|
|
116
|
+
var _a;
|
|
117
|
+
(_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
118
|
+
unit: autoUnit ? config.pixelPerUnit : undefined,
|
|
119
|
+
percentage: autoPercent ? config.pixelPerPercentage : undefined,
|
|
120
|
+
});
|
|
121
|
+
};
|
|
115
122
|
const targetHeight = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.height;
|
|
116
123
|
const availableWidth = this.containerWidth || 0;
|
|
117
124
|
if (!targetHeight || targetHeight <= 0) {
|
|
@@ -121,6 +128,7 @@ export class IbcsChartTime {
|
|
|
121
128
|
config.pixelPerPercentage = 50;
|
|
122
129
|
this.chart = new TimeChart(new IBCSRuleSet(this.ruleSetConfig), this.getDb(), this.tableName, config, styles, availableWidth);
|
|
123
130
|
this.chart.setI18n(this.i18n);
|
|
131
|
+
reportResolved();
|
|
124
132
|
return;
|
|
125
133
|
}
|
|
126
134
|
// First pass: set auto values to 1 and measure SVG height
|
|
@@ -133,6 +141,7 @@ export class IbcsChartTime {
|
|
|
133
141
|
this.chart.toString();
|
|
134
142
|
const svgHeight = this.chart.getAllocatedCanvasHeight();
|
|
135
143
|
if (svgHeight <= 0) {
|
|
144
|
+
reportResolved();
|
|
136
145
|
return;
|
|
137
146
|
}
|
|
138
147
|
// Scale so the chart fits in ~90% of the available height
|
|
@@ -144,6 +153,7 @@ export class IbcsChartTime {
|
|
|
144
153
|
// Second pass with the corrected scaling
|
|
145
154
|
this.chart = new TimeChart(new IBCSRuleSet(this.ruleSetConfig), this.getDb(), this.tableName, config, styles, availableWidth);
|
|
146
155
|
this.chart.setI18n(this.i18n);
|
|
156
|
+
reportResolved();
|
|
147
157
|
}
|
|
148
158
|
async componentWillRender() {
|
|
149
159
|
// return await (async () => {
|
|
@@ -369,6 +379,30 @@ export class IbcsChartTime {
|
|
|
369
379
|
"attribute": "pixel-per-percentage",
|
|
370
380
|
"defaultValue": "50"
|
|
371
381
|
},
|
|
382
|
+
"reportAutoScaling": {
|
|
383
|
+
"type": "unknown",
|
|
384
|
+
"mutable": false,
|
|
385
|
+
"complexType": {
|
|
386
|
+
"original": "(report: AutoScalingReport) => void",
|
|
387
|
+
"resolved": "(report: AutoScalingReport) => void",
|
|
388
|
+
"references": {
|
|
389
|
+
"AutoScalingReport": {
|
|
390
|
+
"location": "import",
|
|
391
|
+
"path": "../../utils/scaling",
|
|
392
|
+
"id": "src/utils/scaling.ts::AutoScalingReport",
|
|
393
|
+
"referenceLocation": "AutoScalingReport"
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
"required": false,
|
|
398
|
+
"optional": true,
|
|
399
|
+
"docs": {
|
|
400
|
+
"tags": [],
|
|
401
|
+
"text": "Internal wrapper channel: called with the auto-fitted values (px for one\ndata unit / px per 1.0 fraction) whenever one of them was auto-resolved, so\nthe outer `bn-chart-time` can surface them in its AUTO_* warnings.\nNot for end users."
|
|
402
|
+
},
|
|
403
|
+
"getter": false,
|
|
404
|
+
"setter": false
|
|
405
|
+
},
|
|
372
406
|
"limit": {
|
|
373
407
|
"type": "number",
|
|
374
408
|
"mutable": false,
|