@bino-bi/bn-template-engine 1.0.0-alpha.9 → 1.0.0-next.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -21
- package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
- package/dist/bn-template-engine/p-28d5c266.entry.js +1 -0
- package/dist/bn-template-engine/p-2d3ea756.entry.js +1 -0
- package/dist/bn-template-engine/p-2fba7c99.entry.js +1 -0
- package/dist/bn-template-engine/p-6077155f.entry.js +1 -0
- package/dist/bn-template-engine/p-687032d5.entry.js +1 -0
- package/dist/bn-template-engine/p-6c7f0076.entry.js +1 -0
- package/dist/bn-template-engine/p-6lOdN-fB.js +1 -0
- package/dist/bn-template-engine/p-7e9dbc93.entry.js +1 -0
- package/dist/bn-template-engine/p-99477a27.entry.js +1 -0
- package/dist/bn-template-engine/p-A8xyE4b1.js +1 -0
- package/dist/bn-template-engine/p-BA48JiHe.js +1 -0
- package/dist/bn-template-engine/p-BgIpdpfH.js +1 -0
- package/dist/bn-template-engine/p-BjBz5cSL.js +1 -0
- package/dist/bn-template-engine/p-BpWWgN6k.js +1 -0
- package/dist/bn-template-engine/p-C5uvAEKI.js +1 -0
- package/dist/bn-template-engine/p-C8Q0lsaU.js +1 -0
- package/dist/bn-template-engine/p-C9i1Xsib.js +1 -0
- package/dist/bn-template-engine/p-CJThzFZm.js +1 -0
- package/dist/bn-template-engine/p-CYE0I1Mx.js +1 -0
- package/dist/bn-template-engine/p-DsTzlzxQ.js +1 -0
- package/dist/bn-template-engine/p-DwYUTvvI.js +1 -0
- package/dist/bn-template-engine/p-a1380d7c.entry.js +1 -0
- package/dist/bn-template-engine/p-a4ea9a79.entry.js +1 -0
- package/dist/bn-template-engine/p-a8291de2.entry.js +1 -0
- package/dist/bn-template-engine/p-b5274369.entry.js +1 -0
- package/dist/bn-template-engine/p-b9e94127.entry.js +1 -0
- package/dist/bn-template-engine/p-ba912130.entry.js +1 -0
- package/dist/bn-template-engine/p-de29986f.entry.js +1 -0
- package/dist/bn-template-engine/p-eEfqksk-.js +1 -0
- package/dist/bn-template-engine/p-fFtEvsY-.js +1 -0
- package/dist/cjs/AxisConfig-D7CAyPLO.js +233 -0
- package/dist/cjs/LabelCollisionManager-DkdQ9Xdg.js +412 -0
- package/dist/cjs/NumericScale-BAyYXpKL.js +107 -0
- package/dist/cjs/Order-IPfAP0q8.js +87 -0
- package/dist/cjs/SVGStyle-BD8jApd4.js +8209 -0
- package/dist/cjs/SVGVariancesStyleGroup-BaWzR951.js +50 -0
- package/dist/cjs/VarianceMeasure-BBWTgv2e.js +372 -0
- package/dist/cjs/XYChartDataRow-BoR0CTfl.js +829 -0
- package/dist/cjs/bn-asset_21.cjs.entry.js +16105 -0
- package/dist/cjs/bn-chart-bubble.cjs.entry.js +762 -0
- package/dist/cjs/bn-chart-bullet.cjs.entry.js +785 -0
- package/dist/cjs/bn-chart-scatter.cjs.entry.js +658 -0
- package/dist/cjs/bn-grid.cjs.entry.js +5 -3
- package/dist/cjs/bn-image.cjs.entry.js +5 -3
- package/dist/cjs/bn-internationalization.cjs.entry.js +10 -8
- package/dist/cjs/bn-ruleset.cjs.entry.js +41 -0
- package/dist/cjs/bn-template-engine.cjs.js +1 -1
- package/dist/cjs/bn-template.cjs.entry.js +1 -1
- package/dist/cjs/bn-text.cjs.entry.js +8 -79
- package/dist/cjs/bn-tree.cjs.entry.js +4 -2
- package/dist/cjs/context-protocol-BBhT9B52.js +9505 -0
- package/dist/cjs/editor-companion.cjs.entry.js +13 -6
- package/dist/cjs/ibcs-chart-bubble.cjs.entry.js +624 -0
- package/dist/cjs/ibcs-chart-bullet.cjs.entry.js +673 -0
- package/dist/cjs/ibcs-chart-scatter.cjs.entry.js +667 -0
- package/dist/cjs/layoutObserver-DUYYkDMQ.js +199 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sanitizeHtml-LuZr1IMd.js +85 -0
- package/dist/cjs/scaling-BIJQ2NV1.js +589 -0
- package/dist/cjs/{withBodyObserver-D7BKWN2N.js → withBodyObserver-BKUE_ypL.js} +12 -7
- package/dist/cjs/withScalingGroup-D5clRvRe.js +73 -0
- package/dist/cjs/withStyled-Cm9dWQhu.js +1168 -0
- package/dist/collection/collection-manifest.json +9 -1
- package/dist/collection/components/bn-body/bn-body.css +1 -0
- package/dist/collection/components/bn-card/bn-card.css +2 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.css +10 -0
- package/dist/collection/components/bn-chart-bubble/bn-chart-bubble.js +1110 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.css +9 -0
- package/dist/collection/components/bn-chart-bubble/ibcs-chart-bubble.js +653 -0
- package/dist/collection/components/bn-chart-bubble/utils/BubbleChart.js +472 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.css +10 -0
- package/dist/collection/components/bn-chart-bullet/bn-chart-bullet.js +1014 -0
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.css +9 -0
- package/dist/collection/components/bn-chart-bullet/ibcs-chart-bullet.js +538 -0
- package/dist/collection/components/bn-chart-bullet/utils/BulletChart.js +440 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletChartStyle.js +132 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/BulletConfig.js +89 -0
- package/dist/collection/components/bn-chart-bullet/utils/model/index.js +2 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.css +10 -0
- package/dist/collection/components/bn-chart-scatter/bn-chart-scatter.js +965 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.css +9 -0
- package/dist/collection/components/bn-chart-scatter/ibcs-chart-scatter.js +580 -0
- package/dist/collection/components/bn-chart-scatter/utils/ScatterChart.js +409 -0
- package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +126 -43
- package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +104 -37
- package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +101 -60
- package/dist/collection/components/bn-chart-structure/utils/helper/ElementPositions.js +46 -4
- package/dist/collection/components/bn-chart-structure/utils/model/StructureChartComponentConfig.js +5 -4
- package/dist/collection/components/bn-chart-time/bn-chart-time.css +1 -1
- package/dist/collection/components/bn-chart-time/bn-chart-time.js +161 -44
- package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +97 -32
- package/dist/collection/components/bn-chart-time/utils/TimeChart.js +151 -75
- package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -3
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartComponentConfig.js +10 -4
- package/dist/collection/components/bn-chart-time/utils/model/TimeChartDataRow.js +2 -0
- package/dist/collection/components/bn-component-style/bn-component-style.js +1 -1
- package/dist/collection/components/bn-context/bn-context.js +20 -1
- package/dist/collection/components/bn-dataset/bn-dataset.js +226 -23
- package/dist/collection/components/bn-datasource/bn-datasource.js +163 -12
- package/dist/collection/components/bn-footer/bn-footer.js +1 -1
- package/dist/collection/components/bn-grid/bn-grid.js +20 -1
- package/dist/collection/components/bn-image/bn-image.js +1 -1
- package/dist/collection/components/bn-internationalization/bn-internationalization.js +10 -7
- package/dist/collection/components/bn-layout-card/bn-layout-card.css +8 -3
- package/dist/collection/components/bn-layout-card/bn-layout-card.js +98 -35
- package/dist/collection/components/bn-layout-page/bn-layout-page.css +5 -3
- package/dist/collection/components/bn-layout-page/bn-layout-page.js +98 -25
- package/dist/collection/components/bn-message/bn-message.css +6 -2
- package/dist/collection/components/bn-message/bn-message.js +3 -2
- package/dist/collection/components/bn-page/bn-page.js +1 -1
- package/dist/collection/components/bn-ruleset/bn-ruleset.css +3 -0
- package/dist/collection/components/bn-ruleset/bn-ruleset.js +68 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.css +3 -0
- package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +136 -0
- package/dist/collection/components/bn-table/bn-table.js +318 -62
- package/dist/collection/components/bn-table/ibcs-table.css +8 -0
- package/dist/collection/components/bn-table/ibcs-table.js +162 -33
- package/dist/collection/components/bn-table/utils/Table.js +72 -29
- package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +13 -8
- package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -2
- package/dist/collection/components/bn-table/utils/elements/WaterfallBar.js +47 -0
- package/dist/collection/components/bn-table/utils/elements/index.js +1 -0
- package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +120 -23
- package/dist/collection/components/bn-table/utils/helper/DataQuery.js +380 -50
- package/dist/collection/components/bn-table/utils/helper/IntervalColumns.js +140 -0
- package/dist/collection/components/bn-table/utils/helper/QueryGroup.js +4 -9
- package/dist/collection/components/bn-table/utils/helper/WaterfallCalculator.js +166 -0
- package/dist/collection/components/bn-table/utils/helper/index.js +2 -0
- package/dist/collection/components/bn-table/utils/model/TableAttribute.js +46 -0
- package/dist/collection/components/bn-table/utils/model/TableComponentConfig.js +20 -4
- package/dist/collection/components/bn-template/bn-template.js +1 -1
- package/dist/collection/components/bn-text/bn-text.js +2 -75
- package/dist/collection/components/bn-title/bn-title.js +31 -3
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.css +4 -0
- package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +52 -6
- package/dist/collection/components/bn-title/ibcs-title/utils/Title.js +7 -4
- package/dist/collection/components/bn-title/ibcs-title/utils/factories/TitleDataSetFactory.js +6 -2
- package/dist/collection/components/bn-title/ibcs-title/utils/model/TitleConfig.js +5 -0
- package/dist/collection/components/bn-tree/bn-tree.js +19 -0
- package/dist/collection/components/editor-companion/editor-companion.js +12 -5
- package/dist/collection/context/scopedDb.js +127 -0
- package/dist/collection/stores/componentStyles.js +67 -0
- package/dist/collection/stores/createScopedStores.js +11 -5
- package/dist/collection/stores/internationalization.js +77 -3
- package/dist/collection/stores/ruleSets.js +46 -0
- package/dist/collection/utils/DateStringFactory.js +31 -0
- package/dist/collection/utils/constants.js +5 -0
- package/dist/collection/utils/dataAnalyzer.js +14 -8
- package/dist/collection/utils/ibcsRuleSet.js +14 -26
- package/dist/collection/utils/layoutObserver.js +88 -0
- package/dist/collection/utils/parentDimensions.js +71 -15
- package/dist/collection/utils/sanitizeHtml.js +81 -0
- package/dist/collection/utils/validate.js +47 -0
- package/dist/collection/utils/withBodyObserver.js +12 -7
- package/dist/collection/utils/withComponentStyle.js +3 -5
- package/dist/collection/utils/withDataset.js +43 -39
- package/dist/collection/utils/withDatasource.js +28 -18
- package/dist/collection/utils/withInheritedProps.js +26 -1
- package/dist/collection/utils/withRuleSet.js +105 -0
- package/dist/collection/utils/withScalingGroup.js +69 -0
- package/dist/collection/utils/withTranslation.js +53 -15
- package/dist/collection/utils/xy/FacetGrid.js +36 -0
- package/dist/collection/utils/xy/IsoCurves.js +156 -0
- package/dist/collection/utils/xy/NumericScale.js +103 -0
- package/dist/collection/utils/xy/PointLabeler.js +96 -0
- package/dist/collection/utils/xy/RadiusScale.js +42 -0
- package/dist/collection/utils/xy/SeriesPalette.js +80 -0
- package/dist/collection/utils/xy/VarianceMeasure.js +76 -0
- package/dist/collection/utils/xy/XYFrame.js +120 -0
- package/dist/collection/utils/xy/XYLegend.js +107 -0
- package/dist/collection/utils/xy/model/AxisConfig.js +221 -0
- package/dist/collection/utils/xy/model/ScaleFactorsXYChart.js +69 -0
- package/dist/collection/utils/xy/model/XYChartDataRow.js +0 -0
- package/dist/collection/utils/xy/model/XYChartStyle.js +52 -0
- package/dist/components/AxisConfig.js +1 -0
- package/dist/components/CompareUtil.js +1 -0
- package/dist/components/DataFormatDigits.js +1 -1
- package/dist/components/DateStringFactory.js +1 -1
- package/dist/components/LabelCollisionManager.js +1 -0
- package/dist/components/NumericScale.js +1 -0
- package/dist/components/Order.js +1 -1
- package/dist/components/SVGVariancesStyleGroup.js +1 -1
- package/dist/components/SiPrefix.js +1 -0
- package/dist/components/StringAdapter.js +1 -0
- package/dist/components/VarianceMeasure.js +1 -0
- package/dist/components/XYChartDataRow.js +1 -0
- package/dist/components/bn-body2.js +1 -1
- package/dist/components/bn-card2.js +1 -1
- package/dist/components/bn-chart-bubble.d.ts +11 -0
- package/dist/components/bn-chart-bubble.js +1 -0
- package/dist/components/bn-chart-bullet.d.ts +11 -0
- package/dist/components/bn-chart-bullet.js +1 -0
- package/dist/components/bn-chart-scatter.d.ts +11 -0
- package/dist/components/bn-chart-scatter.js +1 -0
- package/dist/components/bn-chart-structure.js +1 -1
- package/dist/components/bn-chart-time.js +1 -1
- package/dist/components/bn-component-style.js +1 -1
- package/dist/components/bn-context.js +1 -1
- package/dist/components/bn-dataset.js +1 -1
- package/dist/components/bn-datasource.js +1 -1
- package/dist/components/bn-footer2.js +1 -1
- package/dist/components/bn-grid.js +1 -1
- package/dist/components/bn-image.js +1 -1
- package/dist/components/bn-internationalization.js +1 -1
- package/dist/components/bn-layout-card.js +1 -1
- package/dist/components/bn-layout-page.js +1 -1
- package/dist/components/bn-message2.js +1 -1
- package/dist/components/bn-page2.js +1 -1
- package/dist/components/bn-ruleset.d.ts +11 -0
- package/dist/components/bn-ruleset.js +1 -0
- package/dist/components/bn-scaling-group.d.ts +11 -0
- package/dist/components/bn-scaling-group.js +1 -0
- package/dist/components/bn-table.js +1 -1
- package/dist/components/bn-template.js +1 -1
- package/dist/components/bn-text.js +1 -1
- package/dist/components/bn-title2.js +1 -1
- package/dist/components/bn-tree.js +1 -1
- package/dist/components/context-protocol.js +1 -1
- package/dist/components/editor-companion.js +1 -1
- package/dist/components/formatter.js +1 -0
- package/dist/components/ibcs-chart-bubble.d.ts +11 -0
- package/dist/components/ibcs-chart-bubble.js +1 -0
- package/dist/components/ibcs-chart-bubble2.js +1 -0
- package/dist/components/ibcs-chart-bullet.d.ts +11 -0
- package/dist/components/ibcs-chart-bullet.js +1 -0
- package/dist/components/ibcs-chart-bullet2.js +1 -0
- package/dist/components/ibcs-chart-scatter.d.ts +11 -0
- package/dist/components/ibcs-chart-scatter.js +1 -0
- package/dist/components/ibcs-chart-scatter2.js +1 -0
- package/dist/components/ibcs-chart-structure2.js +1 -1
- package/dist/components/ibcs-chart-time2.js +1 -1
- package/dist/components/ibcs-table2.js +1 -1
- package/dist/components/ibcs-title2.js +1 -1
- package/dist/components/layoutObserver.js +1 -0
- package/dist/components/luxon.js +1 -0
- package/dist/components/main.js +1 -0
- package/dist/components/merge.js +1 -0
- package/dist/components/sanitizeHtml.js +1 -0
- package/dist/components/stackColors.js +1 -0
- package/dist/components/validate.js +1 -1
- package/dist/components/withBodyObserver.js +1 -1
- package/dist/components/withComponentStyle.js +1 -1
- package/dist/components/withDataset.js +1 -0
- package/dist/components/withRuleSet.js +1 -0
- package/dist/components/withScalingGroup.js +1 -0
- package/dist/components/withStyled.js +1 -1
- package/dist/components/withTranslation.js +1 -1
- package/dist/esm/AxisConfig-ByIP5J-9.js +224 -0
- package/dist/esm/LabelCollisionManager-DaNiDiM9.js +404 -0
- package/dist/esm/NumericScale-DsTzlzxQ.js +105 -0
- package/dist/esm/Order-BQeJE_yi.js +83 -0
- package/dist/esm/SVGStyle-BwBlY3Km.js +8199 -0
- package/dist/esm/SVGVariancesStyleGroup-BpGW4CvN.js +48 -0
- package/dist/esm/VarianceMeasure-CE3N8Bea.js +364 -0
- package/dist/esm/XYChartDataRow-DeMI1JKU.js +820 -0
- package/dist/esm/bn-asset_21.entry.js +16083 -0
- package/dist/esm/bn-chart-bubble.entry.js +760 -0
- package/dist/esm/bn-chart-bullet.entry.js +783 -0
- package/dist/esm/bn-chart-scatter.entry.js +656 -0
- package/dist/esm/bn-grid.entry.js +5 -3
- package/dist/esm/bn-image.entry.js +5 -3
- package/dist/esm/bn-internationalization.entry.js +10 -8
- package/dist/esm/bn-ruleset.entry.js +39 -0
- package/dist/esm/bn-template-engine.js +1 -1
- package/dist/esm/bn-template.entry.js +1 -1
- package/dist/esm/bn-text.entry.js +7 -78
- package/dist/esm/bn-tree.entry.js +4 -2
- package/dist/esm/context-protocol-d8MHrEo8.js +9490 -0
- package/dist/esm/editor-companion.entry.js +13 -6
- package/dist/esm/ibcs-chart-bubble.entry.js +622 -0
- package/dist/esm/ibcs-chart-bullet.entry.js +671 -0
- package/dist/esm/ibcs-chart-scatter.entry.js +665 -0
- package/dist/esm/layoutObserver-BJBEyhNf.js +196 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sanitizeHtml-BA48JiHe.js +83 -0
- package/dist/esm/scaling-BGnpSN1j.js +581 -0
- package/dist/esm/{withBodyObserver-AFk2wwHT.js → withBodyObserver-IokS6fHD.js} +12 -7
- package/dist/esm/withScalingGroup-CC3UcvC5.js +71 -0
- package/dist/esm/withStyled-2l5Tx3cf.js +1135 -0
- package/dist/types/components/bn-chart-bubble/bn-chart-bubble.d.ts +193 -0
- package/dist/types/components/bn-chart-bubble/ibcs-chart-bubble.d.ts +58 -0
- package/dist/types/components/bn-chart-bubble/utils/BubbleChart.d.ts +91 -0
- package/dist/types/components/bn-chart-bullet/bn-chart-bullet.d.ts +172 -0
- package/dist/types/components/bn-chart-bullet/ibcs-chart-bullet.d.ts +52 -0
- package/dist/types/components/bn-chart-bullet/utils/BulletChart.d.ts +91 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletChartStyle.d.ts +70 -0
- package/dist/types/components/bn-chart-bullet/utils/model/BulletConfig.d.ts +43 -0
- package/dist/types/components/bn-chart-bullet/utils/model/index.d.ts +2 -0
- package/dist/types/components/bn-chart-scatter/bn-chart-scatter.d.ts +172 -0
- package/dist/types/components/bn-chart-scatter/ibcs-chart-scatter.d.ts +53 -0
- package/dist/types/components/bn-chart-scatter/utils/ScatterChart.d.ts +66 -0
- package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +19 -5
- package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +13 -6
- package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +21 -12
- package/dist/types/components/bn-chart-structure/utils/helper/ElementPositions.d.ts +16 -1
- package/dist/types/components/bn-chart-structure/utils/model/StructureChartComponentConfig.d.ts +5 -3
- package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +53 -13
- package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +13 -6
- package/dist/types/components/bn-chart-time/utils/TimeChart.d.ts +21 -12
- package/dist/types/components/bn-chart-time/utils/model/TimeChartComponentConfig.d.ts +7 -3
- package/dist/types/components/bn-context/bn-context.d.ts +8 -0
- package/dist/types/components/bn-dataset/bn-dataset.d.ts +47 -5
- package/dist/types/components/bn-datasource/bn-datasource.d.ts +53 -6
- package/dist/types/components/bn-grid/bn-grid.d.ts +8 -0
- package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +39 -8
- package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +36 -1
- package/dist/types/components/bn-message/bn-message.d.ts +5 -2
- package/dist/types/components/bn-ruleset/bn-ruleset.d.ts +8 -0
- package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +37 -0
- package/dist/types/components/bn-table/bn-table.d.ts +74 -12
- package/dist/types/components/bn-table/ibcs-table.d.ts +27 -4
- package/dist/types/components/bn-table/utils/Table.d.ts +16 -6
- package/dist/types/components/bn-table/utils/elements/Cell.d.ts +2 -0
- package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +33 -0
- package/dist/types/components/bn-table/utils/elements/TableRow.d.ts +2 -1
- package/dist/types/components/bn-table/utils/elements/WaterfallBar.d.ts +21 -0
- package/dist/types/components/bn-table/utils/elements/index.d.ts +1 -0
- package/dist/types/components/bn-table/utils/factories/tableDataSetFactory.d.ts +17 -9
- package/dist/types/components/bn-table/utils/helper/DataQuery.d.ts +35 -3
- package/dist/types/components/bn-table/utils/helper/IntervalColumns.d.ts +37 -0
- package/dist/types/components/bn-table/utils/helper/QueryGroup.d.ts +4 -5
- package/dist/types/components/bn-table/utils/helper/WaterfallCalculator.d.ts +55 -0
- package/dist/types/components/bn-table/utils/helper/index.d.ts +2 -0
- package/dist/types/components/bn-table/utils/model/TableAttribute.d.ts +22 -0
- package/dist/types/components/bn-table/utils/model/TableComponentConfig.d.ts +12 -3
- package/dist/types/components/bn-table/utils/model/index.d.ts +21 -0
- package/dist/types/components/bn-title/bn-title.d.ts +12 -1
- package/dist/types/components/bn-title/ibcs-title/ibcs-title.d.ts +4 -0
- package/dist/types/components/bn-title/ibcs-title/utils/Title.d.ts +1 -0
- package/dist/types/components/bn-title/ibcs-title/utils/factories/TitleDataSetFactory.d.ts +3 -1
- package/dist/types/components/bn-title/ibcs-title/utils/model/TitleConfig.d.ts +2 -0
- package/dist/types/components/bn-tree/bn-tree.d.ts +8 -0
- package/dist/types/components/editor-companion/editor-companion.d.ts +2 -0
- package/dist/types/components.d.ts +1725 -116
- package/dist/types/context/context-protocol.d.ts +7 -3
- package/dist/types/context/scopedDb.d.ts +37 -0
- package/dist/types/stores/componentStyles.d.ts +41 -0
- package/dist/types/stores/createScopedStores.d.ts +4 -2
- package/dist/types/stores/ruleSets.d.ts +40 -0
- package/dist/types/utils/DateStringFactory.d.ts +20 -1
- package/dist/types/utils/constants.d.ts +5 -0
- package/dist/types/utils/dataAnalyzer.d.ts +2 -1
- package/dist/types/utils/ibcsRuleSet.d.ts +6 -1
- package/dist/types/utils/layoutObserver.d.ts +27 -0
- package/dist/types/utils/model/ChartStyles.d.ts +2 -1
- package/dist/types/utils/parentDimensions.d.ts +1 -1
- package/dist/types/utils/sanitizeHtml.d.ts +6 -0
- package/dist/types/utils/validate.d.ts +18 -0
- package/dist/types/utils/withDataset.d.ts +6 -2
- package/dist/types/utils/withDatasource.d.ts +3 -3
- package/dist/types/utils/withInheritedProps.d.ts +19 -0
- package/dist/types/utils/withRuleSet.d.ts +24 -0
- package/dist/types/utils/withScalingGroup.d.ts +14 -0
- package/dist/types/utils/withTranslation.d.ts +15 -5
- package/dist/types/utils/xy/FacetGrid.d.ts +27 -0
- package/dist/types/utils/xy/IsoCurves.d.ts +46 -0
- package/dist/types/utils/xy/NumericScale.d.ts +41 -0
- package/dist/types/utils/xy/PointLabeler.d.ts +58 -0
- package/dist/types/utils/xy/RadiusScale.d.ts +26 -0
- package/dist/types/utils/xy/SeriesPalette.d.ts +59 -0
- package/dist/types/utils/xy/VarianceMeasure.d.ts +37 -0
- package/dist/types/utils/xy/XYFrame.d.ts +44 -0
- package/dist/types/utils/xy/XYLegend.d.ts +43 -0
- package/dist/types/utils/xy/model/AxisConfig.d.ts +96 -0
- package/dist/types/utils/xy/model/ScaleFactorsXYChart.d.ts +36 -0
- package/dist/types/utils/xy/model/XYChartDataRow.d.ts +157 -0
- package/dist/types/utils/xy/model/XYChartStyle.d.ts +31 -0
- package/package.json +5 -4
- package/readme.md +9 -5
- package/dist/bn-template-engine/p-3141c4a2.entry.js +0 -1
- package/dist/bn-template-engine/p-67538176.entry.js +0 -1
- package/dist/bn-template-engine/p-916296a5.entry.js +0 -1
- package/dist/bn-template-engine/p-96006b06.entry.js +0 -1
- package/dist/bn-template-engine/p-Ck-NYtot.js +0 -1
- package/dist/bn-template-engine/p-CnDq0oVa.js +0 -1
- package/dist/bn-template-engine/p-DSXNgKLa.js +0 -1
- package/dist/bn-template-engine/p-bc711fb0.entry.js +0 -1
- package/dist/bn-template-engine/p-c86395b8.entry.js +0 -1
- package/dist/bn-template-engine/p-e6f646b1.entry.js +0 -1
- package/dist/bn-template-engine/p-f41d9242.entry.js +0 -1
- package/dist/bn-template-engine/p-gFbbuhtl.js +0 -1
- package/dist/cjs/bn-asset_20.cjs.entry.js +0 -23547
- package/dist/cjs/context-protocol-ohYzcb5F.js +0 -663
- package/dist/cjs/scaling-CIAClQR5.js +0 -314
- package/dist/cjs/withStyled-qd94SSb4.js +0 -9535
- package/dist/collection/stores/datasets.js +0 -14
- package/dist/collection/stores/datasources.js +0 -14
- package/dist/components/_commonjsHelpers.js +0 -1
- package/dist/components/alasql.min.js +0 -1
- package/dist/components/ibcsRuleSet.js +0 -1
- package/dist/components/scaling.js +0 -1
- package/dist/components/withInheritedProps.js +0 -1
- package/dist/esm/bn-asset_20.entry.js +0 -23526
- package/dist/esm/context-protocol-DdbSplvE.js +0 -656
- package/dist/esm/scaling-DGKKkuL9.js +0 -309
- package/dist/esm/withStyled-BIkqU2w4.js +0 -9501
- package/dist/types/stores/datasets.d.ts +0 -14
- package/dist/types/stores/datasources.d.ts +0 -14
|
@@ -0,0 +1,665 @@
|
|
|
1
|
+
import { r as registerInstance, h, H as Host, g as getElement } from './index-B_d-jp99.js';
|
|
2
|
+
import { r as resolveSeriesColor, m as markTreatment, g as getStores, b as buildFromExpr } from './context-protocol-d8MHrEo8.js';
|
|
3
|
+
import { C as CalculateSize, S as Svg, F as Formatter, I as IBCSRuleSet, a as FontStyleAdapter, b as SVGStyleGroupAdapter, c as SVGStyleAdapter, P as PaddingAdapter } from './SVGStyle-BwBlY3Km.js';
|
|
4
|
+
import { X as XYChartDataRowAdapter, r as resolveXYData, a as XYLegend, b as XYFrame, P as PointLabeler, F as FacetGrid, c as XYChartStylesAdapter, S as ScaleFactorsXYChartAdapter } from './XYChartDataRow-DeMI1JKU.js';
|
|
5
|
+
import { N as NumericScale } from './NumericScale-DsTzlzxQ.js';
|
|
6
|
+
import { r as resolveMeasure } from './VarianceMeasure-CE3N8Bea.js';
|
|
7
|
+
import './LabelCollisionManager-DaNiDiM9.js';
|
|
8
|
+
|
|
9
|
+
const SAMPLES = 64;
|
|
10
|
+
/**
|
|
11
|
+
* Hyperbolic iso-lines `x·y = k` for the scatter chart (IBCS 09C/09D):
|
|
12
|
+
* a third derived measure visualized as thin curves with value labels at
|
|
13
|
+
* the curve's exit edge, optionally shading the region `x·y >= k`.
|
|
14
|
+
*
|
|
15
|
+
* Requires a strictly positive plot domain on both axes.
|
|
16
|
+
*/
|
|
17
|
+
class IsoCurves {
|
|
18
|
+
constructor(xScale, yScale) {
|
|
19
|
+
this.xScale = xScale;
|
|
20
|
+
this.yScale = yScale;
|
|
21
|
+
}
|
|
22
|
+
/** Iso-curves are only defined on strictly positive domains. */
|
|
23
|
+
isPositiveDomain() {
|
|
24
|
+
return this.xScale.domainMin > 0 && this.yScale.domainMin > 0;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Picks 2–4 nice k values from the 1-2-5 ladder spanning the central
|
|
28
|
+
* product range of the data (products = `x·y` per point).
|
|
29
|
+
*/
|
|
30
|
+
static autoK(products) {
|
|
31
|
+
const positive = products.filter((p) => p > 0).sort((a, b) => a - b);
|
|
32
|
+
if (positive.length === 0) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
const quantile = (q) => positive[Math.min(positive.length - 1, Math.floor(q * positive.length))];
|
|
36
|
+
let candidates = IsoCurves.ladderValues(quantile(0.25), quantile(0.75));
|
|
37
|
+
if (candidates.length < 2) {
|
|
38
|
+
candidates = IsoCurves.ladderValues(positive[0], positive[positive.length - 1]);
|
|
39
|
+
}
|
|
40
|
+
if (candidates.length === 0) {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
if (candidates.length === 1) {
|
|
44
|
+
return candidates;
|
|
45
|
+
}
|
|
46
|
+
if (candidates.length <= 4) {
|
|
47
|
+
return candidates;
|
|
48
|
+
}
|
|
49
|
+
// Evenly spaced subset of 4 across the candidate list.
|
|
50
|
+
const picked = [];
|
|
51
|
+
for (let i = 0; i < 4; i++) {
|
|
52
|
+
picked.push(candidates[Math.round((i * (candidates.length - 1)) / 3)]);
|
|
53
|
+
}
|
|
54
|
+
return [...new Set(picked)];
|
|
55
|
+
}
|
|
56
|
+
/** All 1-2-5 ladder values within `[min, max]`, ascending. */
|
|
57
|
+
static ladderValues(min, max) {
|
|
58
|
+
if (min <= 0 || max < min) {
|
|
59
|
+
return [];
|
|
60
|
+
}
|
|
61
|
+
const values = [];
|
|
62
|
+
for (let exp = Math.floor(Math.log10(min)) - 1; exp <= Math.ceil(Math.log10(max)); exp++) {
|
|
63
|
+
for (const mantissa of [1, 2, 5]) {
|
|
64
|
+
const value = mantissa * Math.pow(10, exp);
|
|
65
|
+
if (value >= min && value <= max) {
|
|
66
|
+
values.push(value);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return values;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Domain x-interval where the curve `y = k/x` lies inside the domain
|
|
74
|
+
* rectangle, or `null` when the curve misses it entirely.
|
|
75
|
+
*/
|
|
76
|
+
visibleRange(k) {
|
|
77
|
+
if (!this.isPositiveDomain() || k <= 0) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const x1 = Math.max(this.xScale.domainMin, k / this.yScale.domainMax);
|
|
81
|
+
const x2 = Math.min(this.xScale.domainMax, k / this.yScale.domainMin);
|
|
82
|
+
if (x1 >= x2) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return [x1, x2];
|
|
86
|
+
}
|
|
87
|
+
/** Curve sample points in pixel coordinates (geometric x-spacing). */
|
|
88
|
+
samples(k) {
|
|
89
|
+
const range = this.visibleRange(k);
|
|
90
|
+
if (range === null) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const [x1, x2] = range;
|
|
94
|
+
const points = [];
|
|
95
|
+
for (let i = 0; i < SAMPLES; i++) {
|
|
96
|
+
const x = x1 * Math.pow(x2 / x1, i / (SAMPLES - 1));
|
|
97
|
+
points.push({ x: this.xScale.scale(x), y: this.yScale.scale(k / x) });
|
|
98
|
+
}
|
|
99
|
+
return points;
|
|
100
|
+
}
|
|
101
|
+
/** SVG path of the curve clipped to the frame, or `null` when invisible. */
|
|
102
|
+
path(k) {
|
|
103
|
+
const points = this.samples(k);
|
|
104
|
+
if (points === null) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`).join(" ");
|
|
108
|
+
}
|
|
109
|
+
/** Where the curve leaves the frame at its high-x end (label position). */
|
|
110
|
+
exitPoint(k) {
|
|
111
|
+
const range = this.visibleRange(k);
|
|
112
|
+
if (range === null) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
const x2 = range[1];
|
|
116
|
+
const exitsRight = x2 >= this.xScale.domainMax - Math.abs(this.xScale.domainMax) * 1e-9;
|
|
117
|
+
return {
|
|
118
|
+
x: this.xScale.scale(x2),
|
|
119
|
+
y: this.yScale.scale(k / x2),
|
|
120
|
+
edge: exitsRight ? "right" : "bottom",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Closed SVG path of the region `x·y >= k` inside the frame (the area
|
|
125
|
+
* between the curve and the top-right frame corner), or the full frame
|
|
126
|
+
* when the curve lies entirely below-left of it, or `null` when the
|
|
127
|
+
* region is empty.
|
|
128
|
+
*/
|
|
129
|
+
regionPath(k) {
|
|
130
|
+
if (!this.isPositiveDomain() || k <= 0) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
const xMin = this.xScale.domainMin;
|
|
134
|
+
const xMax = this.xScale.domainMax;
|
|
135
|
+
const yMin = this.yScale.domainMin;
|
|
136
|
+
const yMax = this.yScale.domainMax;
|
|
137
|
+
const left = this.xScale.scale(xMin);
|
|
138
|
+
const right = this.xScale.scale(xMax);
|
|
139
|
+
const top = this.yScale.scale(yMax);
|
|
140
|
+
const bottom = this.yScale.scale(yMin);
|
|
141
|
+
if (k >= xMax * yMax) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
if (k <= xMin * yMin) {
|
|
145
|
+
return `M ${left} ${top} L ${right} ${top} L ${right} ${bottom} L ${left} ${bottom} Z`;
|
|
146
|
+
}
|
|
147
|
+
const points = this.samples(k);
|
|
148
|
+
const [x1, x2] = this.visibleRange(k);
|
|
149
|
+
const entersTop = x1 > xMin;
|
|
150
|
+
const exitsRight = x2 >= xMax - Math.abs(xMax) * 1e-9;
|
|
151
|
+
const path = points.map((p, i) => `${i === 0 ? "M" : "L"} ${p.x} ${p.y}`);
|
|
152
|
+
// Walk the frame boundary from the exit point back to the entry point,
|
|
153
|
+
// enclosing the top-right corner.
|
|
154
|
+
if (!exitsRight) {
|
|
155
|
+
path.push(`L ${right} ${bottom}`);
|
|
156
|
+
}
|
|
157
|
+
path.push(`L ${right} ${top}`);
|
|
158
|
+
if (!entersTop) {
|
|
159
|
+
path.push(`L ${left} ${top}`);
|
|
160
|
+
}
|
|
161
|
+
path.push("Z");
|
|
162
|
+
return path.join(" ");
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* SVG orchestrator for `bn-chart-scatter` (IBCS template C09).
|
|
168
|
+
*
|
|
169
|
+
* Pipeline per render: adapt rows → resolve facets/series/points → resolve
|
|
170
|
+
* shared scales → per panel: bands → iso → refLines → frame → dots →
|
|
171
|
+
* labels → tick labels → panel title; then the legend and chart title.
|
|
172
|
+
* The SVG is built on a detached `Svg` root and emitted via `toString()`.
|
|
173
|
+
*/
|
|
174
|
+
class ScatterChart {
|
|
175
|
+
constructor(ruleSet, db, fromExpr, config, styles, availableWidth) {
|
|
176
|
+
var _a, _b;
|
|
177
|
+
this.ruleSet = ruleSet;
|
|
178
|
+
this.config = config;
|
|
179
|
+
this.styles = styles;
|
|
180
|
+
this.availableWidth = availableWidth;
|
|
181
|
+
this.warnings = [];
|
|
182
|
+
this.canvasHeight = 0;
|
|
183
|
+
this.i18nMap = new Map();
|
|
184
|
+
const adapter = new XYChartDataRowAdapter();
|
|
185
|
+
const rawRows = fromExpr !== "" ? db.exec(`SELECT * FROM ${fromExpr}`) : [];
|
|
186
|
+
const rows = (rawRows !== null && rawRows !== void 0 ? rawRows : []).map((row) => adapter.adapt(row));
|
|
187
|
+
this.data = resolveXYData(rows, {
|
|
188
|
+
pointLevel: config.pointLevel,
|
|
189
|
+
seriesLevel: config.seriesLevel,
|
|
190
|
+
facetLevel: config.facet !== null ? (config.facet.level === "rowgroup" ? "rowGroup" : "category") : null,
|
|
191
|
+
measures: {
|
|
192
|
+
x: (_a = resolveMeasure(config.x.measure)) !== null && _a !== void 0 ? _a : { kind: "scenario", slot: "ac1" },
|
|
193
|
+
y: (_b = resolveMeasure(config.y.measure)) !== null && _b !== void 0 ? _b : { kind: "scenario", slot: "ac2" },
|
|
194
|
+
},
|
|
195
|
+
domains: {
|
|
196
|
+
x: { min: config.x.min, max: config.x.max },
|
|
197
|
+
y: { min: config.y.min, max: config.y.max },
|
|
198
|
+
},
|
|
199
|
+
limit: config.limit,
|
|
200
|
+
limitBy: "order",
|
|
201
|
+
});
|
|
202
|
+
this.warnings.push(...this.data.warnings);
|
|
203
|
+
}
|
|
204
|
+
get em() {
|
|
205
|
+
return this.styles.fontStyles.size;
|
|
206
|
+
}
|
|
207
|
+
fontFamily() {
|
|
208
|
+
return this.styles.fontStyles.font.replace(/^[\d.]+px\s*/, "");
|
|
209
|
+
}
|
|
210
|
+
textWidth(text, bold = false) {
|
|
211
|
+
const width = CalculateSize(text, {
|
|
212
|
+
font: this.styles.fontStyles.font,
|
|
213
|
+
fontSize: this.styles.fontStyles.size + "px",
|
|
214
|
+
fontWeight: bold ? "bold" : "normal",
|
|
215
|
+
}).width;
|
|
216
|
+
// calculate-size needs a live DOM; fall back to an estimate in test environments.
|
|
217
|
+
return Number.isFinite(width) && width > 0 ? width : text.length * 0.6 * this.em;
|
|
218
|
+
}
|
|
219
|
+
drawText(group, text, x, y, options = {}) {
|
|
220
|
+
var _a, _b, _c;
|
|
221
|
+
group
|
|
222
|
+
.text(text)
|
|
223
|
+
.font({
|
|
224
|
+
size: (_a = options.size) !== null && _a !== void 0 ? _a : this.styles.fontStyles.size,
|
|
225
|
+
weight: options.bold ? "bold" : "normal",
|
|
226
|
+
anchor: (_b = options.anchor) !== null && _b !== void 0 ? _b : "start",
|
|
227
|
+
})
|
|
228
|
+
.fill((_c = options.color) !== null && _c !== void 0 ? _c : this.styles.fontStyles.color)
|
|
229
|
+
.attr({ x, y, "font-family": this.fontFamily() });
|
|
230
|
+
}
|
|
231
|
+
hasNoData() {
|
|
232
|
+
return this.data.totalPoints === 0;
|
|
233
|
+
}
|
|
234
|
+
/** Warnings collected during data resolution and drawing (§8 codes). */
|
|
235
|
+
getWarnings() {
|
|
236
|
+
return this.warnings;
|
|
237
|
+
}
|
|
238
|
+
getAllocatedCanvasWidth() {
|
|
239
|
+
return this.availableWidth;
|
|
240
|
+
}
|
|
241
|
+
getAllocatedCanvasHeight() {
|
|
242
|
+
return this.canvasHeight;
|
|
243
|
+
}
|
|
244
|
+
/** Axis title in the IBCS "Label in Unit" form. */
|
|
245
|
+
axisTitle(axis, inWord) {
|
|
246
|
+
var _a;
|
|
247
|
+
const label = (_a = axis.label) !== null && _a !== void 0 ? _a : "";
|
|
248
|
+
if (label === "") {
|
|
249
|
+
return "";
|
|
250
|
+
}
|
|
251
|
+
if (axis.unit === undefined || axis.unit === "") {
|
|
252
|
+
return label;
|
|
253
|
+
}
|
|
254
|
+
return `${label} ${inWord} ${axis.unit}`;
|
|
255
|
+
}
|
|
256
|
+
setI18n(i18n) {
|
|
257
|
+
this.i18nMap = i18n;
|
|
258
|
+
}
|
|
259
|
+
/** Ordered legend entries: one per series, colored by the primary treatment. */
|
|
260
|
+
legendModel() {
|
|
261
|
+
const entries = this.data.series.map((series) => {
|
|
262
|
+
var _a;
|
|
263
|
+
return ({
|
|
264
|
+
label: series.key === "" ? ((_a = this.ruleSet.getScenario("").name) !== null && _a !== void 0 ? _a : "Series") : series.key,
|
|
265
|
+
treatment: this.seriesTreatment(series.index),
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
return {
|
|
269
|
+
sizeCaption: [],
|
|
270
|
+
title: this.i18nMap.get("legend.title") || null,
|
|
271
|
+
compareEntries: [],
|
|
272
|
+
entries,
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/** ColorIndex of the primary scenario family (variance axes → 10, spec §4.4). */
|
|
276
|
+
primaryColorIndex() {
|
|
277
|
+
const ref = resolveMeasure(this.config.x.measure);
|
|
278
|
+
if (ref === null || ref.kind === "variance") {
|
|
279
|
+
return 10;
|
|
280
|
+
}
|
|
281
|
+
return this.ruleSet.getScenarioColorIndex(ref.slot);
|
|
282
|
+
}
|
|
283
|
+
seriesTreatment(seriesIndex) {
|
|
284
|
+
const { color, overflowed } = resolveSeriesColor(seriesIndex, this.styles.seriesColors);
|
|
285
|
+
if (overflowed) {
|
|
286
|
+
this.addWarningOnce("xy-series-overflow", {});
|
|
287
|
+
}
|
|
288
|
+
return markTreatment(this.primaryColorIndex(), color, "dot");
|
|
289
|
+
}
|
|
290
|
+
addWarningOnce(code, data) {
|
|
291
|
+
if (!this.warnings.some((w) => w.code === code)) {
|
|
292
|
+
this.warnings.push({ code, data });
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
toString() {
|
|
296
|
+
const container = new Svg();
|
|
297
|
+
this.draw(container);
|
|
298
|
+
container.id("drawCanvas");
|
|
299
|
+
container.width(this.getAllocatedCanvasWidth());
|
|
300
|
+
container.height(this.getAllocatedCanvasHeight());
|
|
301
|
+
container.attr("overflow", "visible");
|
|
302
|
+
return container.svg();
|
|
303
|
+
}
|
|
304
|
+
draw(container) {
|
|
305
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
306
|
+
this.warnings = this.data.warnings.slice();
|
|
307
|
+
const em = this.em;
|
|
308
|
+
const padding = this.styles.padding;
|
|
309
|
+
const inWord = this.i18nMap.get("axis.in") || "in";
|
|
310
|
+
const root = container.group();
|
|
311
|
+
const legend = new XYLegend(this.styles);
|
|
312
|
+
const legendModel = this.legendModel();
|
|
313
|
+
const showLegend = this.config.legend.show && legendModel.entries.length > 0;
|
|
314
|
+
const legendSize = showLegend ? legend.measure(legendModel, this.config.legend.position) : { width: 0, height: 0 };
|
|
315
|
+
// Reserved column right of the frame: legend and/or iso exit labels.
|
|
316
|
+
const isoActive = this.config.iso !== null;
|
|
317
|
+
const isoLabelReserve = isoActive
|
|
318
|
+
? Math.max(3 * em, this.textWidth((_a = this.config.iso.label) !== null && _a !== void 0 ? _a : "", true) + em, this.textWidth(this.config.iso.unit !== undefined && this.config.iso.unit !== ""
|
|
319
|
+
? `${inWord} ${this.config.iso.unit}`
|
|
320
|
+
: "") + em)
|
|
321
|
+
: 0;
|
|
322
|
+
const rightReserve = this.config.legend.position === "right"
|
|
323
|
+
? Math.max(showLegend ? legendSize.width + em : 0, isoLabelReserve)
|
|
324
|
+
: isoLabelReserve;
|
|
325
|
+
const titleH = this.config.chartTitle !== "" ? 1.6 * em : 0;
|
|
326
|
+
const yTitleText = this.axisTitle(this.config.y, inWord);
|
|
327
|
+
const xTitleText = this.axisTitle(this.config.x, inWord);
|
|
328
|
+
const yTitleH = yTitleText !== "" ? 1.4 * em : 0.4 * em;
|
|
329
|
+
const xAxisH = 1.4 * em + (xTitleText !== "" ? 1.3 * em : 0);
|
|
330
|
+
// First pass with an estimated left-axis reservation, refined below.
|
|
331
|
+
let axisLeftW = 3 * em;
|
|
332
|
+
let drawing = { x: 0, y: 0, width: 0, height: 0 };
|
|
333
|
+
let grid;
|
|
334
|
+
let ticksY = [];
|
|
335
|
+
const facetCount = Math.max(1, this.data.facets.length);
|
|
336
|
+
const columns = (_b = this.config.facet) === null || _b === void 0 ? void 0 : _b.columns;
|
|
337
|
+
const xDomain = NumericScale.domain((_d = (_c = this.data.extents) === null || _c === void 0 ? void 0 : _c.xMin) !== null && _d !== void 0 ? _d : 0, (_f = (_e = this.data.extents) === null || _e === void 0 ? void 0 : _e.xMax) !== null && _f !== void 0 ? _f : 1, {
|
|
338
|
+
min: this.config.x.min,
|
|
339
|
+
max: this.config.x.max,
|
|
340
|
+
});
|
|
341
|
+
const yDomain = NumericScale.domain((_h = (_g = this.data.extents) === null || _g === void 0 ? void 0 : _g.yMin) !== null && _h !== void 0 ? _h : 0, (_k = (_j = this.data.extents) === null || _j === void 0 ? void 0 : _j.yMax) !== null && _k !== void 0 ? _k : 1, {
|
|
342
|
+
min: this.config.y.min,
|
|
343
|
+
max: this.config.y.max,
|
|
344
|
+
});
|
|
345
|
+
for (let pass = 0; pass < 2; pass++) {
|
|
346
|
+
const drawingW = Math.max(10, this.availableWidth - padding.left - padding.right - axisLeftW - rightReserve);
|
|
347
|
+
const drawingH = drawingW / this.config.aspect;
|
|
348
|
+
drawing = {
|
|
349
|
+
x: padding.left + axisLeftW,
|
|
350
|
+
y: padding.top + titleH + yTitleH,
|
|
351
|
+
width: drawingW,
|
|
352
|
+
height: drawingH,
|
|
353
|
+
};
|
|
354
|
+
grid = new FacetGrid(facetCount, columns, drawing, this.styles.scaleFactors.panelGap * em);
|
|
355
|
+
const panelH = grid.panelRect(0).height;
|
|
356
|
+
const targetY = Math.max(4, Math.min(8, Math.round(panelH / (4 * em))));
|
|
357
|
+
const yScale = new NumericScale(yDomain[0], yDomain[1], panelH, 0);
|
|
358
|
+
ticksY = yScale.ticks(targetY);
|
|
359
|
+
const yDecimals = NumericScale.tickDecimals(ticksY);
|
|
360
|
+
const maxTickW = Math.max(...ticksY.map((tick) => this.textWidth(this.formatTick(tick, yDecimals))), em);
|
|
361
|
+
axisLeftW = maxTickW + this.styles.scaleFactors.axisTickLength * em + 0.4 * em;
|
|
362
|
+
}
|
|
363
|
+
this.canvasHeight =
|
|
364
|
+
drawing.y +
|
|
365
|
+
drawing.height +
|
|
366
|
+
xAxisH +
|
|
367
|
+
(this.config.legend.position === "bottom" && showLegend ? legendSize.height + em : 0) +
|
|
368
|
+
padding.bottom;
|
|
369
|
+
// Chart title.
|
|
370
|
+
if (this.config.chartTitle !== "") {
|
|
371
|
+
this.drawText(root, this.config.chartTitle, padding.left, padding.top + em, { bold: true });
|
|
372
|
+
}
|
|
373
|
+
// Y axis title, top-left above the plot (template style).
|
|
374
|
+
if (yTitleText !== "") {
|
|
375
|
+
this.drawAxisTitleText(root, this.config.y, inWord, padding.left, drawing.y - 0.6 * em, "start");
|
|
376
|
+
}
|
|
377
|
+
const panels = this.buildPanels(grid, xDomain, yDomain);
|
|
378
|
+
const ticksX = panels[0].xScale.ticks(Math.max(3, Math.min(8, Math.round(panels[0].rect.width / (7 * em)))));
|
|
379
|
+
const xDecimals = NumericScale.tickDecimals(ticksX);
|
|
380
|
+
const yDecimals = NumericScale.tickDecimals(ticksY);
|
|
381
|
+
// Iso guard: requires a strictly positive domain on both axes.
|
|
382
|
+
let isoDrawable = false;
|
|
383
|
+
if (isoActive) {
|
|
384
|
+
if (xDomain[0] > 0 && yDomain[0] > 0) {
|
|
385
|
+
isoDrawable = true;
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
this.addWarningOnce("xy-iso-domain", {});
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
if (this.data.facets.length === 0) {
|
|
392
|
+
this.drawPanel(root, panels[0], { key: "", points: [] }, ticksX, ticksY, xDecimals, yDecimals, true, true, isoDrawable);
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
this.data.facets.forEach((facet, index) => {
|
|
396
|
+
this.drawPanel(root, panels[index], facet, ticksX, ticksY, xDecimals, yDecimals, grid.isOuterLeft(index), grid.isOuterBottom(index), isoDrawable, this.data.facets.length > 1 ? facet.key : "");
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
// X axis title, right-aligned below the bottom-right panel.
|
|
400
|
+
if (xTitleText !== "") {
|
|
401
|
+
this.drawAxisTitleText(root, this.config.x, inWord, drawing.x + drawing.width, drawing.y + drawing.height + 2.6 * em, "end");
|
|
402
|
+
}
|
|
403
|
+
// Legend (chart-level, once).
|
|
404
|
+
if (showLegend) {
|
|
405
|
+
if (this.config.legend.position === "right") {
|
|
406
|
+
legend.draw(root, legendModel, drawing.x + drawing.width + em, drawing.y, "right");
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
legend.draw(root, legendModel, drawing.x, drawing.y + drawing.height + xAxisH, "bottom");
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
// Stable, empty hook for a future annotation layer (spec §12).
|
|
413
|
+
container.group().addClass("annotations");
|
|
414
|
+
}
|
|
415
|
+
/** Axis title with the label bold and the "in Unit" part regular. */
|
|
416
|
+
drawAxisTitleText(group, axis, inWord, x, y, anchor) {
|
|
417
|
+
var _a;
|
|
418
|
+
const label = (_a = axis.label) !== null && _a !== void 0 ? _a : "";
|
|
419
|
+
const suffix = axis.unit !== undefined && axis.unit !== "" ? `${inWord} ${axis.unit}` : "";
|
|
420
|
+
// SVG collapses leading whitespace in text nodes — position the suffix
|
|
421
|
+
// with an explicit gap instead.
|
|
422
|
+
const gap = 0.3 * this.em;
|
|
423
|
+
if (anchor === "start") {
|
|
424
|
+
this.drawText(group, label, x, y, { bold: true });
|
|
425
|
+
if (suffix !== "") {
|
|
426
|
+
this.drawText(group, suffix, x + this.textWidth(label, true) + gap, y, {});
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
else if (suffix !== "") {
|
|
430
|
+
this.drawText(group, suffix, x, y, { anchor: "end" });
|
|
431
|
+
this.drawText(group, label, x - this.textWidth(suffix) - gap, y, { anchor: "end", bold: true });
|
|
432
|
+
}
|
|
433
|
+
else {
|
|
434
|
+
this.drawText(group, label, x, y, { anchor: "end", bold: true });
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
buildPanels(grid, xDomain, yDomain) {
|
|
438
|
+
const panels = [];
|
|
439
|
+
for (let i = 0; i < grid.count; i++) {
|
|
440
|
+
const rect = grid.panelRect(i);
|
|
441
|
+
const xScale = new NumericScale(xDomain[0], xDomain[1], rect.x, rect.x + rect.width);
|
|
442
|
+
const yScale = new NumericScale(yDomain[0], yDomain[1], rect.y + rect.height, rect.y);
|
|
443
|
+
panels.push({ rect, xScale, yScale, frame: new XYFrame(xScale, yScale, rect, this.styles) });
|
|
444
|
+
}
|
|
445
|
+
return panels;
|
|
446
|
+
}
|
|
447
|
+
drawPanel(root, panel, facet, ticksX, ticksY, xDecimals, yDecimals, isOuterLeft, isOuterBottom, isoDrawable, panelTitle = "") {
|
|
448
|
+
var _a, _b;
|
|
449
|
+
const group = root.group();
|
|
450
|
+
const em = this.em;
|
|
451
|
+
panel.frame.drawBands(group, this.config.x.highlight, this.config.y.highlight);
|
|
452
|
+
// Gridlines: horizontal always; vertical only without refLines on wide panels.
|
|
453
|
+
const hasRefLines = this.config.x.refLine !== undefined || this.config.y.refLine !== undefined;
|
|
454
|
+
const wide = panel.rect.width > 30 * em;
|
|
455
|
+
panel.frame.drawGrid(group, ticksY, !hasRefLines && wide ? ticksX : undefined);
|
|
456
|
+
if (isoDrawable && this.config.iso !== null) {
|
|
457
|
+
this.drawIso(group, panel);
|
|
458
|
+
}
|
|
459
|
+
panel.frame.drawRefLines(group, this.config.x.refLine, this.config.y.refLine);
|
|
460
|
+
panel.frame.drawFrame(group);
|
|
461
|
+
// Marks: filled circles in data order, white separation stroke.
|
|
462
|
+
const radius = this.styles.scaleFactors.pointRadius * em;
|
|
463
|
+
const labeler = new PointLabeler(panel.rect, this.styles.scaleFactors.labelToMark * em);
|
|
464
|
+
const marks = [];
|
|
465
|
+
for (const point of facet.points) {
|
|
466
|
+
const seriesIndex = (_b = (_a = this.data.series.find((s) => s.key === point.seriesKey)) === null || _a === void 0 ? void 0 : _a.index) !== null && _b !== void 0 ? _b : 0;
|
|
467
|
+
const treatment = this.seriesTreatment(seriesIndex);
|
|
468
|
+
const cx = panel.xScale.scale(point.x);
|
|
469
|
+
const cy = panel.yScale.scale(point.y);
|
|
470
|
+
marks.push({ point, cx, cy, treatment });
|
|
471
|
+
const circle = group
|
|
472
|
+
.circle(radius * 2)
|
|
473
|
+
.center(cx, cy)
|
|
474
|
+
.fill(treatment.fill)
|
|
475
|
+
.stroke({ color: treatment.stroke, width: treatment.strokeWidth });
|
|
476
|
+
if (treatment.dasharray !== undefined) {
|
|
477
|
+
circle.attr("stroke-dasharray", treatment.dasharray);
|
|
478
|
+
}
|
|
479
|
+
labeler.registerMark(cx, cy, radius);
|
|
480
|
+
}
|
|
481
|
+
this.drawPointLabels(group, labeler, marks, radius);
|
|
482
|
+
panel.frame.drawTickLabels(group, {
|
|
483
|
+
ticksX,
|
|
484
|
+
ticksY,
|
|
485
|
+
xDecimals,
|
|
486
|
+
yDecimals,
|
|
487
|
+
showXLabels: isOuterBottom,
|
|
488
|
+
showYLabels: isOuterLeft,
|
|
489
|
+
});
|
|
490
|
+
if (panelTitle !== "") {
|
|
491
|
+
panel.frame.drawPanelTitle(group, panelTitle);
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
drawPointLabels(group, labeler, marks, radius) {
|
|
495
|
+
// Rank by extremity: distance from the pixel-space centroid.
|
|
496
|
+
const centroidX = marks.reduce((sum, m) => sum + m.cx, 0) / Math.max(1, marks.length);
|
|
497
|
+
const centroidY = marks.reduce((sum, m) => sum + m.cy, 0) / Math.max(1, marks.length);
|
|
498
|
+
const ranked = [...marks].sort((a, b) => Math.hypot(b.cx - centroidX, b.cy - centroidY) - Math.hypot(a.cx - centroidX, a.cy - centroidY));
|
|
499
|
+
const { selected, unknownNames } = labeler.selectCandidates(ranked, this.config.labels.points, this.config.labels.max, (mark) => mark.point.name);
|
|
500
|
+
if (unknownNames.length > 0) {
|
|
501
|
+
this.addWarningOnce("xy-label-unknown", { names: unknownNames.join(", ") });
|
|
502
|
+
}
|
|
503
|
+
const candidates = selected.map((mark) => ({
|
|
504
|
+
name: mark.point.name,
|
|
505
|
+
cx: mark.cx,
|
|
506
|
+
cy: mark.cy,
|
|
507
|
+
r: radius,
|
|
508
|
+
width: this.textWidth(mark.point.name),
|
|
509
|
+
height: 1.1 * this.em,
|
|
510
|
+
}));
|
|
511
|
+
for (const placed of labeler.place(candidates)) {
|
|
512
|
+
this.drawText(group, placed.candidate.name, placed.x, placed.y + 0.9 * placed.candidate.height, {});
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
drawIso(group, panel) {
|
|
516
|
+
const iso = this.config.iso;
|
|
517
|
+
const curves = new IsoCurves(panel.xScale, panel.yScale);
|
|
518
|
+
const inWord = this.i18nMap.get("axis.in") || "in";
|
|
519
|
+
const products = this.data.facets.flatMap((facet) => facet.points.map((p) => p.x * p.y));
|
|
520
|
+
const ks = iso.values === "auto" ? IsoCurves.autoK(products) : iso.values;
|
|
521
|
+
if (iso.highlight !== undefined) {
|
|
522
|
+
const region = curves.regionPath(iso.highlight.from);
|
|
523
|
+
if (region !== null) {
|
|
524
|
+
group.path(region).fill(this.styles.axisStyles.pl.fill).stroke("none");
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
const stroke = { color: this.styles.axisStyles.fc.stroke, width: this.styles.scaleFactors.gridLineWidth };
|
|
528
|
+
let topExit = null;
|
|
529
|
+
for (const k of ks) {
|
|
530
|
+
const path = curves.path(k);
|
|
531
|
+
if (path === null) {
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
group.path(path).fill("none").stroke(stroke);
|
|
535
|
+
const exit = curves.exitPoint(k);
|
|
536
|
+
if (exit === null) {
|
|
537
|
+
continue;
|
|
538
|
+
}
|
|
539
|
+
if (exit.edge === "right") {
|
|
540
|
+
this.drawText(group, this.formatTick(k, 0), exit.x + 0.4 * this.em, exit.y + 0.35 * this.em, {});
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
// Bottom exit: keep the label inside the frame, above-right of the curve end.
|
|
544
|
+
this.drawText(group, this.formatTick(k, 0), exit.x + 0.4 * this.em, exit.y - 0.5 * this.em, {});
|
|
545
|
+
}
|
|
546
|
+
if (topExit === null || exit.y < topExit.y) {
|
|
547
|
+
topExit = exit;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
// Edge caption ("Gross profit in mUSD"), once, above the topmost k label.
|
|
551
|
+
if (topExit !== null && iso.label !== undefined && iso.label !== "") {
|
|
552
|
+
const suffix = iso.unit !== undefined && iso.unit !== "" ? `${inWord} ${iso.unit}` : "";
|
|
553
|
+
this.drawText(group, iso.label, topExit.x + 0.4 * this.em, topExit.y - 1.6 * this.em, { bold: true });
|
|
554
|
+
if (suffix !== "") {
|
|
555
|
+
this.drawText(group, suffix, topExit.x + 0.4 * this.em, topExit.y - 0.5 * this.em, {});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
formatTick(value, decimals) {
|
|
560
|
+
return Formatter.number(value, "decimal", decimals, decimals);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const ibcsChartScatterCss = () => `:host{position:relative;display:inline-block}.warning{font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}`;
|
|
565
|
+
|
|
566
|
+
/** The §8 codes this chart can raise from data resolution / drawing. */
|
|
567
|
+
const SCATTER_DATA_WARNING_CODES = [
|
|
568
|
+
"xy-duplicate-point",
|
|
569
|
+
"xy-point-clipped",
|
|
570
|
+
"xy-variance-nodata",
|
|
571
|
+
"xy-iso-domain",
|
|
572
|
+
"xy-label-unknown",
|
|
573
|
+
"xy-series-overflow",
|
|
574
|
+
"xy-point-budget",
|
|
575
|
+
];
|
|
576
|
+
const IbcsChartScatter = class {
|
|
577
|
+
constructor(hostRef) {
|
|
578
|
+
registerInstance(this, hostRef);
|
|
579
|
+
/** Name of the dataset (table or view in the scoped alasql database). */
|
|
580
|
+
this.tableName = "";
|
|
581
|
+
/** Bumped by the facade when the dataset changes; triggers re-render. */
|
|
582
|
+
this.dataVersion = 0;
|
|
583
|
+
this.chartTitle = "";
|
|
584
|
+
this.iso = null;
|
|
585
|
+
this.facet = null;
|
|
586
|
+
this.pointLevel = "category";
|
|
587
|
+
this.seriesLevel = null;
|
|
588
|
+
/** Plot aspect ratio, width/height. */
|
|
589
|
+
this.aspect = 16 / 9;
|
|
590
|
+
this.limit = 0;
|
|
591
|
+
this.filter = "";
|
|
592
|
+
this.i18n = new Map();
|
|
593
|
+
this.containerWidth = 0;
|
|
594
|
+
this.svgMarkup = "";
|
|
595
|
+
}
|
|
596
|
+
getDb() {
|
|
597
|
+
if (!this.stores)
|
|
598
|
+
this.stores = getStores(this.element);
|
|
599
|
+
return this.stores.db.db;
|
|
600
|
+
}
|
|
601
|
+
componentWillLoad() {
|
|
602
|
+
this.rebuild();
|
|
603
|
+
}
|
|
604
|
+
componentWillUpdate() {
|
|
605
|
+
this.rebuild();
|
|
606
|
+
}
|
|
607
|
+
rebuild() {
|
|
608
|
+
const styles = this.prepareStyle();
|
|
609
|
+
const fromExpr = this.tableName ? buildFromExpr(this.tableName, this.filter) : "";
|
|
610
|
+
this.chart = new ScatterChart(new IBCSRuleSet(this.ruleSetConfig), this.getDb(), fromExpr, {
|
|
611
|
+
chartTitle: this.chartTitle,
|
|
612
|
+
x: this.x,
|
|
613
|
+
y: this.y,
|
|
614
|
+
iso: this.iso,
|
|
615
|
+
labels: this.labels,
|
|
616
|
+
legend: this.legend,
|
|
617
|
+
facet: this.facet,
|
|
618
|
+
pointLevel: this.pointLevel,
|
|
619
|
+
seriesLevel: this.seriesLevel,
|
|
620
|
+
aspect: this.aspect,
|
|
621
|
+
limit: this.limit,
|
|
622
|
+
}, styles, this.containerWidth || 0);
|
|
623
|
+
this.chart.setI18n(this.i18n);
|
|
624
|
+
this.svgMarkup = this.chart.hasNoData() ? "" : this.chart.toString();
|
|
625
|
+
this.syncWarnings(this.chart.getWarnings());
|
|
626
|
+
}
|
|
627
|
+
/**
|
|
628
|
+
* Syncs the orchestrator's data warnings to the facade's dispatcher.
|
|
629
|
+
* Walks the full fixed code list so cleared warnings are removed again
|
|
630
|
+
* (addOrReplace/remove discipline, stable ids).
|
|
631
|
+
*/
|
|
632
|
+
syncWarnings(warnings) {
|
|
633
|
+
if (this.errors === undefined) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
636
|
+
const present = new Map(warnings.map((warning) => [warning.code, warning.data]));
|
|
637
|
+
for (const code of SCATTER_DATA_WARNING_CODES) {
|
|
638
|
+
const id = `WARN_${code}`;
|
|
639
|
+
if (present.has(code)) {
|
|
640
|
+
const message = this.translate !== undefined ? this.translate(`.${code}`, present.get(code)) : code;
|
|
641
|
+
this.errors.addOrReplace({ id, type: "warning", message });
|
|
642
|
+
}
|
|
643
|
+
else {
|
|
644
|
+
this.errors.remove(id);
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
prepareStyle() {
|
|
649
|
+
return new XYChartStylesAdapter(new ScaleFactorsXYChartAdapter(), new FontStyleAdapter(), new SVGStyleGroupAdapter(new SVGStyleAdapter()), new PaddingAdapter()).adapt(this.styles);
|
|
650
|
+
}
|
|
651
|
+
render() {
|
|
652
|
+
if (this.chart === undefined) {
|
|
653
|
+
return h(Host, null);
|
|
654
|
+
}
|
|
655
|
+
if (this.chart.hasNoData()) {
|
|
656
|
+
const errorMsg = this.i18n.get("no-data") || "==No Data==";
|
|
657
|
+
return (h(Host, null, h("p", { class: "warning" }, errorMsg)));
|
|
658
|
+
}
|
|
659
|
+
return (h(Host, null, h("div", { innerHTML: this.svgMarkup })));
|
|
660
|
+
}
|
|
661
|
+
get element() { return getElement(this); }
|
|
662
|
+
};
|
|
663
|
+
IbcsChartScatter.style = ibcsChartScatterCss();
|
|
664
|
+
|
|
665
|
+
export { IbcsChartScatter as ibcs_chart_scatter };
|