@bino-bi/bn-template-engine 1.0.0-alpha.0
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 +21 -0
- package/dist/bn-template-engine/assets/bar.png +0 -0
- package/dist/bn-template-engine/assets/gpx/Chasing_Legends.gpx +195076 -0
- package/dist/bn-template-engine/assets/gpx/Fahrt_am_Nachmittag.gpx +142007 -0
- package/dist/bn-template-engine/assets/icons/gpx-finish.png +0 -0
- package/dist/bn-template-engine/assets/icons/gpx-shadow.png +0 -0
- package/dist/bn-template-engine/assets/icons/gpx-start.png +0 -0
- package/dist/bn-template-engine/assets/icons/marker-example.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin-icon-end.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin-icon-start.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin-icon-wpt.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin-shadow.png +0 -0
- package/dist/bn-template-engine/assets/icons/pin.png +0 -0
- package/dist/bn-template-engine/assets/matrix.png +0 -0
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -0
- package/dist/bn-template-engine/index.esm.js +0 -0
- package/dist/bn-template-engine/p--TeDldm8.js +1 -0
- package/dist/bn-template-engine/p-0e7dc113.entry.js +1 -0
- package/dist/bn-template-engine/p-1jFf17Vj.js +1 -0
- package/dist/bn-template-engine/p-264c6bad.entry.js +1 -0
- package/dist/bn-template-engine/p-326a0902.entry.js +1 -0
- package/dist/bn-template-engine/p-38a8bde3.entry.js +1 -0
- package/dist/bn-template-engine/p-577eafcd.entry.js +1 -0
- package/dist/bn-template-engine/p-5905cc43.entry.js +1 -0
- package/dist/bn-template-engine/p-5d155a72.entry.js +1 -0
- package/dist/bn-template-engine/p-65f8962a.entry.js +1 -0
- package/dist/bn-template-engine/p-6b8d1ebf.entry.js +1 -0
- package/dist/bn-template-engine/p-7995acb2.entry.js +1 -0
- package/dist/bn-template-engine/p-7afe431e.entry.js +1 -0
- package/dist/bn-template-engine/p-8014b1ac.entry.js +1 -0
- package/dist/bn-template-engine/p-80423fc8.entry.js +1 -0
- package/dist/bn-template-engine/p-91e74d42.entry.js +1 -0
- package/dist/bn-template-engine/p-930a9e29.entry.js +1 -0
- package/dist/bn-template-engine/p-93C9jL8R.js +1 -0
- package/dist/bn-template-engine/p-93ff8584.entry.js +1 -0
- package/dist/bn-template-engine/p-B0m0U4wJ.js +1 -0
- package/dist/bn-template-engine/p-B27Ax6P_.js +2 -0
- package/dist/bn-template-engine/p-B79VcHiT.js +1 -0
- package/dist/bn-template-engine/p-BBd0ZVLL.js +1 -0
- package/dist/bn-template-engine/p-BFTU3MAI.js +1 -0
- package/dist/bn-template-engine/p-BFatTBqh.js +1 -0
- package/dist/bn-template-engine/p-BQp6ZPYW.js +1 -0
- package/dist/bn-template-engine/p-BYmPQYxx.js +1 -0
- package/dist/bn-template-engine/p-BhEQy-2D.js +1 -0
- package/dist/bn-template-engine/p-BtVfu16B.js +1 -0
- package/dist/bn-template-engine/p-CY1RzLjU.js +1 -0
- package/dist/bn-template-engine/p-CfWnag33.js +1 -0
- package/dist/bn-template-engine/p-CnI71OA9.js +1 -0
- package/dist/bn-template-engine/p-Cp4MVxCu.js +1 -0
- package/dist/bn-template-engine/p-DQuL1Twl.js +1 -0
- package/dist/bn-template-engine/p-DbyXf6dF.js +1 -0
- package/dist/bn-template-engine/p-TdL-LRR9.js +1 -0
- package/dist/bn-template-engine/p-_LBTIfNN.js +1 -0
- package/dist/bn-template-engine/p-a342cd3c.entry.js +1 -0
- package/dist/bn-template-engine/p-ad94cf63.entry.js +1 -0
- package/dist/bn-template-engine/p-bc37d750.entry.js +1 -0
- package/dist/bn-template-engine/p-c9f050bf.entry.js +1 -0
- package/dist/bn-template-engine/p-d07a0ca3.entry.js +1 -0
- package/dist/bn-template-engine/p-e5f372af.entry.js +1 -0
- package/dist/bn-template-engine/p-e620028c.entry.js +1 -0
- package/dist/bn-template-engine/p-e81e116a.entry.js +1 -0
- package/dist/bn-template-engine/p-eca98070.entry.js +1 -0
- package/dist/bn-template-engine/p-ee6de950.entry.js +1 -0
- package/dist/bn-template-engine/p-efe0ef1e.entry.js +1 -0
- package/dist/bn-template-engine/p-f034f1b8.entry.js +1 -0
- package/dist/bn-template-engine/p-f1c1a8a3.entry.js +1 -0
- package/dist/bn-template-engine/p-fe573a1a.entry.js +1 -0
- package/dist/bn-template-engine/p-kMyLevYy.js +1 -0
- package/dist/cjs/DataFormatDigits-DmTbhF8q.js +142 -0
- package/dist/cjs/DateStringFactory-Dn0aRj2Y.js +453 -0
- package/dist/cjs/Order-B4NIqQWe.js +129 -0
- package/dist/cjs/SVGVariancesStyleGroup-Czizhngt.js +7973 -0
- package/dist/cjs/StringAdapter-0EbYMkR0.js +136 -0
- package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +10 -0
- package/dist/cjs/alasql.min-C_nHTuEQ.js +306 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/bn-asset.cjs.entry.js +42 -0
- package/dist/cjs/bn-body_3.cjs.entry.js +413 -0
- package/dist/cjs/bn-card.cjs.entry.js +37 -0
- package/dist/cjs/bn-chart-structure.cjs.entry.js +705 -0
- package/dist/cjs/bn-chart-time.cjs.entry.js +987 -0
- package/dist/cjs/bn-component-style.cjs.entry.js +44 -0
- package/dist/cjs/bn-context_5.cjs.entry.js +3380 -0
- package/dist/cjs/bn-dataset.cjs.entry.js +278 -0
- package/dist/cjs/bn-grid.cjs.entry.js +407 -0
- package/dist/cjs/bn-image.cjs.entry.js +57 -0
- package/dist/cjs/bn-internationalization.cjs.entry.js +40 -0
- package/dist/cjs/bn-layout-card.cjs.entry.js +128 -0
- package/dist/cjs/bn-layout-page.cjs.entry.js +142 -0
- package/dist/cjs/bn-map.cjs.entry.js +425 -0
- package/dist/cjs/bn-message.cjs.entry.js +52 -0
- package/dist/cjs/bn-template-engine.cjs.js +52 -0
- package/dist/cjs/bn-template.cjs.entry.js +20 -0
- package/dist/cjs/bn-text.cjs.entry.js +286 -0
- package/dist/cjs/bn-tree.cjs.entry.js +969 -0
- package/dist/cjs/componentRegister-C17UFNPh.js +72 -0
- package/dist/cjs/constants-DHqQXSSd.js +158 -0
- package/dist/cjs/context-protocol-BkYHFkXE.js +661 -0
- package/dist/cjs/editor-companion.cjs.entry.js +49 -0
- package/dist/cjs/formatter-DIJL_crx.js +215 -0
- package/dist/cjs/ibcs-chart-structure.cjs.entry.js +2906 -0
- package/dist/cjs/ibcs-chart-time.cjs.entry.js +4140 -0
- package/dist/cjs/ibcs-map.cjs.entry.js +1075 -0
- package/dist/cjs/ibcs-title.cjs.entry.js +352 -0
- package/dist/cjs/index-CScBFiS1.js +4653 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/luxon-8hyy5YD7.js +8132 -0
- package/dist/cjs/scaling-B23eOtsC.js +67 -0
- package/dist/cjs/test-runner-card.cjs.entry.js +27 -0
- package/dist/cjs/test-runner-chart-time.cjs.entry.js +230 -0
- package/dist/cjs/test-runner-chart.cjs.entry.js +326 -0
- package/dist/cjs/test-runner-map.cjs.entry.js +1862 -0
- package/dist/cjs/test-runner-table.cjs.entry.js +477 -0
- package/dist/cjs/test-runner-time.cjs.entry.js +381 -0
- package/dist/cjs/test-runner-title.cjs.entry.js +115 -0
- package/dist/cjs/withBodyObserver-B0_W1VOf.js +39 -0
- package/dist/cjs/withComponentStatus-BrxL7usr.js +39 -0
- package/dist/cjs/withComponentStyle-C6KHnZHt.js +128 -0
- package/dist/cjs/withDataset-ZdN-RRTx.js +146 -0
- package/dist/cjs/withHasError-Dspb3lIV.js +154 -0
- package/dist/cjs/withStyled-Bf-stJTR.js +567 -0
- package/dist/cjs/withTranslation-Cz0M5maV.js +77 -0
- package/dist/collection/collection-manifest.json +48 -0
- package/dist/collection/components/bn-asset/bn-asset.css +3 -0
- package/dist/collection/components/bn-asset/bn-asset.js +67 -0
- package/dist/collection/components/bn-body/bn-body.css +9 -0
- package/dist/collection/components/bn-body/bn-body.js +38 -0
- package/dist/collection/components/bn-card/bn-card.css +21 -0
- package/dist/collection/components/bn-card/bn-card.js +38 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.css +105 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +1047 -0
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +594 -0
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +979 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/Axis.js +39 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/Bar.js +293 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +136 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/Marker.js +118 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/Needle.js +151 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +83 -0
- package/dist/collection/components/bn-chart-structure/utils/elements/index.js +6 -0
- package/dist/collection/components/bn-chart-structure/utils/factories/ScenarioFactory.js +119 -0
- package/dist/collection/components/bn-chart-structure/utils/factories/index.js +1 -0
- package/dist/collection/components/bn-chart-structure/utils/helper/CustomPattern.js +45 -0
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +210 -0
- package/dist/collection/components/bn-chart-structure/utils/helper/MarkerPattern.js +46 -0
- package/dist/collection/components/bn-chart-structure/utils/helper/Padding.js +13 -0
- package/dist/collection/components/bn-chart-structure/utils/helper/index.js +15 -0
- package/dist/collection/components/bn-chart-structure/utils/model/DataPoint.js +101 -0
- package/dist/collection/components/bn-chart-structure/utils/model/OverflowConfig.js +1 -0
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +106 -0
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartDataRow.js +127 -0
- package/dist/collection/components/bn-chart-structure/utils/model/index.js +45 -0
- package/dist/collection/components/bn-chart-structure/utils/model/styles/ScaleFactorsStructureChart.js +99 -0
- package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +58 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.css +17 -0
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +1510 -0
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.css +96 -0
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +829 -0
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +1388 -0
- package/dist/collection/components/bn-chart-time/utils/elements/AreaFill.js +83 -0
- package/dist/collection/components/bn-chart-time/utils/elements/Axis.js +42 -0
- package/dist/collection/components/bn-chart-time/utils/elements/Column.js +266 -0
- package/dist/collection/components/bn-chart-time/utils/elements/Label.js +174 -0
- package/dist/collection/components/bn-chart-time/utils/elements/Line.js +150 -0
- package/dist/collection/components/bn-chart-time/utils/elements/LineSeries.js +267 -0
- package/dist/collection/components/bn-chart-time/utils/elements/Marker.js +121 -0
- package/dist/collection/components/bn-chart-time/utils/elements/Needle.js +148 -0
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +107 -0
- package/dist/collection/components/bn-chart-time/utils/elements/index.js +8 -0
- package/dist/collection/components/bn-chart-time/utils/factories/ScenarioFactory.js +146 -0
- package/dist/collection/components/bn-chart-time/utils/factories/index.js +1 -0
- package/dist/collection/components/bn-chart-time/utils/helper/CustomPattern.js +46 -0
- package/dist/collection/components/bn-chart-time/utils/helper/ElementPositions.js +178 -0
- package/dist/collection/components/bn-chart-time/utils/helper/LabelCollisionManager.js +199 -0
- package/dist/collection/components/bn-chart-time/utils/helper/MarkerPattern.js +84 -0
- package/dist/collection/components/bn-chart-time/utils/helper/Padding.js +13 -0
- package/dist/collection/components/bn-chart-time/utils/helper/index.js +5 -0
- package/dist/collection/components/bn-chart-time/utils/model/DataPoint.js +93 -0
- package/dist/collection/components/bn-chart-time/utils/model/OverflowConfig.js +1 -0
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +150 -0
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +146 -0
- package/dist/collection/components/bn-chart-time/utils/model/index.js +45 -0
- package/dist/collection/components/bn-chart-time/utils/model/styles/ScaleFactorsTimeChart.js +99 -0
- package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +54 -0
- package/dist/collection/components/bn-component-style/bn-component-style.css +3 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +69 -0
- package/dist/collection/components/bn-context/bn-context.css +3 -0
- package/dist/collection/components/bn-context/bn-context.js +96 -0
- package/dist/collection/components/bn-dataset/bn-dataset.css +3 -0
- package/dist/collection/components/bn-dataset/bn-dataset.js +159 -0
- package/dist/collection/components/bn-datasource/bn-datasource.css +3 -0
- package/dist/collection/components/bn-datasource/bn-datasource.js +70 -0
- package/dist/collection/components/bn-footer/assets/bar.png +0 -0
- package/dist/collection/components/bn-footer/assets/matrix.png +0 -0
- package/dist/collection/components/bn-footer/bn-footer.css +40 -0
- package/dist/collection/components/bn-footer/bn-footer.js +146 -0
- package/dist/collection/components/bn-grid/bn-grid.css +37 -0
- package/dist/collection/components/bn-grid/bn-grid.js +467 -0
- package/dist/collection/components/bn-grid/utils/GridConfig.js +114 -0
- package/dist/collection/components/bn-image/bn-image.css +10 -0
- package/dist/collection/components/bn-image/bn-image.js +78 -0
- package/dist/collection/components/bn-internationalization/bn-internationalization.css +3 -0
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +84 -0
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +25 -0
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +534 -0
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +10 -0
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +624 -0
- package/dist/collection/components/bn-map/bn-map.css +4 -0
- package/dist/collection/components/bn-map/bn-map.js +725 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/gpx/Chasing_Legends.gpx +195076 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/gpx/Fahrt_am_Nachmittag.gpx +142007 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-finish.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-shadow.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-start.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/marker-example.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-end.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-start.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-wpt.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-shadow.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin.png +0 -0
- package/dist/collection/components/bn-map/ibcs-map/ibcs-map.css +674 -0
- package/dist/collection/components/bn-map/ibcs-map/ibcs-map.js +744 -0
- package/dist/collection/components/bn-map/ibcs-map/utils/model/GeoJsonLayer.js +9 -0
- package/dist/collection/components/bn-map/ibcs-map/utils/model/GpxLayer.js +13 -0
- package/dist/collection/components/bn-map/ibcs-map/utils/model/Marker.js +11 -0
- package/dist/collection/components/bn-map/ibcs-map/utils/model/index.js +2 -0
- package/dist/collection/components/bn-message/assets/bar.png +0 -0
- package/dist/collection/components/bn-message/assets/matrix.png +0 -0
- package/dist/collection/components/bn-message/bn-message.css +31 -0
- package/dist/collection/components/bn-message/bn-message.js +96 -0
- package/dist/collection/components/bn-page/bn-page.css +252 -0
- package/dist/collection/components/bn-page/bn-page.js +118 -0
- package/dist/collection/components/bn-table/bn-table.css +5 -0
- package/dist/collection/components/bn-table/bn-table.js +1475 -0
- package/dist/collection/components/bn-table/ibcs-table.css +322 -0
- package/dist/collection/components/bn-table/ibcs-table.js +757 -0
- package/dist/collection/components/bn-table/utils/Table.js +182 -0
- package/dist/collection/components/bn-table/utils/elements/Cell.js +66 -0
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +251 -0
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +88 -0
- package/dist/collection/components/bn-table/utils/elements/index.js +3 -0
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +380 -0
- package/dist/collection/components/bn-table/utils/helper/ColumnStatistics.js +62 -0
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +750 -0
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +38 -0
- package/dist/collection/components/bn-table/utils/helper/index.js +1 -0
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +136 -0
- package/dist/collection/components/bn-table/utils/model/TableDataRow.js +134 -0
- package/dist/collection/components/bn-table/utils/model/TableDrillGroup.js +42 -0
- package/dist/collection/components/bn-table/utils/model/index.js +63 -0
- package/dist/collection/components/bn-template/bn-template.js +38 -0
- package/dist/collection/components/bn-text/bn-text.css +14 -0
- package/dist/collection/components/bn-text/bn-text.js +343 -0
- package/dist/collection/components/bn-title/bn-title.css +11 -0
- package/dist/collection/components/bn-title/bn-title.js +541 -0
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.css +15 -0
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +321 -0
- package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +91 -0
- package/dist/collection/components/bn-title/ibcs-title/utils/factories/TitleDataSetFactory.js +86 -0
- package/dist/collection/components/bn-title/ibcs-title/utils/factories/index.js +1 -0
- package/dist/collection/components/bn-title/ibcs-title/utils/model/MeasureEntriy.js +25 -0
- package/dist/collection/components/bn-title/ibcs-title/utils/model/TimePeriod.js +33 -0
- package/dist/collection/components/bn-title/ibcs-title/utils/model/TitleConfig.js +48 -0
- package/dist/collection/components/bn-title/ibcs-title/utils/model/index.js +6 -0
- package/dist/collection/components/bn-tree/bn-tree.css +40 -0
- package/dist/collection/components/bn-tree/bn-tree.js +520 -0
- package/dist/collection/components/bn-tree/utils/EdgeRenderer.js +196 -0
- package/dist/collection/components/bn-tree/utils/TreeLayout.js +225 -0
- package/dist/collection/components/bn-tree/utils/TreeParser.js +180 -0
- package/dist/collection/components/editor-companion/editor-companion.css +3 -0
- package/dist/collection/components/editor-companion/editor-companion.js +130 -0
- package/dist/collection/context/context-protocol.js +84 -0
- package/dist/collection/declarations.js +1 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/stores/assets.js +12 -0
- package/dist/collection/stores/componentStyles.js +106 -0
- package/dist/collection/stores/context.js +1 -0
- package/dist/collection/stores/createScopedStores.js +31 -0
- package/dist/collection/stores/datasets.js +14 -0
- package/dist/collection/stores/datasetsMeta.js +14 -0
- package/dist/collection/stores/datasources.js +14 -0
- package/dist/collection/stores/internationalization.js +128 -0
- package/dist/collection/test-runner/test-runner-card.js +36 -0
- package/dist/collection/test-runner/test-runner-chart-time.js +234 -0
- package/dist/collection/test-runner/test-runner-chart.js +364 -0
- package/dist/collection/test-runner/test-runner-map.js +1901 -0
- package/dist/collection/test-runner/test-runner-table.js +469 -0
- package/dist/collection/test-runner/test-runner-time.js +399 -0
- package/dist/collection/test-runner/test-runner-title.js +108 -0
- package/dist/collection/utils/DataUriUtil.js +19 -0
- package/dist/collection/utils/DateStringFactory.js +448 -0
- package/dist/collection/utils/componentRegister.js +70 -0
- package/dist/collection/utils/constants.js +156 -0
- package/dist/collection/utils/dataAnalyzer.js +103 -0
- package/dist/collection/utils/datasetMetaCalculator.js +137 -0
- package/dist/collection/utils/flattenObject.js +28 -0
- package/dist/collection/utils/formatter.js +86 -0
- package/dist/collection/utils/helper/AdapterUtils.js +24 -0
- package/dist/collection/utils/helper/CompareUtil.js +42 -0
- package/dist/collection/utils/helper/IAdapter.js +1 -0
- package/dist/collection/utils/helper/StringAdapter.js +9 -0
- package/dist/collection/utils/ibcsRuleSet.js +120 -0
- package/dist/collection/utils/index.js +2 -0
- package/dist/collection/utils/model/ChartStyles.js +1 -0
- package/dist/collection/utils/model/DataFormatDigits.js +23 -0
- package/dist/collection/utils/model/DataQueryResultRow.js +1 -0
- package/dist/collection/utils/model/DatasetMeta.js +1 -0
- package/dist/collection/utils/model/DateFormat.js +1 -0
- package/dist/collection/utils/model/Order.js +56 -0
- package/dist/collection/utils/model/SiPrefix.js +23 -0
- package/dist/collection/utils/model/TextStyles.js +1 -0
- package/dist/collection/utils/model/VarianceScenario.js +33 -0
- package/dist/collection/utils/model/index.js +38 -0
- package/dist/collection/utils/model/styles/FontStyle.js +34 -0
- package/dist/collection/utils/model/styles/Padding.js +30 -0
- package/dist/collection/utils/model/styles/SVGStyle.js +47 -0
- package/dist/collection/utils/model/styles/SVGStyleGroup.js +48 -0
- package/dist/collection/utils/model/styles/SVGVariancesStyleGroup.js +45 -0
- package/dist/collection/utils/parentDimensions.js +44 -0
- package/dist/collection/utils/scaling.js +17 -0
- package/dist/collection/utils/stackColors.js +31 -0
- package/dist/collection/utils/styled/attributes.js +110 -0
- package/dist/collection/utils/styled/style-sheet.js +21 -0
- package/dist/collection/utils/styled/withStyled.js +71 -0
- package/dist/collection/utils/templateId.js +12 -0
- package/dist/collection/utils/utils.js +83 -0
- package/dist/collection/utils/validate.js +372 -0
- package/dist/collection/utils/withBodyObserver.js +35 -0
- package/dist/collection/utils/withComponentStatus.js +35 -0
- package/dist/collection/utils/withComponentStyle.js +74 -0
- package/dist/collection/utils/withDataset.js +142 -0
- package/dist/collection/utils/withDatasource.js +59 -0
- package/dist/collection/utils/withHasError.js +56 -0
- package/dist/collection/utils/withTranslation.js +73 -0
- package/dist/components/DataFormatDigits.js +1 -0
- package/dist/components/DateStringFactory.js +1 -0
- package/dist/components/Order.js +1 -0
- package/dist/components/SVGVariancesStyleGroup.js +1 -0
- package/dist/components/_commonjsHelpers.js +1 -0
- package/dist/components/alasql.min.js +1 -0
- package/dist/components/bn-asset.d.ts +11 -0
- package/dist/components/bn-asset.js +1 -0
- package/dist/components/bn-body.d.ts +11 -0
- package/dist/components/bn-body.js +1 -0
- package/dist/components/bn-body2.js +1 -0
- package/dist/components/bn-card.d.ts +11 -0
- package/dist/components/bn-card.js +1 -0
- package/dist/components/bn-card2.js +1 -0
- package/dist/components/bn-chart-structure.d.ts +11 -0
- package/dist/components/bn-chart-structure.js +1 -0
- package/dist/components/bn-chart-time.d.ts +11 -0
- package/dist/components/bn-chart-time.js +1 -0
- package/dist/components/bn-component-style.d.ts +11 -0
- package/dist/components/bn-component-style.js +1 -0
- package/dist/components/bn-context.d.ts +11 -0
- package/dist/components/bn-context.js +1 -0
- package/dist/components/bn-dataset.d.ts +11 -0
- package/dist/components/bn-dataset.js +1 -0
- package/dist/components/bn-datasource.d.ts +11 -0
- package/dist/components/bn-datasource.js +1 -0
- package/dist/components/bn-footer.d.ts +11 -0
- package/dist/components/bn-footer.js +1 -0
- package/dist/components/bn-footer2.js +1 -0
- package/dist/components/bn-grid.d.ts +11 -0
- package/dist/components/bn-grid.js +1 -0
- package/dist/components/bn-image.d.ts +11 -0
- package/dist/components/bn-image.js +1 -0
- package/dist/components/bn-internationalization.d.ts +11 -0
- package/dist/components/bn-internationalization.js +1 -0
- package/dist/components/bn-layout-card.d.ts +11 -0
- package/dist/components/bn-layout-card.js +1 -0
- package/dist/components/bn-layout-page.d.ts +11 -0
- package/dist/components/bn-layout-page.js +1 -0
- package/dist/components/bn-map.d.ts +11 -0
- package/dist/components/bn-map.js +1 -0
- package/dist/components/bn-message.d.ts +11 -0
- package/dist/components/bn-message.js +1 -0
- package/dist/components/bn-message2.js +1 -0
- package/dist/components/bn-page.d.ts +11 -0
- package/dist/components/bn-page.js +1 -0
- package/dist/components/bn-page2.js +1 -0
- package/dist/components/bn-table.d.ts +11 -0
- package/dist/components/bn-table.js +1 -0
- package/dist/components/bn-template.d.ts +11 -0
- package/dist/components/bn-template.js +1 -0
- package/dist/components/bn-text.d.ts +11 -0
- package/dist/components/bn-text.js +1 -0
- package/dist/components/bn-title.d.ts +11 -0
- package/dist/components/bn-title.js +1 -0
- package/dist/components/bn-title2.js +1 -0
- package/dist/components/bn-tree.d.ts +11 -0
- package/dist/components/bn-tree.js +1 -0
- package/dist/components/componentRegister.js +1 -0
- package/dist/components/context-protocol.js +1 -0
- package/dist/components/editor-companion.d.ts +11 -0
- package/dist/components/editor-companion.js +1 -0
- package/dist/components/ibcs-chart-structure.d.ts +11 -0
- package/dist/components/ibcs-chart-structure.js +1 -0
- package/dist/components/ibcs-chart-structure2.js +1 -0
- package/dist/components/ibcs-chart-time.d.ts +11 -0
- package/dist/components/ibcs-chart-time.js +1 -0
- package/dist/components/ibcs-chart-time2.js +1 -0
- package/dist/components/ibcs-map.d.ts +11 -0
- package/dist/components/ibcs-map.js +1 -0
- package/dist/components/ibcs-map2.js +1 -0
- package/dist/components/ibcs-table.d.ts +11 -0
- package/dist/components/ibcs-table.js +1 -0
- package/dist/components/ibcs-table2.js +1 -0
- package/dist/components/ibcs-title.d.ts +11 -0
- package/dist/components/ibcs-title.js +1 -0
- package/dist/components/ibcs-title2.js +1 -0
- package/dist/components/ibcsRuleSet.js +1 -0
- package/dist/components/index.d.ts +35 -0
- package/dist/components/index.js +1 -0
- package/dist/components/scaling.js +1 -0
- package/dist/components/test-runner-card.d.ts +11 -0
- package/dist/components/test-runner-card.js +1 -0
- package/dist/components/test-runner-chart-time.d.ts +11 -0
- package/dist/components/test-runner-chart-time.js +1 -0
- package/dist/components/test-runner-chart.d.ts +11 -0
- package/dist/components/test-runner-chart.js +1 -0
- package/dist/components/test-runner-map.d.ts +11 -0
- package/dist/components/test-runner-map.js +1 -0
- package/dist/components/test-runner-table.d.ts +11 -0
- package/dist/components/test-runner-table.js +1 -0
- package/dist/components/test-runner-time.d.ts +11 -0
- package/dist/components/test-runner-time.js +1 -0
- package/dist/components/test-runner-title.d.ts +11 -0
- package/dist/components/test-runner-title.js +1 -0
- package/dist/components/utils.js +1 -0
- package/dist/components/validate.js +1 -0
- package/dist/components/withBodyObserver.js +1 -0
- package/dist/components/withComponentStyle.js +1 -0
- package/dist/components/withDataset.js +1 -0
- package/dist/components/withHasError.js +1 -0
- package/dist/components/withStyled.js +1 -0
- package/dist/components/withTranslation.js +1 -0
- package/dist/esm/DataFormatDigits-Dt6gpIiZ.js +137 -0
- package/dist/esm/DateStringFactory-_Qiv0IvF.js +451 -0
- package/dist/esm/Order-B4fpLe_f.js +125 -0
- package/dist/esm/SVGVariancesStyleGroup-DlWgvpzs.js +7961 -0
- package/dist/esm/StringAdapter-BLvo1Krl.js +133 -0
- package/dist/esm/_commonjsHelpers-BFTU3MAI.js +7 -0
- package/dist/esm/alasql.min-CWu4NkIt.js +304 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/bn-asset.entry.js +40 -0
- package/dist/esm/bn-body_3.entry.js +409 -0
- package/dist/esm/bn-card.entry.js +35 -0
- package/dist/esm/bn-chart-structure.entry.js +703 -0
- package/dist/esm/bn-chart-time.entry.js +985 -0
- package/dist/esm/bn-component-style.entry.js +42 -0
- package/dist/esm/bn-context_5.entry.js +3374 -0
- package/dist/esm/bn-dataset.entry.js +276 -0
- package/dist/esm/bn-grid.entry.js +405 -0
- package/dist/esm/bn-image.entry.js +55 -0
- package/dist/esm/bn-internationalization.entry.js +38 -0
- package/dist/esm/bn-layout-card.entry.js +126 -0
- package/dist/esm/bn-layout-page.entry.js +140 -0
- package/dist/esm/bn-map.entry.js +423 -0
- package/dist/esm/bn-message.entry.js +50 -0
- package/dist/esm/bn-template-engine.js +48 -0
- package/dist/esm/bn-template.entry.js +18 -0
- package/dist/esm/bn-text.entry.js +284 -0
- package/dist/esm/bn-tree.entry.js +967 -0
- package/dist/esm/componentRegister-BtVfu16B.js +72 -0
- package/dist/esm/constants-kMyLevYy.js +158 -0
- package/dist/esm/context-protocol-DzeqZxg6.js +654 -0
- package/dist/esm/editor-companion.entry.js +47 -0
- package/dist/esm/formatter-DTMEZ6d8.js +211 -0
- package/dist/esm/ibcs-chart-structure.entry.js +2904 -0
- package/dist/esm/ibcs-chart-time.entry.js +4138 -0
- package/dist/esm/ibcs-map.entry.js +1073 -0
- package/dist/esm/ibcs-title.entry.js +350 -0
- package/dist/esm/index-B27Ax6P_.js +4635 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/luxon-DbyXf6dF.js +8130 -0
- package/dist/esm/scaling-BBd0ZVLL.js +64 -0
- package/dist/esm/test-runner-card.entry.js +25 -0
- package/dist/esm/test-runner-chart-time.entry.js +228 -0
- package/dist/esm/test-runner-chart.entry.js +324 -0
- package/dist/esm/test-runner-map.entry.js +1860 -0
- package/dist/esm/test-runner-table.entry.js +475 -0
- package/dist/esm/test-runner-time.entry.js +379 -0
- package/dist/esm/test-runner-title.entry.js +113 -0
- package/dist/esm/withBodyObserver-gZpZiEIK.js +37 -0
- package/dist/esm/withComponentStatus-elELReKt.js +37 -0
- package/dist/esm/withComponentStyle-NaxfakAG.js +126 -0
- package/dist/esm/withDataset-BT2VQCsG.js +144 -0
- package/dist/esm/withHasError-C48fTE2k.js +150 -0
- package/dist/esm/withStyled-CpUTv74m.js +539 -0
- package/dist/esm/withTranslation-Do4GhleK.js +75 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/types/components/bn-asset/bn-asset.d.ts +11 -0
- package/dist/types/components/bn-body/bn-body.d.ts +8 -0
- package/dist/types/components/bn-card/bn-card.d.ts +8 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +234 -0
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +47 -0
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +137 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Axis.d.ts +29 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Bar.d.ts +58 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +47 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Marker.d.ts +33 -0
- package/dist/types/components/bn-chart-structure/utils/elements/Needle.d.ts +37 -0
- package/dist/types/components/bn-chart-structure/utils/elements/StackedBar.d.ts +25 -0
- package/dist/types/components/bn-chart-structure/utils/elements/index.d.ts +6 -0
- package/dist/types/components/bn-chart-structure/utils/factories/ScenarioFactory.d.ts +46 -0
- package/dist/types/components/bn-chart-structure/utils/factories/index.d.ts +1 -0
- package/dist/types/components/bn-chart-structure/utils/helper/CustomPattern.d.ts +20 -0
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +60 -0
- package/dist/types/components/bn-chart-structure/utils/helper/MarkerPattern.d.ts +28 -0
- package/dist/types/components/bn-chart-structure/utils/helper/Padding.d.ts +14 -0
- package/dist/types/components/bn-chart-structure/utils/helper/index.d.ts +13 -0
- package/dist/types/components/bn-chart-structure/utils/model/DataPoint.d.ts +44 -0
- package/dist/types/components/bn-chart-structure/utils/model/OverflowConfig.d.ts +7 -0
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +60 -0
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartDataRow.d.ts +61 -0
- package/dist/types/components/bn-chart-structure/utils/model/index.d.ts +108 -0
- package/dist/types/components/bn-chart-structure/utils/model/styles/ScaleFactorsStructureChart.d.ts +46 -0
- package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +29 -0
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +325 -0
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +59 -0
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +154 -0
- package/dist/types/components/bn-chart-time/utils/elements/AreaFill.d.ts +23 -0
- package/dist/types/components/bn-chart-time/utils/elements/Axis.d.ts +28 -0
- package/dist/types/components/bn-chart-time/utils/elements/Column.d.ts +68 -0
- package/dist/types/components/bn-chart-time/utils/elements/Label.d.ts +55 -0
- package/dist/types/components/bn-chart-time/utils/elements/Line.d.ts +48 -0
- package/dist/types/components/bn-chart-time/utils/elements/LineSeries.d.ts +74 -0
- package/dist/types/components/bn-chart-time/utils/elements/Marker.d.ts +37 -0
- package/dist/types/components/bn-chart-time/utils/elements/Needle.d.ts +41 -0
- package/dist/types/components/bn-chart-time/utils/elements/StackedColumn.d.ts +40 -0
- package/dist/types/components/bn-chart-time/utils/elements/index.d.ts +8 -0
- package/dist/types/components/bn-chart-time/utils/factories/ScenarioFactory.d.ts +65 -0
- package/dist/types/components/bn-chart-time/utils/factories/index.d.ts +1 -0
- package/dist/types/components/bn-chart-time/utils/helper/CustomPattern.d.ts +22 -0
- package/dist/types/components/bn-chart-time/utils/helper/ElementPositions.d.ts +60 -0
- package/dist/types/components/bn-chart-time/utils/helper/LabelCollisionManager.d.ts +101 -0
- package/dist/types/components/bn-chart-time/utils/helper/MarkerPattern.d.ts +42 -0
- package/dist/types/components/bn-chart-time/utils/helper/Padding.d.ts +14 -0
- package/dist/types/components/bn-chart-time/utils/helper/index.d.ts +5 -0
- package/dist/types/components/bn-chart-time/utils/model/DataPoint.d.ts +44 -0
- package/dist/types/components/bn-chart-time/utils/model/OverflowConfig.d.ts +7 -0
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +73 -0
- package/dist/types/components/bn-chart-time/utils/model/TimeChartDataRow.d.ts +62 -0
- package/dist/types/components/bn-chart-time/utils/model/index.d.ts +109 -0
- package/dist/types/components/bn-chart-time/utils/model/styles/ScaleFactorsTimeChart.d.ts +46 -0
- package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +29 -0
- package/dist/types/components/bn-component-style/bn-component-style.d.ts +8 -0
- package/dist/types/components/bn-context/bn-context.d.ts +19 -0
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +38 -0
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +18 -0
- package/dist/types/components/bn-footer/bn-footer.d.ts +29 -0
- package/dist/types/components/bn-grid/bn-grid.d.ts +70 -0
- package/dist/types/components/bn-grid/utils/GridConfig.d.ts +47 -0
- package/dist/types/components/bn-image/bn-image.d.ts +22 -0
- package/dist/types/components/bn-internationalization/bn-internationalization.d.ts +9 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +38 -0
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +40 -0
- package/dist/types/components/bn-map/bn-map.d.ts +122 -0
- package/dist/types/components/bn-map/ibcs-map/ibcs-map.d.ts +73 -0
- package/dist/types/components/bn-map/ibcs-map/utils/model/GeoJsonLayer.d.ts +8 -0
- package/dist/types/components/bn-map/ibcs-map/utils/model/GpxLayer.d.ts +11 -0
- package/dist/types/components/bn-map/ibcs-map/utils/model/Marker.d.ts +9 -0
- package/dist/types/components/bn-map/ibcs-map/utils/model/index.d.ts +2 -0
- package/dist/types/components/bn-message/bn-message.d.ts +27 -0
- package/dist/types/components/bn-page/bn-page.d.ts +29 -0
- package/dist/types/components/bn-table/bn-table.d.ts +373 -0
- package/dist/types/components/bn-table/ibcs-table.d.ts +59 -0
- package/dist/types/components/bn-table/utils/Table.d.ts +61 -0
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +36 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +45 -0
- package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +30 -0
- package/dist/types/components/bn-table/utils/elements/index.d.ts +3 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +114 -0
- package/dist/types/components/bn-table/utils/helper/ColumnStatistics.d.ts +21 -0
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +139 -0
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +19 -0
- package/dist/types/components/bn-table/utils/helper/index.d.ts +1 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +72 -0
- package/dist/types/components/bn-table/utils/model/TableDataRow.d.ts +70 -0
- package/dist/types/components/bn-table/utils/model/TableDrillGroup.d.ts +22 -0
- package/dist/types/components/bn-table/utils/model/index.d.ts +130 -0
- package/dist/types/components/bn-template/bn-template.d.ts +10 -0
- package/dist/types/components/bn-text/bn-text.d.ts +63 -0
- package/dist/types/components/bn-title/bn-title.d.ts +128 -0
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +23 -0
- package/dist/types/components/bn-title/ibcs-title/utils/Title.d.ts +28 -0
- package/dist/types/components/bn-title/ibcs-title/utils/factories/TitleDataSetFactory.d.ts +26 -0
- package/dist/types/components/bn-title/ibcs-title/utils/factories/index.d.ts +1 -0
- package/dist/types/components/bn-title/ibcs-title/utils/model/MeasureEntriy.d.ts +11 -0
- package/dist/types/components/bn-title/ibcs-title/utils/model/TimePeriod.d.ts +15 -0
- package/dist/types/components/bn-title/ibcs-title/utils/model/TitleConfig.d.ts +25 -0
- package/dist/types/components/bn-title/ibcs-title/utils/model/index.d.ts +35 -0
- package/dist/types/components/bn-tree/bn-tree.d.ts +84 -0
- package/dist/types/components/bn-tree/utils/EdgeRenderer.d.ts +57 -0
- package/dist/types/components/bn-tree/utils/TreeLayout.d.ts +37 -0
- package/dist/types/components/bn-tree/utils/TreeParser.d.ts +42 -0
- package/dist/types/components/editor-companion/editor-companion.d.ts +18 -0
- package/dist/types/components.d.ts +3311 -0
- package/dist/types/context/context-protocol.d.ts +53 -0
- package/dist/types/declarations.d.ts +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/stencil-public-runtime.d.ts +1860 -0
- package/dist/types/stores/assets.d.ts +12 -0
- package/dist/types/stores/componentStyles.d.ts +82 -0
- package/dist/types/stores/context.d.ts +12 -0
- package/dist/types/stores/createScopedStores.d.ts +12 -0
- package/dist/types/stores/datasets.d.ts +14 -0
- package/dist/types/stores/datasetsMeta.d.ts +14 -0
- package/dist/types/stores/datasources.d.ts +14 -0
- package/dist/types/stores/internationalization.d.ts +9 -0
- package/dist/types/test-runner/test-runner-card.d.ts +3 -0
- package/dist/types/test-runner/test-runner-chart-time.d.ts +3 -0
- package/dist/types/test-runner/test-runner-chart.d.ts +3 -0
- package/dist/types/test-runner/test-runner-map.d.ts +3 -0
- package/dist/types/test-runner/test-runner-table.d.ts +3 -0
- package/dist/types/test-runner/test-runner-time.d.ts +3 -0
- package/dist/types/test-runner/test-runner-title.d.ts +3 -0
- package/dist/types/utils/DataUriUtil.d.ts +5 -0
- package/dist/types/utils/DateStringFactory.d.ts +123 -0
- package/dist/types/utils/componentRegister.d.ts +38 -0
- package/dist/types/utils/constants.d.ts +142 -0
- package/dist/types/utils/dataAnalyzer.d.ts +56 -0
- package/dist/types/utils/datasetMetaCalculator.d.ts +16 -0
- package/dist/types/utils/flattenObject.d.ts +13 -0
- package/dist/types/utils/formatter.d.ts +34 -0
- package/dist/types/utils/helper/AdapterUtils.d.ts +11 -0
- package/dist/types/utils/helper/CompareUtil.d.ts +26 -0
- package/dist/types/utils/helper/IAdapter.d.ts +16 -0
- package/dist/types/utils/helper/StringAdapter.d.ts +5 -0
- package/dist/types/utils/ibcsRuleSet.d.ts +47 -0
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/model/ChartStyles.d.ts +58 -0
- package/dist/types/utils/model/DataFormatDigits.d.ts +11 -0
- package/dist/types/utils/model/DataQueryResultRow.d.ts +29 -0
- package/dist/types/utils/model/DatasetMeta.d.ts +43 -0
- package/dist/types/utils/model/DateFormat.d.ts +38 -0
- package/dist/types/utils/model/Order.d.ts +46 -0
- package/dist/types/utils/model/SiPrefix.d.ts +11 -0
- package/dist/types/utils/model/TextStyles.d.ts +10 -0
- package/dist/types/utils/model/VarianceScenario.d.ts +20 -0
- package/dist/types/utils/model/index.d.ts +37 -0
- package/dist/types/utils/model/styles/FontStyle.d.ts +13 -0
- package/dist/types/utils/model/styles/Padding.d.ts +11 -0
- package/dist/types/utils/model/styles/SVGStyle.d.ts +20 -0
- package/dist/types/utils/model/styles/SVGStyleGroup.d.ts +16 -0
- package/dist/types/utils/model/styles/SVGVariancesStyleGroup.d.ts +16 -0
- package/dist/types/utils/parentDimensions.d.ts +13 -0
- package/dist/types/utils/scaling.d.ts +22 -0
- package/dist/types/utils/stackColors.d.ts +20 -0
- package/dist/types/utils/styled/attributes.d.ts +6 -0
- package/dist/types/utils/styled/style-sheet.d.ts +10 -0
- package/dist/types/utils/styled/withStyled.d.ts +12 -0
- package/dist/types/utils/templateId.d.ts +9 -0
- package/dist/types/utils/utils.d.ts +36 -0
- package/dist/types/utils/validate.d.ts +55 -0
- package/dist/types/utils/withBodyObserver.d.ts +14 -0
- package/dist/types/utils/withComponentStatus.d.ts +15 -0
- package/dist/types/utils/withComponentStyle.d.ts +20 -0
- package/dist/types/utils/withDataset.d.ts +18 -0
- package/dist/types/utils/withDatasource.d.ts +16 -0
- package/dist/types/utils/withHasError.d.ts +35 -0
- package/dist/types/utils/withTranslation.d.ts +24 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/package.json +68 -0
- package/readme.md +164 -0
|
@@ -0,0 +1,1388 @@
|
|
|
1
|
+
import { Svg } from "@svgdotjs/svg.js";
|
|
2
|
+
import { ElementPositions, Padding } from "./helper";
|
|
3
|
+
import { DataPoint, Scenario } from "./model";
|
|
4
|
+
import { AreaFill, Axis, HookLocation, Label, StackedColumn, } from "./elements";
|
|
5
|
+
import { ScenarioFactory } from "./factories";
|
|
6
|
+
import { LabelCollisionManager, SCENARIO_PRIORITY } from "./helper";
|
|
7
|
+
import alasql from "alasql";
|
|
8
|
+
import CalculateSize from "calculate-size";
|
|
9
|
+
import { ScaleFactorsTimeChart } from "./model/styles/ScaleFactorsTimeChart";
|
|
10
|
+
import { DateTime } from "luxon";
|
|
11
|
+
import { DateDistance, DateStringFactory } from "../../../utils/DateStringFactory";
|
|
12
|
+
import { AxisLabelsMode, ChartMode, StackBy, StackMode } from "../../../utils/constants";
|
|
13
|
+
import { getScenarioPrefix, IBCS_LAYER_ORDER } from "../../../utils/stackColors";
|
|
14
|
+
import { Formatter } from "../../../utils";
|
|
15
|
+
import { IBCSRuleSet } from "../../../utils/ibcsRuleSet";
|
|
16
|
+
import { VarianceScenario } from "../../../utils/model";
|
|
17
|
+
import { SiPrefix } from "../../../utils/model/SiPrefix";
|
|
18
|
+
/** Tracks whether the internal data model needs to be regenerated. */
|
|
19
|
+
var FactoryState;
|
|
20
|
+
(function (FactoryState) {
|
|
21
|
+
FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
|
|
22
|
+
FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
|
|
23
|
+
})(FactoryState || (FactoryState = {}));
|
|
24
|
+
/** Classifies how a data model entry should be rendered: as an absolute or relative variance, or as a regular scenario. */
|
|
25
|
+
var VarianceType;
|
|
26
|
+
(function (VarianceType) {
|
|
27
|
+
VarianceType["RELATIVE"] = "dr";
|
|
28
|
+
VarianceType["ABSOLUTE"] = "d";
|
|
29
|
+
VarianceType["NONE"] = "";
|
|
30
|
+
})(VarianceType || (VarianceType = {}));
|
|
31
|
+
/**
|
|
32
|
+
* Orchestrates the full rendering pipeline for an IBCS time series chart.
|
|
33
|
+
*
|
|
34
|
+
* Rendering pipeline (in draw()):
|
|
35
|
+
* 1. Clears the SVG container
|
|
36
|
+
* 2. Routes to the appropriate drawing method based on chart type:
|
|
37
|
+
* - Variance chart: drawVarianceScenario() for absolute/relative variance bars
|
|
38
|
+
* - Stacked chart: drawStackedScenarios() or drawStackedAreaScenarios() (line mode)
|
|
39
|
+
* - Standard chart: drawScenarios() (bar mode) or drawLineScenarios() (line mode)
|
|
40
|
+
* 3. Draws axis baseline + date labels via drawAxisAndLabels()
|
|
41
|
+
*
|
|
42
|
+
* Data pipeline (in setConfig()):
|
|
43
|
+
* 1. Raw data is filtered via AlaSQL (optional WHERE clause)
|
|
44
|
+
* 2. Dates are normalized to the configured interval (day/week/month/quarter/year)
|
|
45
|
+
* 3. Scenarios are aggregated per date bucket (SUM with operation sign)
|
|
46
|
+
* 4. Missing date buckets are filled via leftOuterJoinDates()
|
|
47
|
+
* 5. Variance model is computed from base/delta scenario pairs
|
|
48
|
+
* 6. Min/max DataPoints are found for coordinate system sizing
|
|
49
|
+
*
|
|
50
|
+
* Auto chart mode: when dataModel.length exceeds maxBars, switches from bar to line.
|
|
51
|
+
*/
|
|
52
|
+
export class TimeChart {
|
|
53
|
+
constructor(ruleSet, config, styles, availableWidth = 0) {
|
|
54
|
+
this.CSS_CATEGORIES = "categories";
|
|
55
|
+
this.dataModel = [];
|
|
56
|
+
this.variancesDataModel = [];
|
|
57
|
+
this.title = "";
|
|
58
|
+
this.smallestDataPointValue = new DataPoint(0, Scenario.AC1, 1, Scenario.NEU);
|
|
59
|
+
this.highestDataPointValue = new DataPoint(0, Scenario.AC1, 1, Scenario.NEU);
|
|
60
|
+
this.smallestVarianceDataPointValue = new DataPoint(0, Scenario.AC1, 1, Scenario.NEU);
|
|
61
|
+
this.highestVarianceDataPointValue = new DataPoint(0, Scenario.AC1, 1, Scenario.NEU);
|
|
62
|
+
this.pixelPerUnit = 1;
|
|
63
|
+
this.pixelPerPercentage = 1;
|
|
64
|
+
this.hideAxisLabels = false;
|
|
65
|
+
this.axisScenario = Scenario.AC1;
|
|
66
|
+
this.preparedDataSet = [];
|
|
67
|
+
this.axisCategoryArea = { width: 0, height: 0 };
|
|
68
|
+
this.scenariosArea = { width: 0, height: 0 };
|
|
69
|
+
this.state = FactoryState.DIRTY;
|
|
70
|
+
this.i18n = new Map();
|
|
71
|
+
this.leftSideOffsetForHorizontalSync = -1;
|
|
72
|
+
this.dateInterval = DateDistance.DAY;
|
|
73
|
+
this.locale = "de";
|
|
74
|
+
this.axisLabelsMode = AxisLabelsMode.SMART;
|
|
75
|
+
this.intervalSpanLimit = 32;
|
|
76
|
+
this.measureScale = new SiPrefix();
|
|
77
|
+
this.measureUnit = "";
|
|
78
|
+
this.dataFormatDigits = { percent: 2, decimal: 1 };
|
|
79
|
+
this.showOverlayMedian = false;
|
|
80
|
+
this.showOverlayAvg = false;
|
|
81
|
+
this.chartMode = ChartMode.BAR;
|
|
82
|
+
this.maxBars = 28;
|
|
83
|
+
this.stackConfig = null;
|
|
84
|
+
this.lineFullWidth = true;
|
|
85
|
+
this.availableWidth = 0;
|
|
86
|
+
this.overflowConfig = null;
|
|
87
|
+
this.lastScenarios = [];
|
|
88
|
+
this.initSQLFunctions();
|
|
89
|
+
this.ruleSet = ruleSet || new IBCSRuleSet();
|
|
90
|
+
this.i18n = this.createI18n(new Map());
|
|
91
|
+
this.styles = styles;
|
|
92
|
+
this.availableWidth = availableWidth;
|
|
93
|
+
this.setConfig(config);
|
|
94
|
+
this.position = this.createElementPosition(config.scenarios);
|
|
95
|
+
}
|
|
96
|
+
updatePosition(scenarios) {
|
|
97
|
+
this.position = this.createElementPosition(scenarios);
|
|
98
|
+
}
|
|
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
|
+
setStyles(newStyle) {
|
|
112
|
+
this.styles = newStyle;
|
|
113
|
+
}
|
|
114
|
+
setAvailableWidth(w) {
|
|
115
|
+
this.availableWidth = w;
|
|
116
|
+
}
|
|
117
|
+
setAvailableHeight(availableHeight) {
|
|
118
|
+
// Only apply overdrive for manual scaling in bar mode
|
|
119
|
+
if (this.pixelPerUnit <= 0 || availableHeight <= 0) {
|
|
120
|
+
this.overflowConfig = null;
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (this.stackConfig != null) {
|
|
124
|
+
this.overflowConfig = null;
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const effectiveMode = this.determineEffectiveChartMode();
|
|
128
|
+
if (effectiveMode !== ChartMode.BAR) {
|
|
129
|
+
this.overflowConfig = null;
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
this.overflowConfig = this.calculateOverflowConfig(availableHeight);
|
|
133
|
+
// Rebuild position with virtual max so the coordinate system fits the container
|
|
134
|
+
if (this.overflowConfig) {
|
|
135
|
+
this.updatePosition(this.lastScenarios);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
calculateOverflowConfig(availableHeight) {
|
|
139
|
+
const highest = this.isVarianceChart() ? this.highestVarianceDataPointValue : this.highestDataPointValue;
|
|
140
|
+
const highestScaledUnit = highest.getScaledUnit();
|
|
141
|
+
if (highestScaledUnit <= 0)
|
|
142
|
+
return null;
|
|
143
|
+
const fontSize = this.styles.fontStyles.size;
|
|
144
|
+
// Non-bar overhead: everything except the bars themselves (labels, axis, padding)
|
|
145
|
+
const nonBarOverhead = this.position.dataLabelHeight +
|
|
146
|
+
this.position.spacings.labelToColumn +
|
|
147
|
+
this.position.padding.top +
|
|
148
|
+
this.position.padding.bottom +
|
|
149
|
+
this.position.spacings.labelToAxis +
|
|
150
|
+
fontSize; // axis labels approximate height
|
|
151
|
+
const overdriveZoneHeight = fontSize * 1.5;
|
|
152
|
+
const breakGap = fontSize * 0.3;
|
|
153
|
+
const cutHeight = availableHeight - nonBarOverhead - overdriveZoneHeight - breakGap;
|
|
154
|
+
// Non-AC scenarios break lower than AC by this offset
|
|
155
|
+
const scenarioCutOffset = fontSize * 0.8;
|
|
156
|
+
if (cutHeight <= scenarioCutOffset)
|
|
157
|
+
return null;
|
|
158
|
+
// Use the lower (non-AC) cut height for overflow detection threshold
|
|
159
|
+
const lowestCutHeight = cutHeight - scenarioCutOffset;
|
|
160
|
+
// No bar exceeds even the lowest cut height → no overflow needed
|
|
161
|
+
if (highestScaledUnit <= lowestCutHeight)
|
|
162
|
+
return null;
|
|
163
|
+
// maxOverflow based on lowest cut height so no bar exceeds overdriveZoneHeight
|
|
164
|
+
const maxOverflow = highestScaledUnit - lowestCutHeight;
|
|
165
|
+
return {
|
|
166
|
+
cutHeight,
|
|
167
|
+
overdriveZoneHeight,
|
|
168
|
+
breakGap,
|
|
169
|
+
maxOverflow,
|
|
170
|
+
scenarioCutOffset,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
setConfig(config) {
|
|
174
|
+
var _a;
|
|
175
|
+
this.state = FactoryState.DIRTY;
|
|
176
|
+
this.sortScenariosbyVisualisationRules(config);
|
|
177
|
+
this.setData([...config.data], config.filter);
|
|
178
|
+
this.hideAxisLabels = config.hideAxisLabels || false;
|
|
179
|
+
this.pixelPerUnit = config.pixelPerUnit;
|
|
180
|
+
this.pixelPerPercentage = config.pixelPerPercentage;
|
|
181
|
+
this.axisLabelsMode = config.axisLabelsMode;
|
|
182
|
+
this.intervalSpanLimit = config.intervalSpanLimit;
|
|
183
|
+
this.dateInterval = this.findDateInterval(config.dateInterval);
|
|
184
|
+
this.dataModel = this.populateModel(config.scenarios, this.dateInterval, config.level, config.sortOrder);
|
|
185
|
+
this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
|
|
186
|
+
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
|
+
this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
|
|
188
|
+
this.smallestVarianceDataPointValue = this.findSmallestDataPointValue(this.variancesDataModel);
|
|
189
|
+
this.highestDataPointValue = this.findHighestDataPointValue(this.dataModel);
|
|
190
|
+
this.highestVarianceDataPointValue = this.findHighestDataPointValue(this.variancesDataModel);
|
|
191
|
+
this.axisScenario = this.setAxisScenario(config.variances);
|
|
192
|
+
this.leftSideOffsetForHorizontalSync = config.leftSideOffsetForHorizontalSync;
|
|
193
|
+
this.measureScale = config.measureScale;
|
|
194
|
+
this.measureUnit = config.measureUnit;
|
|
195
|
+
this.dataFormatDigits = config.dataFormatDigits;
|
|
196
|
+
this.showOverlayMedian = config.showOverlayMedian;
|
|
197
|
+
this.showOverlayAvg = config.showOverlayAvg;
|
|
198
|
+
this.chartMode = config.chartMode;
|
|
199
|
+
this.maxBars = config.maxBars;
|
|
200
|
+
this.stackConfig = config.stackConfig;
|
|
201
|
+
this.lineFullWidth = config.lineFullWidth;
|
|
202
|
+
this.lastScenarios = config.scenarios;
|
|
203
|
+
this.updatePosition(config.scenarios);
|
|
204
|
+
}
|
|
205
|
+
getFooter() {
|
|
206
|
+
if (this.measureScale.value === 1 && this.measureUnit === "") {
|
|
207
|
+
return " ";
|
|
208
|
+
}
|
|
209
|
+
return Formatter.translateScenarioLabel("in", this.i18n) + " " + this.measureScale.prefix + this.measureUnit;
|
|
210
|
+
}
|
|
211
|
+
sortScenariosbyVisualisationRules(config) {
|
|
212
|
+
const self = this;
|
|
213
|
+
config.scenarios
|
|
214
|
+
.sort((n1, n2) => {
|
|
215
|
+
return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
|
|
216
|
+
})
|
|
217
|
+
.reverse();
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Init load of translation dictionary map
|
|
221
|
+
* map is used to translate lables in the table
|
|
222
|
+
*
|
|
223
|
+
* example:
|
|
224
|
+
* ```
|
|
225
|
+
* let i18n: Map<string, string> = new Map();
|
|
226
|
+
* [{key: 'ac',value: 'AC'}].forEach(function(entry){
|
|
227
|
+
* i18n.set(entry.key, entry.value);
|
|
228
|
+
* })
|
|
229
|
+
* ```
|
|
230
|
+
* @param i18n
|
|
231
|
+
*/
|
|
232
|
+
setI18n(i18n) {
|
|
233
|
+
this.i18n = this.createI18n(i18n);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Init load raw datasets the loaded dataset is
|
|
237
|
+
* the base on which the filters defined in the config
|
|
238
|
+
* are apllied on internaly it is called prepared DataSet
|
|
239
|
+
*
|
|
240
|
+
* @param data
|
|
241
|
+
* @param filter - data filter
|
|
242
|
+
* @param customColumnNameMap Custon ColumnNameMap can be used if data uses non standard columnames
|
|
243
|
+
*/
|
|
244
|
+
setData(data, filter) {
|
|
245
|
+
if (data == null) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.state = FactoryState.DIRTY; // mark dataSet for update
|
|
249
|
+
this.preparedDataSet.length = 0; // cleans formerly loaded and prepared dataset
|
|
250
|
+
if (filter != null && filter.length > 0) {
|
|
251
|
+
try {
|
|
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
|
+
}
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
this.preparedDataSet = data;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
getAllocatedCanvasWidth() {
|
|
264
|
+
// Analytical calculation — doesn't rely on text bbox (unreliable in detached SVGs)
|
|
265
|
+
const axisEnd = this.position.getAxisEndPositionX();
|
|
266
|
+
// Buffer for the last date label extending beyond axis end
|
|
267
|
+
const labelBuffer = this.styles.fontStyles.size * 3;
|
|
268
|
+
// Also consider bbox-based measurement as a fallback (works for rects)
|
|
269
|
+
const bboxWidth = Math.max(this.axisCategoryArea.width, this.scenariosArea.width);
|
|
270
|
+
const bboxTotal = bboxWidth > 0 ? bboxWidth + this.position.leftSideLabelLength : 0;
|
|
271
|
+
return Math.max(axisEnd + labelBuffer, bboxTotal);
|
|
272
|
+
}
|
|
273
|
+
getAllocatedCanvasHeight() {
|
|
274
|
+
if (this.smallestVarianceDataPointValue.value == null ||
|
|
275
|
+
this.highestVarianceDataPointValue.value == null ||
|
|
276
|
+
this.smallestDataPointValue.value == null ||
|
|
277
|
+
this.highestDataPointValue.value == null) {
|
|
278
|
+
return 0;
|
|
279
|
+
}
|
|
280
|
+
// Analytical calculation — doesn't rely on text bbox
|
|
281
|
+
const isRelative = this.isVarianceChart() &&
|
|
282
|
+
this.variancesDataModel.some((e) => e.type === VarianceType.RELATIVE);
|
|
283
|
+
const axisY = this.position.getAxisPositionY(isRelative);
|
|
284
|
+
// Space below axis: gap to date labels + date label height + bottom padding
|
|
285
|
+
const belowAxis = this.position.spacings.labelToAxis + this.position.dataLabelHeight + this.styles.padding.bottom;
|
|
286
|
+
let analyticalHeight;
|
|
287
|
+
if (!this.isOnSameAxisSide()) {
|
|
288
|
+
// Bars extend below axis — account for negative bar + its data label
|
|
289
|
+
const min = this.isVarianceChart() ? this.smallestVarianceDataPointValue : this.smallestDataPointValue;
|
|
290
|
+
const minScaled = Math.abs(min.getScaledUnit());
|
|
291
|
+
analyticalHeight =
|
|
292
|
+
axisY + minScaled + this.position.spacings.labelToColumn + this.position.dataLabelHeight + belowAxis;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
analyticalHeight = axisY + belowAxis;
|
|
296
|
+
}
|
|
297
|
+
// Also consider bbox-based measurement as a fallback
|
|
298
|
+
const isOnSameAxisSide = this.isOnSameAxisSide();
|
|
299
|
+
const bboxHeight = isOnSameAxisSide
|
|
300
|
+
? this.axisCategoryArea.height + this.scenariosArea.height
|
|
301
|
+
: this.scenariosArea.height;
|
|
302
|
+
return Math.max(analyticalHeight, bboxHeight);
|
|
303
|
+
}
|
|
304
|
+
toString() {
|
|
305
|
+
const container = new Svg();
|
|
306
|
+
this.draw(container);
|
|
307
|
+
container.id("drawCanvas");
|
|
308
|
+
container.width(this.getAllocatedCanvasWidth());
|
|
309
|
+
container.height(this.getAllocatedCanvasHeight());
|
|
310
|
+
container.attr("overflow", "visible");
|
|
311
|
+
return container.svg();
|
|
312
|
+
}
|
|
313
|
+
draw(svgContainer) {
|
|
314
|
+
this.cleanSVGforRedraw(svgContainer);
|
|
315
|
+
if (this.state === FactoryState.DIRTY) {
|
|
316
|
+
this.state = FactoryState.UP_TO_DATE;
|
|
317
|
+
}
|
|
318
|
+
if (this.isVarianceChart()) {
|
|
319
|
+
this.drawVarianceScenario(this.variancesDataModel, svgContainer);
|
|
320
|
+
this.drawAxisAndLabels(this.variancesDataModel, svgContainer);
|
|
321
|
+
}
|
|
322
|
+
else if (this.stackConfig != null) {
|
|
323
|
+
const effectiveChartMode = this.determineEffectiveChartMode();
|
|
324
|
+
if (effectiveChartMode === ChartMode.LINE) {
|
|
325
|
+
this.drawStackedAreaScenarios(this.dataModel, svgContainer);
|
|
326
|
+
this.drawAxisAndLabelsForLineChart(this.dataModel, svgContainer);
|
|
327
|
+
}
|
|
328
|
+
else {
|
|
329
|
+
this.drawStackedScenarios(this.dataModel, svgContainer);
|
|
330
|
+
this.drawStackedHeaders(this.dataModel, svgContainer);
|
|
331
|
+
this.drawAxisAndLabels(this.dataModel, svgContainer);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
const effectiveChartMode = this.determineEffectiveChartMode();
|
|
336
|
+
if (effectiveChartMode === ChartMode.LINE) {
|
|
337
|
+
this.drawLineScenarios(this.dataModel, svgContainer);
|
|
338
|
+
this.drawAxisAndLabelsForLineChart(this.dataModel, svgContainer);
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
this.drawScenarios(this.dataModel, svgContainer);
|
|
342
|
+
this.drawOverlayLayer(this.dataModel, svgContainer);
|
|
343
|
+
this.drawAxisAndLabels(this.dataModel, svgContainer);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
determineEffectiveChartMode() {
|
|
348
|
+
if (this.chartMode === ChartMode.LINE) {
|
|
349
|
+
return ChartMode.LINE;
|
|
350
|
+
}
|
|
351
|
+
if (this.chartMode === ChartMode.AUTO) {
|
|
352
|
+
// Auto-switch to line mode when data points exceed maxBars threshold
|
|
353
|
+
if (this.dataModel.length > this.maxBars) {
|
|
354
|
+
return ChartMode.LINE;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return ChartMode.BAR;
|
|
358
|
+
}
|
|
359
|
+
setPattern(fc, fcPolygonPattern) {
|
|
360
|
+
this.styles.pattern.set(fc, fcPolygonPattern);
|
|
361
|
+
}
|
|
362
|
+
hasNoData() {
|
|
363
|
+
return this.dataModel.length === 0;
|
|
364
|
+
}
|
|
365
|
+
isOnSameAxisSide() {
|
|
366
|
+
if (this.smallestVarianceDataPointValue.value == null ||
|
|
367
|
+
this.highestVarianceDataPointValue.value == null ||
|
|
368
|
+
this.smallestDataPointValue.value == null ||
|
|
369
|
+
this.highestDataPointValue.value == null) {
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
if (this.isVarianceChart()) {
|
|
373
|
+
return (Math.sign(this.smallestVarianceDataPointValue.value) === Math.sign(this.highestVarianceDataPointValue.value) ||
|
|
374
|
+
(this.smallestDataPointValue.value === 0 && Math.sign(this.highestDataPointValue.value) === 1));
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
return (Math.sign(this.smallestDataPointValue.value) === Math.sign(this.highestDataPointValue.value) ||
|
|
378
|
+
(this.smallestDataPointValue.value === 0 && Math.sign(this.highestDataPointValue.value) === 1));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
createI18n(i18n) {
|
|
382
|
+
this.state = FactoryState.DIRTY;
|
|
383
|
+
const defaultI18n = new Map([
|
|
384
|
+
["SEPERATOR_WS", ", "],
|
|
385
|
+
["in", "in"],
|
|
386
|
+
["ORDER_asc", "↑"],
|
|
387
|
+
["ORDER_desc", "↓"],
|
|
388
|
+
["ac1", "AC"],
|
|
389
|
+
["pp1", "PY"],
|
|
390
|
+
["fc1", "FC"],
|
|
391
|
+
["pl1", "PL"],
|
|
392
|
+
["ac2", "AC2"],
|
|
393
|
+
["pp2", "PY2"],
|
|
394
|
+
["fc2", "FC2"],
|
|
395
|
+
["pl2", "PL2"],
|
|
396
|
+
["ac3", "AC3"],
|
|
397
|
+
["pp3", "PY3"],
|
|
398
|
+
["fc3", "FC3"],
|
|
399
|
+
["pl3", "PL3"],
|
|
400
|
+
["ac4", "AC4"],
|
|
401
|
+
["pp4", "PY4"],
|
|
402
|
+
["fc4", "FC4"],
|
|
403
|
+
["pl4", "PL4"],
|
|
404
|
+
["category", " "],
|
|
405
|
+
["operation", " "],
|
|
406
|
+
["there_of", "davon"],
|
|
407
|
+
["part_of", "in % von"],
|
|
408
|
+
["ibcssymbol_delta_ac", "Δ{%}"],
|
|
409
|
+
["ibcssymbol_delta_generic", "Δ({%})"],
|
|
410
|
+
["ibcssymbol_delta_ac_relative", "Δ{%}%"],
|
|
411
|
+
["ibcssymbol_delta_generic_relative", "Δ({%})%"],
|
|
412
|
+
["SUM_TOTAL", "❖"],
|
|
413
|
+
]);
|
|
414
|
+
return new Map([...defaultI18n, ...i18n]);
|
|
415
|
+
}
|
|
416
|
+
createElementPosition(scenarios) {
|
|
417
|
+
let maxLabelLengthLeft;
|
|
418
|
+
// only need scenarios written on the leftside of bar/ marker
|
|
419
|
+
const scenarioLabelLeft = CalculateSize(scenarios
|
|
420
|
+
.filter((_value, index) => index === 1 || index === 2)
|
|
421
|
+
.map((scenario) => Formatter.translateScenarioLabel(scenario, this.i18n))
|
|
422
|
+
.reduce((a, b) => (a.length < b.length ? b : a), ""), {
|
|
423
|
+
font: this.styles.fontStyles.font,
|
|
424
|
+
fontSize: this.styles.fontStyles.size + "px",
|
|
425
|
+
}).width;
|
|
426
|
+
const titleLength = this.calculateTitleLength(this.leftSideOffsetForHorizontalSync);
|
|
427
|
+
if (scenarioLabelLeft > titleLength) {
|
|
428
|
+
maxLabelLengthLeft = scenarioLabelLeft;
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
maxLabelLengthLeft = titleLength;
|
|
432
|
+
}
|
|
433
|
+
if (this.position != null) {
|
|
434
|
+
maxLabelLengthLeft = maxLabelLengthLeft + this.position.spacings.labelToColumn;
|
|
435
|
+
}
|
|
436
|
+
//if (maxLabelLengthLeft < this.leftSideOffsetForHorizontalSync) {
|
|
437
|
+
// maxLabelLengthLeft = this.leftSideOffsetForHorizontalSync;
|
|
438
|
+
//}
|
|
439
|
+
if (this.leftSideOffsetForHorizontalSync > -1) {
|
|
440
|
+
maxLabelLengthLeft = this.leftSideOffsetForHorizontalSync;
|
|
441
|
+
}
|
|
442
|
+
let min;
|
|
443
|
+
let max;
|
|
444
|
+
if (this.isVarianceChart()) {
|
|
445
|
+
min = this.smallestVarianceDataPointValue;
|
|
446
|
+
max = this.highestVarianceDataPointValue;
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
min = this.smallestDataPointValue;
|
|
450
|
+
max = this.highestDataPointValue;
|
|
451
|
+
}
|
|
452
|
+
// When overflow config is active, create a virtual max so the coordinate system
|
|
453
|
+
// allocates exactly cutHeight + breakGap + overdriveZoneHeight instead of the
|
|
454
|
+
// full (clipped) bar height.
|
|
455
|
+
if (this.overflowConfig) {
|
|
456
|
+
const { cutHeight, overdriveZoneHeight, breakGap } = this.overflowConfig;
|
|
457
|
+
const virtualHeight = cutHeight + overdriveZoneHeight + breakGap;
|
|
458
|
+
// Create a virtual DataPoint with pixelPerUnit=1 so getScaledUnit() returns virtualHeight directly
|
|
459
|
+
max = new DataPoint(virtualHeight, max.scenario, 1, max.variance);
|
|
460
|
+
}
|
|
461
|
+
// In line mode with lineFullWidth enabled, override categoryWidth so data points
|
|
462
|
+
// are evenly distributed across the available container width.
|
|
463
|
+
let effectiveScaleFactors = this.styles.scaleFactors;
|
|
464
|
+
const effectiveMode = this.determineEffectiveChartMode();
|
|
465
|
+
if (this.lineFullWidth &&
|
|
466
|
+
this.availableWidth > 0 &&
|
|
467
|
+
this.dataModel.length > 0 &&
|
|
468
|
+
!this.isVarianceChart() &&
|
|
469
|
+
effectiveMode === ChartMode.LINE) {
|
|
470
|
+
const fontSize = this.styles.fontStyles.size;
|
|
471
|
+
const padding = this.styles.padding;
|
|
472
|
+
const sf = this.styles.scaleFactors;
|
|
473
|
+
// Fixed overhead: padding + scenarioOffset + leftSideLabels + half columnWidth (right margin)
|
|
474
|
+
const fixedOverhead = padding.left + padding.right + fontSize * sf.scenarioOffset + maxLabelLengthLeft + fontSize * sf.columnWidth;
|
|
475
|
+
const availableDataWidth = this.availableWidth - fixedOverhead;
|
|
476
|
+
if (availableDataWidth > 0) {
|
|
477
|
+
const customCategoryWidthFactor = availableDataWidth / this.dataModel.length / fontSize;
|
|
478
|
+
// Enforce minimum to prevent label overlap
|
|
479
|
+
const minFactor = sf.columnWidth * 1.2;
|
|
480
|
+
const finalFactor = Math.max(customCategoryWidthFactor, minFactor);
|
|
481
|
+
// Clone scaleFactors with overridden categoryWidth
|
|
482
|
+
const cloned = new ScaleFactorsTimeChart();
|
|
483
|
+
Object.assign(cloned, sf);
|
|
484
|
+
cloned.categoryWidth = finalFactor;
|
|
485
|
+
effectiveScaleFactors = cloned;
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return new ElementPositions(new Padding(this.styles.padding), effectiveScaleFactors, this.styles.fontStyles, min, max, this.dataModel.length, maxLabelLengthLeft);
|
|
489
|
+
}
|
|
490
|
+
calculateTitleLength(minWidth) {
|
|
491
|
+
let tmpTitle = "_______"; // default width if this.title is sorther
|
|
492
|
+
if (tmpTitle.length < this.title.length) {
|
|
493
|
+
tmpTitle = this.title;
|
|
494
|
+
}
|
|
495
|
+
const width = CalculateSize(tmpTitle, {
|
|
496
|
+
font: this.styles.fontStyles.font,
|
|
497
|
+
fontSize: this.styles.fontStyles.size + "px",
|
|
498
|
+
}).width;
|
|
499
|
+
if (width < minWidth) {
|
|
500
|
+
return minWidth;
|
|
501
|
+
}
|
|
502
|
+
return width;
|
|
503
|
+
}
|
|
504
|
+
setAxisScenario(scenarios) {
|
|
505
|
+
let result = Scenario.AC1;
|
|
506
|
+
if (scenarios != null && scenarios.length > 0) {
|
|
507
|
+
const axis = new VarianceScenario(scenarios.toString());
|
|
508
|
+
if (axis.isValid) {
|
|
509
|
+
result = axis.delta;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
if (result === null) {
|
|
513
|
+
// arrays with invalid scenarios are set to Senario.AC Fallback
|
|
514
|
+
result = Scenario.AC1;
|
|
515
|
+
}
|
|
516
|
+
return result;
|
|
517
|
+
}
|
|
518
|
+
populateModel(selectedScenarios, dateInterval, _level, _sortOrder) {
|
|
519
|
+
var _a;
|
|
520
|
+
if (((_a = this.preparedDataSet) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
521
|
+
return [];
|
|
522
|
+
}
|
|
523
|
+
const select = ``;
|
|
524
|
+
const order = "";
|
|
525
|
+
let result = this.queryDataSet(dateInterval, select, order);
|
|
526
|
+
this.detectNaNCells(selectedScenarios, result);
|
|
527
|
+
result = this.leftOuterJoinDates(result, dateInterval);
|
|
528
|
+
const dataModel = this.createDataRows(result, selectedScenarios);
|
|
529
|
+
return dataModel;
|
|
530
|
+
}
|
|
531
|
+
detectNaNCells(scenarios, res) {
|
|
532
|
+
res.forEach((row) => {
|
|
533
|
+
scenarios.forEach((scenario) => {
|
|
534
|
+
const varianceScenario = new VarianceScenario(scenario);
|
|
535
|
+
if (varianceScenario.isValid === true) {
|
|
536
|
+
if (row[varianceScenario.base + "_cnt"] === 0 || row[varianceScenario.delta + "_cnt"] === 0) {
|
|
537
|
+
row[scenario] = Number.NaN;
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
else {
|
|
541
|
+
if (row[scenario + "_cnt"] === 0) {
|
|
542
|
+
row[scenario] = Number.NaN;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
return row;
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
findDateInterval(dateInterval) {
|
|
550
|
+
var _a, _b, _c;
|
|
551
|
+
if (dateInterval !== DateDistance.AUTO) {
|
|
552
|
+
return dateInterval;
|
|
553
|
+
}
|
|
554
|
+
const resultMinMax = this.queryMinMaxDates();
|
|
555
|
+
let localDateInterval = DateDistance.DAY;
|
|
556
|
+
if (((_a = resultMinMax[0]) === null || _a === void 0 ? void 0 : _a.mindate) != null) {
|
|
557
|
+
localDateInterval = new DateStringFactory().calculateDistanceType((_b = resultMinMax[0]) === null || _b === void 0 ? void 0 : _b.mindate, (_c = resultMinMax[0]) === null || _c === void 0 ? void 0 : _c.maxdate, this.intervalSpanLimit);
|
|
558
|
+
}
|
|
559
|
+
return localDateInterval;
|
|
560
|
+
}
|
|
561
|
+
queryMinMaxDates() {
|
|
562
|
+
var _a, _b, _c, _d;
|
|
563
|
+
//let result: any[] = [];
|
|
564
|
+
const result = alasql(`SELECT MAX(${"date"}) as maxdate, MIN(${"date"}) as mindate FROM ?`, [this.preparedDataSet]);
|
|
565
|
+
if (((_a = result[0]) === null || _a === void 0 ? void 0 : _a.mindate) != null) {
|
|
566
|
+
result[0].mindate = DateTime.fromMillis((_b = result[0]) === null || _b === void 0 ? void 0 : _b.mindate);
|
|
567
|
+
}
|
|
568
|
+
if (((_c = result[0]) === null || _c === void 0 ? void 0 : _c.maxdate) != null) {
|
|
569
|
+
result[0].maxdate = DateTime.fromMillis((_d = result[0]) === null || _d === void 0 ? void 0 : _d.maxdate);
|
|
570
|
+
}
|
|
571
|
+
return result;
|
|
572
|
+
}
|
|
573
|
+
queryDataSet(dateInterval, select, order) {
|
|
574
|
+
const scenarios = [
|
|
575
|
+
"ac1",
|
|
576
|
+
"ac2",
|
|
577
|
+
"ac3",
|
|
578
|
+
"ac4",
|
|
579
|
+
"pp1",
|
|
580
|
+
"pp2",
|
|
581
|
+
"pp3",
|
|
582
|
+
"pp4",
|
|
583
|
+
"fc1",
|
|
584
|
+
"fc2",
|
|
585
|
+
"fc3",
|
|
586
|
+
"fc4",
|
|
587
|
+
"pl1",
|
|
588
|
+
"pl2",
|
|
589
|
+
"pl3",
|
|
590
|
+
"pl4",
|
|
591
|
+
];
|
|
592
|
+
const dateSelect = `normalizeDate([date], '${dateInterval}' , '${this.locale}') as calcdate`;
|
|
593
|
+
const result = alasql(`SELECT ${"p.calcdate"} ${select},
|
|
594
|
+
${scenarios
|
|
595
|
+
.map((scenario) => {
|
|
596
|
+
return `SUM(${scenario} * transformOperator(operation)) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
|
|
597
|
+
})
|
|
598
|
+
.join(",")}
|
|
599
|
+
|
|
600
|
+
FROM (SELECT ${dateSelect} ${select},
|
|
601
|
+
ac1,
|
|
602
|
+
ac2,
|
|
603
|
+
ac3,
|
|
604
|
+
ac4,
|
|
605
|
+
pp1,
|
|
606
|
+
pp2,
|
|
607
|
+
pp3,
|
|
608
|
+
pp4,
|
|
609
|
+
fc1,
|
|
610
|
+
fc2,
|
|
611
|
+
fc3,
|
|
612
|
+
fc4,
|
|
613
|
+
pl1,
|
|
614
|
+
pl2,
|
|
615
|
+
pl3,
|
|
616
|
+
pl4
|
|
617
|
+
FROM ?) as p
|
|
618
|
+
GROUP BY ${"calcdate"} ${order}
|
|
619
|
+
ORDER BY ${"calcdate asc"}`, [this.preparedDataSet]);
|
|
620
|
+
return result;
|
|
621
|
+
}
|
|
622
|
+
createDataRows(result, selectedScenarios) {
|
|
623
|
+
const dataModel = [];
|
|
624
|
+
result.forEach((element, index) => {
|
|
625
|
+
dataModel.push({
|
|
626
|
+
id: index,
|
|
627
|
+
category: element.category,
|
|
628
|
+
type: VarianceType.NONE,
|
|
629
|
+
date: element["calcdate"],
|
|
630
|
+
scenario1: new DataPoint(element[selectedScenarios[0]], selectedScenarios[0], this.pixelPerUnit, Scenario.NEU),
|
|
631
|
+
scenario2: new DataPoint(element[selectedScenarios[1]], selectedScenarios[1], this.pixelPerUnit, Scenario.NEU),
|
|
632
|
+
scenario3: new DataPoint(element[selectedScenarios[2]], selectedScenarios[2], this.pixelPerUnit, Scenario.NEU),
|
|
633
|
+
scenario4: new DataPoint(element[selectedScenarios[3]], selectedScenarios[3], this.pixelPerUnit, Scenario.NEU),
|
|
634
|
+
});
|
|
635
|
+
//}
|
|
636
|
+
});
|
|
637
|
+
return dataModel;
|
|
638
|
+
}
|
|
639
|
+
findSmallestDataPointValue(dataModel) {
|
|
640
|
+
const pixel = this.isVarianceChart() ? this.pixelPerPercentage : this.pixelPerUnit;
|
|
641
|
+
let smallestDataPoint = new DataPoint(0, "default", pixel, Scenario.NEU);
|
|
642
|
+
for (const entry of dataModel) {
|
|
643
|
+
for (const current of [entry.scenario1, entry.scenario2, entry.scenario3, entry.scenario4]) {
|
|
644
|
+
if (current && current.value != null) {
|
|
645
|
+
if (current.value < Number(smallestDataPoint.value)) {
|
|
646
|
+
smallestDataPoint = current;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
return smallestDataPoint;
|
|
652
|
+
}
|
|
653
|
+
findHighestDataPointValue(dataModel) {
|
|
654
|
+
const pixel = this.isVarianceChart() ? this.pixelPerPercentage : this.pixelPerUnit;
|
|
655
|
+
let highestDataPoint = new DataPoint(0, "default", pixel, Scenario.NEU);
|
|
656
|
+
for (const entry of dataModel) {
|
|
657
|
+
for (const current of [entry.scenario1, entry.scenario2, entry.scenario3, entry.scenario4]) {
|
|
658
|
+
if (current != null) {
|
|
659
|
+
if (current.value > Number(highestDataPoint.value)) {
|
|
660
|
+
highestDataPoint = current;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
return highestDataPoint;
|
|
666
|
+
}
|
|
667
|
+
populateVarianceModel(variancesConfig, dataModel) {
|
|
668
|
+
const varianceModel = [];
|
|
669
|
+
if (variancesConfig == null || variancesConfig.length === 0) {
|
|
670
|
+
return varianceModel;
|
|
671
|
+
}
|
|
672
|
+
let firstRow = null;
|
|
673
|
+
if (dataModel != null && dataModel.length > 0) {
|
|
674
|
+
firstRow = dataModel[0];
|
|
675
|
+
}
|
|
676
|
+
for (const varianceScenario in variancesConfig) {
|
|
677
|
+
const scenarios = new VarianceScenario(variancesConfig[varianceScenario]);
|
|
678
|
+
if (scenarios.isValid) {
|
|
679
|
+
const scenariomap = this.mapScenarios(scenarios, firstRow);
|
|
680
|
+
const directon = scenarios.direction;
|
|
681
|
+
const pixelPerUnit = scenarios.type === "dr" ? this.pixelPerPercentage : this.pixelPerUnit;
|
|
682
|
+
for (const index in dataModel) {
|
|
683
|
+
varianceModel.push({
|
|
684
|
+
id: Number(index),
|
|
685
|
+
category: dataModel[index].category,
|
|
686
|
+
type: scenarios.type === "dr" ? VarianceType.RELATIVE : VarianceType.ABSOLUTE,
|
|
687
|
+
date: dataModel[index].date,
|
|
688
|
+
scenario1: new DataPoint(this.calculateVariance(scenarios, dataModel[index], scenariomap), scenarios.delta, pixelPerUnit, directon),
|
|
689
|
+
scenario2: new DataPoint(null, null, null, null),
|
|
690
|
+
scenario3: new DataPoint(null, null, null, null),
|
|
691
|
+
scenario4: new DataPoint(null, null, null, null),
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return varianceModel;
|
|
697
|
+
}
|
|
698
|
+
calculateVariance(scenarios, element, scenarioMap) {
|
|
699
|
+
const scenarioBase = scenarioMap.get(scenarios.base);
|
|
700
|
+
const scenarioDelta = scenarioMap.get(scenarios.delta);
|
|
701
|
+
if (scenarioBase == null || scenarioDelta == null) {
|
|
702
|
+
return null;
|
|
703
|
+
}
|
|
704
|
+
if (element[scenarioBase].value == null || element[scenarioDelta].value == null) {
|
|
705
|
+
return null;
|
|
706
|
+
}
|
|
707
|
+
const isRelativeVariance = scenarios.type === VarianceType.RELATIVE;
|
|
708
|
+
if (isRelativeVariance) {
|
|
709
|
+
return (element[scenarioBase].value - element[scenarioDelta].value) / element[scenarioDelta].value;
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
return element[scenarioBase].value - element[scenarioDelta].value;
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
mapScenarios(scenarios, firstRow) {
|
|
716
|
+
const varianceMap = new Map();
|
|
717
|
+
if (firstRow == null) {
|
|
718
|
+
return varianceMap;
|
|
719
|
+
}
|
|
720
|
+
["scenario1", "scenario2", "scenario3", "scenario4"].forEach((scenarioKey) => {
|
|
721
|
+
if (firstRow[scenarioKey].scenario === scenarios.delta) {
|
|
722
|
+
varianceMap.set(scenarios.delta, scenarioKey);
|
|
723
|
+
}
|
|
724
|
+
else if (firstRow[scenarioKey].scenario === scenarios.base) {
|
|
725
|
+
varianceMap.set(scenarios.base, scenarioKey);
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
return varianceMap;
|
|
729
|
+
}
|
|
730
|
+
cleanSVGforRedraw(svgContainer) {
|
|
731
|
+
svgContainer.clear();
|
|
732
|
+
}
|
|
733
|
+
isVarianceChart() {
|
|
734
|
+
return this.variancesDataModel && this.variancesDataModel.length > 0;
|
|
735
|
+
}
|
|
736
|
+
createDateFactory() {
|
|
737
|
+
const factory = new DateStringFactory();
|
|
738
|
+
return factory;
|
|
739
|
+
}
|
|
740
|
+
drawAxisAndLabels(dataModel, svgContainer) {
|
|
741
|
+
const dateStringFactory = this.createDateFactory();
|
|
742
|
+
const axisLabelGroup = svgContainer.group().id("AxisAndDateLables");
|
|
743
|
+
let isRelative = false;
|
|
744
|
+
if (this.hideAxisLabels === false) {
|
|
745
|
+
dataModel.forEach((elements, index) => {
|
|
746
|
+
let hookLocation = HookLocation.Top;
|
|
747
|
+
let offset = this.position.spacings.labelToAxis;
|
|
748
|
+
if (elements["scenario1"]["value"] < 0) {
|
|
749
|
+
hookLocation = HookLocation.Bottom;
|
|
750
|
+
offset *= -1;
|
|
751
|
+
}
|
|
752
|
+
if (elements["type"] === VarianceType.RELATIVE) {
|
|
753
|
+
isRelative = true;
|
|
754
|
+
}
|
|
755
|
+
let datelabel = dateStringFactory.getDateString(elements.date, this.dateInterval);
|
|
756
|
+
if (this.axisLabelsMode === AxisLabelsMode.SMART) {
|
|
757
|
+
datelabel = dateStringFactory.getSmartDateString(elements.date, this.dateInterval);
|
|
758
|
+
if (index === 0 && this.dateInterval !== DateDistance.YEAR) {
|
|
759
|
+
datelabel = dateStringFactory.getShortDateString(elements.date, this.dateInterval);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
else if (this.axisLabelsMode === AxisLabelsMode.SHORT) {
|
|
763
|
+
datelabel = dateStringFactory.getShortDateString(elements.date, this.dateInterval);
|
|
764
|
+
}
|
|
765
|
+
new Label(axisLabelGroup, this.position.getColumnCenterPositionX(index), this.position.getAxisPositionY(isRelative) + offset, "", datelabel, this.styles, hookLocation, HookLocation.Center).forceStringTypeDraw();
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
else {
|
|
769
|
+
const element = dataModel === null || dataModel === void 0 ? void 0 : dataModel[0];
|
|
770
|
+
if (element && element["type"] === VarianceType.RELATIVE) {
|
|
771
|
+
isRelative = true;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
new Axis({
|
|
775
|
+
scenarioType: this.axisScenario,
|
|
776
|
+
labelText: this.title,
|
|
777
|
+
isRelative: isRelative,
|
|
778
|
+
}, this.position, axisLabelGroup).draw();
|
|
779
|
+
this.axisCategoryArea = {
|
|
780
|
+
height: axisLabelGroup.height(),
|
|
781
|
+
width: axisLabelGroup.width(),
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
drawScenarios(dataModel, svgContainer) {
|
|
785
|
+
const columnGroup = svgContainer.group().id("Scenarios");
|
|
786
|
+
const scenarioFactory = new ScenarioFactory(this.position, columnGroup, this.styles, dataModel.length, this.i18n);
|
|
787
|
+
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
788
|
+
let hasValidPrim = false;
|
|
789
|
+
dataModel.forEach((elements, index) => {
|
|
790
|
+
scenarioFactory.createPrimaryBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
791
|
+
scenarioFactory.createSecondaryBar(elements["scenario2"], index).draw();
|
|
792
|
+
scenarioFactory.createPrimaryMarker(elements["scenario3"], index).draw();
|
|
793
|
+
scenarioFactory.createSecondaryMarker(elements["scenario4"], index).draw();
|
|
794
|
+
if (elements["scenario1"].isEmpty() === false) {
|
|
795
|
+
hasValidPrim = true;
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
let heightOffset = 0;
|
|
799
|
+
if (hasValidPrim === false) {
|
|
800
|
+
if (this.isOnSameAxisSide()) {
|
|
801
|
+
heightOffset = this.position.dataLabelHeight;
|
|
802
|
+
}
|
|
803
|
+
else {
|
|
804
|
+
heightOffset = this.position.dataLabelHeight * 2;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
this.scenariosArea = {
|
|
808
|
+
height: columnGroup.height() + this.styles.padding.top + this.styles.padding.bottom + heightOffset,
|
|
809
|
+
width: columnGroup.width() + this.position.spacings.columnWidth,
|
|
810
|
+
};
|
|
811
|
+
}
|
|
812
|
+
drawLineScenarios(dataModel, svgContainer) {
|
|
813
|
+
var _a, _b;
|
|
814
|
+
const lineGroup = svgContainer.group().id("LineScenarios");
|
|
815
|
+
// Create collision manager for label overlap detection across all line series
|
|
816
|
+
const collisionManager = new LabelCollisionManager();
|
|
817
|
+
const scenarioFactory = new ScenarioFactory(this.position, lineGroup, this.styles, dataModel.length, this.i18n);
|
|
818
|
+
scenarioFactory.setCollisionManager(collisionManager);
|
|
819
|
+
// Collect data points for each scenario
|
|
820
|
+
const slotDefaults = ["ac1", "pp1", "fc1", "pl1"];
|
|
821
|
+
const slotPoints = [[], [], [], []];
|
|
822
|
+
dataModel.forEach((elements, index) => {
|
|
823
|
+
const keys = ["scenario1", "scenario2", "scenario3", "scenario4"];
|
|
824
|
+
keys.forEach((key, slotIdx) => {
|
|
825
|
+
if (elements[key]) {
|
|
826
|
+
slotPoints[slotIdx].push({ dataPoint: elements[key], index });
|
|
827
|
+
}
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
// Build scenario info (only non-empty scenarios)
|
|
831
|
+
const scenarios = [];
|
|
832
|
+
for (let i = 0; i < slotPoints.length; i++) {
|
|
833
|
+
const points = slotPoints[i];
|
|
834
|
+
if (points.length > 0 && points.some((p) => !p.dataPoint.isEmpty())) {
|
|
835
|
+
const scenarioName = ((_b = (_a = points[0]) === null || _a === void 0 ? void 0 : _a.dataPoint) === null || _b === void 0 ? void 0 : _b.scenario) || slotDefaults[i];
|
|
836
|
+
const scenarioType = scenarioName.slice(0, 2).toLowerCase();
|
|
837
|
+
scenarios.push({ points, scenarioName, scenarioType });
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
// Sort by z-order: lowest priority first so SVG groups are created in correct render order
|
|
841
|
+
// PL(4) → FC(3) → PP(2) → AC(1) — AC geometry on top of PP geometry
|
|
842
|
+
scenarios.sort((a, b) => {
|
|
843
|
+
const pa = SCENARIO_PRIORITY[a.scenarioType] || 99;
|
|
844
|
+
const pb = SCENARIO_PRIORITY[b.scenarioType] || 99;
|
|
845
|
+
return pb - pa;
|
|
846
|
+
});
|
|
847
|
+
// Create LineSeries in z-order (SVG group creation order = render order)
|
|
848
|
+
const seriesList = [];
|
|
849
|
+
for (const scenario of scenarios) {
|
|
850
|
+
const series = scenarioFactory.createLineSeries(scenario.points, scenario.scenarioName);
|
|
851
|
+
seriesList.push({ series, scenarioType: scenario.scenarioType });
|
|
852
|
+
}
|
|
853
|
+
// Phase 1: Draw geometry (groups already in correct z-order from creation)
|
|
854
|
+
for (const entry of seriesList) {
|
|
855
|
+
entry.series.drawGeometry();
|
|
856
|
+
}
|
|
857
|
+
// Move label group to front so labels render on top of all lines/markers
|
|
858
|
+
scenarioFactory.moveLabelsToFront();
|
|
859
|
+
// Phase 2: Draw labels in priority order (highest priority first)
|
|
860
|
+
// AC(1) → PP(2) → FC(3) → PL(4) so AC claims best label positions first
|
|
861
|
+
const labelOrder = [...seriesList].sort((a, b) => {
|
|
862
|
+
const pa = SCENARIO_PRIORITY[a.scenarioType] || 99;
|
|
863
|
+
const pb = SCENARIO_PRIORITY[b.scenarioType] || 99;
|
|
864
|
+
return pa - pb; // lowest priority number first (AC first)
|
|
865
|
+
});
|
|
866
|
+
for (const entry of labelOrder) {
|
|
867
|
+
entry.series.drawLabels(this.dataFormatDigits, this.measureScale);
|
|
868
|
+
}
|
|
869
|
+
// In line mode the lines only span between data points (all above the axis),
|
|
870
|
+
// so lineGroup.height() does not extend to the axis like bar rects do.
|
|
871
|
+
// Use getColumnPositionY() (the axis baseline) as the minimum height
|
|
872
|
+
// so that axis date labels drawn below are not cut off.
|
|
873
|
+
const axisY = this.position.getColumnPositionY();
|
|
874
|
+
this.scenariosArea = {
|
|
875
|
+
height: Math.max(lineGroup.height() + this.styles.padding.top, axisY) + this.styles.padding.bottom,
|
|
876
|
+
width: lineGroup.width() + this.position.spacings.columnWidth,
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
drawAxisAndLabelsForLineChart(dataModel, svgContainer) {
|
|
880
|
+
const dateStringFactory = this.createDateFactory();
|
|
881
|
+
const axisLabelGroup = svgContainer.group().id("AxisAndDateLabelsLine");
|
|
882
|
+
const isRelative = false;
|
|
883
|
+
const lastIndex = dataModel.length - 1;
|
|
884
|
+
if (this.hideAxisLabels === false) {
|
|
885
|
+
dataModel.forEach((elements, index) => {
|
|
886
|
+
// Only show labels for first, last, and year change points
|
|
887
|
+
if (!this.shouldShowLineChartAxisLabel(dataModel, index)) {
|
|
888
|
+
return;
|
|
889
|
+
}
|
|
890
|
+
let hookLocation = HookLocation.Top;
|
|
891
|
+
let offset = this.position.spacings.labelToAxis;
|
|
892
|
+
if (elements["scenario1"]["value"] < 0) {
|
|
893
|
+
hookLocation = HookLocation.Bottom;
|
|
894
|
+
offset *= -1;
|
|
895
|
+
}
|
|
896
|
+
// Get the date label — use smart/short logic when full-width shows all labels
|
|
897
|
+
let datelabel;
|
|
898
|
+
if (this.lineFullWidth && this.availableWidth > 0) {
|
|
899
|
+
if (this.axisLabelsMode === AxisLabelsMode.SMART) {
|
|
900
|
+
datelabel = dateStringFactory.getSmartDateString(elements.date, this.dateInterval);
|
|
901
|
+
if (index === 0 && this.dateInterval !== DateDistance.YEAR) {
|
|
902
|
+
datelabel = dateStringFactory.getShortDateString(elements.date, this.dateInterval);
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
else if (this.axisLabelsMode === AxisLabelsMode.SHORT) {
|
|
906
|
+
datelabel = dateStringFactory.getShortDateString(elements.date, this.dateInterval);
|
|
907
|
+
}
|
|
908
|
+
else {
|
|
909
|
+
datelabel = dateStringFactory.getDateString(elements.date, this.dateInterval);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
datelabel = dateStringFactory.getShortDateString(elements.date, this.dateInterval);
|
|
914
|
+
}
|
|
915
|
+
new Label(axisLabelGroup, this.position.getColumnCenterPositionX(index), this.position.getAxisPositionY(isRelative) + offset, "", datelabel, this.styles, hookLocation, HookLocation.Center).forceStringTypeDraw();
|
|
916
|
+
// Draw vertical dashed separator line at year transitions (except for first and last)
|
|
917
|
+
if (index > 0 && index < lastIndex && this.isYearChange(dataModel, index)) {
|
|
918
|
+
this.drawYearSeparatorLine(axisLabelGroup, index, isRelative);
|
|
919
|
+
}
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
new Axis({
|
|
923
|
+
scenarioType: this.axisScenario,
|
|
924
|
+
labelText: this.title,
|
|
925
|
+
isRelative: isRelative,
|
|
926
|
+
}, this.position, axisLabelGroup).draw();
|
|
927
|
+
this.axisCategoryArea = {
|
|
928
|
+
height: axisLabelGroup.height(),
|
|
929
|
+
width: axisLabelGroup.width(),
|
|
930
|
+
};
|
|
931
|
+
}
|
|
932
|
+
shouldShowLineChartAxisLabel(dataModel, index) {
|
|
933
|
+
// In full-width mode, every data point gets a label (enough horizontal space)
|
|
934
|
+
if (this.lineFullWidth && this.availableWidth > 0) {
|
|
935
|
+
return true;
|
|
936
|
+
}
|
|
937
|
+
const lastIndex = dataModel.length - 1;
|
|
938
|
+
// Always show first and last labels
|
|
939
|
+
if (index === 0 || index === lastIndex) {
|
|
940
|
+
return true;
|
|
941
|
+
}
|
|
942
|
+
// Show label if year changed from previous data point
|
|
943
|
+
return this.isYearChange(dataModel, index);
|
|
944
|
+
}
|
|
945
|
+
isYearChange(dataModel, index) {
|
|
946
|
+
var _a, _b;
|
|
947
|
+
if (index === 0) {
|
|
948
|
+
return false;
|
|
949
|
+
}
|
|
950
|
+
const currentDate = (_a = dataModel[index]) === null || _a === void 0 ? void 0 : _a.date;
|
|
951
|
+
const previousDate = (_b = dataModel[index - 1]) === null || _b === void 0 ? void 0 : _b.date;
|
|
952
|
+
if (!currentDate || !previousDate) {
|
|
953
|
+
return false;
|
|
954
|
+
}
|
|
955
|
+
return currentDate.year !== previousDate.year;
|
|
956
|
+
}
|
|
957
|
+
drawYearSeparatorLine(group, index, isRelative) {
|
|
958
|
+
const xPos = this.position.getColumnCenterPositionX(index) - this.position.spacings.columnWidth / 2;
|
|
959
|
+
// Calculate chart height from the max data point
|
|
960
|
+
const chartHeight = this.position.columnValue.max.getScaledUnit() + this.position.dataLabelHeight;
|
|
961
|
+
const topY = this.position.getAxisPositionY(isRelative) - chartHeight;
|
|
962
|
+
const bottomY = this.position.getAxisPositionY(isRelative);
|
|
963
|
+
group
|
|
964
|
+
.line([
|
|
965
|
+
[xPos, topY],
|
|
966
|
+
[xPos, bottomY],
|
|
967
|
+
])
|
|
968
|
+
.stroke({
|
|
969
|
+
color: "#999999",
|
|
970
|
+
width: 1,
|
|
971
|
+
dasharray: "4,4",
|
|
972
|
+
})
|
|
973
|
+
.attr("stroke-dasharray", "4,4");
|
|
974
|
+
}
|
|
975
|
+
drawVarianceScenario(dataModel, svgContainer) {
|
|
976
|
+
const columnGroup = svgContainer.group().id("Scenarios");
|
|
977
|
+
const scenarioFactory = new ScenarioFactory(this.position, columnGroup, this.styles, dataModel.length, this.i18n);
|
|
978
|
+
scenarioFactory.setOverflowConfig(this.overflowConfig);
|
|
979
|
+
dataModel.forEach((elements, index) => {
|
|
980
|
+
if (elements["type"] === VarianceType.RELATIVE) {
|
|
981
|
+
scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw();
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
scenarioFactory.createVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
this.scenariosArea = {
|
|
988
|
+
height: columnGroup.height() + this.styles.padding.top + this.styles.padding.bottom,
|
|
989
|
+
width: columnGroup.width() + this.position.spacings.columnWidth,
|
|
990
|
+
};
|
|
991
|
+
return columnGroup;
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Draw stacked bar columns. Supports stacking by scenario or by data dimension.
|
|
995
|
+
* When stacking by scenario with multiple scenario types (e.g. ac+pl),
|
|
996
|
+
* uses overlay mode: each type group is drawn from the same baseline,
|
|
997
|
+
* back-to-front per IBCS convention (PL behind, AC on top).
|
|
998
|
+
*/
|
|
999
|
+
drawStackedScenarios(dataModel, svgContainer) {
|
|
1000
|
+
if (!this.stackConfig)
|
|
1001
|
+
return;
|
|
1002
|
+
const stackGroup = svgContainer.group().id("StackedScenarios");
|
|
1003
|
+
const isScenarioStack = this.stackConfig.by === StackBy.SCENARIO;
|
|
1004
|
+
dataModel.forEach((elements, index) => {
|
|
1005
|
+
const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
|
|
1006
|
+
const segments = [];
|
|
1007
|
+
if (isScenarioStack) {
|
|
1008
|
+
for (const key of scenarioKeys) {
|
|
1009
|
+
const dp = elements[key];
|
|
1010
|
+
if (dp && !dp.isEmpty() && dp.value != null) {
|
|
1011
|
+
segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
else {
|
|
1016
|
+
const dp = elements["scenario1"];
|
|
1017
|
+
if (dp && !dp.isEmpty() && dp.value != null) {
|
|
1018
|
+
segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
if (segments.length === 0)
|
|
1022
|
+
return;
|
|
1023
|
+
// Check if we have multiple scenario type groups for overlay mode
|
|
1024
|
+
const prefixes = isScenarioStack
|
|
1025
|
+
? new Set(segments.map((s) => getScenarioPrefix(s.scenario)))
|
|
1026
|
+
: new Set();
|
|
1027
|
+
if (prefixes.size > 1) {
|
|
1028
|
+
// Overlay mode: group by scenario prefix, draw each group from same baseline
|
|
1029
|
+
const groupMap = new Map();
|
|
1030
|
+
for (const seg of segments) {
|
|
1031
|
+
const prefix = getScenarioPrefix(seg.scenario);
|
|
1032
|
+
if (!groupMap.has(prefix))
|
|
1033
|
+
groupMap.set(prefix, []);
|
|
1034
|
+
groupMap.get(prefix).push(seg);
|
|
1035
|
+
}
|
|
1036
|
+
const groups = [];
|
|
1037
|
+
for (const prefix of IBCS_LAYER_ORDER) {
|
|
1038
|
+
if (groupMap.has(prefix)) {
|
|
1039
|
+
groups.push({ prefix, segments: groupMap.get(prefix) });
|
|
1040
|
+
groupMap.delete(prefix);
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
for (const [prefix, segs] of groupMap) {
|
|
1044
|
+
groups.push({ prefix, segments: segs });
|
|
1045
|
+
}
|
|
1046
|
+
// Draw each group from baseline=0 (overlapping)
|
|
1047
|
+
groups.forEach((group, groupIdx) => {
|
|
1048
|
+
const groupTotal = group.segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
1049
|
+
const colorIndex = groups.length - 1 - groupIdx;
|
|
1050
|
+
let cumulativeValue = 0;
|
|
1051
|
+
let lastColumn = null;
|
|
1052
|
+
group.segments.forEach((seg) => {
|
|
1053
|
+
const column = new StackedColumn(this.position, this.styles, seg.dataPoint, index, cumulativeValue, seg.scenario, colorIndex, this.stackConfig.mode, groupTotal, true, stackGroup);
|
|
1054
|
+
column.draw(this.dataFormatDigits, this.measureScale);
|
|
1055
|
+
cumulativeValue += Math.abs(seg.value);
|
|
1056
|
+
lastColumn = column;
|
|
1057
|
+
});
|
|
1058
|
+
if (lastColumn) {
|
|
1059
|
+
lastColumn.drawTotalLabel(this.dataFormatDigits, this.measureScale);
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
else {
|
|
1064
|
+
// Single group or non-scenario: additive stacking
|
|
1065
|
+
if (this.stackConfig.order === "asc") {
|
|
1066
|
+
segments.sort((a, b) => a.value - b.value);
|
|
1067
|
+
}
|
|
1068
|
+
else if (this.stackConfig.order === "desc") {
|
|
1069
|
+
segments.sort((a, b) => b.value - a.value);
|
|
1070
|
+
}
|
|
1071
|
+
const total = segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
1072
|
+
let cumulativeValue = 0;
|
|
1073
|
+
let lastColumn = null;
|
|
1074
|
+
segments.forEach((seg, segIdx) => {
|
|
1075
|
+
const column = new StackedColumn(this.position, this.styles, seg.dataPoint, index, cumulativeValue, seg.scenario, segIdx, this.stackConfig.mode, total, isScenarioStack, stackGroup);
|
|
1076
|
+
column.draw(this.dataFormatDigits, this.measureScale);
|
|
1077
|
+
cumulativeValue += Math.abs(seg.value);
|
|
1078
|
+
lastColumn = column;
|
|
1079
|
+
});
|
|
1080
|
+
if (lastColumn) {
|
|
1081
|
+
lastColumn.drawTotalLabel(this.dataFormatDigits, this.measureScale);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
});
|
|
1085
|
+
this.scenariosArea = {
|
|
1086
|
+
height: stackGroup.height() + this.styles.padding.top + this.styles.padding.bottom,
|
|
1087
|
+
width: stackGroup.width() + this.position.spacings.columnWidth,
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
/**
|
|
1091
|
+
* Draw column headers next to stacked columns showing what each group/segment represents.
|
|
1092
|
+
* For overlay mode (multiple scenario types): shows one header per group.
|
|
1093
|
+
* For single-group: shows individual segment headers.
|
|
1094
|
+
*/
|
|
1095
|
+
drawStackedHeaders(dataModel, svgContainer) {
|
|
1096
|
+
if (!this.stackConfig || dataModel.length === 0)
|
|
1097
|
+
return;
|
|
1098
|
+
const isScenarioStack = this.stackConfig.by === StackBy.SCENARIO;
|
|
1099
|
+
if (!isScenarioStack)
|
|
1100
|
+
return;
|
|
1101
|
+
const headerGroup = svgContainer.group().id("StackedHeaders");
|
|
1102
|
+
const firstRow = dataModel[0];
|
|
1103
|
+
const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
|
|
1104
|
+
const segments = [];
|
|
1105
|
+
for (const key of scenarioKeys) {
|
|
1106
|
+
const dp = firstRow[key];
|
|
1107
|
+
if (dp && !dp.isEmpty() && dp.value != null) {
|
|
1108
|
+
segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
if (segments.length === 0)
|
|
1112
|
+
return;
|
|
1113
|
+
const prefixes = new Set(segments.map((s) => getScenarioPrefix(s.scenario)));
|
|
1114
|
+
const axisY = this.position.getColumnPositionY();
|
|
1115
|
+
const xBase = this.position.getColumnCenterPositionX(0) - this.position.getColumnWidth() / 2;
|
|
1116
|
+
const labelX = xBase - this.position.spacings.labelToColumn;
|
|
1117
|
+
if (prefixes.size > 1) {
|
|
1118
|
+
// Overlay mode: one header per group, centered vertically on group's column height
|
|
1119
|
+
const groupMap = new Map();
|
|
1120
|
+
for (const seg of segments) {
|
|
1121
|
+
const prefix = getScenarioPrefix(seg.scenario);
|
|
1122
|
+
if (!groupMap.has(prefix))
|
|
1123
|
+
groupMap.set(prefix, []);
|
|
1124
|
+
groupMap.get(prefix).push(seg);
|
|
1125
|
+
}
|
|
1126
|
+
const groups = [];
|
|
1127
|
+
for (const prefix of IBCS_LAYER_ORDER) {
|
|
1128
|
+
if (groupMap.has(prefix)) {
|
|
1129
|
+
groups.push({ prefix, segments: groupMap.get(prefix) });
|
|
1130
|
+
groupMap.delete(prefix);
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
for (const [prefix, segs] of groupMap) {
|
|
1134
|
+
groups.push({ prefix, segments: segs });
|
|
1135
|
+
}
|
|
1136
|
+
groups.forEach((group) => {
|
|
1137
|
+
const groupTotal = group.segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
1138
|
+
const pixelPerUnit = group.segments[0].dataPoint.pixelPerUnit;
|
|
1139
|
+
const groupPixelHeight = this.stackConfig.mode === StackMode.RELATIVE ? pixelPerUnit : groupTotal * pixelPerUnit;
|
|
1140
|
+
const centerY = axisY - groupPixelHeight / 2;
|
|
1141
|
+
const labelText = this.i18n.get(group.prefix + "1") || group.prefix.toUpperCase();
|
|
1142
|
+
new Label(headerGroup, labelX, centerY, "STACK_HEADER", labelText, this.styles, HookLocation.Center, HookLocation.Right).forceStringTypeDraw();
|
|
1143
|
+
});
|
|
1144
|
+
}
|
|
1145
|
+
else {
|
|
1146
|
+
// Single group: show individual segment headers
|
|
1147
|
+
if (this.stackConfig.order === "asc")
|
|
1148
|
+
segments.sort((a, b) => a.value - b.value);
|
|
1149
|
+
else if (this.stackConfig.order === "desc")
|
|
1150
|
+
segments.sort((a, b) => b.value - a.value);
|
|
1151
|
+
const total = segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
|
|
1152
|
+
const pixelPerUnit = segments[0].dataPoint.pixelPerUnit;
|
|
1153
|
+
let cumulativePixels = 0;
|
|
1154
|
+
segments.forEach((seg) => {
|
|
1155
|
+
let segmentHeight;
|
|
1156
|
+
if (this.stackConfig.mode === StackMode.RELATIVE) {
|
|
1157
|
+
const proportion = total !== 0 ? Math.abs(seg.value) / total : 0;
|
|
1158
|
+
segmentHeight = proportion * pixelPerUnit;
|
|
1159
|
+
}
|
|
1160
|
+
else {
|
|
1161
|
+
segmentHeight = Math.abs(seg.value * pixelPerUnit);
|
|
1162
|
+
}
|
|
1163
|
+
const centerY = axisY - cumulativePixels - segmentHeight / 2;
|
|
1164
|
+
const labelText = this.i18n.get(seg.scenario) || seg.scenario;
|
|
1165
|
+
new Label(headerGroup, labelX, centerY, "STACK_HEADER", labelText, this.styles, HookLocation.Center, HookLocation.Right).forceStringTypeDraw();
|
|
1166
|
+
cumulativePixels += segmentHeight;
|
|
1167
|
+
});
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
/**
|
|
1171
|
+
* Draw stacked area chart (line mode with stack).
|
|
1172
|
+
* Computes cumulative y-values and draws AreaFill paths between layers.
|
|
1173
|
+
*/
|
|
1174
|
+
drawStackedAreaScenarios(dataModel, svgContainer) {
|
|
1175
|
+
if (!this.stackConfig)
|
|
1176
|
+
return;
|
|
1177
|
+
const areaGroup = svgContainer.group().id("StackedAreaScenarios");
|
|
1178
|
+
const isScenarioStack = this.stackConfig.by === StackBy.SCENARIO;
|
|
1179
|
+
const stackMode = this.stackConfig.mode;
|
|
1180
|
+
const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
|
|
1181
|
+
// Determine how many layers we have
|
|
1182
|
+
const layerCount = isScenarioStack
|
|
1183
|
+
? scenarioKeys.filter((key) => dataModel.some((el) => el[key] && !el[key].isEmpty()))
|
|
1184
|
+
.length
|
|
1185
|
+
: 1;
|
|
1186
|
+
if (layerCount === 0)
|
|
1187
|
+
return;
|
|
1188
|
+
// Build cumulative values per layer
|
|
1189
|
+
// cumulativePoints[layerIdx][dataIdx] = cumulative y-value at that point
|
|
1190
|
+
const cumulativeValues = [];
|
|
1191
|
+
const layerScenarios = [];
|
|
1192
|
+
// Identify active layers
|
|
1193
|
+
const activeLayers = [];
|
|
1194
|
+
for (const key of scenarioKeys) {
|
|
1195
|
+
if (dataModel.some((el) => el[key] && !el[key].isEmpty())) {
|
|
1196
|
+
activeLayers.push(key);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
// Compute cumulative values
|
|
1200
|
+
for (let layerIdx = 0; layerIdx < activeLayers.length; layerIdx++) {
|
|
1201
|
+
const key = activeLayers[layerIdx];
|
|
1202
|
+
const values = [];
|
|
1203
|
+
for (let dataIdx = 0; dataIdx < dataModel.length; dataIdx++) {
|
|
1204
|
+
const dp = dataModel[dataIdx][key];
|
|
1205
|
+
const value = dp && !dp.isEmpty() && dp.value != null ? dp.value : 0;
|
|
1206
|
+
const prevCumulative = layerIdx > 0 ? cumulativeValues[layerIdx - 1][dataIdx] : 0;
|
|
1207
|
+
if (stackMode === StackMode.RELATIVE) {
|
|
1208
|
+
// For relative: need total at each x position
|
|
1209
|
+
const total = activeLayers.reduce((sum, k) => {
|
|
1210
|
+
const d = dataModel[dataIdx][k];
|
|
1211
|
+
return sum + (d && !d.isEmpty() && d.value != null ? Math.abs(d.value) : 0);
|
|
1212
|
+
}, 0);
|
|
1213
|
+
const proportion = total !== 0 ? Math.abs(value) / total : 0;
|
|
1214
|
+
values.push(prevCumulative + proportion);
|
|
1215
|
+
}
|
|
1216
|
+
else {
|
|
1217
|
+
values.push(prevCumulative + value);
|
|
1218
|
+
}
|
|
1219
|
+
}
|
|
1220
|
+
cumulativeValues.push(values);
|
|
1221
|
+
const firstDp = dataModel[0][key];
|
|
1222
|
+
layerScenarios.push((firstDp === null || firstDp === void 0 ? void 0 : firstDp.scenario) || "ac1");
|
|
1223
|
+
}
|
|
1224
|
+
// Convert cumulative values to pixel coordinates
|
|
1225
|
+
const axisY = this.position.getColumnPositionY();
|
|
1226
|
+
const pixelPerUnit = this.pixelPerUnit;
|
|
1227
|
+
const toAreaPoints = (values) => {
|
|
1228
|
+
return values.map((val, idx) => ({
|
|
1229
|
+
x: this.position.getColumnCenterPositionX(idx),
|
|
1230
|
+
y: axisY -
|
|
1231
|
+
(stackMode === StackMode.RELATIVE
|
|
1232
|
+
? val * pixelPerUnit // pixelPerUnit acts as "height for 100%"
|
|
1233
|
+
: val * pixelPerUnit),
|
|
1234
|
+
}));
|
|
1235
|
+
};
|
|
1236
|
+
// Baseline (y = axis)
|
|
1237
|
+
const baselinePoints = dataModel.map((_, idx) => ({
|
|
1238
|
+
x: this.position.getColumnCenterPositionX(idx),
|
|
1239
|
+
y: axisY,
|
|
1240
|
+
}));
|
|
1241
|
+
// Draw area fills bottom-to-top
|
|
1242
|
+
for (let layerIdx = 0; layerIdx < cumulativeValues.length; layerIdx++) {
|
|
1243
|
+
const upperPoints = toAreaPoints(cumulativeValues[layerIdx]);
|
|
1244
|
+
const lowerPoints = layerIdx === 0 ? baselinePoints : toAreaPoints(cumulativeValues[layerIdx - 1]);
|
|
1245
|
+
const scenarioType = isScenarioStack ? layerScenarios[layerIdx] : null;
|
|
1246
|
+
const areaFill = new AreaFill(areaGroup, upperPoints, lowerPoints, scenarioType, layerIdx, isScenarioStack);
|
|
1247
|
+
areaFill.draw();
|
|
1248
|
+
areaFill.drawBoundaryLine();
|
|
1249
|
+
}
|
|
1250
|
+
this.scenariosArea = {
|
|
1251
|
+
height: areaGroup.height() + this.styles.padding.top + this.styles.padding.bottom,
|
|
1252
|
+
width: areaGroup.width() + this.position.spacings.columnWidth,
|
|
1253
|
+
};
|
|
1254
|
+
}
|
|
1255
|
+
drawOverlayLayer(dataModel, svgContainer) {
|
|
1256
|
+
const overlayGroup = svgContainer.group().id("Overlay");
|
|
1257
|
+
const scenarioFactory = new ScenarioFactory(this.position, overlayGroup, this.styles, dataModel.length, this.i18n);
|
|
1258
|
+
if (this.showOverlayAvg === true) {
|
|
1259
|
+
let previousDataPoint = null;
|
|
1260
|
+
const avgDataModel = tranformToAvgDataModel(dataModel);
|
|
1261
|
+
avgDataModel.forEach((elements, index) => {
|
|
1262
|
+
if (previousDataPoint != null) {
|
|
1263
|
+
scenarioFactory
|
|
1264
|
+
.createLine(`Ø ${this.i18n.get(elements["scenario1"].scenario) || elements["scenario1"].scenario}`, elements["scenario1"], previousDataPoint, index - 1)
|
|
1265
|
+
.draw(this.dataFormatDigits, this.measureScale);
|
|
1266
|
+
}
|
|
1267
|
+
previousDataPoint = elements["scenario1"];
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
if (this.showOverlayMedian === true) {
|
|
1271
|
+
let previousDataPoint = null;
|
|
1272
|
+
const medianDataModel = tranformToMedianDataModel(dataModel);
|
|
1273
|
+
medianDataModel.forEach((elements, index) => {
|
|
1274
|
+
if (previousDataPoint != null) {
|
|
1275
|
+
scenarioFactory
|
|
1276
|
+
.createLine(`Mdn ${this.i18n.get(elements["scenario1"].scenario) || elements["scenario1"].scenario}`, elements["scenario1"], previousDataPoint, index - 1)
|
|
1277
|
+
.draw(this.dataFormatDigits, this.measureScale);
|
|
1278
|
+
}
|
|
1279
|
+
previousDataPoint = elements["scenario1"];
|
|
1280
|
+
});
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
leftOuterJoinDates(result, dateInterval) {
|
|
1284
|
+
const to = DateTime.max(...result.map(function (e) {
|
|
1285
|
+
return e.calcdate;
|
|
1286
|
+
}));
|
|
1287
|
+
const from = DateTime.min(...result.map(function (e) {
|
|
1288
|
+
return e.calcdate;
|
|
1289
|
+
}));
|
|
1290
|
+
const dateRange = new DateStringFactory().datesBetween(from, to, dateInterval, this.intervalSpanLimit);
|
|
1291
|
+
const dateRangeEntries = new Map();
|
|
1292
|
+
dateRange.forEach((element, idx) => {
|
|
1293
|
+
dateRangeEntries.set(element.toISO(), {
|
|
1294
|
+
id: idx,
|
|
1295
|
+
calcdate: element,
|
|
1296
|
+
category: null,
|
|
1297
|
+
ac1: null,
|
|
1298
|
+
ac2: null,
|
|
1299
|
+
ac3: null,
|
|
1300
|
+
ac4: null,
|
|
1301
|
+
pp1: null,
|
|
1302
|
+
pp2: null,
|
|
1303
|
+
pp3: null,
|
|
1304
|
+
pp4: null,
|
|
1305
|
+
fc1: null,
|
|
1306
|
+
fc2: null,
|
|
1307
|
+
fc3: null,
|
|
1308
|
+
fc4: null,
|
|
1309
|
+
pl1: null,
|
|
1310
|
+
pl2: null,
|
|
1311
|
+
pl3: null,
|
|
1312
|
+
pl4: null,
|
|
1313
|
+
isEmpty: true,
|
|
1314
|
+
});
|
|
1315
|
+
});
|
|
1316
|
+
result.forEach((element) => {
|
|
1317
|
+
const millisecondKey = element.calcdate.toISO();
|
|
1318
|
+
const placeholder = dateRangeEntries.get(millisecondKey);
|
|
1319
|
+
if (placeholder && placeholder.isEmpty) {
|
|
1320
|
+
const newElement = {
|
|
1321
|
+
id: placeholder.id,
|
|
1322
|
+
calcdate: element.calcdate,
|
|
1323
|
+
category: element.category,
|
|
1324
|
+
ac1: element.ac1,
|
|
1325
|
+
ac2: element.ac2,
|
|
1326
|
+
ac3: element.ac3,
|
|
1327
|
+
ac4: element.ac4,
|
|
1328
|
+
pp1: element.pp1,
|
|
1329
|
+
pp2: element.pp2,
|
|
1330
|
+
pp3: element.pp3,
|
|
1331
|
+
pp4: element.pp4,
|
|
1332
|
+
fc1: element.fc1,
|
|
1333
|
+
fc2: element.fc2,
|
|
1334
|
+
fc3: element.fc3,
|
|
1335
|
+
fc4: element.fc4,
|
|
1336
|
+
pl1: element.pl1,
|
|
1337
|
+
pl2: element.pl2,
|
|
1338
|
+
pl3: element.pl3,
|
|
1339
|
+
pl4: element.pl4,
|
|
1340
|
+
isEmpty: false,
|
|
1341
|
+
};
|
|
1342
|
+
dateRangeEntries.set(millisecondKey, newElement);
|
|
1343
|
+
}
|
|
1344
|
+
});
|
|
1345
|
+
return Array.from(dateRangeEntries.values());
|
|
1346
|
+
}
|
|
1347
|
+
}
|
|
1348
|
+
function tranformToAvgDataModel(dataModel) {
|
|
1349
|
+
const total = dataModel.reduce((sum, elements) => {
|
|
1350
|
+
var _a;
|
|
1351
|
+
return sum + (((_a = elements["scenario1"]) === null || _a === void 0 ? void 0 : _a.value) || 0); // Sum up the values of scenario1
|
|
1352
|
+
}, 0);
|
|
1353
|
+
const count = dataModel.filter((elements) => { var _a; return ((_a = elements["scenario1"]) === null || _a === void 0 ? void 0 : _a.value) !== undefined; }).length; // Count valid scenario1 values
|
|
1354
|
+
const average = count > 0 ? total / count : 0; // Calculate the average, avoid division by zero
|
|
1355
|
+
// Create a new first element
|
|
1356
|
+
const firstElement = Object.assign(Object.assign({}, dataModel[0]), { scenario1: new DataPoint(average, dataModel[0]["scenario1"].scenario, dataModel[0]["scenario1"].pixelPerUnit, dataModel[0]["scenario1"].variance) });
|
|
1357
|
+
// Create a new last element
|
|
1358
|
+
const lastElement = Object.assign(Object.assign({}, dataModel[dataModel.length - 1]), { scenario1: new DataPoint(average, dataModel[dataModel.length - 1]["scenario1"].scenario, dataModel[dataModel.length - 1]["scenario1"].pixelPerUnit, dataModel[dataModel.length - 1]["scenario1"].variance) });
|
|
1359
|
+
// Add the new first and last elements to the transformed data model
|
|
1360
|
+
return [
|
|
1361
|
+
firstElement,
|
|
1362
|
+
...dataModel.map((elements) => {
|
|
1363
|
+
return Object.assign(Object.assign({}, elements), { scenario1: new DataPoint(average, elements["scenario1"].scenario, elements["scenario1"].pixelPerUnit, elements["scenario1"].variance) });
|
|
1364
|
+
}),
|
|
1365
|
+
lastElement,
|
|
1366
|
+
];
|
|
1367
|
+
}
|
|
1368
|
+
function tranformToMedianDataModel(dataModel) {
|
|
1369
|
+
const values = dataModel
|
|
1370
|
+
.map((elements) => { var _a; return (_a = elements["scenario1"]) === null || _a === void 0 ? void 0 : _a.value; })
|
|
1371
|
+
.filter((value) => value !== undefined)
|
|
1372
|
+
.sort((a, b) => a - b);
|
|
1373
|
+
const median = values.length % 2 === 0
|
|
1374
|
+
? (values[values.length / 2 - 1] + values[values.length / 2]) / 2
|
|
1375
|
+
: values[Math.floor(values.length / 2)];
|
|
1376
|
+
// Create a new first element
|
|
1377
|
+
const firstElement = Object.assign(Object.assign({}, dataModel[0]), { scenario1: new DataPoint(median, dataModel[0]["scenario1"].scenario, dataModel[0]["scenario1"].pixelPerUnit, dataModel[0]["scenario1"].variance) });
|
|
1378
|
+
// Create a new last element
|
|
1379
|
+
const lastElement = Object.assign(Object.assign({}, dataModel[dataModel.length - 1]), { scenario1: new DataPoint(median, dataModel[dataModel.length - 1]["scenario1"].scenario, dataModel[dataModel.length - 1]["scenario1"].pixelPerUnit, dataModel[dataModel.length - 1]["scenario1"].variance) });
|
|
1380
|
+
// Add the new first and last elements to the transformed data model
|
|
1381
|
+
return [
|
|
1382
|
+
firstElement,
|
|
1383
|
+
...dataModel.map((elements) => {
|
|
1384
|
+
return Object.assign(Object.assign({}, elements), { scenario1: new DataPoint(median, elements["scenario1"].scenario, elements["scenario1"].pixelPerUnit, elements["scenario1"].variance) });
|
|
1385
|
+
}),
|
|
1386
|
+
lastElement,
|
|
1387
|
+
];
|
|
1388
|
+
}
|