@bino-bi/bn-template-engine 1.0.0-next.21 → 1.0.0-next.23
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-28d5c266.entry.js → p-0a49cf00.entry.js} +1 -1
- package/dist/bn-template-engine/{p-b9e94127.entry.js → p-22b8d044.entry.js} +1 -1
- package/dist/bn-template-engine/{p-6c7f0076.entry.js → p-251bb53d.entry.js} +1 -1
- package/dist/bn-template-engine/p-2aed639e.entry.js +1 -0
- package/dist/bn-template-engine/{p-7e9dbc93.entry.js → p-4616b879.entry.js} +1 -1
- package/dist/bn-template-engine/{p-99477a27.entry.js → p-629edcca.entry.js} +1 -1
- package/dist/bn-template-engine/p-686d8e44.entry.js +1 -0
- package/dist/bn-template-engine/{p-a4ea9a79.entry.js → p-68aa61cc.entry.js} +1 -1
- package/dist/bn-template-engine/{p-DwYUTvvI.js → p-B5x8M8OC.js} +1 -1
- package/dist/bn-template-engine/{p-fFtEvsY-.js → p-BGrnfif3.js} +1 -1
- package/dist/bn-template-engine/{p-6lOdN-fB.js → p-BVfLus3u.js} +1 -1
- package/dist/bn-template-engine/{p-CJThzFZm.js → p-BcZ5GQZ8.js} +1 -1
- package/dist/bn-template-engine/{p-CYE0I1Mx.js → p-Bca5V28_.js} +1 -1
- package/dist/bn-template-engine/p-C5UYpZUU.js +2 -0
- package/dist/bn-template-engine/{p-BgIpdpfH.js → p-C7T4DAAW.js} +1 -1
- package/dist/bn-template-engine/p-CDo04UEU.js +1 -0
- package/dist/bn-template-engine/p-CTrNbSXN.js +1 -0
- package/dist/bn-template-engine/{p-C5uvAEKI.js → p-CbciPY-M.js} +1 -1
- package/dist/bn-template-engine/{p-BpWWgN6k.js → p-CuR4S456.js} +1 -1
- package/dist/bn-template-engine/p-DWtTjg0f.js +1 -0
- package/dist/bn-template-engine/{p-eEfqksk-.js → p-DdqXNsKP.js} +1 -1
- package/dist/bn-template-engine/{p-B4JfKvVT.js → p-DtLI_CzV.js} +1 -1
- package/dist/bn-template-engine/p-UtNHLX1j.js +1 -0
- package/dist/bn-template-engine/{p-ba912130.entry.js → p-aecb5de3.entry.js} +1 -1
- package/dist/bn-template-engine/{p-687032d5.entry.js → p-ba43d46e.entry.js} +1 -1
- package/dist/bn-template-engine/{p-6077155f.entry.js → p-c476e7bb.entry.js} +1 -1
- package/dist/bn-template-engine/{p-2d3ea756.entry.js → p-d7c670ec.entry.js} +1 -1
- package/dist/bn-template-engine/{p-a1380d7c.entry.js → p-e4a584a8.entry.js} +1 -1
- package/dist/bn-template-engine/{p-de29986f.entry.js → p-f12fb09b.entry.js} +1 -1
- package/dist/bn-template-engine/p-f9a721bb.entry.js +1 -0
- package/dist/cjs/{AxisConfig-D7CAyPLO.js → AxisConfig-DmP4U3JM.js} +1 -1
- package/dist/cjs/{LabelCollisionManager-DkdQ9Xdg.js → LabelCollisionManager-Cet3WPm0.js} +2 -2
- package/dist/cjs/{Order-IPfAP0q8.js → Order-DlKLywO_.js} +1 -1
- package/dist/cjs/{SVGStyle-BD8jApd4.js → SVGStyle-D78RaNnj.js} +2 -2
- package/dist/cjs/{SVGVariancesStyleGroup-BaWzR951.js → SVGVariancesStyleGroup-XvNAnYYA.js} +1 -1
- package/dist/cjs/{VarianceMeasure-BBWTgv2e.js → VarianceMeasure-BfZLlICl.js} +4 -4
- package/dist/cjs/{XYChartDataRow-BoR0CTfl.js → XYChartDataRow-B0NNOqxB.js} +4 -4
- package/dist/cjs/bn-asset_21.cjs.entry.js +1052 -314
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +25 -15
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +9 -9
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +9 -9
- package/dist/cjs/bn-grid.cjs.entry.js +6 -6
- package/dist/cjs/bn-image.cjs.entry.js +6 -6
- package/dist/cjs/bn-internationalization.cjs.entry.js +4 -4
- package/dist/cjs/bn-ruleset.cjs.entry.js +4 -4
- package/dist/cjs/bn-template-engine.cjs.js +3 -3
- package/dist/cjs/bn-template.cjs.entry.js +2 -2
- package/dist/cjs/bn-text.cjs.entry.js +7 -7
- package/dist/cjs/bn-tree.cjs.entry.js +6 -6
- package/dist/cjs/{context-protocol-BBhT9B52.js → context-protocol-DeLmu5s2.js} +1 -1
- package/dist/cjs/editor-companion.cjs.entry.js +2 -2
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +6 -6
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +6 -6
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +6 -6
- package/dist/cjs/{index-CDKG4xmO.js → index-C1Z9vO7z.js} +61 -19
- package/dist/cjs/{layoutObserver-DUYYkDMQ.js → layoutObserver-CrzQQGpv.js} +5 -5
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{scaling-BIJQ2NV1.js → scaling-JAU6IJnR.js} +85 -3
- package/dist/cjs/{withBodyObserver-BKUE_ypL.js → withBodyObserver-DJO98AJ-.js} +2 -2
- package/dist/cjs/{withHasError-Cl2gTQzA.js → withHasError-BdDmiOXM.js} +1 -1
- package/dist/cjs/{withScalingGroup-D5clRvRe.js → withScalingGroup-Bu5gatHT.js} +3 -3
- package/dist/cjs/{withStyled-Cm9dWQhu.js → withStyled-50UepUwV.js} +8 -8
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +15 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +6 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +149 -57
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +135 -28
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +30 -19
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +186 -49
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +9 -3
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +141 -22
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +36 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +76 -19
- package/dist/collection/components/bn-table/bn-table.js +121 -49
- package/dist/collection/components/bn-table/ibcs-table.js +83 -42
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +20 -34
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +4 -5
- package/dist/collection/components/bn-table/utils/helper/barColumnGeometry.js +89 -0
- package/dist/collection/utils/autoFit.js +63 -0
- package/dist/collection/utils/constants.js +3 -3
- 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/autoFit.js +1 -0
- 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/{AxisConfig-ByIP5J-9.js → AxisConfig-Cjy_RANi.js} +1 -1
- package/dist/esm/{LabelCollisionManager-DaNiDiM9.js → LabelCollisionManager-B_NUM9yq.js} +2 -2
- package/dist/esm/{Order-BQeJE_yi.js → Order-B-aF6Rwn.js} +1 -1
- package/dist/esm/{SVGStyle-BwBlY3Km.js → SVGStyle-8FfAtUF-.js} +2 -2
- package/dist/esm/{SVGVariancesStyleGroup-BpGW4CvN.js → SVGVariancesStyleGroup-DD4mIOjT.js} +1 -1
- package/dist/esm/{VarianceMeasure-CE3N8Bea.js → VarianceMeasure-DLOuIIJ7.js} +4 -4
- package/dist/esm/{XYChartDataRow-DeMI1JKU.js → XYChartDataRow-CKfILBFG.js} +4 -4
- package/dist/esm/bn-asset_21.entry.js +1052 -314
- package/dist/esm/bn-chart-bubble.entry.js +25 -15
- package/dist/esm/bn-chart-bullet.entry.js +9 -9
- package/dist/esm/bn-chart-scatter.entry.js +9 -9
- package/dist/esm/bn-grid.entry.js +6 -6
- package/dist/esm/bn-image.entry.js +6 -6
- package/dist/esm/bn-internationalization.entry.js +4 -4
- package/dist/esm/bn-ruleset.entry.js +4 -4
- package/dist/esm/bn-template-engine.js +4 -4
- package/dist/esm/bn-template.entry.js +2 -2
- package/dist/esm/bn-text.entry.js +7 -7
- package/dist/esm/bn-tree.entry.js +6 -6
- package/dist/esm/{context-protocol-d8MHrEo8.js → context-protocol-BoEL0caI.js} +1 -1
- package/dist/esm/editor-companion.entry.js +2 -2
- package/dist/esm/ibcs-chart-bubble.entry.js +6 -6
- package/dist/esm/ibcs-chart-bullet.entry.js +6 -6
- package/dist/esm/ibcs-chart-scatter.entry.js +6 -6
- package/dist/esm/{index-B_d-jp99.js → index-C5UYpZUU.js} +61 -19
- package/dist/esm/{layoutObserver-BJBEyhNf.js → layoutObserver-cgIXg2sg.js} +5 -5
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{scaling-BGnpSN1j.js → scaling-CxyNpMQM.js} +83 -4
- package/dist/esm/{withBodyObserver-IokS6fHD.js → withBodyObserver-Cb9ZC5_J.js} +2 -2
- package/dist/esm/{withHasError-DW_vMDUp.js → withHasError-Bh1Viz52.js} +1 -1
- package/dist/esm/{withScalingGroup-CC3UcvC5.js → withScalingGroup-Yv9nGGe1.js} +3 -3
- package/dist/esm/{withStyled-2l5Tx3cf.js → withStyled-By9Jd-Oy.js} +8 -8
- 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 +47 -19
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +17 -3
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +11 -3
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +52 -18
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +18 -3
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +12 -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 +45 -19
- package/dist/types/components/bn-table/ibcs-table.d.ts +23 -6
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +9 -1
- package/dist/types/components/bn-table/utils/helper/barColumnGeometry.d.ts +51 -0
- package/dist/types/components.d.ts +91 -55
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/dist/types/utils/autoFit.d.ts +79 -0
- package/dist/types/utils/constants.d.ts +3 -3
- 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-2fba7c99.entry.js +0 -1
- package/dist/bn-template-engine/p-A8xyE4b1.js +0 -1
- package/dist/bn-template-engine/p-B_d-jp99.js +0 -2
- package/dist/bn-template-engine/p-BjBz5cSL.js +0 -1
- package/dist/bn-template-engine/p-C8Q0lsaU.js +0 -1
- package/dist/bn-template-engine/p-C9i1Xsib.js +0 -1
- package/dist/bn-template-engine/p-a8291de2.entry.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, isTableBarColumnWidth, isTableCategoryWidth, isValidBoolean, isValidDataFormat, isValidDateFormat, isValidDirection, isValidInteger, isValidMeasureScale, isValidMeasureType,
|
|
2
|
+
import { isBlankInput, isTableBarColumnWidth, isTableCategoryWidth, isValidBoolean, isValidDataFormat, isValidDateFormat, isValidDirection, isValidInteger, isValidMeasureScale, isValidMeasureType, isValidTableType, validateAttributesJsonStr, validateBarColumnsList, validateColumnThereOfJsonStr, validateOrderList, validatePartOfJsonStr, validateScenarioList, validateThereOfJsonStr, validateVariancesList, } from "../../utils/validate";
|
|
3
3
|
import withDataset from "../../utils/withDataset";
|
|
4
4
|
import withComponentStatus from "../../utils/withComponentStatus";
|
|
5
5
|
import withScalingGroup from "../../utils/withScalingGroup";
|
|
@@ -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 { BAR_COLUMN_WIDTH_EM, DataFormat, I18nMode, MeasureType, TableBarColumnWidth, TableCategoryWidth, } from "../../utils/constants";
|
|
17
17
|
import { TableType } from "./utils/model";
|
|
@@ -73,38 +73,50 @@ export class Table {
|
|
|
73
73
|
*/
|
|
74
74
|
this.measureUnit = "";
|
|
75
75
|
/**
|
|
76
|
-
* Set width of bar chart columns
|
|
76
|
+
* Set the total width of bar chart columns, in em of the table font — the same
|
|
77
|
+
* unit and vocabulary as ```categoryWidth```, so ```bar-column-width="w15"```
|
|
78
|
+
* renders exactly as wide as ```category-width="w15"```. The bar/pin drawing
|
|
79
|
+
* area is that width minus the value-label gutters.
|
|
77
80
|
* <br /><br />
|
|
78
81
|
* values:<br />
|
|
79
82
|
* ``` w5 // w10 // w15 // w20 // w25 // w30 // w40 // w60 // w80 // w100 ```
|
|
80
83
|
*/
|
|
81
84
|
this.barColumnWidth = "w10";
|
|
82
85
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
86
|
+
* Data units displayed per 1 em of bar length for absolute variance bar
|
|
87
|
+
* charts (ΔPY) — map-scale semantics: a larger value means smaller bars.
|
|
85
88
|
* Bars exceeding barColumnWidth are shown with an arrow indicator.
|
|
86
|
-
* <br /><br />
|
|
87
|
-
* Accepts a number, `"auto"`, or a `<bn-scaling-group>` name for synchronized scaling.
|
|
88
|
-
* <br /><br />
|
|
89
|
-
* Default: 0.01
|
|
90
89
|
*
|
|
91
|
-
*
|
|
90
|
+
* | Value | Behavior |
|
|
91
|
+
* |------------------|----------------------------------------------------------------|
|
|
92
|
+
* | `"auto"` | Auto-fit the largest bar to the bar column width |
|
|
93
|
+
* | `"250000"`, `"1M"` | Units per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |
|
|
94
|
+
* | group name | References a `<bn-scaling-group>` for synchronized scaling |
|
|
95
|
+
* | invalid / unknown | Auto-fit + `AUTO_unitScaling` warning |
|
|
96
|
+
*
|
|
97
|
+
* Default: `"100"` (1 em of bar represents 100 units)
|
|
98
|
+
*
|
|
99
|
+
* @example unit-scaling="1M"
|
|
92
100
|
* @example unit-scaling="revenue-scale"
|
|
93
101
|
*/
|
|
94
|
-
this.unitScaling =
|
|
102
|
+
this.unitScaling = "100";
|
|
95
103
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
104
|
+
* Percentage points displayed per 1 em of pin length for relative variance
|
|
105
|
+
* pin charts (ΔPY%) — a larger value means shorter pins.
|
|
106
|
+
*
|
|
107
|
+
* | Value | Behavior |
|
|
108
|
+
* |------------------|----------------------------------------------------------------|
|
|
109
|
+
* | `"auto"` | Auto-fit the largest pin to the pin area |
|
|
110
|
+
* | `"10"`, `"2.5"` | Percentage points per em; optional SI suffix `k`/`K`/`M`/`G`/`T` |
|
|
111
|
+
* | group name | References a `<bn-scaling-group>` for synchronized scaling |
|
|
112
|
+
* | invalid / unknown | Auto-fit + `AUTO_percentageScaling` warning |
|
|
103
113
|
*
|
|
104
|
-
*
|
|
114
|
+
* Default: `"2"` (a +2 % variance pin is 1 em long)
|
|
115
|
+
*
|
|
116
|
+
* @example percentage-scaling="10"
|
|
105
117
|
* @example percentage-scaling="pct-scale"
|
|
106
118
|
*/
|
|
107
|
-
this.percentageScaling =
|
|
119
|
+
this.percentageScaling = "2";
|
|
108
120
|
// Global scaling groups map - can be populated externally for shared scaling across components
|
|
109
121
|
this.pixelPerUnitGroupMap = new Map();
|
|
110
122
|
/**
|
|
@@ -218,7 +230,7 @@ export class Table {
|
|
|
218
230
|
* original value.
|
|
219
231
|
* <br /><br />
|
|
220
232
|
* values: <br />
|
|
221
|
-
* ```_ // k // M // G // T // P // E // Z // Y // m // μ // n // p //
|
|
233
|
+
* ```_ // k // M // G // T // P // E // Z // Y // m // my (μ) // n // p // f // a // z // y // GREATEST // LEAST```
|
|
222
234
|
* <br /><br />
|
|
223
235
|
* SiPrefix overview:
|
|
224
236
|
* ``` "Y": 1E+24,```<br />
|
|
@@ -231,7 +243,7 @@ export class Table {
|
|
|
231
243
|
* ``` "k": 1000,```<br />
|
|
232
244
|
* <br />
|
|
233
245
|
* ``` "m": 0.001,```<br />
|
|
234
|
-
* ``` "μ
|
|
246
|
+
* ``` "my" (μ): 0.000001,```<br />
|
|
235
247
|
* ``` "n": 0.000000001,```<br />
|
|
236
248
|
* ``` "p": 0.000000000001,```<br />
|
|
237
249
|
* ``` "f": 0.000000000000001,```<br />
|
|
@@ -257,10 +269,13 @@ export class Table {
|
|
|
257
269
|
*/
|
|
258
270
|
this.dataFormatDigitsPercent = 2;
|
|
259
271
|
/**
|
|
260
|
-
* Set width of category column. <br />
|
|
272
|
+
* Set width of category column, in em of the table font. <br />
|
|
261
273
|
* If INF is selected the columns scaling to the min space they need
|
|
262
274
|
* seperatly.
|
|
263
275
|
* <br /><br />
|
|
276
|
+
* The column is fixed at this width; a category label too long to fit is
|
|
277
|
+
* truncated with an ellipsis.
|
|
278
|
+
* <br /><br />
|
|
264
279
|
* values:<br />
|
|
265
280
|
* ``` w5 // w10 // w15 // w20 // w25 // w50 // inf ```
|
|
266
281
|
*/
|
|
@@ -303,6 +318,39 @@ export class Table {
|
|
|
303
318
|
*/
|
|
304
319
|
this.tableAttributes = "";
|
|
305
320
|
this._autoScaleGuard = false;
|
|
321
|
+
this.autoUnitWarningActive = false;
|
|
322
|
+
this.autoPctWarningActive = false;
|
|
323
|
+
/**
|
|
324
|
+
* Receives the auto-fitted scaling values from the inner ibcs-table
|
|
325
|
+
* (em per unit / em per percentage point) and surfaces them in the AUTO_*
|
|
326
|
+
* warnings, converted back to the attribute's units-per-em form so users
|
|
327
|
+
* can copy them into a bn-scaling-group.
|
|
328
|
+
*/
|
|
329
|
+
this.handleAutoScalingReport = (report) => {
|
|
330
|
+
const changed = (next, last) => last === undefined || Math.abs(next - last) > Math.abs(next) * 1e-3;
|
|
331
|
+
if (report.unit !== undefined && report.unit > 0 && this.autoUnitWarningActive) {
|
|
332
|
+
const unitsPerEm = 1 / report.unit;
|
|
333
|
+
if (changed(unitsPerEm, this.lastReportedUnitsPerEm)) {
|
|
334
|
+
this.lastReportedUnitsPerEm = unitsPerEm;
|
|
335
|
+
this.errors.addOrReplace({
|
|
336
|
+
id: "AUTO_unitScaling",
|
|
337
|
+
type: "warning",
|
|
338
|
+
message: `unit-scaling: invalid value "${this.unitScaling}" — auto-fitted to 1 em ≈ ${formatScalingValue(unitsPerEm)} units.`,
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
if (report.percentage !== undefined && report.percentage > 0 && this.autoPctWarningActive) {
|
|
343
|
+
const ppPerEm = 1 / report.percentage;
|
|
344
|
+
if (changed(ppPerEm, this.lastReportedPpPerEm)) {
|
|
345
|
+
this.lastReportedPpPerEm = ppPerEm;
|
|
346
|
+
this.errors.addOrReplace({
|
|
347
|
+
id: "AUTO_percentageScaling",
|
|
348
|
+
type: "warning",
|
|
349
|
+
message: `percentage-scaling: invalid value "${this.percentageScaling}" — auto-fitted to 1 em ≈ ${formatScalingValue(ppPerEm)} percentage points.`,
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
};
|
|
306
354
|
withStyled(this);
|
|
307
355
|
withComponentStatus(this);
|
|
308
356
|
this.errors = withHasError(this);
|
|
@@ -397,8 +445,7 @@ export class Table {
|
|
|
397
445
|
}
|
|
398
446
|
validateUnitScaling(newValue) {
|
|
399
447
|
const errId = "ERR_unitScaling";
|
|
400
|
-
|
|
401
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
448
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
402
449
|
this.errors.addOrReplace({
|
|
403
450
|
id: errId,
|
|
404
451
|
type: "warning",
|
|
@@ -411,8 +458,7 @@ export class Table {
|
|
|
411
458
|
}
|
|
412
459
|
validatePercentageScaling(newValue) {
|
|
413
460
|
const errId = "ERR_percentageScaling";
|
|
414
|
-
|
|
415
|
-
if (!isAuto && !isValidNumber(newValue) && !this.pixelPerUnitGroupMap.has(newValue)) {
|
|
461
|
+
if (resolveScalingValue(newValue, this.pixelPerUnitGroupMap).kind === "invalid") {
|
|
416
462
|
this.errors.addOrReplace({
|
|
417
463
|
id: errId,
|
|
418
464
|
type: "warning",
|
|
@@ -1047,24 +1093,50 @@ export class Table {
|
|
|
1047
1093
|
return this.barColumns.split(",").map((col) => col.trim());
|
|
1048
1094
|
}
|
|
1049
1095
|
prepareUnitScaling() {
|
|
1050
|
-
|
|
1051
|
-
if (
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1096
|
+
const resolved = resolveScalingValue(this.unitScaling, this.pixelPerUnitGroupMap);
|
|
1097
|
+
if (resolved.kind === "value") {
|
|
1098
|
+
this.errors.remove("AUTO_unitScaling");
|
|
1099
|
+
this.autoUnitWarningActive = false;
|
|
1100
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
1101
|
+
// Inner ibcs-table expects em per unit; the attribute is units per em.
|
|
1102
|
+
return 1 / resolved.value;
|
|
1103
|
+
}
|
|
1104
|
+
if (resolved.kind === "auto") {
|
|
1105
|
+
this.errors.remove("AUTO_unitScaling");
|
|
1106
|
+
this.autoUnitWarningActive = false;
|
|
1107
|
+
this.lastReportedUnitsPerEm = undefined;
|
|
1055
1108
|
return 0;
|
|
1056
1109
|
}
|
|
1057
|
-
|
|
1110
|
+
this.autoUnitWarningActive = true;
|
|
1111
|
+
this.errors.addOrReplace({
|
|
1112
|
+
id: "AUTO_unitScaling",
|
|
1113
|
+
type: "warning",
|
|
1114
|
+
message: `unit-scaling: invalid value "${resolved.raw}" — auto-fitting to the bar column width.`,
|
|
1115
|
+
});
|
|
1116
|
+
return 0;
|
|
1058
1117
|
}
|
|
1059
1118
|
preparePercentageScaling() {
|
|
1060
|
-
|
|
1061
|
-
if (
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1119
|
+
const resolved = resolveScalingValue(this.percentageScaling, this.pixelPerUnitGroupMap);
|
|
1120
|
+
if (resolved.kind === "value") {
|
|
1121
|
+
this.errors.remove("AUTO_percentageScaling");
|
|
1122
|
+
this.autoPctWarningActive = false;
|
|
1123
|
+
this.lastReportedPpPerEm = undefined;
|
|
1124
|
+
// Inner ibcs-table expects em per percentage point.
|
|
1125
|
+
return 1 / resolved.value;
|
|
1126
|
+
}
|
|
1127
|
+
if (resolved.kind === "auto") {
|
|
1128
|
+
this.errors.remove("AUTO_percentageScaling");
|
|
1129
|
+
this.autoPctWarningActive = false;
|
|
1130
|
+
this.lastReportedPpPerEm = undefined;
|
|
1065
1131
|
return 0;
|
|
1066
1132
|
}
|
|
1067
|
-
|
|
1133
|
+
this.autoPctWarningActive = true;
|
|
1134
|
+
this.errors.addOrReplace({
|
|
1135
|
+
id: "AUTO_percentageScaling",
|
|
1136
|
+
type: "warning",
|
|
1137
|
+
message: `percentage-scaling: invalid value "${resolved.raw}" — auto-fitting to the pin area.`,
|
|
1138
|
+
});
|
|
1139
|
+
return 0;
|
|
1068
1140
|
}
|
|
1069
1141
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1070
1142
|
getDataStructure() {
|
|
@@ -1127,7 +1199,7 @@ export class Table {
|
|
|
1127
1199
|
render() {
|
|
1128
1200
|
const fontStyles = this.getFontStyles();
|
|
1129
1201
|
const effectiveFactor = this.getEffectiveScaleFactor();
|
|
1130
|
-
return (h(Host, { key: '
|
|
1202
|
+
return (h(Host, { key: '7960f554ac93c0fb6a09cf47f886827fff1aea84', style: fontStyles }, h("div", { key: 'e9f328144ab89bbde8c47111f7ce7de7a6c882db' }, h("ibcs-table", { key: 'a06695fad28dc30967784006c151abd47d2efd77', tableName: this.datasetName, dataVersion: this.dataVersion, sumTitle: this.prepareSumTitle(), scenarios: this.prepareScenarios(), scenariosDataFormat: this.prepareDataFormat(), grouped: this.prepareGrouped(), limit: this.prepareLimit(), showGroupTitle: this.prepareShowGroupTitle(), thereof: this.prepareThereOf(), partof: this.preparePartOf(), order: this.prepareOrder(), categorythereof: this.prepareColumnThereOf(), attributeColumns: this.prepareAttributes(), type: this.prepareTableType(), categoryWidth: this.prepareCategoryWidth(), dataFormatDigits: this.prepareDataFormatDigits(), i18n: this.prepareI18n(), i18nMode: this.prepareI18nMode(), measureScale: this.prepareMeasureScale(), measureType: this.prepareMeasureType(), measureUnit: this.prepareMeasureUnit(), showMeasureScale: this.prepareShowMeasureScale(), filter: this.prepareFilter(), barColumns: this.prepareBarColumns(), interval: this.prepareInterval(), barColumnMaxWidth: this.prepareBarColumnWidth(), unitScaling: this.prepareUnitScaling(), percentageScaling: this.preparePercentageScaling(), reportAutoScaling: this.handleAutoScalingReport, scaleFactor: effectiveFactor, ruleSetConfig: this.ruleSetConfig(), selectedStyle: this.selectedStyle }))));
|
|
1131
1203
|
}
|
|
1132
1204
|
static get is() { return "bn-table"; }
|
|
1133
1205
|
static get encapsulation() { return "shadow"; }
|
|
@@ -1332,7 +1404,7 @@ export class Table {
|
|
|
1332
1404
|
"optional": false,
|
|
1333
1405
|
"docs": {
|
|
1334
1406
|
"tags": [],
|
|
1335
|
-
"text": "Set width of bar chart columns
|
|
1407
|
+
"text": "Set the total width of bar chart columns, in em of the table font \u2014 the same\nunit and vocabulary as ```categoryWidth```, so ```bar-column-width=\"w15\"```\nrenders exactly as wide as ```category-width=\"w15\"```. The bar/pin drawing\narea is that width minus the value-label gutters.\n<br /><br />\nvalues:<br />\n``` w5 // w10 // w15 // w20 // w25 // w30 // w40 // w60 // w80 // w100 ```"
|
|
1336
1408
|
},
|
|
1337
1409
|
"getter": false,
|
|
1338
1410
|
"setter": false,
|
|
@@ -1353,18 +1425,18 @@ export class Table {
|
|
|
1353
1425
|
"docs": {
|
|
1354
1426
|
"tags": [{
|
|
1355
1427
|
"name": "example",
|
|
1356
|
-
"text": "unit-scaling=\"
|
|
1428
|
+
"text": "unit-scaling=\"1M\""
|
|
1357
1429
|
}, {
|
|
1358
1430
|
"name": "example",
|
|
1359
1431
|
"text": "unit-scaling=\"revenue-scale\""
|
|
1360
1432
|
}],
|
|
1361
|
-
"text": "
|
|
1433
|
+
"text": "Data units displayed per 1 em of bar length for absolute variance bar\ncharts (\u0394PY) \u2014 map-scale semantics: a larger value means smaller bars.\nBars exceeding barColumnWidth are shown with an arrow indicator.\n\n| Value | Behavior |\n|------------------|----------------------------------------------------------------|\n| `\"auto\"` | Auto-fit the largest bar to the bar column width |\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| invalid / unknown | Auto-fit + `AUTO_unitScaling` warning |\n\nDefault: `\"100\"` (1 em of bar represents 100 units)"
|
|
1362
1434
|
},
|
|
1363
1435
|
"getter": false,
|
|
1364
1436
|
"setter": false,
|
|
1365
1437
|
"reflect": false,
|
|
1366
1438
|
"attribute": "unit-scaling",
|
|
1367
|
-
"defaultValue": "
|
|
1439
|
+
"defaultValue": "\"100\""
|
|
1368
1440
|
},
|
|
1369
1441
|
"percentageScaling": {
|
|
1370
1442
|
"type": "any",
|
|
@@ -1379,18 +1451,18 @@ export class Table {
|
|
|
1379
1451
|
"docs": {
|
|
1380
1452
|
"tags": [{
|
|
1381
1453
|
"name": "example",
|
|
1382
|
-
"text": "percentage-scaling=\"
|
|
1454
|
+
"text": "percentage-scaling=\"10\""
|
|
1383
1455
|
}, {
|
|
1384
1456
|
"name": "example",
|
|
1385
1457
|
"text": "percentage-scaling=\"pct-scale\""
|
|
1386
1458
|
}],
|
|
1387
|
-
"text": "
|
|
1459
|
+
"text": "Percentage points displayed per 1 em of pin length for relative variance\npin charts (\u0394PY%) \u2014 a larger value means shorter pins.\n\n| Value | Behavior |\n|------------------|----------------------------------------------------------------|\n| `\"auto\"` | Auto-fit the largest pin to the pin area |\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 |\n| invalid / unknown | Auto-fit + `AUTO_percentageScaling` warning |\n\nDefault: `\"2\"` (a +2 % variance pin is 1 em long)"
|
|
1388
1460
|
},
|
|
1389
1461
|
"getter": false,
|
|
1390
1462
|
"setter": false,
|
|
1391
1463
|
"reflect": false,
|
|
1392
1464
|
"attribute": "percentage-scaling",
|
|
1393
|
-
"defaultValue": "
|
|
1465
|
+
"defaultValue": "\"2\""
|
|
1394
1466
|
},
|
|
1395
1467
|
"dataFormat": {
|
|
1396
1468
|
"type": "string",
|
|
@@ -1624,7 +1696,7 @@ export class Table {
|
|
|
1624
1696
|
"optional": false,
|
|
1625
1697
|
"docs": {
|
|
1626
1698
|
"tags": [],
|
|
1627
|
-
"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 //
|
|
1699
|
+
"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."
|
|
1628
1700
|
},
|
|
1629
1701
|
"getter": false,
|
|
1630
1702
|
"setter": false,
|
|
@@ -1684,7 +1756,7 @@ export class Table {
|
|
|
1684
1756
|
"optional": false,
|
|
1685
1757
|
"docs": {
|
|
1686
1758
|
"tags": [],
|
|
1687
|
-
"text": "Set width of category column. <br />\nIf INF is selected the columns scaling to the min space they need\nseperatly.\n<br /><br />\nvalues:<br />\n``` w5 // w10 // w15 // w20 // w25 // w50 // inf ```"
|
|
1759
|
+
"text": "Set width of category column, in em of the table font. <br />\nIf INF is selected the columns scaling to the min space they need\nseperatly.\n<br /><br />\nThe column is fixed at this width; a category label too long to fit is\ntruncated with an ellipsis.\n<br /><br />\nvalues:<br />\n``` w5 // w10 // w15 // w20 // w25 // w50 // inf ```"
|
|
1688
1760
|
},
|
|
1689
1761
|
"getter": false,
|
|
1690
1762
|
"setter": false,
|
|
@@ -12,6 +12,7 @@ import { CellBarChart } from "./utils/elements/CellBarChart";
|
|
|
12
12
|
import { WaterfallBar } from "./utils/elements/WaterfallBar";
|
|
13
13
|
import withComponentStyle from "../../utils/withComponentStyle";
|
|
14
14
|
import { getStores } from "../../context/context-protocol";
|
|
15
|
+
import { absoluteBarGeometry, BAR_LABEL_FONT_RATIO, relativePinGeometry } from "./utils/helper/barColumnGeometry";
|
|
15
16
|
/**
|
|
16
17
|
* Internal rendering engine for `bn-table`.
|
|
17
18
|
*
|
|
@@ -63,6 +64,10 @@ export class IbcsTable {
|
|
|
63
64
|
this.filter = "";
|
|
64
65
|
this.barColumns = [];
|
|
65
66
|
this.interval = "none";
|
|
67
|
+
/**
|
|
68
|
+
* Total width of a bar chart column, in em of the table font — the same unit
|
|
69
|
+
* `categoryWidth` uses, so the two render at the same width for the same value.
|
|
70
|
+
*/
|
|
66
71
|
this.barColumnMaxWidth = 30;
|
|
67
72
|
this.unitScaling = 0.01;
|
|
68
73
|
this.percentageScaling = 0.5;
|
|
@@ -81,7 +86,7 @@ export class IbcsTable {
|
|
|
81
86
|
}
|
|
82
87
|
return (h("table", null, h("thead", null, this.table.getHeader().map((row) => (h("tr", { class: row.cssStyle }, row.getCells().map((cell) => (h("th", { colSpan: cell.colSpan, class: cell.cssStyle }, cell.getAsHeaderList().map((line, i, arr) => (h("span", null, i === arr.length - 1 ? (h("span", { class: line === " " ? "table-footer" : "" }, line, cell.drawPrefix(), " ")) : (h("span", null, line, cell.drawPrefix(), h("br", null))))))))))))), h("tbody", null, this.table.getBody().map((row) => (h("tr", { class: row.cssStyle }, row === null || row === void 0 ? void 0 : row.getCells().map((cell) => (h("td", { colSpan: cell.colSpan, class: cell.type ? `${cell.cssStyle} ${cell.type}` : cell.cssStyle }, cell.prefix != null ? (h("span", { class: cell.cssStyle + " " + cell.prefixStyle }, cell.drawPrefix())) : (""), cell.isBarChart &&
|
|
83
88
|
cell.columnStats &&
|
|
84
|
-
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale,
|
|
89
|
+
(cell.waterfall !== undefined || row.type !== TableRowType.SUM) ? (cell.waterfall !== undefined ? (h(WaterfallBar, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: false, isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles, waterfall: cell.waterfall })) : (h(CellBarChart, { value: cell.value, scenario: cell.key, columnStats: cell.columnStats, height: 18 * this.scaleFactor, isRelative: cell.key.startsWith("dr"), isPositiveGood: cell.key.endsWith("_pos"), measureScale: cell.measureScale, columnWidthEm: this.barColumnMaxWidth, styles: this.barChartStyles }))) : (cell.draw(this.componentDataFormatDigits)))))))))));
|
|
85
90
|
};
|
|
86
91
|
return h(Host, null, helper());
|
|
87
92
|
}
|
|
@@ -135,8 +140,19 @@ export class IbcsTable {
|
|
|
135
140
|
* Scenario styles (ac, pp, fc, pl) use barStyles for IBCS-compliant grayscale coloring.
|
|
136
141
|
*/
|
|
137
142
|
prepareBarChartStyles() {
|
|
143
|
+
var _a;
|
|
144
|
+
const autoUnit = !(this.unitScaling > 0);
|
|
145
|
+
const autoPercent = !(this.percentageScaling > 0);
|
|
146
|
+
const resolvedUnit = autoUnit ? this.autoUnitScaling() : this.unitScaling;
|
|
147
|
+
const resolvedPercent = autoPercent ? this.autoPercentageScaling() : this.percentageScaling;
|
|
148
|
+
if (autoUnit || autoPercent) {
|
|
149
|
+
(_a = this.reportAutoScaling) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
150
|
+
unit: autoUnit ? resolvedUnit : undefined,
|
|
151
|
+
percentage: autoPercent ? resolvedPercent : undefined,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
138
154
|
return this.componentStyle(($) => {
|
|
139
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
155
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
|
|
140
156
|
const varianceStyles = (_a = $["bn-chart-time"]) === null || _a === void 0 ? void 0 : _a["varianceStyles"];
|
|
141
157
|
const barStyles = (_b = $["bn-chart-time"]) === null || _b === void 0 ? void 0 : _b["barStyles"];
|
|
142
158
|
// Default variance styles with fillpattern
|
|
@@ -189,26 +205,32 @@ export class IbcsTable {
|
|
|
189
205
|
},
|
|
190
206
|
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
191
207
|
fontColor: ((_z = $["global"]) === null || _z === void 0 ? void 0 : _z["fontColor"]) || "#000000",
|
|
192
|
-
fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) *
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
208
|
+
fontSize: (((_0 = $["global"]) === null || _0 === void 0 ? void 0 : _0["fontSizePx"]) || 13.3333) * BAR_LABEL_FONT_RATIO * this.scaleFactor,
|
|
209
|
+
emPx: (((_1 = $["global"]) === null || _1 === void 0 ? void 0 : _1["fontSizePx"]) || 13.3333) * this.scaleFactor,
|
|
210
|
+
fontFamily: ((_2 = $["global"]) === null || _2 === void 0 ? void 0 : _2["fontFamily"]) || "'Noto Sans', sans-serif",
|
|
211
|
+
unitScaling: resolvedUnit,
|
|
212
|
+
percentageScaling: resolvedPercent,
|
|
196
213
|
scaleFactor: this.scaleFactor,
|
|
197
214
|
};
|
|
198
215
|
});
|
|
199
216
|
}
|
|
217
|
+
/** The table's true em in px — the unit `.category-wN` and the bar columns share. */
|
|
218
|
+
emPx() {
|
|
219
|
+
return this.componentStyle(($) => { var _a; return ((_a = $["global"]) === null || _a === void 0 ? void 0 : _a["fontSizePx"]) || 13.3333; }) * this.scaleFactor;
|
|
220
|
+
}
|
|
200
221
|
/**
|
|
201
222
|
* Auto-calculate unitScaling so the largest absolute variance bar
|
|
202
|
-
* fills ~80% of the bar
|
|
223
|
+
* fills ~80% of its side of the bar area, without tripping the overdrive break.
|
|
203
224
|
*/
|
|
204
225
|
autoUnitScaling() {
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
const absMax = this.getMaxAbsValue();
|
|
226
|
+
const emPx = this.emPx();
|
|
227
|
+
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
228
|
+
const { absMax, hasNeg, hasPos } = this.getAbsBarColumnStats();
|
|
209
229
|
if (absMax <= 0 || fs <= 0) {
|
|
210
230
|
return 0.01;
|
|
211
231
|
}
|
|
232
|
+
const { maxBarWidth, cutWidth } = absoluteBarGeometry(this.barColumnMaxWidth, emPx, hasNeg, hasPos);
|
|
233
|
+
const targetWidth = Math.min(maxBarWidth * 0.8, cutWidth);
|
|
212
234
|
return targetWidth / (absMax * fs);
|
|
213
235
|
}
|
|
214
236
|
/**
|
|
@@ -216,52 +238,47 @@ export class IbcsTable {
|
|
|
216
238
|
* fills ~80% of the pin area.
|
|
217
239
|
*/
|
|
218
240
|
autoPercentageScaling() {
|
|
219
|
-
const
|
|
220
|
-
const
|
|
221
|
-
const
|
|
222
|
-
const maxPct = this.getMaxRelativeValue();
|
|
241
|
+
const emPx = this.emPx();
|
|
242
|
+
const fs = emPx * BAR_LABEL_FONT_RATIO;
|
|
243
|
+
const { absMax: maxPct, hasNeg, hasPos } = this.getRelativeBarColumnStats();
|
|
223
244
|
if (maxPct <= 0 || fs <= 0) {
|
|
224
245
|
return 0.5;
|
|
225
246
|
}
|
|
226
|
-
|
|
247
|
+
const { maxPinLength } = relativePinGeometry(this.barColumnMaxWidth, emPx, hasNeg, hasPos);
|
|
248
|
+
return (maxPinLength * 0.8) / (maxPct * fs);
|
|
227
249
|
}
|
|
228
250
|
/**
|
|
229
|
-
*
|
|
251
|
+
* Maximum value and sign coverage across all absolute variance columns (d_*) in the table body.
|
|
252
|
+
* Sign coverage decides how much of the column the bar area gets (see barColumnGeometry.ts);
|
|
253
|
+
* OR-ing it across columns keeps the single shared scaling inside the narrowest bar area.
|
|
230
254
|
*/
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
let max = 0;
|
|
235
|
-
for (const row of this.table.getBody()) {
|
|
236
|
-
if (row.type === TableRowType.SUM)
|
|
237
|
-
continue;
|
|
238
|
-
for (const cell of row.getCells()) {
|
|
239
|
-
// waterfall cells scale independently and must not skew variance auto-scaling
|
|
240
|
-
if (cell.isBarChart && cell.columnStats && !cell.key.startsWith("dr") && !cell.waterfall) {
|
|
241
|
-
max = Math.max(max, cell.columnStats.absMax);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
return max;
|
|
255
|
+
getAbsBarColumnStats() {
|
|
256
|
+
// waterfall cells scale independently and must not skew variance auto-scaling
|
|
257
|
+
return this.collectBarColumnStats((cell) => !cell.key.startsWith("dr") && !cell.waterfall, 1);
|
|
246
258
|
}
|
|
247
259
|
/**
|
|
248
|
-
*
|
|
249
|
-
*
|
|
260
|
+
* Same for the relative variance columns (dr_*). Values are stored as decimals
|
|
261
|
+
* (e.g. 0.2 = 20%), returned as percentage (20).
|
|
250
262
|
*/
|
|
251
|
-
|
|
263
|
+
getRelativeBarColumnStats() {
|
|
264
|
+
return this.collectBarColumnStats((cell) => cell.key.startsWith("dr"), 100);
|
|
265
|
+
}
|
|
266
|
+
collectBarColumnStats(accept, valueFactor) {
|
|
267
|
+
const stats = { absMax: 0, hasNeg: false, hasPos: false };
|
|
252
268
|
if (!this.table)
|
|
253
|
-
return
|
|
254
|
-
let max = 0;
|
|
269
|
+
return stats;
|
|
255
270
|
for (const row of this.table.getBody()) {
|
|
256
271
|
if (row.type === TableRowType.SUM)
|
|
257
272
|
continue;
|
|
258
273
|
for (const cell of row.getCells()) {
|
|
259
|
-
if (cell.isBarChart
|
|
260
|
-
|
|
261
|
-
|
|
274
|
+
if (!cell.isBarChart || !cell.columnStats || !accept(cell))
|
|
275
|
+
continue;
|
|
276
|
+
stats.absMax = Math.max(stats.absMax, cell.columnStats.absMax * valueFactor);
|
|
277
|
+
stats.hasNeg = stats.hasNeg || cell.columnStats.min < 0;
|
|
278
|
+
stats.hasPos = stats.hasPos || cell.columnStats.max > 0;
|
|
262
279
|
}
|
|
263
280
|
}
|
|
264
|
-
return
|
|
281
|
+
return stats;
|
|
265
282
|
}
|
|
266
283
|
static get is() { return "ibcs-table"; }
|
|
267
284
|
static get encapsulation() { return "shadow"; }
|
|
@@ -898,7 +915,7 @@ export class IbcsTable {
|
|
|
898
915
|
"optional": false,
|
|
899
916
|
"docs": {
|
|
900
917
|
"tags": [],
|
|
901
|
-
"text": ""
|
|
918
|
+
"text": "Total width of a bar chart column, in em of the table font \u2014 the same unit\n`categoryWidth` uses, so the two render at the same width for the same value."
|
|
902
919
|
},
|
|
903
920
|
"getter": false,
|
|
904
921
|
"setter": false,
|
|
@@ -946,6 +963,30 @@ export class IbcsTable {
|
|
|
946
963
|
"attribute": "percentage-scaling",
|
|
947
964
|
"defaultValue": "0.5"
|
|
948
965
|
},
|
|
966
|
+
"reportAutoScaling": {
|
|
967
|
+
"type": "unknown",
|
|
968
|
+
"mutable": false,
|
|
969
|
+
"complexType": {
|
|
970
|
+
"original": "(report: AutoScalingReport) => void",
|
|
971
|
+
"resolved": "(report: AutoScalingReport) => void",
|
|
972
|
+
"references": {
|
|
973
|
+
"AutoScalingReport": {
|
|
974
|
+
"location": "import",
|
|
975
|
+
"path": "../../utils/scaling",
|
|
976
|
+
"id": "src/utils/scaling.ts::AutoScalingReport",
|
|
977
|
+
"referenceLocation": "AutoScalingReport"
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
},
|
|
981
|
+
"required": false,
|
|
982
|
+
"optional": true,
|
|
983
|
+
"docs": {
|
|
984
|
+
"tags": [],
|
|
985
|
+
"text": "Internal wrapper channel: called with the auto-fitted scaling values\n(em per unit / em per percentage point) whenever one of them was\nauto-resolved, so the outer `bn-table` can surface them in its AUTO_*\nwarnings. Not for end users."
|
|
986
|
+
},
|
|
987
|
+
"getter": false,
|
|
988
|
+
"setter": false
|
|
989
|
+
},
|
|
949
990
|
"scaleFactor": {
|
|
950
991
|
"type": "number",
|
|
951
992
|
"mutable": false,
|