@bino-bi/bn-template-engine 1.0.0-alpha.3 → 1.0.0-alpha.4
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-1265d8d3.entry.js +1 -0
- package/dist/bn-template-engine/p-15516dac.entry.js +1 -0
- package/dist/bn-template-engine/p-1c716641.entry.js +1 -0
- package/dist/bn-template-engine/p-27cc8dc0.entry.js +1 -0
- package/dist/bn-template-engine/p-4426d484.entry.js +1 -0
- package/dist/bn-template-engine/p-51f8dc9e.entry.js +1 -0
- package/dist/bn-template-engine/p-53d4e690.entry.js +1 -0
- package/dist/bn-template-engine/p-5KQYRQLK.js +1 -0
- package/dist/bn-template-engine/p-745f4596.entry.js +1 -0
- package/dist/bn-template-engine/{p-0f1504f3.entry.js → p-75e97c87.entry.js} +1 -1
- package/dist/bn-template-engine/p-7a560278.entry.js +1 -0
- package/dist/bn-template-engine/p-7ea7c325.entry.js +1 -0
- package/dist/bn-template-engine/p-945cc95d.entry.js +1 -0
- package/dist/bn-template-engine/p-BYBpC0EO.js +1 -0
- package/dist/bn-template-engine/p-BfXY5dsy.js +1 -0
- package/dist/bn-template-engine/p-BgnHJQ9Q.js +1 -0
- package/dist/bn-template-engine/{p-B4ySv9KQ.js → p-Bhd_WSML.js} +1 -1
- package/dist/bn-template-engine/p-Bka-Z6jo.js +1 -0
- package/dist/bn-template-engine/p-Bnhh02CF.js +1 -0
- package/dist/bn-template-engine/p-C7dQL8CS.js +1 -0
- package/dist/bn-template-engine/p-CL1RYuNU.js +1 -0
- package/dist/bn-template-engine/p-CYwd_ZNM.js +1 -0
- package/dist/bn-template-engine/p-ChlK-T9I.js +1 -0
- package/dist/bn-template-engine/p-DHezf8pZ.js +1 -0
- package/dist/bn-template-engine/{p-DVMu6dEy.js → p-DlppAFq9.js} +1 -1
- package/dist/bn-template-engine/p-DvDDgmcV.js +1 -0
- package/dist/bn-template-engine/p-DvvwfRQG.js +1 -0
- package/dist/bn-template-engine/{p-DG-1MR_T.js → p-P7pGJBgc.js} +1 -1
- package/dist/bn-template-engine/p-b34eaf86.entry.js +1 -0
- package/dist/bn-template-engine/p-bdb8b44c.entry.js +1 -0
- package/dist/bn-template-engine/p-c44fcb8e.entry.js +1 -0
- package/dist/bn-template-engine/p-c7e1a49b.entry.js +1 -0
- package/dist/bn-template-engine/p-d9003041.entry.js +1 -0
- package/dist/bn-template-engine/p-daa7ffa3.entry.js +1 -0
- package/dist/bn-template-engine/p-e084f50a.entry.js +1 -0
- package/dist/bn-template-engine/p-eaba6658.entry.js +1 -0
- package/dist/bn-template-engine/{p-C0yAPzJz.js → p-u8igQLRZ.js} +1 -1
- package/dist/cjs/{DataFormatDigits-DAmZzqbD.js → DataFormatDigits-DKcOeLNK.js} +1 -1
- package/dist/cjs/{DateStringFactory-CcluhpGI.js → DateStringFactory-CSKvbS8K.js} +1 -1
- package/dist/cjs/{Order-BKoDS21t.js → Order-iG11HI4R.js} +8 -5
- package/dist/cjs/{SVGVariancesStyleGroup-DYYAU-81.js → SVGVariancesStyleGroup-K-Tw6lOD.js} +1 -14
- package/dist/cjs/bn-asset.cjs.entry.js +5 -4
- package/dist/cjs/bn-body_4.cjs.entry.js +15 -13
- package/dist/cjs/bn-card.cjs.entry.js +5 -4
- package/dist/cjs/{ibcs-chart-structure.cjs.entry.js → bn-chart-structure_5.cjs.entry.js} +1058 -28
- package/dist/cjs/bn-chart-time.cjs.entry.js +38 -12
- package/dist/cjs/bn-component-style.cjs.entry.js +5 -4
- package/dist/cjs/bn-dataset.cjs.entry.js +38 -9
- package/dist/cjs/bn-grid.cjs.entry.js +9 -7
- package/dist/cjs/bn-image.cjs.entry.js +9 -7
- package/dist/cjs/bn-internationalization.cjs.entry.js +5 -4
- package/dist/cjs/bn-layout-card.cjs.entry.js +3 -2
- package/dist/cjs/bn-layout-page.cjs.entry.js +2 -1
- package/dist/cjs/bn-message.cjs.entry.js +5 -4
- package/dist/cjs/bn-table.cjs.entry.js +979 -0
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +3 -2
- package/dist/cjs/bn-text.cjs.entry.js +11 -9
- package/dist/cjs/bn-tree.cjs.entry.js +9 -7
- package/dist/cjs/contentDecoder-JxOldq1e.js +419 -0
- package/dist/cjs/{context-protocol-CRPmux5D.js → context-protocol-DRQWrwsA.js} +2 -0
- package/dist/cjs/editor-companion.cjs.entry.js +1 -1
- package/dist/cjs/emotion-hash.esm-nbbEQ0Dn.js +57 -0
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +22 -18
- package/dist/cjs/{bn-context_5.cjs.entry.js → ibcs-table.cjs.entry.js} +122 -1293
- package/dist/cjs/{StringAdapter-Bneo8T4k.js → ibcsRuleSet-DgUoXOfd.js} +10 -10
- package/dist/cjs/index-Dm85hG6t.js +65 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{scaling-D8sIIKft.js → scaling-9Tz595RQ.js} +7 -7
- package/dist/cjs/{withHasError-B8gHkfV2.js → utils-CwHIVbbL.js} +1 -69
- package/dist/cjs/{withBodyObserver-C6gLgq_e.js → withBodyObserver-CKpSD8UT.js} +3 -3
- package/dist/cjs/{withComponentStatus-_x4LQZ0N.js → withComponentStatus-Bw70BhO0.js} +5 -5
- package/dist/cjs/{withComponentStyle-DMtic_9Y.js → withComponentStyle-aIbTCtfj.js} +5 -5
- package/dist/cjs/withHasError-D7ue5vAv.js +72 -0
- package/dist/cjs/{withStyled-CW30Bh6c.js → withStyled-CS1Yp4sv.js} +8 -61
- package/dist/cjs/{withTranslation-CWPAIRjh.js → withTranslation-rwgyITqe.js} +5 -5
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +226 -99
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +13 -3
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +94 -11
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +3 -4
- package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +4 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +28 -4
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -4
- package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +4 -0
- package/dist/collection/components/bn-dataset/bn-dataset.js +49 -2
- package/dist/collection/components/bn-datasource/bn-datasource.js +46 -3
- package/dist/collection/components/bn-table/bn-table.js +9 -12
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +58 -41
- package/dist/collection/stores/componentStyles.js +2 -0
- package/dist/collection/utils/constants.js +8 -5
- package/dist/collection/utils/contentDecoder.js +28 -0
- package/dist/collection/utils/stackColors.js +2 -2
- package/dist/collection/utils/validate.js +1 -1
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.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-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-table.js +1 -1
- package/dist/components/contentDecoder.js +1 -0
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/emotion-hash.esm.js +1 -0
- 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/ibcs-title2.js +1 -1
- package/dist/components/ibcsRuleSet.js +1 -1
- package/dist/components/validate.js +1 -1
- package/dist/components/withStyled.js +1 -1
- package/dist/esm/{DataFormatDigits--qIbKvXa.js → DataFormatDigits-oSZ1hBKE.js} +1 -1
- package/dist/esm/{DateStringFactory-XWdUjsn8.js → DateStringFactory-CSGz6TDk.js} +1 -1
- package/dist/esm/{Order-sqjrku2z.js → Order-Bnhh02CF.js} +9 -6
- package/dist/esm/{SVGVariancesStyleGroup-ibg3sLjM.js → SVGVariancesStyleGroup-CqTjrZYg.js} +2 -13
- package/dist/esm/bn-asset.entry.js +5 -4
- package/dist/esm/bn-body_4.entry.js +11 -9
- package/dist/esm/bn-card.entry.js +5 -4
- package/dist/esm/{ibcs-chart-structure.entry.js → bn-chart-structure_5.entry.js} +1048 -22
- package/dist/esm/bn-chart-time.entry.js +38 -12
- package/dist/esm/bn-component-style.entry.js +5 -4
- package/dist/esm/bn-dataset.entry.js +35 -6
- package/dist/esm/bn-grid.entry.js +9 -7
- package/dist/esm/bn-image.entry.js +9 -7
- package/dist/esm/bn-internationalization.entry.js +5 -4
- package/dist/esm/bn-layout-card.entry.js +3 -2
- package/dist/esm/bn-layout-page.entry.js +2 -1
- package/dist/esm/bn-message.entry.js +5 -4
- package/dist/esm/bn-table.entry.js +977 -0
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +3 -2
- package/dist/esm/bn-text.entry.js +11 -9
- package/dist/esm/bn-tree.entry.js +9 -7
- package/dist/esm/contentDecoder-oMmxz6nJ.js +416 -0
- package/dist/esm/{context-protocol-Bz5klD-F.js → context-protocol-BHnQsVsr.js} +2 -0
- package/dist/esm/editor-companion.entry.js +1 -1
- package/dist/esm/emotion-hash.esm-BYBpC0EO.js +55 -0
- package/dist/esm/ibcs-chart-time.entry.js +15 -11
- package/dist/esm/{bn-context_5.entry.js → ibcs-table.entry.js} +68 -1235
- package/dist/esm/{StringAdapter-BCLJpQQ8.js → ibcsRuleSet-K4ytuA1f.js} +10 -10
- package/dist/esm/index-DHezf8pZ.js +65 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{scaling-C6K8FYSF.js → scaling-Cehc74IE.js} +2 -2
- package/dist/esm/{withHasError-B3QX2emi.js → utils-DvvwfRQG.js} +1 -69
- package/dist/esm/{withBodyObserver-DczL5ia8.js → withBodyObserver-FQ8NwCIz.js} +1 -1
- package/dist/esm/{withComponentStatus-DodoSXe-.js → withComponentStatus-DWjDYtZ7.js} +1 -1
- package/dist/esm/{withComponentStyle-BerJY64r.js → withComponentStyle-9uP_hcDq.js} +2 -2
- package/dist/esm/withHasError-FyY5mQ_3.js +70 -0
- package/dist/esm/{withStyled-D1fAWJ3g.js → withStyled--qQWquTH.js} +6 -59
- package/dist/esm/{withTranslation-mimbJdER.js → withTranslation-BqD0Kp7b.js} +2 -2
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +155 -109
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +7 -0
- package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +1 -0
- package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +1 -0
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +6 -0
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +8 -0
- package/dist/types/components/bn-table/bn-table.d.ts +3 -3
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +0 -2
- package/dist/types/components.d.ts +100 -36
- package/dist/types/stores/componentStyles.d.ts +2 -0
- package/dist/types/utils/constants.d.ts +8 -5
- package/dist/types/utils/contentDecoder.d.ts +12 -0
- package/package.json +2 -1
- package/dist/bn-template-engine/p-05a82a77.entry.js +0 -1
- package/dist/bn-template-engine/p-1970906d.entry.js +0 -1
- package/dist/bn-template-engine/p-1dbd339c.entry.js +0 -1
- package/dist/bn-template-engine/p-2e68cf09.entry.js +0 -1
- package/dist/bn-template-engine/p-31cc6a2d.entry.js +0 -1
- package/dist/bn-template-engine/p-37881d05.entry.js +0 -1
- package/dist/bn-template-engine/p-3b894997.entry.js +0 -1
- package/dist/bn-template-engine/p-50e49732.entry.js +0 -1
- package/dist/bn-template-engine/p-6c7c0455.entry.js +0 -1
- package/dist/bn-template-engine/p-6da93eae.entry.js +0 -1
- package/dist/bn-template-engine/p-701e1578.entry.js +0 -1
- package/dist/bn-template-engine/p-8tsCnxIz.js +0 -1
- package/dist/bn-template-engine/p-997b2fe4.entry.js +0 -1
- package/dist/bn-template-engine/p-BL8gyUwE.js +0 -1
- package/dist/bn-template-engine/p-BSfqOkN_.js +0 -1
- package/dist/bn-template-engine/p-CRLgp9-v.js +0 -1
- package/dist/bn-template-engine/p-CYjZRKdI.js +0 -1
- package/dist/bn-template-engine/p-DRikHQE-.js +0 -1
- package/dist/bn-template-engine/p-DtdQCMzj.js +0 -1
- package/dist/bn-template-engine/p-a90f1cbe.entry.js +0 -1
- package/dist/bn-template-engine/p-b7bec050.entry.js +0 -1
- package/dist/bn-template-engine/p-d7f0cbaf.entry.js +0 -1
- package/dist/bn-template-engine/p-dfb61aa5.entry.js +0 -1
- package/dist/bn-template-engine/p-ece17f84.entry.js +0 -1
- package/dist/bn-template-engine/p-f27995c9.entry.js +0 -1
- package/dist/bn-template-engine/p-fd427179.entry.js +0 -1
- package/dist/bn-template-engine/p-sqjrku2z.js +0 -1
- package/dist/bn-template-engine/p-tzFCK9qn.js +0 -1
- package/dist/cjs/bn-chart-structure.cjs.entry.js +0 -700
- package/dist/esm/bn-chart-structure.entry.js +0 -698
|
@@ -151,35 +151,59 @@ function getBarStroke(varianceStyle) {
|
|
|
151
151
|
return { stroke: "none", strokeWidth: 0 };
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* majority of bars remain at a useful size. Values exceeding the effective max are
|
|
157
|
-
* flagged as "extreme" and rendered with an arrow indicator.
|
|
158
|
-
*
|
|
159
|
-
* Algorithm: effectiveMax = median * EXTREME_THRESHOLD (default 3×).
|
|
160
|
-
* If this would be less than absMax, some values are extreme.
|
|
161
|
-
* If the median is 0 (e.g. single value), falls back to absMax.
|
|
154
|
+
* Renders a zigzag break indicator at a given x position, matching the structure chart style.
|
|
155
|
+
* Two mirrored zigzag lines with a white background covering the break gap.
|
|
162
156
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
157
|
+
function renderZigzagBreak(breakX, breakGap, yTop, barHeight, s) {
|
|
158
|
+
const midX = breakX + breakGap / 2;
|
|
159
|
+
const halfGap = breakGap * 0.35;
|
|
160
|
+
const zigCount = 3;
|
|
161
|
+
const segHeight = barHeight / zigCount;
|
|
162
|
+
const amplitude = breakGap * 0.3;
|
|
163
|
+
let leftPath = `M ${midX - halfGap} ${yTop}`;
|
|
164
|
+
for (let i = 0; i < zigCount; i++) {
|
|
165
|
+
const y1 = yTop + segHeight * (i + 0.5);
|
|
166
|
+
const y2 = yTop + segHeight * (i + 1);
|
|
167
|
+
leftPath += ` L ${midX - halfGap - amplitude} ${y1} L ${midX - halfGap} ${y2}`;
|
|
168
|
+
}
|
|
169
|
+
let rightPath = `M ${midX + halfGap} ${yTop}`;
|
|
170
|
+
for (let i = 0; i < zigCount; i++) {
|
|
171
|
+
const y1 = yTop + segHeight * (i + 0.5);
|
|
172
|
+
const y2 = yTop + segHeight * (i + 1);
|
|
173
|
+
rightPath += ` L ${midX + halfGap + amplitude} ${y1} L ${midX + halfGap} ${y2}`;
|
|
167
174
|
}
|
|
168
|
-
|
|
169
|
-
|
|
175
|
+
return [
|
|
176
|
+
h("rect", { x: breakX, y: yTop - 1, width: breakGap, height: barHeight + 2, fill: "#ffffff" }),
|
|
177
|
+
h("path", { d: leftPath, fill: "none", stroke: "#000000", "stroke-width": 1 * s }),
|
|
178
|
+
h("path", { d: rightPath, fill: "none", stroke: "#000000", "stroke-width": 1 * s }),
|
|
179
|
+
];
|
|
170
180
|
}
|
|
171
181
|
/**
|
|
172
182
|
* Renders an absolute variance bar chart (d_ prefix).
|
|
173
183
|
* Horizontal bar with centered axis, green for positive, red for negative.
|
|
174
|
-
*
|
|
184
|
+
* When a bar exceeds maxBarWidth it is drawn as an overdrive bar:
|
|
185
|
+
* base segment + zigzag break + proportional overdrive stub (like structure chart).
|
|
175
186
|
*
|
|
176
187
|
* Layout: [left label area][bar area with axis][right label area]
|
|
177
188
|
*/
|
|
178
189
|
const AbsoluteVarianceBar = (props) => {
|
|
179
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm =
|
|
190
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm = 10, styles = DEFAULT_STYLES, } = props;
|
|
180
191
|
const s = styles.scaleFactor;
|
|
192
|
+
const fs = styles.fontSize;
|
|
181
193
|
const labelAreaWidth = 38 * s;
|
|
182
|
-
const maxBarWidth = maxBarWidthEm *
|
|
194
|
+
const maxBarWidth = maxBarWidthEm * fs;
|
|
195
|
+
// Overdrive layout constants
|
|
196
|
+
const breakGap = 4 * s;
|
|
197
|
+
const overdriveZoneWidth = maxBarWidth * 0.15;
|
|
198
|
+
const cutWidth = maxBarWidth - breakGap - overdriveZoneWidth;
|
|
199
|
+
// Direct unit scaling via fontSize
|
|
200
|
+
const scaledWidth = Math.abs(value) * styles.unitScaling * fs;
|
|
201
|
+
const isExtreme = scaledWidth > cutWidth;
|
|
202
|
+
// Compute proportional overdrive width across the column
|
|
203
|
+
const maxScaledWidth = columnStats.absMax * styles.unitScaling * fs;
|
|
204
|
+
const maxOverflow = Math.max(0, maxScaledWidth - cutWidth);
|
|
205
|
+
const overflowAmount = Math.max(0, scaledWidth - cutWidth);
|
|
206
|
+
const overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
|
|
183
207
|
// Adaptive axis placement based on data range
|
|
184
208
|
const hasNeg = columnStats.min < 0;
|
|
185
209
|
const hasPos = columnStats.max > 0;
|
|
@@ -190,18 +214,10 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
190
214
|
const padding = 2 * s;
|
|
191
215
|
const barHeight = height - padding * 2;
|
|
192
216
|
const axisX = (hasNeg ? labelAreaWidth : 0) + negBarWidth;
|
|
193
|
-
// Proportional scaling with outlier detection
|
|
194
|
-
const effectiveMax = computeEffectiveMax(columnStats);
|
|
195
|
-
const absValue = Math.abs(value);
|
|
196
|
-
const proportion = effectiveMax > 0 ? absValue / effectiveMax : 0;
|
|
197
|
-
const isExtreme = absValue > effectiveMax;
|
|
198
|
-
const barWidth = Math.min(proportion, 1) * maxBarWidth;
|
|
199
|
-
const isPositive = value >= 0;
|
|
200
|
-
const barX = isPositive ? axisX : axisX - barWidth;
|
|
201
217
|
const barY = padding;
|
|
218
|
+
const isPositive = value >= 0;
|
|
202
219
|
// Get style based on column type (scenario vs variance)
|
|
203
220
|
const barStyle = getBarStyle(scenario, value, isPositiveGood, styles);
|
|
204
|
-
// Pattern prefix for scenarios uses scenario type, for variances uses pos/neg
|
|
205
221
|
const patternPrefix = isScenarioColumn(scenario)
|
|
206
222
|
? getScenarioType(scenario)
|
|
207
223
|
: isPositiveGood
|
|
@@ -214,13 +230,14 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
214
230
|
const fillValue = getBarFill(barStyle, patternPrefix);
|
|
215
231
|
const { stroke: barStroke, strokeWidth: barStrokeWidth } = getBarStroke(barStyle);
|
|
216
232
|
const displayValue = formattedValue || formatValue(value, false, measureScale);
|
|
217
|
-
//
|
|
218
|
-
|
|
219
|
-
//
|
|
220
|
-
const
|
|
233
|
+
// Normal bar width (clamped to cutWidth when extreme)
|
|
234
|
+
const baseBarWidth = isExtreme ? cutWidth : scaledWidth;
|
|
235
|
+
// Label position accounts for overdrive
|
|
236
|
+
const totalVisualWidth = isExtreme ? cutWidth + breakGap + overdriveWidth : scaledWidth;
|
|
237
|
+
const labelX = isPositive ? axisX + totalVisualWidth + 4 * s : axisX - totalVisualWidth - 4 * s;
|
|
221
238
|
const labelAnchor = isPositive ? "start" : "end";
|
|
222
|
-
|
|
223
|
-
|
|
239
|
+
return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart absolute-variance", style: { overflow: "visible" } }, h(PatternDefs, { styles: styles }), h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), baseBarWidth > 0 && (h("rect", { x: isPositive ? axisX : axisX - baseBarWidth, y: barY, width: baseBarWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme && overdriveWidth > 0 && (h("rect", { x: isPositive ? axisX + cutWidth + breakGap : axisX - cutWidth - breakGap - overdriveWidth, y: barY, width: overdriveWidth, height: barHeight, fill: fillValue, stroke: barStroke, "stroke-width": barStrokeWidth * s })), isExtreme &&
|
|
240
|
+
renderZigzagBreak(isPositive ? axisX + cutWidth : axisX - cutWidth - breakGap, breakGap, barY, barHeight, s), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": labelAnchor, fill: styles.fontColor, "font-size": fs, "font-family": styles.fontFamily }, displayValue)));
|
|
224
241
|
};
|
|
225
242
|
/**
|
|
226
243
|
* Renders a relative variance pin chart (dr_ prefix).
|
|
@@ -230,10 +247,11 @@ const AbsoluteVarianceBar = (props) => {
|
|
|
230
247
|
* Uses percentageScaling to determine pin length (pixels per percentage point).
|
|
231
248
|
*/
|
|
232
249
|
const RelativeVariancePin = (props) => {
|
|
233
|
-
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm =
|
|
250
|
+
const { value, scenario, columnStats, height, isPositiveGood, formattedValue, measureScale, maxBarWidth: maxBarWidthEm = 10, styles = DEFAULT_STYLES, } = props;
|
|
234
251
|
const s = styles.scaleFactor;
|
|
252
|
+
const fs = styles.fontSize;
|
|
235
253
|
// Pin length is ~2/3 of bar width for visual balance
|
|
236
|
-
const maxPinLength = Math.round(maxBarWidthEm * 0.67 *
|
|
254
|
+
const maxPinLength = Math.round(maxBarWidthEm * 0.67 * fs);
|
|
237
255
|
const pinPadding = 5 * s;
|
|
238
256
|
// Adaptive axis placement based on data range
|
|
239
257
|
const hasNeg = columnStats.min < 0;
|
|
@@ -245,12 +263,11 @@ const RelativeVariancePin = (props) => {
|
|
|
245
263
|
const totalWidth = pinAreaWidth + labelAreaWidth;
|
|
246
264
|
const axisX = negPinWidth;
|
|
247
265
|
const centerY = height / 2;
|
|
248
|
-
//
|
|
249
|
-
const
|
|
250
|
-
const
|
|
251
|
-
const
|
|
252
|
-
const
|
|
253
|
-
const pinLength = Math.min(proportion, 1) * maxPinLength;
|
|
266
|
+
// Direct unit scaling via fontSize
|
|
267
|
+
const percentValue = Math.abs(value) * 100;
|
|
268
|
+
const scaledLength = percentValue * styles.percentageScaling * fs;
|
|
269
|
+
const isExtreme = scaledLength > maxPinLength;
|
|
270
|
+
const pinLength = Math.min(scaledLength, maxPinLength);
|
|
254
271
|
const isPositive = value >= 0;
|
|
255
272
|
const pinEndX = isPositive ? axisX + pinLength : axisX - pinLength;
|
|
256
273
|
// Get style based on column type (scenario vs variance)
|
|
@@ -259,7 +276,7 @@ const RelativeVariancePin = (props) => {
|
|
|
259
276
|
const displayValue = formattedValue || formatValue(value, true, measureScale);
|
|
260
277
|
// Label always on the right side after the pin area
|
|
261
278
|
const labelX = pinAreaWidth + 4 * s;
|
|
262
|
-
return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), !isExtreme && h("circle", { cx: pinEndX, cy: centerY, r: dotRadius, fill: styles.fontColor }), h("line", { x1: axisX, y1: centerY, x2: pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": 2 * s }), isExtreme && isPositive && (h("polygon", { points: `${axisX + maxPinLength},${centerY} ${axisX + maxPinLength - 6 * s},${centerY - 3 * s} ${axisX + maxPinLength - 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), isExtreme && !isPositive && (h("polygon", { points: `${axisX - maxPinLength},${centerY} ${axisX - maxPinLength + 6 * s},${centerY - 3 * s} ${axisX - maxPinLength + 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": "start", fill: styles.fontColor, "font-size":
|
|
279
|
+
return (h("svg", { width: totalWidth, height: height, class: "cell-bar-chart relative-variance", style: { overflow: "visible" } }, h("line", { x1: axisX, y1: 0, x2: axisX, y2: height, stroke: AXIS_COLOR, "stroke-width": 1 * s }), !isExtreme && h("circle", { cx: pinEndX, cy: centerY, r: dotRadius, fill: styles.fontColor }), h("line", { x1: axisX, y1: centerY, x2: pinEndX, y2: centerY, stroke: barStyle.fill, "stroke-width": 2 * s }), isExtreme && isPositive && (h("polygon", { points: `${axisX + maxPinLength},${centerY} ${axisX + maxPinLength - 6 * s},${centerY - 3 * s} ${axisX + maxPinLength - 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), isExtreme && !isPositive && (h("polygon", { points: `${axisX - maxPinLength},${centerY} ${axisX - maxPinLength + 6 * s},${centerY - 3 * s} ${axisX - maxPinLength + 6 * s},${centerY + 3 * s}`, fill: barStyle.fill })), h("text", { x: labelX, y: height / 2, dy: "0.35em", "text-anchor": "start", fill: styles.fontColor, "font-size": fs, "font-style": "italic", "font-family": styles.fontFamily }, displayValue)));
|
|
263
280
|
};
|
|
264
281
|
/**
|
|
265
282
|
* CellBarChart - Renders IBCS-compliant variance bar charts.
|
|
@@ -41,6 +41,7 @@ export const SYSTEM_STYLE_DEFAULTS = {
|
|
|
41
41
|
neg: { stroke: "#ff0000", fill: "#ff0000", width: 0.1 },
|
|
42
42
|
neu: { stroke: "#808080", fill: "#808080", width: 0.1 },
|
|
43
43
|
},
|
|
44
|
+
stackColors: ["#000000", "#c0c0c0", "#808080"],
|
|
44
45
|
padding: {
|
|
45
46
|
top: 10,
|
|
46
47
|
left: 10,
|
|
@@ -83,6 +84,7 @@ export const SYSTEM_STYLE_DEFAULTS = {
|
|
|
83
84
|
neg: { stroke: "#ff0000", fill: "#ff0000", width: 0.1 },
|
|
84
85
|
neu: { stroke: "#808080", fill: "#808080", width: 0.1 },
|
|
85
86
|
},
|
|
87
|
+
stackColors: ["#000000", "#c0c0c0", "#808080"],
|
|
86
88
|
padding: {
|
|
87
89
|
top: 10,
|
|
88
90
|
left: 10,
|
|
@@ -154,13 +154,16 @@ export var ChartMode;
|
|
|
154
154
|
ChartMode["LINE"] = "line";
|
|
155
155
|
ChartMode["AUTO"] = "auto";
|
|
156
156
|
})(ChartMode || (ChartMode = {}));
|
|
157
|
-
/**
|
|
157
|
+
/**
|
|
158
|
+
* Stacking dimension for multi-segment bar charts.
|
|
159
|
+
* - SCENARIOS: stack the scenarios from the `scenarios` prop end-to-end
|
|
160
|
+
* - DIMENSIONS: stack by the next-lower hierarchy level derived from the `level` prop
|
|
161
|
+
* (rowGroup → category, category → subCategory)
|
|
162
|
+
*/
|
|
158
163
|
export var StackBy;
|
|
159
164
|
(function (StackBy) {
|
|
160
|
-
StackBy["
|
|
161
|
-
StackBy["
|
|
162
|
-
StackBy["SUBCATEGORY"] = "subcategory";
|
|
163
|
-
StackBy["ROWGROUP"] = "rowgroup";
|
|
165
|
+
StackBy["SCENARIOS"] = "scenarios";
|
|
166
|
+
StackBy["DIMENSIONS"] = "dimensions";
|
|
164
167
|
})(StackBy || (StackBy = {}));
|
|
165
168
|
/**
|
|
166
169
|
* How stacked values are presented.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import hash from "@emotion/hash";
|
|
2
|
+
import { gunzipSync } from "fflate";
|
|
3
|
+
/**
|
|
4
|
+
* Compute a short deterministic hash of a string.
|
|
5
|
+
*/
|
|
6
|
+
export function computeContentHash(text) {
|
|
7
|
+
return hash(text);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Decode a compressed payload in the format `<hash>:<base64_gzip>`.
|
|
11
|
+
* Returns the embedded hash and the decompressed JSON string.
|
|
12
|
+
*/
|
|
13
|
+
export function decodeCompressedContent(text) {
|
|
14
|
+
const colonIndex = text.indexOf(":");
|
|
15
|
+
if (colonIndex === -1) {
|
|
16
|
+
throw new Error("Invalid compressed format: missing ':' separator");
|
|
17
|
+
}
|
|
18
|
+
const embeddedHash = text.slice(0, colonIndex);
|
|
19
|
+
const base64Data = text.slice(colonIndex + 1);
|
|
20
|
+
const binaryString = atob(base64Data);
|
|
21
|
+
const bytes = new Uint8Array(binaryString.length);
|
|
22
|
+
for (let i = 0; i < binaryString.length; i++) {
|
|
23
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
24
|
+
}
|
|
25
|
+
const decompressed = gunzipSync(bytes);
|
|
26
|
+
const json = new TextDecoder().decode(decompressed);
|
|
27
|
+
return { hash: embeddedHash, json };
|
|
28
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Default fill colors cycled through for stacked chart segments. */
|
|
2
|
-
export const STACK_FILLS = ["#
|
|
2
|
+
export const STACK_FILLS = ["#000000", "#c0c0c0", "#808080"];
|
|
3
3
|
/** Default stroke colors cycled through for stacked chart segments. */
|
|
4
|
-
export const STACK_STROKES = ["#
|
|
4
|
+
export const STACK_STROKES = ["#000000", "#c0c0c0", "#808080"];
|
|
5
5
|
/**
|
|
6
6
|
* IBCS rendering order: back-to-front (PL behind FC behind PP behind AC).
|
|
7
7
|
* Used to ensure correct visual layering when scenarios overlap.
|
|
@@ -294,7 +294,7 @@ export function validateStackConfig(value) {
|
|
|
294
294
|
errors.push("stack: 'by' is required");
|
|
295
295
|
}
|
|
296
296
|
else {
|
|
297
|
-
const validBy = ["
|
|
297
|
+
const validBy = ["scenarios", "dimensions"];
|
|
298
298
|
if (!validBy.includes(config.by)) {
|
|
299
299
|
errors.push(`stack: 'by' must be one of: ${validBy.join(", ")}`);
|
|
300
300
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./alasql.min.js";import{
|
|
1
|
+
import{a as e}from"./alasql.min.js";import{j as t}from"./Order.js";class a{constructor(e="",t=1){this.prefix=e,this.value=t}}var s;!function(e){e[e.Y=1e24]="Y",e[e.Z=1e21]="Z",e[e.E=1e18]="E",e[e.P=1e15]="P",e[e.T=1e12]="T",e[e.G=1e9]="G",e[e.M=1e6]="M",e[e.k=1e3]="k",e[e.h=100]="h",e[e.da=10]="da",e[e.d=.1]="d",e[e.c=.01]="c",e[e.m=.001]="m",e[e.my=1e-6]="my",e[e.n=1e-9]="n",e[e.p=1e-12]="p",e[e.f=1e-15]="f",e[e.a=1e-18]="a",e[e.z=1e-21]="z",e[e.y=1e-24]="y"}(s||(s={}));class r{static calculateMeasureScale(t,s,r){var n;if("_"===r)return new a;if(null!=r&&[...this.unitsLeast,...this.unitsGreat].includes(r))return this.lookupPrefix(r);if(0===s.length)return new a;const i=`SELECT MAX(GREATEST(${s.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`,u=`SELECT MIN(LEAST(${s.filter((e=>3===e.length)).map((e=>"ABS("+e+")")).toString()})) as prefixvalue\n FROM ?`;let c=i;"LEAST"===(null==r?void 0:r.toUpperCase())&&(c=u);const l=null===(n=e(c,[t])[0])||void 0===n?void 0:n.prefixvalue;return this.determinePrefix(Math.abs(l))}static determinePrefix(e){if(e>=1e3){const t=Math.floor(Math.floor(Math.abs(e)).toString().length/3),s=+Math.pow(1e3,t);return new a(this.unitsGreat[t-1],s)}if(e<=.001){const t=Math.floor(Math.abs(e).toString().length/3),s=1/Math.pow(1e3,t);return new a(this.unitsLeast[t-1],s)}return new a}static lookupPrefix(e){return new a(e,s[e])}}r.unitsGreat=["k","M","G","T","P","E","Z","Y"],r.unitsLeast=["m","my","n","p","P","f","a","z","y"];class n{constructor(e=2,t=1){this.percent=e,this.decimal=t}}class i{adapt(e){const a=new n;return t.isNumber(e.percent)&&(a.percent=e.percent),t.isNumber(e.decimal)&&(a.decimal=e.decimal),a}default(){return new n}}export{r as D,a as S,n as a,i as b}
|