@bino-bi/bn-template-engine 1.0.0-alpha.8 → 1.0.0-next.19
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/LICENSE +203 -21
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-19bbac66.entry.js +1 -0
- package/dist/bn-template-engine/p-209351c9.entry.js +1 -0
- package/dist/bn-template-engine/p-22d0fb7a.entry.js +1 -0
- package/dist/bn-template-engine/p-2e6dc267.entry.js +1 -0
- package/dist/bn-template-engine/p-485d23d7.entry.js +1 -0
- package/dist/bn-template-engine/p-74c5a95d.entry.js +1 -0
- package/dist/bn-template-engine/p-7bdc0e28.entry.js +1 -0
- package/dist/bn-template-engine/p-83c71b16.entry.js +1 -0
- package/dist/bn-template-engine/p-90806e7a.entry.js +1 -0
- package/dist/bn-template-engine/p-9879c9b2.entry.js +1 -0
- package/dist/bn-template-engine/p-BA48JiHe.js +1 -0
- package/dist/bn-template-engine/p-BWKdb9ym.js +1 -0
- package/dist/bn-template-engine/p-BZV1b5VH.js +1 -0
- package/dist/bn-template-engine/p-Bdfxd_Ke.js +1 -0
- package/dist/bn-template-engine/p-BjBz5cSL.js +1 -0
- package/dist/bn-template-engine/p-BqhIhYr1.js +1 -0
- package/dist/bn-template-engine/p-C0Pwqx-O.js +1 -0
- package/dist/bn-template-engine/p-CiudZRQr.js +1 -0
- package/dist/bn-template-engine/p-DTuaq8Pj.js +1 -0
- package/dist/bn-template-engine/p-DY7YYmpa.js +1 -0
- package/dist/bn-template-engine/p-Dg9OcXAO.js +1 -0
- package/dist/bn-template-engine/p-DsTzlzxQ.js +1 -0
- package/dist/bn-template-engine/p-X6CxL6W-.js +1 -0
- package/dist/bn-template-engine/p-a8291de2.entry.js +1 -0
- package/dist/bn-template-engine/p-aakBGfzL.js +1 -0
- package/dist/bn-template-engine/p-b25455a7.entry.js +1 -0
- package/dist/bn-template-engine/p-e96da91f.entry.js +1 -0
- package/dist/bn-template-engine/p-eca8e2e2.entry.js +1 -0
- package/dist/bn-template-engine/p-f9dfd120.entry.js +1 -0
- package/dist/bn-template-engine/p-rdqTC0_5.js +1 -0
- package/dist/cjs/AxisConfig-VnVelfSV.js +233 -0
- package/dist/cjs/LabelCollisionManager-nfD5P__k.js +412 -0
- package/dist/cjs/NumericScale-BAyYXpKL.js +107 -0
- package/dist/cjs/Order-DobBozQC.js +87 -0
- package/dist/cjs/SVGStyle-BQOmGWLX.js +8209 -0
- package/dist/cjs/SVGVariancesStyleGroup-DCGfHrqh.js +50 -0
- package/dist/cjs/VarianceMeasure-NY9yhiNV.js +372 -0
- package/dist/cjs/XYChartDataRow-B7OKrAcC.js +829 -0
- package/dist/cjs/bn-asset_21.cjs.entry.js +16047 -0
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +762 -0
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +785 -0
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +658 -0
- package/dist/cjs/bn-grid.cjs.entry.js +5 -3
- package/dist/cjs/bn-image.cjs.entry.js +5 -3
- package/dist/cjs/bn-internationalization.cjs.entry.js +10 -8
- package/dist/cjs/bn-ruleset.cjs.entry.js +41 -0
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +8 -79
- package/dist/cjs/bn-tree.cjs.entry.js +9 -3
- package/dist/cjs/context-protocol-BDrMkhc4.js +9499 -0
- package/dist/cjs/editor-companion.cjs.entry.js +13 -6
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +624 -0
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +673 -0
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +667 -0
- package/dist/cjs/layoutObserver-o03YUfn_.js +199 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +85 -0
- package/dist/cjs/scaling-DKZyjWj5.js +587 -0
- package/dist/cjs/{withBodyObserver-D7BKWN2N.js → withBodyObserver-BKUE_ypL.js} +12 -7
- package/dist/cjs/withScalingGroup-BmcRlWBs.js +73 -0
- package/dist/cjs/withStyled-CRiC9fzc.js +1137 -0
- package/dist/collection/collection-manifest.json +9 -1
- package/dist/collection/components/bn-body/bn-body.css +1 -0
- package/dist/collection/components/bn-card/bn-card.css +2 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.css +10 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +1110 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +9 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +653 -0
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +472 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +10 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +1014 -0
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +9 -0
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +538 -0
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +440 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +132 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +89 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/index.js +2 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +10 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +965 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +9 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +580 -0
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +409 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +127 -41
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +103 -36
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +82 -58
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +46 -4
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/bn-chart-time.css +1 -1
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +162 -42
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +94 -31
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +132 -74
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
- package/dist/collection/components/bn-context/bn-context.js +1 -1
- package/dist/collection/components/bn-dataset/bn-dataset.js +226 -23
- package/dist/collection/components/bn-datasource/bn-datasource.js +163 -12
- package/dist/collection/components/bn-footer/bn-footer.js +1 -1
- package/dist/collection/components/bn-grid/bn-grid.js +1 -1
- package/dist/collection/components/bn-image/bn-image.js +1 -1
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +10 -7
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +8 -3
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +98 -35
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +5 -3
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +98 -25
- package/dist/collection/components/bn-message/bn-message.css +6 -2
- package/dist/collection/components/bn-message/bn-message.js +3 -2
- package/dist/collection/components/bn-page/bn-page.js +1 -1
- package/dist/collection/components/bn-ruleset/bn-ruleset.css +3 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +68 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.css +3 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +136 -0
- package/dist/collection/components/bn-table/bn-table.js +317 -61
- package/dist/collection/components/bn-table/ibcs-table.css +8 -0
- package/dist/collection/components/bn-table/ibcs-table.js +161 -32
- package/dist/collection/components/bn-table/utils/Table.js +72 -28
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +13 -8
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -2
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +47 -0
- package/dist/collection/components/bn-table/utils/elements/index.js +1 -0
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +117 -22
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +380 -50
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +140 -0
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +4 -9
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +166 -0
- package/dist/collection/components/bn-table/utils/helper/index.js +2 -0
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +46 -0
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +20 -4
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +2 -75
- package/dist/collection/components/bn-title/bn-title.js +27 -3
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.css +4 -0
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +29 -6
- package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +3 -0
- package/dist/collection/components/bn-tree/bn-tree.js +5 -1
- package/dist/collection/components/editor-companion/editor-companion.js +12 -5
- package/dist/collection/context/scopedDb.js +127 -0
- package/dist/collection/stores/componentStyles.js +67 -0
- package/dist/collection/stores/createScopedStores.js +11 -5
- package/dist/collection/stores/internationalization.js +68 -0
- package/dist/collection/stores/ruleSets.js +46 -0
- package/dist/collection/utils/constants.js +5 -0
- package/dist/collection/utils/dataAnalyzer.js +14 -8
- package/dist/collection/utils/ibcsRuleSet.js +14 -26
- package/dist/collection/utils/layoutObserver.js +88 -0
- package/dist/collection/utils/parentDimensions.js +71 -15
- package/dist/collection/utils/sanitizeHtml.js +81 -0
- package/dist/collection/utils/validate.js +47 -0
- package/dist/collection/utils/withBodyObserver.js +12 -7
- package/dist/collection/utils/withComponentStyle.js +3 -5
- package/dist/collection/utils/withDataset.js +43 -39
- package/dist/collection/utils/withDatasource.js +28 -18
- package/dist/collection/utils/withInheritedProps.js +26 -1
- package/dist/collection/utils/withRuleSet.js +105 -0
- package/dist/collection/utils/withScalingGroup.js +69 -0
- package/dist/collection/utils/withTranslation.js +50 -14
- package/dist/collection/utils/xy/FacetGrid.js +36 -0
- package/dist/collection/utils/xy/IsoCurves.js +156 -0
- package/dist/collection/utils/xy/NumericScale.js +103 -0
- package/dist/collection/utils/xy/PointLabeler.js +96 -0
- package/dist/collection/utils/xy/RadiusScale.js +42 -0
- package/dist/collection/utils/xy/SeriesPalette.js +80 -0
- package/dist/collection/utils/xy/VarianceMeasure.js +76 -0
- package/dist/collection/utils/xy/XYFrame.js +120 -0
- package/dist/collection/utils/xy/XYLegend.js +107 -0
- package/dist/collection/utils/xy/model/AxisConfig.js +221 -0
- package/dist/collection/utils/xy/model/ScaleFactorsXYChart.js +69 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +52 -0
- package/dist/components/AxisConfig.js +1 -0
- package/dist/components/CompareUtil.js +1 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -0
- package/dist/components/NumericScale.js +1 -0
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.js +1 -1
- package/dist/components/SiPrefix.js +1 -0
- package/dist/components/StringAdapter.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -0
- package/dist/components/XYChartDataRow.js +1 -0
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.js +1 -1
- package/dist/components/bn-chart-bubble.d.ts +11 -0
- package/dist/components/bn-chart-bubble.js +1 -0
- package/dist/components/bn-chart-bullet.d.ts +11 -0
- package/dist/components/bn-chart-bullet.js +1 -0
- package/dist/components/bn-chart-scatter.d.ts +11 -0
- package/dist/components/bn-chart-scatter.js +1 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer2.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message2.js +1 -1
- package/dist/components/bn-page2.js +1 -1
- package/dist/components/bn-ruleset.d.ts +11 -0
- package/dist/components/bn-ruleset.js +1 -0
- package/dist/components/bn-scaling-group.d.ts +11 -0
- package/dist/components/bn-scaling-group.js +1 -0
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-template.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/formatter.js +1 -0
- package/dist/components/ibcs-chart-bubble.d.ts +11 -0
- package/dist/components/ibcs-chart-bubble.js +1 -0
- package/dist/components/ibcs-chart-bubble2.js +1 -0
- package/dist/components/ibcs-chart-bullet.d.ts +11 -0
- package/dist/components/ibcs-chart-bullet.js +1 -0
- package/dist/components/ibcs-chart-bullet2.js +1 -0
- package/dist/components/ibcs-chart-scatter.d.ts +11 -0
- package/dist/components/ibcs-chart-scatter.js +1 -0
- package/dist/components/ibcs-chart-scatter2.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/layoutObserver.js +1 -0
- package/dist/components/luxon.js +1 -0
- package/dist/components/main.js +1 -0
- package/dist/components/merge.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -0
- package/dist/components/stackColors.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -0
- package/dist/components/withRuleSet.js +1 -0
- package/dist/components/withScalingGroup.js +1 -0
- package/dist/components/withStyled.js +1 -1
- package/dist/components/withTranslation.js +1 -1
- package/dist/esm/AxisConfig-C_zWCKlL.js +224 -0
- package/dist/esm/LabelCollisionManager-8swVQHKA.js +404 -0
- package/dist/esm/NumericScale-DsTzlzxQ.js +105 -0
- package/dist/esm/Order-BPeWfygb.js +83 -0
- package/dist/esm/SVGStyle-BxEDw9zh.js +8199 -0
- package/dist/esm/SVGVariancesStyleGroup-DRQYvSDD.js +48 -0
- package/dist/esm/VarianceMeasure-DnwNKspZ.js +364 -0
- package/dist/esm/XYChartDataRow-DeV4r-Wm.js +820 -0
- package/dist/esm/bn-asset_21.entry.js +16025 -0
- package/dist/esm/bn-chart-bubble.entry.js +760 -0
- package/dist/esm/bn-chart-bullet.entry.js +783 -0
- package/dist/esm/bn-chart-scatter.entry.js +656 -0
- package/dist/esm/bn-grid.entry.js +5 -3
- package/dist/esm/bn-image.entry.js +5 -3
- package/dist/esm/bn-internationalization.entry.js +10 -8
- package/dist/esm/bn-ruleset.entry.js +39 -0
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +1 -1
- package/dist/esm/bn-text.entry.js +7 -78
- package/dist/esm/bn-tree.entry.js +9 -3
- package/dist/esm/context-protocol-1Yj1uKvh.js +9484 -0
- package/dist/esm/editor-companion.entry.js +13 -6
- package/dist/esm/ibcs-chart-bubble.entry.js +622 -0
- package/dist/esm/ibcs-chart-bullet.entry.js +671 -0
- package/dist/esm/ibcs-chart-scatter.entry.js +665 -0
- package/dist/esm/layoutObserver-BG5dOBYH.js +196 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sanitizeHtml-BA48JiHe.js +83 -0
- package/dist/esm/scaling-CeSRcRl1.js +579 -0
- package/dist/esm/{withBodyObserver-AFk2wwHT.js → withBodyObserver-IokS6fHD.js} +12 -7
- package/dist/esm/withScalingGroup-Br70pAv9.js +71 -0
- package/dist/esm/withStyled-Br2DGTPs.js +1104 -0
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +193 -0
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +58 -0
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +91 -0
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +172 -0
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +52 -0
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +91 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +70 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +43 -0
- package/dist/types/components/bn-chart-bullet/utils/model/index.d.ts +2 -0
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +172 -0
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +53 -0
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +66 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +19 -5
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +13 -6
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +16 -12
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +16 -1
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +53 -13
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +13 -6
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +16 -12
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +47 -5
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +53 -6
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +35 -8
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +32 -1
- package/dist/types/components/bn-message/bn-message.d.ts +5 -2
- package/dist/types/components/bn-ruleset/bn-ruleset.d.ts +8 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +37 -0
- package/dist/types/components/bn-table/bn-table.d.ts +74 -12
- package/dist/types/components/bn-table/ibcs-table.d.ts +27 -4
- package/dist/types/components/bn-table/utils/Table.d.ts +16 -6
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +33 -0
- package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +2 -1
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +21 -0
- package/dist/types/components/bn-table/utils/elements/index.d.ts +1 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +17 -9
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +35 -3
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +37 -0
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +4 -5
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +55 -0
- package/dist/types/components/bn-table/utils/helper/index.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +22 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +12 -3
- package/dist/types/components/bn-table/utils/model/index.d.ts +21 -0
- package/dist/types/components/bn-title/bn-title.d.ts +11 -1
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +2 -0
- package/dist/types/components/bn-title/ibcs-title/utils/Title.d.ts +1 -0
- package/dist/types/components/editor-companion/editor-companion.d.ts +2 -0
- package/dist/types/components.d.ts +1691 -120
- package/dist/types/context/context-protocol.d.ts +7 -3
- package/dist/types/context/scopedDb.d.ts +37 -0
- package/dist/types/stores/componentStyles.d.ts +41 -0
- package/dist/types/stores/createScopedStores.d.ts +4 -2
- package/dist/types/stores/ruleSets.d.ts +40 -0
- package/dist/types/utils/DateStringFactory.d.ts +1 -1
- package/dist/types/utils/constants.d.ts +5 -0
- package/dist/types/utils/dataAnalyzer.d.ts +2 -1
- package/dist/types/utils/ibcsRuleSet.d.ts +6 -1
- package/dist/types/utils/layoutObserver.d.ts +27 -0
- package/dist/types/utils/model/ChartStyles.d.ts +2 -1
- package/dist/types/utils/parentDimensions.d.ts +1 -1
- package/dist/types/utils/sanitizeHtml.d.ts +6 -0
- package/dist/types/utils/validate.d.ts +18 -0
- package/dist/types/utils/withDataset.d.ts +6 -2
- package/dist/types/utils/withDatasource.d.ts +3 -3
- package/dist/types/utils/withInheritedProps.d.ts +19 -0
- package/dist/types/utils/withRuleSet.d.ts +24 -0
- package/dist/types/utils/withScalingGroup.d.ts +14 -0
- package/dist/types/utils/withTranslation.d.ts +12 -4
- package/dist/types/utils/xy/FacetGrid.d.ts +27 -0
- package/dist/types/utils/xy/IsoCurves.d.ts +46 -0
- package/dist/types/utils/xy/NumericScale.d.ts +41 -0
- package/dist/types/utils/xy/PointLabeler.d.ts +58 -0
- package/dist/types/utils/xy/RadiusScale.d.ts +26 -0
- package/dist/types/utils/xy/SeriesPalette.d.ts +59 -0
- package/dist/types/utils/xy/VarianceMeasure.d.ts +37 -0
- package/dist/types/utils/xy/XYFrame.d.ts +44 -0
- package/dist/types/utils/xy/XYLegend.d.ts +43 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +96 -0
- package/dist/types/utils/xy/model/ScaleFactorsXYChart.d.ts +36 -0
- package/dist/types/utils/xy/model/XYChartDataRow.d.ts +157 -0
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +31 -0
- package/package.json +5 -4
- package/readme.md +9 -5
- package/dist/bn-template-engine/p-0d41c5d8.entry.js +0 -1
- package/dist/bn-template-engine/p-67538176.entry.js +0 -1
- package/dist/bn-template-engine/p-825a07a8.entry.js +0 -1
- package/dist/bn-template-engine/p-916296a5.entry.js +0 -1
- package/dist/bn-template-engine/p-96006b06.entry.js +0 -1
- package/dist/bn-template-engine/p-Ck-NYtot.js +0 -1
- package/dist/bn-template-engine/p-CnDq0oVa.js +0 -1
- package/dist/bn-template-engine/p-DSXNgKLa.js +0 -1
- package/dist/bn-template-engine/p-bc711fb0.entry.js +0 -1
- package/dist/bn-template-engine/p-e6f646b1.entry.js +0 -1
- package/dist/bn-template-engine/p-f41d9242.entry.js +0 -1
- package/dist/bn-template-engine/p-gFbbuhtl.js +0 -1
- package/dist/cjs/bn-asset_20.cjs.entry.js +0 -23541
- package/dist/cjs/context-protocol-ohYzcb5F.js +0 -663
- package/dist/cjs/scaling-CIAClQR5.js +0 -314
- package/dist/cjs/withStyled-qd94SSb4.js +0 -9535
- package/dist/collection/stores/datasets.js +0 -14
- package/dist/collection/stores/datasources.js +0 -14
- package/dist/components/_commonjsHelpers.js +0 -1
- package/dist/components/alasql.min.js +0 -1
- package/dist/components/ibcsRuleSet.js +0 -1
- package/dist/components/scaling.js +0 -1
- package/dist/components/withInheritedProps.js +0 -1
- package/dist/esm/bn-asset_20.entry.js +0 -23520
- package/dist/esm/context-protocol-DdbSplvE.js +0 -656
- package/dist/esm/scaling-DGKKkuL9.js +0 -309
- package/dist/esm/withStyled-BIkqU2w4.js +0 -9501
- package/dist/types/stores/datasets.d.ts +0 -14
- package/dist/types/stores/datasources.d.ts +0 -14
|
@@ -4,12 +4,12 @@ import { DataPoint, Scenario } from "./model";
|
|
|
4
4
|
import { AreaFill, Axis, HookLocation, Label, StackedColumn, } from "./elements";
|
|
5
5
|
import { ScenarioFactory } from "./factories";
|
|
6
6
|
import { LabelCollisionManager, SCENARIO_PRIORITY } from "./helper";
|
|
7
|
-
import alasql from "alasql";
|
|
8
7
|
import CalculateSize from "calculate-size";
|
|
9
8
|
import { ScaleFactorsTimeChart } from "./model/styles/ScaleFactorsTimeChart";
|
|
10
9
|
import { DateTime } from "luxon";
|
|
10
|
+
import { buildFromExpr } from "../../../context/scopedDb";
|
|
11
11
|
import { DateDistance, DateStringFactory } from "../../../utils/DateStringFactory";
|
|
12
|
-
import { AxisLabelsMode, ChartMode, StackBy, StackMode } from "../../../utils/constants";
|
|
12
|
+
import { AxisLabelsMode, ChartMode, RELATIVE_STACK_UNITS, StackBy, StackMode, } from "../../../utils/constants";
|
|
13
13
|
import { getScenarioPrefix, IBCS_LAYER_ORDER } from "../../../utils/stackColors";
|
|
14
14
|
import { Formatter } from "../../../utils";
|
|
15
15
|
import { IBCSRuleSet } from "../../../utils/ibcsRuleSet";
|
|
@@ -50,7 +50,7 @@ var VarianceType;
|
|
|
50
50
|
* Auto chart mode: when dataModel.length exceeds maxBars, switches from bar to line.
|
|
51
51
|
*/
|
|
52
52
|
export class TimeChart {
|
|
53
|
-
constructor(ruleSet, config, styles, availableWidth = 0) {
|
|
53
|
+
constructor(ruleSet, db, tableName, config, styles, availableWidth = 0) {
|
|
54
54
|
this.CSS_CATEGORIES = "categories";
|
|
55
55
|
this.dataModel = [];
|
|
56
56
|
this.variancesDataModel = [];
|
|
@@ -63,7 +63,8 @@ export class TimeChart {
|
|
|
63
63
|
this.pixelPerPercentage = 1;
|
|
64
64
|
this.hideAxisLabels = false;
|
|
65
65
|
this.axisScenario = Scenario.AC1;
|
|
66
|
-
this.
|
|
66
|
+
this.fromExpr = "";
|
|
67
|
+
this.rowCount = 0;
|
|
67
68
|
this.axisCategoryArea = { width: 0, height: 0 };
|
|
68
69
|
this.scenariosArea = { width: 0, height: 0 };
|
|
69
70
|
this.state = FactoryState.DIRTY;
|
|
@@ -81,36 +82,29 @@ export class TimeChart {
|
|
|
81
82
|
this.chartMode = ChartMode.BAR;
|
|
82
83
|
this.maxBars = 28;
|
|
83
84
|
this.stackConfig = null;
|
|
85
|
+
this.scenarioPropOrder = [];
|
|
84
86
|
this.lineFullWidth = true;
|
|
85
87
|
this.availableWidth = 0;
|
|
86
88
|
this.overflowConfig = null;
|
|
87
89
|
this.lastScenarios = [];
|
|
88
|
-
this.
|
|
90
|
+
this.db = db;
|
|
91
|
+
this.tableName = tableName;
|
|
89
92
|
this.ruleSet = ruleSet || new IBCSRuleSet();
|
|
90
93
|
this.i18n = this.createI18n(new Map());
|
|
91
94
|
this.styles = styles;
|
|
92
95
|
this.availableWidth = availableWidth;
|
|
93
96
|
this.setConfig(config);
|
|
94
|
-
this.position = this.createElementPosition(
|
|
97
|
+
this.position = this.createElementPosition(this.lastScenarios);
|
|
95
98
|
}
|
|
96
99
|
updatePosition(scenarios) {
|
|
97
100
|
this.position = this.createElementPosition(scenarios);
|
|
98
101
|
}
|
|
99
|
-
initSQLFunctions() {
|
|
100
|
-
alasql.fn.transformOperator = function (a) {
|
|
101
|
-
return a === "-" ? -1 : 1;
|
|
102
|
-
};
|
|
103
|
-
// @ts-ignore
|
|
104
|
-
alasql.fn.normalizeDate = function (date, normalizationLevel, _locale) {
|
|
105
|
-
if (date === undefined || !date.isValid) {
|
|
106
|
-
return undefined;
|
|
107
|
-
}
|
|
108
|
-
return date.startOf(normalizationLevel);
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
102
|
setStyles(newStyle) {
|
|
112
103
|
this.styles = newStyle;
|
|
113
104
|
}
|
|
105
|
+
setRuleSet(ruleSet) {
|
|
106
|
+
this.ruleSet = ruleSet || new IBCSRuleSet();
|
|
107
|
+
}
|
|
114
108
|
setAvailableWidth(w) {
|
|
115
109
|
this.availableWidth = w;
|
|
116
110
|
}
|
|
@@ -173,15 +167,16 @@ export class TimeChart {
|
|
|
173
167
|
setConfig(config) {
|
|
174
168
|
var _a;
|
|
175
169
|
this.state = FactoryState.DIRTY;
|
|
176
|
-
this.
|
|
177
|
-
this.
|
|
170
|
+
this.scenarioPropOrder = [...config.scenarios];
|
|
171
|
+
const scenarios = this.sortScenariosbyVisualisationRules(config.scenarios);
|
|
172
|
+
this.setSource(config.filter);
|
|
178
173
|
this.hideAxisLabels = config.hideAxisLabels || false;
|
|
179
174
|
this.pixelPerUnit = config.pixelPerUnit;
|
|
180
175
|
this.pixelPerPercentage = config.pixelPerPercentage;
|
|
181
176
|
this.axisLabelsMode = config.axisLabelsMode;
|
|
182
177
|
this.intervalSpanLimit = config.intervalSpanLimit;
|
|
183
178
|
this.dateInterval = this.findDateInterval(config.dateInterval);
|
|
184
|
-
this.dataModel = this.populateModel(
|
|
179
|
+
this.dataModel = this.populateModel(scenarios, this.dateInterval, config.level, config.sortOrder);
|
|
185
180
|
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
186
181
|
this.title = config.title || Formatter.translateScenarioLabel((_a = config === null || config === void 0 ? void 0 : config.variances) === null || _a === void 0 ? void 0 : _a.toString(), this.i18n);
|
|
187
182
|
this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
|
|
@@ -199,8 +194,8 @@ export class TimeChart {
|
|
|
199
194
|
this.maxBars = config.maxBars;
|
|
200
195
|
this.stackConfig = config.stackConfig;
|
|
201
196
|
this.lineFullWidth = config.lineFullWidth;
|
|
202
|
-
this.lastScenarios =
|
|
203
|
-
this.updatePosition(
|
|
197
|
+
this.lastScenarios = scenarios;
|
|
198
|
+
this.updatePosition(scenarios);
|
|
204
199
|
}
|
|
205
200
|
getFooter() {
|
|
206
201
|
if (this.measureScale.value === 1 && this.measureUnit === "") {
|
|
@@ -208,9 +203,10 @@ export class TimeChart {
|
|
|
208
203
|
}
|
|
209
204
|
return Formatter.translateScenarioLabel("in", this.i18n) + " " + this.measureScale.prefix + this.measureUnit;
|
|
210
205
|
}
|
|
211
|
-
|
|
206
|
+
/** Returns a new array; the input keeps the `scenarios` prop order (the config is reused across rebuilds). */
|
|
207
|
+
sortScenariosbyVisualisationRules(scenarios) {
|
|
212
208
|
const self = this;
|
|
213
|
-
|
|
209
|
+
return [...scenarios]
|
|
214
210
|
.sort((n1, n2) => {
|
|
215
211
|
return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
|
|
216
212
|
})
|
|
@@ -233,31 +229,25 @@ export class TimeChart {
|
|
|
233
229
|
this.i18n = this.createI18n(i18n);
|
|
234
230
|
}
|
|
235
231
|
/**
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
* @param data
|
|
241
|
-
* @param filter - data filter
|
|
242
|
-
* @param customColumnNameMap Custon ColumnNameMap can be used if data uses non standard columnames
|
|
232
|
+
* Resolves the dataset (a table or view in the shared alasql database) and
|
|
233
|
+
* caches its row count. Subsequent queries reference the source by name —
|
|
234
|
+
* alasql doesn't have to ingest a fresh array per call.
|
|
243
235
|
*/
|
|
244
|
-
|
|
245
|
-
|
|
236
|
+
setSource(filter) {
|
|
237
|
+
var _a, _b;
|
|
238
|
+
this.state = FactoryState.DIRTY;
|
|
239
|
+
if (!this.tableName) {
|
|
240
|
+
this.fromExpr = "";
|
|
241
|
+
this.rowCount = 0;
|
|
246
242
|
return;
|
|
247
243
|
}
|
|
248
|
-
this.
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
this.preparedDataSet = alasql(`SELECT * FROM ? WHERE ${filter}`, [data]);
|
|
253
|
-
}
|
|
254
|
-
catch (e) {
|
|
255
|
-
console.error("TimeChart: filter query failed, using unfiltered data", filter, e);
|
|
256
|
-
this.preparedDataSet = data;
|
|
257
|
-
}
|
|
244
|
+
this.fromExpr = buildFromExpr(this.tableName, filter);
|
|
245
|
+
try {
|
|
246
|
+
const r = this.db.exec(`SELECT COUNT(*) AS cnt FROM ${this.fromExpr}`);
|
|
247
|
+
this.rowCount = ((_b = (_a = r[0]) === null || _a === void 0 ? void 0 : _a.cnt) !== null && _b !== void 0 ? _b : 0);
|
|
258
248
|
}
|
|
259
|
-
|
|
260
|
-
this.
|
|
249
|
+
catch (_e) {
|
|
250
|
+
this.rowCount = 0;
|
|
261
251
|
}
|
|
262
252
|
}
|
|
263
253
|
getAllocatedCanvasWidth() {
|
|
@@ -414,6 +404,7 @@ export class TimeChart {
|
|
|
414
404
|
return new Map([...defaultI18n, ...i18n]);
|
|
415
405
|
}
|
|
416
406
|
createElementPosition(scenarios) {
|
|
407
|
+
var _a;
|
|
417
408
|
let maxLabelLengthLeft;
|
|
418
409
|
// only need scenarios written on the leftside of bar/ marker
|
|
419
410
|
const scenarioLabelLeft = CalculateSize(scenarios
|
|
@@ -449,6 +440,12 @@ export class TimeChart {
|
|
|
449
440
|
min = this.smallestDataPointValue;
|
|
450
441
|
max = this.highestDataPointValue;
|
|
451
442
|
}
|
|
443
|
+
// In relative (100%) stacking the vertical domain is 0..RELATIVE_STACK_UNITS percent,
|
|
444
|
+
// not the raw data values — use a virtual max so axis position, canvas height and
|
|
445
|
+
// auto-fit all agree on the percent domain.
|
|
446
|
+
if (((_a = this.stackConfig) === null || _a === void 0 ? void 0 : _a.mode) === StackMode.RELATIVE) {
|
|
447
|
+
max = new DataPoint(RELATIVE_STACK_UNITS, max.scenario, this.pixelPerUnit, max.variance);
|
|
448
|
+
}
|
|
452
449
|
// When overflow config is active, create a virtual max so the coordinate system
|
|
453
450
|
// allocates exactly cutHeight + breakGap + overdriveZoneHeight instead of the
|
|
454
451
|
// full (clipped) bar height.
|
|
@@ -516,8 +513,7 @@ export class TimeChart {
|
|
|
516
513
|
return result;
|
|
517
514
|
}
|
|
518
515
|
populateModel(selectedScenarios, dateInterval, _level, _sortOrder) {
|
|
519
|
-
|
|
520
|
-
if (((_a = this.preparedDataSet) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
516
|
+
if (this.rowCount === 0 || !this.fromExpr) {
|
|
521
517
|
return [];
|
|
522
518
|
}
|
|
523
519
|
const select = ``;
|
|
@@ -559,17 +555,41 @@ export class TimeChart {
|
|
|
559
555
|
return localDateInterval;
|
|
560
556
|
}
|
|
561
557
|
queryMinMaxDates() {
|
|
562
|
-
var _a, _b
|
|
563
|
-
|
|
564
|
-
|
|
558
|
+
var _a, _b;
|
|
559
|
+
let result;
|
|
560
|
+
try {
|
|
561
|
+
result = this.db.exec(`SELECT MAX(${"date"}) as maxdate, MIN(${"date"}) as mindate FROM ${this.fromExpr}`);
|
|
562
|
+
}
|
|
563
|
+
catch (e) {
|
|
564
|
+
console.error("TimeChart: min/max date query failed", e);
|
|
565
|
+
return [{}];
|
|
566
|
+
}
|
|
567
|
+
// `date` rows in the shared db are typically ISO strings (raw JSON) or millis;
|
|
568
|
+
// accept both so existing fixtures and live JSON data both work.
|
|
565
569
|
if (((_a = result[0]) === null || _a === void 0 ? void 0 : _a.mindate) != null) {
|
|
566
|
-
result[0].mindate =
|
|
570
|
+
result[0].mindate = TimeChart.coerceDateTime(result[0].mindate);
|
|
567
571
|
}
|
|
568
|
-
if (((
|
|
569
|
-
result[0].maxdate =
|
|
572
|
+
if (((_b = result[0]) === null || _b === void 0 ? void 0 : _b.maxdate) != null) {
|
|
573
|
+
result[0].maxdate = TimeChart.coerceDateTime(result[0].maxdate);
|
|
570
574
|
}
|
|
571
575
|
return result;
|
|
572
576
|
}
|
|
577
|
+
static coerceDateTime(v) {
|
|
578
|
+
if (v == null)
|
|
579
|
+
return undefined;
|
|
580
|
+
if (typeof v === "string") {
|
|
581
|
+
const dt = DateTime.fromISO(v);
|
|
582
|
+
return dt.isValid ? dt : undefined;
|
|
583
|
+
}
|
|
584
|
+
if (typeof v === "number") {
|
|
585
|
+
const dt = DateTime.fromMillis(v);
|
|
586
|
+
return dt.isValid ? dt : undefined;
|
|
587
|
+
}
|
|
588
|
+
if (typeof v.isValid === "boolean") {
|
|
589
|
+
return v;
|
|
590
|
+
}
|
|
591
|
+
return undefined;
|
|
592
|
+
}
|
|
573
593
|
queryDataSet(dateInterval, select, order) {
|
|
574
594
|
const scenarios = [
|
|
575
595
|
"ac1",
|
|
@@ -590,13 +610,15 @@ export class TimeChart {
|
|
|
590
610
|
"pl4",
|
|
591
611
|
];
|
|
592
612
|
const dateSelect = `normalizeDate([date], '${dateInterval}' , '${this.locale}') as calcdate`;
|
|
593
|
-
|
|
613
|
+
let result;
|
|
614
|
+
try {
|
|
615
|
+
result = this.db.exec(`SELECT ${"p.calcdate"} ${select},
|
|
594
616
|
${scenarios
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
617
|
+
.map((scenario) => {
|
|
618
|
+
return `SUM(${scenario} * transformOperator(operation)) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
|
|
619
|
+
})
|
|
620
|
+
.join(",")}
|
|
621
|
+
|
|
600
622
|
FROM (SELECT ${dateSelect} ${select},
|
|
601
623
|
ac1,
|
|
602
624
|
ac2,
|
|
@@ -614,9 +636,14 @@ export class TimeChart {
|
|
|
614
636
|
pl2,
|
|
615
637
|
pl3,
|
|
616
638
|
pl4
|
|
617
|
-
FROM
|
|
639
|
+
FROM ${this.fromExpr}) as p
|
|
618
640
|
GROUP BY ${"calcdate"} ${order}
|
|
619
|
-
ORDER BY ${"calcdate asc"}
|
|
641
|
+
ORDER BY ${"calcdate asc"}`);
|
|
642
|
+
}
|
|
643
|
+
catch (e) {
|
|
644
|
+
console.error("TimeChart: queryDataSet failed", e);
|
|
645
|
+
return [];
|
|
646
|
+
}
|
|
620
647
|
return result;
|
|
621
648
|
}
|
|
622
649
|
createDataRows(result, selectedScenarios) {
|
|
@@ -990,6 +1017,17 @@ export class TimeChart {
|
|
|
990
1017
|
};
|
|
991
1018
|
return columnGroup;
|
|
992
1019
|
}
|
|
1020
|
+
/** Restore the original `scenarios` prop order for stacked segments (IBCS sort reorders the slots). */
|
|
1021
|
+
sortSegmentsByPropOrder(segments) {
|
|
1022
|
+
if (this.scenarioPropOrder.length === 0)
|
|
1023
|
+
return;
|
|
1024
|
+
const order = this.scenarioPropOrder;
|
|
1025
|
+
segments.sort((a, b) => {
|
|
1026
|
+
const ia = order.indexOf(a.scenario);
|
|
1027
|
+
const ib = order.indexOf(b.scenario);
|
|
1028
|
+
return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
993
1031
|
/**
|
|
994
1032
|
* Draw stacked bar columns. Supports stacking by scenario or by data dimension.
|
|
995
1033
|
* When stacking by scenario with multiple scenario types (e.g. ac+pl),
|
|
@@ -1011,6 +1049,7 @@ export class TimeChart {
|
|
|
1011
1049
|
segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
|
|
1012
1050
|
}
|
|
1013
1051
|
}
|
|
1052
|
+
this.sortSegmentsByPropOrder(segments);
|
|
1014
1053
|
}
|
|
1015
1054
|
else {
|
|
1016
1055
|
const dp = elements["scenario1"];
|
|
@@ -1110,12 +1149,14 @@ export class TimeChart {
|
|
|
1110
1149
|
}
|
|
1111
1150
|
if (segments.length === 0)
|
|
1112
1151
|
return;
|
|
1152
|
+
this.sortSegmentsByPropOrder(segments);
|
|
1113
1153
|
const prefixes = new Set(segments.map((s) => getScenarioPrefix(s.scenario)));
|
|
1114
1154
|
const axisY = this.position.getColumnPositionY();
|
|
1115
1155
|
const xBase = this.position.getColumnCenterPositionX(0) - this.position.getColumnWidth() / 2;
|
|
1116
1156
|
const labelX = xBase - this.position.spacings.labelToColumn;
|
|
1117
1157
|
if (prefixes.size > 1) {
|
|
1118
|
-
// Overlay mode: one header per group
|
|
1158
|
+
// Overlay mode: one header per group — front group centered on its bar,
|
|
1159
|
+
// back groups aligned with their bar's top edge
|
|
1119
1160
|
const groupMap = new Map();
|
|
1120
1161
|
for (const seg of segments) {
|
|
1121
1162
|
const prefix = getScenarioPrefix(seg.scenario);
|
|
@@ -1133,11 +1174,17 @@ export class TimeChart {
|
|
|
1133
1174
|
for (const [prefix, segs] of groupMap) {
|
|
1134
1175
|
groups.push({ prefix, segments: segs });
|
|
1135
1176
|
}
|
|
1136
|
-
groups.forEach((group) => {
|
|
1177
|
+
groups.forEach((group, groupIdx) => {
|
|
1137
1178
|
const groupTotal = group.segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
1138
1179
|
const pixelPerUnit = group.segments[0].dataPoint.pixelPerUnit;
|
|
1139
|
-
const groupPixelHeight = this.stackConfig.mode === StackMode.RELATIVE
|
|
1140
|
-
|
|
1180
|
+
const groupPixelHeight = this.stackConfig.mode === StackMode.RELATIVE
|
|
1181
|
+
? RELATIVE_STACK_UNITS * pixelPerUnit
|
|
1182
|
+
: groupTotal * pixelPerUnit;
|
|
1183
|
+
// The front-most group (drawn last, e.g. AC) is fully visible, so its
|
|
1184
|
+
// label is centered on the bar. Back groups are mostly hidden behind it
|
|
1185
|
+
// and only peek out at the top, so their labels align with the bar's top edge.
|
|
1186
|
+
const isFrontGroup = groupIdx === groups.length - 1;
|
|
1187
|
+
const centerY = isFrontGroup ? axisY - groupPixelHeight / 2 : axisY - groupPixelHeight;
|
|
1141
1188
|
const labelText = this.i18n.get(group.prefix + "1") || group.prefix.toUpperCase();
|
|
1142
1189
|
new Label(headerGroup, labelX, centerY, "STACK_HEADER", labelText, this.styles, HookLocation.Center, HookLocation.Right).forceStringTypeDraw();
|
|
1143
1190
|
});
|
|
@@ -1155,7 +1202,7 @@ export class TimeChart {
|
|
|
1155
1202
|
let segmentHeight;
|
|
1156
1203
|
if (this.stackConfig.mode === StackMode.RELATIVE) {
|
|
1157
1204
|
const proportion = total !== 0 ? Math.abs(seg.value) / total : 0;
|
|
1158
|
-
segmentHeight = proportion * pixelPerUnit;
|
|
1205
|
+
segmentHeight = proportion * RELATIVE_STACK_UNITS * pixelPerUnit;
|
|
1159
1206
|
}
|
|
1160
1207
|
else {
|
|
1161
1208
|
segmentHeight = Math.abs(seg.value * pixelPerUnit);
|
|
@@ -1196,6 +1243,15 @@ export class TimeChart {
|
|
|
1196
1243
|
activeLayers.push(key);
|
|
1197
1244
|
}
|
|
1198
1245
|
}
|
|
1246
|
+
if (isScenarioStack && this.scenarioPropOrder.length > 0) {
|
|
1247
|
+
const order = this.scenarioPropOrder;
|
|
1248
|
+
activeLayers.sort((a, b) => {
|
|
1249
|
+
var _a, _b, _c, _d;
|
|
1250
|
+
const ia = order.indexOf((_b = (_a = dataModel[0][a]) === null || _a === void 0 ? void 0 : _a.scenario) !== null && _b !== void 0 ? _b : "");
|
|
1251
|
+
const ib = order.indexOf((_d = (_c = dataModel[0][b]) === null || _c === void 0 ? void 0 : _c.scenario) !== null && _d !== void 0 ? _d : "");
|
|
1252
|
+
return (ia === -1 ? order.length : ia) - (ib === -1 ? order.length : ib);
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1199
1255
|
// Compute cumulative values
|
|
1200
1256
|
for (let layerIdx = 0; layerIdx < activeLayers.length; layerIdx++) {
|
|
1201
1257
|
const key = activeLayers[layerIdx];
|
|
@@ -1229,7 +1285,7 @@ export class TimeChart {
|
|
|
1229
1285
|
x: this.position.getColumnCenterPositionX(idx),
|
|
1230
1286
|
y: axisY -
|
|
1231
1287
|
(stackMode === StackMode.RELATIVE
|
|
1232
|
-
? val * pixelPerUnit //
|
|
1288
|
+
? val * RELATIVE_STACK_UNITS * pixelPerUnit // val is a 0..1 cumulative proportion
|
|
1233
1289
|
: val * pixelPerUnit),
|
|
1234
1290
|
}));
|
|
1235
1291
|
};
|
|
@@ -1281,12 +1337,14 @@ export class TimeChart {
|
|
|
1281
1337
|
}
|
|
1282
1338
|
}
|
|
1283
1339
|
leftOuterJoinDates(result, dateInterval) {
|
|
1284
|
-
const
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
return
|
|
1289
|
-
}
|
|
1340
|
+
const validDates = result
|
|
1341
|
+
.map((e) => e.calcdate)
|
|
1342
|
+
.filter((d) => d != null && typeof d.isValid === "boolean" && d.isValid);
|
|
1343
|
+
if (validDates.length === 0) {
|
|
1344
|
+
return result;
|
|
1345
|
+
}
|
|
1346
|
+
const to = DateTime.max(...validDates);
|
|
1347
|
+
const from = DateTime.min(...validDates);
|
|
1290
1348
|
const dateRange = new DateStringFactory().datesBetween(from, to, dateInterval, this.intervalSpanLimit);
|
|
1291
1349
|
const dateRangeEntries = new Map();
|
|
1292
1350
|
dateRange.forEach((element, idx) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HookLocation, Label } from "./Label";
|
|
2
2
|
import { SiPrefix } from "../../../../utils/model/SiPrefix";
|
|
3
|
-
import { StackMode } from "../../../../utils/constants";
|
|
3
|
+
import { RELATIVE_STACK_UNITS, StackMode } from "../../../../utils/constants";
|
|
4
4
|
/**
|
|
5
5
|
* Renders a single segment within a stacked bar column in a time chart.
|
|
6
6
|
*
|
|
@@ -44,8 +44,8 @@ export class StackedColumn {
|
|
|
44
44
|
if (this.stackMode === StackMode.RELATIVE) {
|
|
45
45
|
// 100% stacked: segment height is proportion of total
|
|
46
46
|
const proportion = this.totalValue !== 0 ? Math.abs(value) / Math.abs(this.totalValue) : 0;
|
|
47
|
-
//
|
|
48
|
-
const totalPixelHeight =
|
|
47
|
+
// Full stack spans RELATIVE_STACK_UNITS percent; pixelPerUnit = pixels per percentage point
|
|
48
|
+
const totalPixelHeight = RELATIVE_STACK_UNITS * pixelPerUnit;
|
|
49
49
|
segmentHeight = proportion * totalPixelHeight;
|
|
50
50
|
const baselinePixels = (this.baselineValue / Math.abs(this.totalValue)) * totalPixelHeight;
|
|
51
51
|
yPos = axisY - baselinePixels - segmentHeight;
|
|
@@ -59,15 +59,16 @@ export class TimeChartComponentConfig {
|
|
|
59
59
|
/**
|
|
60
60
|
* Converts untyped JSON into a validated {@link TimeChartComponentConfig}.
|
|
61
61
|
*
|
|
62
|
-
*
|
|
62
|
+
* Reads from the shared alasql database for measure-scale auto-calculation.
|
|
63
63
|
*/
|
|
64
64
|
export class TimeChartComponentConfigAdapter {
|
|
65
|
-
constructor(dataRowAdapter, orderAdapter, stringAdapter, dataFormatDigitsAdapter,
|
|
65
|
+
constructor(dataRowAdapter, orderAdapter, stringAdapter, dataFormatDigitsAdapter, db, fromExpr) {
|
|
66
66
|
this.dataRowAdapter = dataRowAdapter;
|
|
67
67
|
this.orderAdapter = orderAdapter;
|
|
68
68
|
this.stringAdapter = stringAdapter;
|
|
69
69
|
this.dataFormatDigitsAdapter = dataFormatDigitsAdapter;
|
|
70
|
-
this.
|
|
70
|
+
this.db = db;
|
|
71
|
+
this.fromExpr = fromExpr;
|
|
71
72
|
}
|
|
72
73
|
adapt(data) {
|
|
73
74
|
const dataSet = AdapterUtils.adaptArray(data.data, this.dataRowAdapter);
|
|
@@ -113,7 +114,7 @@ export class TimeChartComponentConfigAdapter {
|
|
|
113
114
|
config.filter = data.filter;
|
|
114
115
|
}
|
|
115
116
|
if (CompareUtil.isExisting(data.measureScale)) {
|
|
116
|
-
config.measureScale = DataAnalyzer.calculateMeasureScale(this.
|
|
117
|
+
config.measureScale = DataAnalyzer.calculateMeasureScale(this.db, this.fromExpr, config.scenarios, data.measureScale);
|
|
117
118
|
}
|
|
118
119
|
if (CompareUtil.isString(data.measureUnit)) {
|
|
119
120
|
config.measureUnit = data.measureUnit;
|
|
@@ -28,7 +28,7 @@ export class ComponentStyle {
|
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
render() {
|
|
31
|
-
return h(Host, { key: '
|
|
31
|
+
return h(Host, { key: '9138ba4914f990823213f637bdc65274669bfe86' });
|
|
32
32
|
}
|
|
33
33
|
static get is() { return "bn-component-style"; }
|
|
34
34
|
static get originalStyleUrls() {
|
|
@@ -49,7 +49,7 @@ export class Context {
|
|
|
49
49
|
componentWillUpdate() { }
|
|
50
50
|
componentDidUpdate() { }
|
|
51
51
|
render() {
|
|
52
|
-
return (h(Host, { key: '
|
|
52
|
+
return (h(Host, { key: 'f4f3a64c06e0cd8fa4863007ba25cacc74194e45' }, h("slot", { key: 'ee5dd7d7065107f657f1d92cdf91eedbd94f8f81' })));
|
|
53
53
|
}
|
|
54
54
|
static get is() { return "bn-context"; }
|
|
55
55
|
static get encapsulation() { return "shadow"; }
|