@bino-bi/bn-template-engine 1.0.0-alpha.0 → 1.0.0-alpha.11

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.
Files changed (361) hide show
  1. package/LICENSE +203 -21
  2. package/dist/bn-template-engine/bn-template-engine.esm.js +1 -1
  3. package/dist/bn-template-engine/p-095f74d7.entry.js +1 -0
  4. package/dist/bn-template-engine/p-14318b0d.entry.js +1 -0
  5. package/dist/bn-template-engine/{p-c9f050bf.entry.js → p-2133e02b.entry.js} +1 -1
  6. package/dist/bn-template-engine/p-6b469808.entry.js +1 -0
  7. package/dist/bn-template-engine/p-7HSTE79g.js +1 -0
  8. package/dist/bn-template-engine/p-B4JfKvVT.js +1 -0
  9. package/dist/bn-template-engine/p-B_d-jp99.js +2 -0
  10. package/dist/bn-template-engine/p-Bi2wx-el.js +1 -0
  11. package/dist/bn-template-engine/p-CWiZks2h.js +1 -0
  12. package/dist/bn-template-engine/{p-BQp6ZPYW.js → p-DSXNgKLa.js} +1 -1
  13. package/dist/bn-template-engine/p-c2cbb8ea.entry.js +1 -0
  14. package/dist/bn-template-engine/p-e783733e.entry.js +1 -0
  15. package/dist/bn-template-engine/p-e94b4e31.entry.js +1 -0
  16. package/dist/bn-template-engine/p-fdb3e99a.entry.js +1 -0
  17. package/dist/cjs/bn-asset_21.cjs.entry.js +23995 -0
  18. package/dist/cjs/bn-grid.cjs.entry.js +6 -13
  19. package/dist/cjs/bn-image.cjs.entry.js +6 -13
  20. package/dist/cjs/bn-internationalization.cjs.entry.js +5 -7
  21. package/dist/cjs/bn-template-engine.cjs.js +2 -2
  22. package/dist/cjs/bn-template.cjs.entry.js +4 -6
  23. package/dist/cjs/bn-text.cjs.entry.js +10 -19
  24. package/dist/cjs/bn-tree.cjs.entry.js +11 -14
  25. package/dist/cjs/{context-protocol-BkYHFkXE.js → context-protocol-B_jipZpJ.js} +6 -2
  26. package/dist/cjs/editor-companion.cjs.entry.js +3 -3
  27. package/dist/cjs/{index-CScBFiS1.js → index-CDKG4xmO.js} +2 -2
  28. package/dist/cjs/loader.cjs.js +2 -2
  29. package/dist/cjs/scaling-eyzCrFB8.js +329 -0
  30. package/dist/cjs/{withBodyObserver-B0_W1VOf.js → withBodyObserver-D7BKWN2N.js} +2 -2
  31. package/dist/cjs/{withHasError-Dspb3lIV.js → withHasError-Cl2gTQzA.js} +106 -2
  32. package/dist/{esm/luxon-DbyXf6dF.js → cjs/withStyled-V7xz_x1c.js} +1406 -1
  33. package/dist/collection/collection-manifest.json +2 -10
  34. package/dist/collection/components/bn-body/bn-body.css +1 -0
  35. package/dist/collection/components/bn-card/bn-card.css +2 -0
  36. package/dist/collection/components/bn-chart-structure/bn-chart-structure.js +368 -130
  37. package/dist/collection/components/bn-chart-structure/ibcs-chart-structure.js +34 -10
  38. package/dist/collection/components/bn-chart-structure/utils/StructureChart.js +94 -11
  39. package/dist/collection/components/bn-chart-structure/utils/elements/Label.js +11 -0
  40. package/dist/collection/components/bn-chart-structure/utils/elements/StackedBar.js +8 -6
  41. package/dist/collection/components/bn-chart-structure/utils/model/styles/StructureChartStyle.js +4 -0
  42. package/dist/collection/components/bn-chart-time/bn-chart-time.css +1 -1
  43. package/dist/collection/components/bn-chart-time/bn-chart-time.js +172 -51
  44. package/dist/collection/components/bn-chart-time/ibcs-chart-time.js +22 -9
  45. package/dist/collection/components/bn-chart-time/utils/TimeChart.js +3 -3
  46. package/dist/collection/components/bn-chart-time/utils/elements/StackedColumn.js +3 -4
  47. package/dist/collection/components/bn-chart-time/utils/model/styles/TimeChartStyle.js +4 -0
  48. package/dist/collection/components/bn-dataset/bn-dataset.js +49 -2
  49. package/dist/collection/components/bn-datasource/bn-datasource.js +173 -8
  50. package/dist/collection/components/bn-layout-card/bn-layout-card.css +3 -2
  51. package/dist/collection/components/bn-layout-card/bn-layout-card.js +207 -32
  52. package/dist/collection/components/bn-layout-page/bn-layout-page.css +1 -3
  53. package/dist/collection/components/bn-layout-page/bn-layout-page.js +172 -43
  54. package/dist/collection/components/bn-message/bn-message.js +1 -1
  55. package/dist/collection/components/bn-page/bn-page.js +1 -1
  56. package/dist/collection/components/bn-scaling-group/bn-scaling-group.css +3 -0
  57. package/dist/collection/components/bn-scaling-group/bn-scaling-group.js +136 -0
  58. package/dist/collection/components/bn-table/bn-table.js +201 -58
  59. package/dist/collection/components/bn-table/ibcs-table.css +7 -5
  60. package/dist/collection/components/bn-table/ibcs-table.js +91 -5
  61. package/dist/collection/components/bn-table/utils/elements/CellBarChart.js +79 -31
  62. package/dist/collection/components/bn-table/utils/elements/TableRow.js +3 -1
  63. package/dist/collection/components/bn-table/utils/factories/tableDataSetFactory.js +12 -3
  64. package/dist/collection/components/bn-table/utils/helper/ColumnStatistics.js +9 -1
  65. package/dist/collection/components/bn-template/bn-template.js +1 -1
  66. package/dist/collection/components/bn-text/bn-text.js +1 -1
  67. package/dist/collection/components/bn-title/bn-title.js +1 -9
  68. package/dist/collection/components/bn-title/ibcs-title/ibcs-title.js +1 -4
  69. package/dist/collection/components/bn-tree/bn-tree.js +5 -1
  70. package/dist/collection/components/editor-companion/editor-companion.js +1 -1
  71. package/dist/collection/stores/componentStyles.js +2 -0
  72. package/dist/collection/stores/createScopedStores.js +3 -1
  73. package/dist/collection/utils/DateStringFactory.js +0 -1
  74. package/dist/collection/utils/constants.js +35 -5
  75. package/dist/collection/utils/contentDecoder.js +28 -0
  76. package/dist/collection/utils/layoutObserver.js +88 -0
  77. package/dist/collection/utils/parentDimensions.js +57 -10
  78. package/dist/collection/utils/stackColors.js +2 -2
  79. package/dist/collection/utils/validate.js +5 -2
  80. package/dist/collection/utils/withInheritedProps.js +152 -0
  81. package/dist/collection/utils/withScalingGroup.js +66 -0
  82. package/dist/components/DataFormatDigits.js +1 -1
  83. package/dist/components/DateStringFactory.js +1 -1
  84. package/dist/components/Order.js +1 -1
  85. package/dist/components/SVGVariancesStyleGroup.js +1 -1
  86. package/dist/components/bn-body2.js +1 -1
  87. package/dist/components/bn-card2.js +1 -1
  88. package/dist/components/bn-chart-structure.js +1 -1
  89. package/dist/components/bn-chart-time.js +1 -1
  90. package/dist/components/bn-dataset.js +1 -1
  91. package/dist/components/bn-datasource.js +1 -1
  92. package/dist/components/bn-layout-card.js +1 -1
  93. package/dist/components/bn-layout-page.js +1 -1
  94. package/dist/components/bn-message2.js +1 -1
  95. package/dist/components/bn-page2.js +1 -1
  96. package/dist/components/{test-runner-time.d.ts → bn-scaling-group.d.ts} +4 -4
  97. package/dist/components/bn-scaling-group.js +1 -0
  98. package/dist/components/bn-table.js +1 -1
  99. package/dist/components/bn-template.js +1 -1
  100. package/dist/components/bn-text.js +1 -1
  101. package/dist/components/bn-title2.js +1 -1
  102. package/dist/components/bn-tree.js +1 -1
  103. package/dist/components/contentDecoder.js +1 -0
  104. package/dist/components/context-protocol.js +1 -1
  105. package/dist/components/editor-companion.js +1 -1
  106. package/dist/components/emotion-hash.esm.js +1 -0
  107. package/dist/components/ibcs-chart-structure2.js +1 -1
  108. package/dist/components/ibcs-chart-time2.js +1 -1
  109. package/dist/components/ibcs-table2.js +1 -1
  110. package/dist/components/ibcs-title2.js +1 -1
  111. package/dist/components/ibcsRuleSet.js +1 -1
  112. package/dist/components/layoutObserver.js +1 -0
  113. package/dist/components/scaling.js +1 -1
  114. package/dist/components/validate.js +1 -1
  115. package/dist/components/withHasError.js +1 -1
  116. package/dist/components/withInheritedProps.js +1 -0
  117. package/dist/components/withStyled.js +1 -1
  118. package/dist/esm/bn-asset_21.entry.js +23973 -0
  119. package/dist/esm/bn-grid.entry.js +4 -11
  120. package/dist/esm/bn-image.entry.js +4 -11
  121. package/dist/esm/bn-internationalization.entry.js +4 -6
  122. package/dist/esm/bn-template-engine.js +3 -3
  123. package/dist/esm/bn-template.entry.js +3 -5
  124. package/dist/esm/bn-text.entry.js +6 -15
  125. package/dist/esm/bn-tree.entry.js +9 -12
  126. package/dist/esm/{context-protocol-DzeqZxg6.js → context-protocol-D-o_UZ33.js} +6 -2
  127. package/dist/esm/editor-companion.entry.js +3 -3
  128. package/dist/esm/{index-B27Ax6P_.js → index-B_d-jp99.js} +2 -2
  129. package/dist/esm/loader.js +3 -3
  130. package/dist/esm/scaling-BzbiBnuN.js +324 -0
  131. package/dist/esm/{withBodyObserver-gZpZiEIK.js → withBodyObserver-AFk2wwHT.js} +2 -2
  132. package/dist/esm/{withHasError-C48fTE2k.js → withHasError-DW_vMDUp.js} +106 -2
  133. package/dist/{cjs/luxon-8hyy5YD7.js → esm/withStyled-5RqF8WBL.js} +1371 -2
  134. package/dist/types/components/bn-chart-structure/bn-chart-structure.d.ts +163 -110
  135. package/dist/types/components/bn-chart-structure/ibcs-chart-structure.d.ts +4 -3
  136. package/dist/types/components/bn-chart-structure/utils/StructureChart.d.ts +7 -0
  137. package/dist/types/components/bn-chart-structure/utils/elements/Label.d.ts +2 -0
  138. package/dist/types/components/bn-chart-structure/utils/model/styles/StructureChartStyle.d.ts +1 -0
  139. package/dist/types/components/bn-chart-time/bn-chart-time.d.ts +29 -12
  140. package/dist/types/components/bn-chart-time/ibcs-chart-time.d.ts +4 -3
  141. package/dist/types/components/bn-chart-time/utils/model/styles/TimeChartStyle.d.ts +1 -0
  142. package/dist/types/components/bn-dataset/bn-dataset.d.ts +6 -0
  143. package/dist/types/components/bn-datasource/bn-datasource.d.ts +48 -5
  144. package/dist/types/components/bn-layout-card/bn-layout-card.d.ts +153 -0
  145. package/dist/types/components/bn-layout-page/bn-layout-page.d.ts +160 -1
  146. package/dist/types/components/bn-scaling-group/bn-scaling-group.d.ts +37 -0
  147. package/dist/types/components/bn-table/bn-table.d.ts +32 -17
  148. package/dist/types/components/bn-table/ibcs-table.d.ts +20 -0
  149. package/dist/types/components/bn-table/utils/elements/Cell.d.ts +1 -0
  150. package/dist/types/components/bn-table/utils/elements/CellBarChart.d.ts +1 -0
  151. package/dist/types/components/bn-title/bn-title.d.ts +0 -1
  152. package/dist/types/components.d.ts +438 -461
  153. package/dist/types/context/context-protocol.d.ts +2 -1
  154. package/dist/types/stores/componentStyles.d.ts +2 -0
  155. package/dist/types/stores/createScopedStores.d.ts +1 -0
  156. package/dist/types/utils/constants.d.ts +23 -5
  157. package/dist/types/utils/contentDecoder.d.ts +12 -0
  158. package/dist/types/utils/layoutObserver.d.ts +27 -0
  159. package/dist/types/utils/parentDimensions.d.ts +7 -2
  160. package/dist/types/utils/validate.d.ts +1 -0
  161. package/dist/types/utils/withInheritedProps.d.ts +38 -0
  162. package/dist/types/utils/withScalingGroup.d.ts +14 -0
  163. package/package.json +4 -4
  164. package/readme.md +2 -3
  165. package/dist/bn-template-engine/assets/gpx/Chasing_Legends.gpx +0 -195076
  166. package/dist/bn-template-engine/assets/gpx/Fahrt_am_Nachmittag.gpx +0 -142007
  167. package/dist/bn-template-engine/assets/icons/gpx-finish.png +0 -0
  168. package/dist/bn-template-engine/assets/icons/gpx-shadow.png +0 -0
  169. package/dist/bn-template-engine/assets/icons/gpx-start.png +0 -0
  170. package/dist/bn-template-engine/assets/icons/marker-example.png +0 -0
  171. package/dist/bn-template-engine/assets/icons/pin-icon-end.png +0 -0
  172. package/dist/bn-template-engine/assets/icons/pin-icon-start.png +0 -0
  173. package/dist/bn-template-engine/assets/icons/pin-icon-wpt.png +0 -0
  174. package/dist/bn-template-engine/assets/icons/pin-shadow.png +0 -0
  175. package/dist/bn-template-engine/assets/icons/pin.png +0 -0
  176. package/dist/bn-template-engine/p--TeDldm8.js +0 -1
  177. package/dist/bn-template-engine/p-0e7dc113.entry.js +0 -1
  178. package/dist/bn-template-engine/p-1jFf17Vj.js +0 -1
  179. package/dist/bn-template-engine/p-264c6bad.entry.js +0 -1
  180. package/dist/bn-template-engine/p-326a0902.entry.js +0 -1
  181. package/dist/bn-template-engine/p-38a8bde3.entry.js +0 -1
  182. package/dist/bn-template-engine/p-577eafcd.entry.js +0 -1
  183. package/dist/bn-template-engine/p-5905cc43.entry.js +0 -1
  184. package/dist/bn-template-engine/p-5d155a72.entry.js +0 -1
  185. package/dist/bn-template-engine/p-65f8962a.entry.js +0 -1
  186. package/dist/bn-template-engine/p-6b8d1ebf.entry.js +0 -1
  187. package/dist/bn-template-engine/p-7995acb2.entry.js +0 -1
  188. package/dist/bn-template-engine/p-7afe431e.entry.js +0 -1
  189. package/dist/bn-template-engine/p-8014b1ac.entry.js +0 -1
  190. package/dist/bn-template-engine/p-80423fc8.entry.js +0 -1
  191. package/dist/bn-template-engine/p-91e74d42.entry.js +0 -1
  192. package/dist/bn-template-engine/p-930a9e29.entry.js +0 -1
  193. package/dist/bn-template-engine/p-93C9jL8R.js +0 -1
  194. package/dist/bn-template-engine/p-93ff8584.entry.js +0 -1
  195. package/dist/bn-template-engine/p-B0m0U4wJ.js +0 -1
  196. package/dist/bn-template-engine/p-B27Ax6P_.js +0 -2
  197. package/dist/bn-template-engine/p-B79VcHiT.js +0 -1
  198. package/dist/bn-template-engine/p-BBd0ZVLL.js +0 -1
  199. package/dist/bn-template-engine/p-BFTU3MAI.js +0 -1
  200. package/dist/bn-template-engine/p-BFatTBqh.js +0 -1
  201. package/dist/bn-template-engine/p-BYmPQYxx.js +0 -1
  202. package/dist/bn-template-engine/p-BhEQy-2D.js +0 -1
  203. package/dist/bn-template-engine/p-BtVfu16B.js +0 -1
  204. package/dist/bn-template-engine/p-CY1RzLjU.js +0 -1
  205. package/dist/bn-template-engine/p-CfWnag33.js +0 -1
  206. package/dist/bn-template-engine/p-CnI71OA9.js +0 -1
  207. package/dist/bn-template-engine/p-Cp4MVxCu.js +0 -1
  208. package/dist/bn-template-engine/p-DbyXf6dF.js +0 -1
  209. package/dist/bn-template-engine/p-TdL-LRR9.js +0 -1
  210. package/dist/bn-template-engine/p-_LBTIfNN.js +0 -1
  211. package/dist/bn-template-engine/p-a342cd3c.entry.js +0 -1
  212. package/dist/bn-template-engine/p-ad94cf63.entry.js +0 -1
  213. package/dist/bn-template-engine/p-bc37d750.entry.js +0 -1
  214. package/dist/bn-template-engine/p-d07a0ca3.entry.js +0 -1
  215. package/dist/bn-template-engine/p-e5f372af.entry.js +0 -1
  216. package/dist/bn-template-engine/p-e620028c.entry.js +0 -1
  217. package/dist/bn-template-engine/p-e81e116a.entry.js +0 -1
  218. package/dist/bn-template-engine/p-eca98070.entry.js +0 -1
  219. package/dist/bn-template-engine/p-ee6de950.entry.js +0 -1
  220. package/dist/bn-template-engine/p-efe0ef1e.entry.js +0 -1
  221. package/dist/bn-template-engine/p-f034f1b8.entry.js +0 -1
  222. package/dist/bn-template-engine/p-f1c1a8a3.entry.js +0 -1
  223. package/dist/bn-template-engine/p-fe573a1a.entry.js +0 -1
  224. package/dist/bn-template-engine/p-kMyLevYy.js +0 -1
  225. package/dist/cjs/DataFormatDigits-DmTbhF8q.js +0 -142
  226. package/dist/cjs/DateStringFactory-Dn0aRj2Y.js +0 -453
  227. package/dist/cjs/Order-B4NIqQWe.js +0 -129
  228. package/dist/cjs/SVGVariancesStyleGroup-Czizhngt.js +0 -7973
  229. package/dist/cjs/StringAdapter-0EbYMkR0.js +0 -136
  230. package/dist/cjs/_commonjsHelpers-BJu3ubxk.js +0 -10
  231. package/dist/cjs/alasql.min-C_nHTuEQ.js +0 -306
  232. package/dist/cjs/bn-asset.cjs.entry.js +0 -42
  233. package/dist/cjs/bn-body_3.cjs.entry.js +0 -413
  234. package/dist/cjs/bn-card.cjs.entry.js +0 -37
  235. package/dist/cjs/bn-chart-structure.cjs.entry.js +0 -705
  236. package/dist/cjs/bn-chart-time.cjs.entry.js +0 -987
  237. package/dist/cjs/bn-component-style.cjs.entry.js +0 -44
  238. package/dist/cjs/bn-context_5.cjs.entry.js +0 -3380
  239. package/dist/cjs/bn-dataset.cjs.entry.js +0 -278
  240. package/dist/cjs/bn-layout-card.cjs.entry.js +0 -128
  241. package/dist/cjs/bn-layout-page.cjs.entry.js +0 -142
  242. package/dist/cjs/bn-map.cjs.entry.js +0 -425
  243. package/dist/cjs/bn-message.cjs.entry.js +0 -52
  244. package/dist/cjs/componentRegister-C17UFNPh.js +0 -72
  245. package/dist/cjs/constants-DHqQXSSd.js +0 -158
  246. package/dist/cjs/formatter-DIJL_crx.js +0 -215
  247. package/dist/cjs/ibcs-chart-structure.cjs.entry.js +0 -2906
  248. package/dist/cjs/ibcs-chart-time.cjs.entry.js +0 -4140
  249. package/dist/cjs/ibcs-map.cjs.entry.js +0 -1075
  250. package/dist/cjs/ibcs-title.cjs.entry.js +0 -352
  251. package/dist/cjs/scaling-B23eOtsC.js +0 -67
  252. package/dist/cjs/test-runner-card.cjs.entry.js +0 -27
  253. package/dist/cjs/test-runner-chart-time.cjs.entry.js +0 -230
  254. package/dist/cjs/test-runner-chart.cjs.entry.js +0 -326
  255. package/dist/cjs/test-runner-map.cjs.entry.js +0 -1862
  256. package/dist/cjs/test-runner-table.cjs.entry.js +0 -477
  257. package/dist/cjs/test-runner-time.cjs.entry.js +0 -381
  258. package/dist/cjs/test-runner-title.cjs.entry.js +0 -115
  259. package/dist/cjs/withComponentStatus-BrxL7usr.js +0 -39
  260. package/dist/cjs/withComponentStyle-C6KHnZHt.js +0 -128
  261. package/dist/cjs/withDataset-ZdN-RRTx.js +0 -146
  262. package/dist/cjs/withStyled-Bf-stJTR.js +0 -567
  263. package/dist/cjs/withTranslation-Cz0M5maV.js +0 -77
  264. package/dist/collection/components/bn-map/bn-map.css +0 -4
  265. package/dist/collection/components/bn-map/bn-map.js +0 -725
  266. package/dist/collection/components/bn-map/ibcs-map/assets/gpx/Chasing_Legends.gpx +0 -195076
  267. package/dist/collection/components/bn-map/ibcs-map/assets/gpx/Fahrt_am_Nachmittag.gpx +0 -142007
  268. package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-finish.png +0 -0
  269. package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-shadow.png +0 -0
  270. package/dist/collection/components/bn-map/ibcs-map/assets/icons/gpx-start.png +0 -0
  271. package/dist/collection/components/bn-map/ibcs-map/assets/icons/marker-example.png +0 -0
  272. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-end.png +0 -0
  273. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-start.png +0 -0
  274. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-icon-wpt.png +0 -0
  275. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin-shadow.png +0 -0
  276. package/dist/collection/components/bn-map/ibcs-map/assets/icons/pin.png +0 -0
  277. package/dist/collection/components/bn-map/ibcs-map/ibcs-map.css +0 -674
  278. package/dist/collection/components/bn-map/ibcs-map/ibcs-map.js +0 -744
  279. package/dist/collection/components/bn-map/ibcs-map/utils/model/GeoJsonLayer.js +0 -9
  280. package/dist/collection/components/bn-map/ibcs-map/utils/model/GpxLayer.js +0 -13
  281. package/dist/collection/components/bn-map/ibcs-map/utils/model/Marker.js +0 -11
  282. package/dist/collection/components/bn-map/ibcs-map/utils/model/index.js +0 -2
  283. package/dist/collection/test-runner/test-runner-card.js +0 -36
  284. package/dist/collection/test-runner/test-runner-chart-time.js +0 -234
  285. package/dist/collection/test-runner/test-runner-chart.js +0 -364
  286. package/dist/collection/test-runner/test-runner-map.js +0 -1901
  287. package/dist/collection/test-runner/test-runner-table.js +0 -469
  288. package/dist/collection/test-runner/test-runner-time.js +0 -399
  289. package/dist/collection/test-runner/test-runner-title.js +0 -108
  290. package/dist/components/bn-map.d.ts +0 -11
  291. package/dist/components/bn-map.js +0 -1
  292. package/dist/components/componentRegister.js +0 -1
  293. package/dist/components/ibcs-map.d.ts +0 -11
  294. package/dist/components/ibcs-map.js +0 -1
  295. package/dist/components/ibcs-map2.js +0 -1
  296. package/dist/components/test-runner-card.d.ts +0 -11
  297. package/dist/components/test-runner-card.js +0 -1
  298. package/dist/components/test-runner-chart-time.d.ts +0 -11
  299. package/dist/components/test-runner-chart-time.js +0 -1
  300. package/dist/components/test-runner-chart.d.ts +0 -11
  301. package/dist/components/test-runner-chart.js +0 -1
  302. package/dist/components/test-runner-map.d.ts +0 -11
  303. package/dist/components/test-runner-map.js +0 -1
  304. package/dist/components/test-runner-table.d.ts +0 -11
  305. package/dist/components/test-runner-table.js +0 -1
  306. package/dist/components/test-runner-time.js +0 -1
  307. package/dist/components/test-runner-title.d.ts +0 -11
  308. package/dist/components/test-runner-title.js +0 -1
  309. package/dist/components/withDataset.js +0 -1
  310. package/dist/esm/DataFormatDigits-Dt6gpIiZ.js +0 -137
  311. package/dist/esm/DateStringFactory-_Qiv0IvF.js +0 -451
  312. package/dist/esm/Order-B4fpLe_f.js +0 -125
  313. package/dist/esm/SVGVariancesStyleGroup-DlWgvpzs.js +0 -7961
  314. package/dist/esm/StringAdapter-BLvo1Krl.js +0 -133
  315. package/dist/esm/_commonjsHelpers-BFTU3MAI.js +0 -7
  316. package/dist/esm/alasql.min-CWu4NkIt.js +0 -304
  317. package/dist/esm/bn-asset.entry.js +0 -40
  318. package/dist/esm/bn-body_3.entry.js +0 -409
  319. package/dist/esm/bn-card.entry.js +0 -35
  320. package/dist/esm/bn-chart-structure.entry.js +0 -703
  321. package/dist/esm/bn-chart-time.entry.js +0 -985
  322. package/dist/esm/bn-component-style.entry.js +0 -42
  323. package/dist/esm/bn-context_5.entry.js +0 -3374
  324. package/dist/esm/bn-dataset.entry.js +0 -276
  325. package/dist/esm/bn-layout-card.entry.js +0 -126
  326. package/dist/esm/bn-layout-page.entry.js +0 -140
  327. package/dist/esm/bn-map.entry.js +0 -423
  328. package/dist/esm/bn-message.entry.js +0 -50
  329. package/dist/esm/componentRegister-BtVfu16B.js +0 -72
  330. package/dist/esm/constants-kMyLevYy.js +0 -158
  331. package/dist/esm/formatter-DTMEZ6d8.js +0 -211
  332. package/dist/esm/ibcs-chart-structure.entry.js +0 -2904
  333. package/dist/esm/ibcs-chart-time.entry.js +0 -4138
  334. package/dist/esm/ibcs-map.entry.js +0 -1073
  335. package/dist/esm/ibcs-title.entry.js +0 -350
  336. package/dist/esm/scaling-BBd0ZVLL.js +0 -64
  337. package/dist/esm/test-runner-card.entry.js +0 -25
  338. package/dist/esm/test-runner-chart-time.entry.js +0 -228
  339. package/dist/esm/test-runner-chart.entry.js +0 -324
  340. package/dist/esm/test-runner-map.entry.js +0 -1860
  341. package/dist/esm/test-runner-table.entry.js +0 -475
  342. package/dist/esm/test-runner-time.entry.js +0 -379
  343. package/dist/esm/test-runner-title.entry.js +0 -113
  344. package/dist/esm/withComponentStatus-elELReKt.js +0 -37
  345. package/dist/esm/withComponentStyle-NaxfakAG.js +0 -126
  346. package/dist/esm/withDataset-BT2VQCsG.js +0 -144
  347. package/dist/esm/withStyled-CpUTv74m.js +0 -539
  348. package/dist/esm/withTranslation-Do4GhleK.js +0 -75
  349. package/dist/types/components/bn-map/bn-map.d.ts +0 -122
  350. package/dist/types/components/bn-map/ibcs-map/ibcs-map.d.ts +0 -73
  351. package/dist/types/components/bn-map/ibcs-map/utils/model/GeoJsonLayer.d.ts +0 -8
  352. package/dist/types/components/bn-map/ibcs-map/utils/model/GpxLayer.d.ts +0 -11
  353. package/dist/types/components/bn-map/ibcs-map/utils/model/Marker.d.ts +0 -9
  354. package/dist/types/components/bn-map/ibcs-map/utils/model/index.d.ts +0 -2
  355. package/dist/types/test-runner/test-runner-card.d.ts +0 -3
  356. package/dist/types/test-runner/test-runner-chart-time.d.ts +0 -3
  357. package/dist/types/test-runner/test-runner-chart.d.ts +0 -3
  358. package/dist/types/test-runner/test-runner-map.d.ts +0 -3
  359. package/dist/types/test-runner/test-runner-table.d.ts +0 -3
  360. package/dist/types/test-runner/test-runner-time.d.ts +0 -3
  361. package/dist/types/test-runner/test-runner-title.d.ts +0 -3
@@ -1,2904 +0,0 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } from './index-B27Ax6P_.js';
2
- import { S as Svg, g as getContrastTextColor, a as getStackFill, b as getStackStroke, c as getScenarioPrefix, I as IBCS_LAYER_ORDER, F as FontStyleAdapter, d as SVGStyleGroupAdapter, e as SVGStyleAdapter, f as SVGVariancesStyleGroupAdapter, P as PaddingAdapter } from './SVGVariancesStyleGroup-DlWgvpzs.js';
3
- import { A as AggregationLevel, b as StackMode, f as StackBy } from './constants-kMyLevYy.js';
4
- import { D as DataAnalyzer, S as SiPrefix, b as DataFormatDigitsAdapter } from './DataFormatDigits-Dt6gpIiZ.js';
5
- import { A as AdapterUtils, C as CompareUtil, b as OrderAdapter, a as OrderColumn, O as OrderDirection } from './Order-B4fpLe_f.js';
6
- import { F as Formatter, C as CalculateSize, V as VarianceScenario } from './formatter-DTMEZ6d8.js';
7
- import { a as alasql } from './alasql.min-CWu4NkIt.js';
8
- import { S as StringAdapter, I as IBCSRuleSet } from './StringAdapter-BLvo1Krl.js';
9
- import './luxon-DbyXf6dF.js';
10
- import './_commonjsHelpers-BFTU3MAI.js';
11
-
12
- /**
13
- * Spatial layout engine for the structure chart (horizontal bars).
14
- *
15
- * Converts logical data model coordinates (bar index, data values) into pixel positions
16
- * for all chart elements. All spacings are derived from the font size multiplied by
17
- * ScaleFactorsStructureChart factors.
18
- *
19
- * Key coordinate reference points:
20
- * - getBarPositionX(): the X coordinate of the vertical axis baseline
21
- * - getBarCenterPositionY(index): center Y for the bar at the given category index
22
- * - getAxisPositionX(): axis X accounting for left-side labels and padding
23
- *
24
- * The layout accounts for: padding, left-side label space (title, category names,
25
- * negative-value labels), scenario offsets, and marker positioning above/below bars.
26
- */
27
- class ElementPositions {
28
- // private smallestDataPoint: DataPoint;
29
- constructor(padding, scaleFactors, fontSize, numberOfColumns, leftSideLengthSync, titleLength, leftSideWidth, categoryWidth) {
30
- this.categoryPosition = { x: 0, y: 0 };
31
- this.spacings = {
32
- scenarioOffset: 0,
33
- markerOffset: 0,
34
- scenarioLabelToBar: 0,
35
- labelToBar: 0,
36
- labelToAxis: 0,
37
- needleWidth: 0,
38
- needleHeadWidth: 0,
39
- barWidth: 0,
40
- varianceAxisLineWidth: 0,
41
- axisLineWidth: 0,
42
- auxiliaryLineWidth: 0,
43
- scenarioLineWidth: 0,
44
- markerWidth: 0,
45
- categoryWidth: 0,
46
- axisTickLength: 0,
47
- };
48
- this.categoriesBoxOffset = {
49
- width: 0,
50
- height: 0,
51
- };
52
- this.padding = padding;
53
- this.scaleFactors = scaleFactors;
54
- this.fontSize = fontSize;
55
- this.axisPosition = { x: 0, y: 0 };
56
- this.numberOfColumns = numberOfColumns;
57
- this.leftSideLengthSync = leftSideLengthSync;
58
- this.topSideLabelHeight = titleLength > 0 ? this.fontSize : 0;
59
- this.leftSideLabelLength = this.calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth);
60
- this.calculateSpacings();
61
- this.calculateCategoryPosition();
62
- this.calculateAxisPosition();
63
- }
64
- getBarPositionX() {
65
- return this.axisPosition.x;
66
- }
67
- getBarCenterPositionY(index) {
68
- return this.categoryPosition.y + this.spacings.scenarioOffset + index * this.spacings.categoryWidth;
69
- }
70
- getBarPositionY(index, isPrimaryMarker) {
71
- if (isPrimaryMarker) {
72
- return this.getBarCenterPositionY(index);
73
- }
74
- return this.getBarCenterPositionY(index) - this.spacings.scenarioOffset;
75
- }
76
- getCategoryPositionX(isPositive) {
77
- let offset = this.spacings.labelToAxis;
78
- if (isPositive) {
79
- offset = -this.spacings.labelToAxis;
80
- }
81
- return this.getAxisPositionX() + offset;
82
- }
83
- getAxisTitlePositionX() {
84
- return this.axisPosition.x;
85
- }
86
- getAxisTitlePositionY() {
87
- return this.axisPosition.y - this.spacings.labelToAxis;
88
- }
89
- getNeedleWidth() {
90
- return this.spacings.needleWidth;
91
- }
92
- getAxisPositionX() {
93
- return this.leftSideLabelLength + this.padding.left + this.spacings.labelToAxis;
94
- }
95
- getAxisPositionY() {
96
- return this.padding.top + this.getAxisTitleOffset();
97
- }
98
- loadCategoriesBox(categoriesBoxOffset) {
99
- this.categoriesBoxOffset = categoriesBoxOffset;
100
- this.calculateAxisPosition();
101
- }
102
- addOffsetByNegativeDataPoints(smallestDataPoint, boxWidth, isPercent, titleLength) {
103
- if (smallestDataPoint != null && smallestDataPoint.value != null) {
104
- if (smallestDataPoint.value < 0) {
105
- if (isPercent && smallestDataPoint.isClipped()) {
106
- this.axisPosition.x += Math.abs(smallestDataPoint.getClippedValue() * smallestDataPoint.pixelPerUnit);
107
- }
108
- else {
109
- this.axisPosition.x += Math.abs(smallestDataPoint.value * smallestDataPoint.pixelPerUnit);
110
- }
111
- this.axisPosition.x += boxWidth;
112
- this.axisPosition.x += this.spacings.labelToBar;
113
- }
114
- }
115
- if (this.axisPosition.x < titleLength / 2) {
116
- this.axisPosition.x = titleLength / 2 + this.spacings.labelToBar;
117
- }
118
- }
119
- getLabelPositionX(scaledUnit) {
120
- let offset = this.spacings.labelToBar;
121
- if (scaledUnit < 0) {
122
- offset *= -1;
123
- }
124
- return this.axisPosition.x + scaledUnit + offset;
125
- }
126
- getLabelPositionY(scaledUnit) {
127
- return this.axisPosition.y + scaledUnit + this.spacings.labelToBar;
128
- }
129
- getCategoryToAxisSpaceing() {
130
- return this.spacings.labelToAxis;
131
- }
132
- getCategoryToTopSpaceing() {
133
- return this.spacings.scenarioOffset;
134
- }
135
- getCategoryToBottomSpaceing() {
136
- return this.spacings.scenarioOffset; // this.categoryOffset;
137
- }
138
- getAxisEndPositionY() {
139
- return this.getAxisPositionY() + (this.numberOfColumns + 1 / 2) * this.spacings.categoryWidth;
140
- }
141
- getScenarioLabelPositionOffsetY(isPrimaryBar) {
142
- if (isPrimaryBar) {
143
- return this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar;
144
- }
145
- return -(this.getBarWidth() * 0.5 + this.spacings.scenarioLabelToBar);
146
- }
147
- getBarWidth() {
148
- return this.spacings.barWidth;
149
- }
150
- getMarkerPositionY(index, isPrimaryMarker) {
151
- if (isPrimaryMarker) {
152
- return this.getBarCenterPositionY(index) - this.spacings.markerOffset - this.getBarWidth() * 0.5;
153
- }
154
- return this.getBarCenterPositionY(index) + this.spacings.markerOffset + this.getBarWidth() * 0.5;
155
- }
156
- getMarkerPositionX() {
157
- return this.getBarPositionX();
158
- }
159
- getMarkerScenarioLabelPositionOffsetY(isPrimaryColumn) {
160
- if (isPrimaryColumn) {
161
- return -(this.spacings.markerWidth * 0.5 + this.spacings.scenarioLabelToBar);
162
- }
163
- return this.spacings.scenarioLabelToBar + this.spacings.markerWidth * 0.5;
164
- }
165
- getAxisEndPositionX() {
166
- return this.getAxisPositionX();
167
- }
168
- calculateSpacings() {
169
- this.spacings = {
170
- scenarioOffset: this.fontSize * this.scaleFactors.scenarioOffset,
171
- markerOffset: this.fontSize * this.scaleFactors.markerOffset,
172
- scenarioLabelToBar: this.fontSize * this.scaleFactors.scenarioLabelToBar,
173
- labelToBar: this.fontSize * this.scaleFactors.labelToBar,
174
- labelToAxis: this.fontSize * this.scaleFactors.labelToAxis,
175
- needleWidth: this.fontSize * this.scaleFactors.needleWidth,
176
- needleHeadWidth: this.fontSize * this.scaleFactors.needleHeadWidth,
177
- barWidth: this.fontSize * this.scaleFactors.barWidth,
178
- varianceAxisLineWidth: this.fontSize * this.scaleFactors.varianceAxisLineWidth,
179
- axisLineWidth: this.fontSize * this.scaleFactors.axisLineWidth,
180
- auxiliaryLineWidth: this.fontSize * this.scaleFactors.auxiliaryLineWidth,
181
- scenarioLineWidth: this.fontSize * this.scaleFactors.scenarioLineWidth,
182
- markerWidth: this.fontSize * this.scaleFactors.markerWidth,
183
- categoryWidth: this.fontSize * this.scaleFactors.categoryWidth,
184
- axisTickLength: this.fontSize * this.scaleFactors.axisTickLength,
185
- };
186
- }
187
- calculateCategoryPosition() {
188
- this.categoryPosition = {
189
- x: this.padding.left,
190
- y: this.getAxisPositionY() + this.spacings.categoryWidth * 0.5,
191
- };
192
- }
193
- calculateAxisPosition() {
194
- this.axisPosition = {
195
- x: this.getAxisPositionX(),
196
- y: this.getAxisPositionY(),
197
- };
198
- }
199
- // @ts-ignore
200
- recalculatePositions() {
201
- this.calculateCategoryPosition();
202
- this.calculateAxisPosition();
203
- }
204
- getAxisTitleOffset() {
205
- return this.topSideLabelHeight;
206
- }
207
- calculateSideLabelLength(titleLength, leftSideWidth, categoryWidth) {
208
- if (this.leftSideLengthSync) {
209
- return this.leftSideLengthSync;
210
- }
211
- const leftSideTitleLength = titleLength / 2;
212
- let sideLabelLength = leftSideWidth;
213
- if (leftSideTitleLength > sideLabelLength) {
214
- sideLabelLength = leftSideTitleLength;
215
- }
216
- if (categoryWidth > sideLabelLength) {
217
- sideLabelLength = categoryWidth;
218
- }
219
- return sideLabelLength;
220
- }
221
- }
222
-
223
- class Padding {
224
- constructor(padding) {
225
- this.top = padding.top;
226
- this.bottom = padding.bottom;
227
- this.left = padding.left;
228
- this.right = padding.right;
229
- }
230
- addBoxTopLeft(addition) {
231
- this.top += addition.height | this.top;
232
- this.left += addition.width | this.top;
233
- return this;
234
- }
235
- }
236
-
237
- // import { SVGPolgonPattern } from "../../../../utils/model";
238
- class MarkerPattern {
239
- constructor(fontSize) {
240
- const backgroundFactor = 1;
241
- const foregroundFactor = 0.7;
242
- const maxBg = fontSize * backgroundFactor;
243
- const maxFg = fontSize * foregroundFactor;
244
- this.bgOffset = (maxBg - maxFg) / 2;
245
- this.markerUp = { top: maxFg / 2 + ",0", left: "0," + maxFg, right: maxFg + "," + maxFg };
246
- this.markerUpBackground = { top: maxBg / 2 + ",0", left: "0," + maxBg, right: maxBg + "," + maxBg };
247
- this.markerDown = { bottom: maxFg / 2 + "," + maxFg, left: "0,0", right: maxFg + ",0" };
248
- this.markerDownBackground = { bottom: maxBg / 2 + "," + maxBg, left: "0,0", right: maxBg + ",0" };
249
- }
250
- upMarkerPatternStrings() {
251
- return {
252
- background: this.markerUpBackground.left +
253
- " " +
254
- this.markerUpBackground.right +
255
- " " +
256
- this.markerUpBackground.top +
257
- " " +
258
- this.markerUpBackground.left,
259
- foreground: this.markerUp.left + " " + this.markerUp.right + " " + this.markerUp.top + " " + this.markerUp.left,
260
- bgOffset: this.bgOffset,
261
- };
262
- }
263
- downMarkerPatternStrings() {
264
- return {
265
- background: this.markerDownBackground.left +
266
- " " +
267
- this.markerDownBackground.right +
268
- " " +
269
- this.markerDownBackground.bottom +
270
- " " +
271
- this.markerDownBackground.left,
272
- foreground: this.markerDown.left + " " + this.markerDown.right + " " + this.markerDown.bottom + " " + this.markerDown.left,
273
- bgOffset: this.bgOffset,
274
- };
275
- }
276
- createPatternMapForStructureBar() {
277
- const pattern = new Map();
278
- pattern.set("marker-up", this.upMarkerPatternStrings());
279
- pattern.set("marker-down", this.downMarkerPatternStrings());
280
- return pattern;
281
- }
282
- }
283
-
284
- // import { SVGPolgonPattern } from "../../../../utils/model";
285
- /**
286
- * Generates SVG diagonal-line hatching patterns for forecast (FC) scenario bars
287
- * in the structure chart.
288
- *
289
- * Creates a 10x10 SVG <pattern> tile with diagonal lines using the FC bar style colors.
290
- * Used as fill for FC horizontal bars to distinguish forecast from actual data per IBCS.
291
- */
292
- class CustomPattern {
293
- constructor(styles) {
294
- this.container = new Svg();
295
- this.pattern = this.createFCPattern(this.container.group(), styles);
296
- this.styles = styles;
297
- const backgroundFactor = 1;
298
- const foregroundFactor = 0.7;
299
- let fontSize = 10;
300
- if (styles != null && styles.fontStyles != null && styles.fontStyles.size) {
301
- fontSize = styles.fontStyles.size;
302
- }
303
- const maxBg = fontSize * backgroundFactor;
304
- const maxFg = fontSize * foregroundFactor;
305
- this.bgOffset = (maxBg - maxFg) / 2;
306
- }
307
- createFCPattern(group, styles) {
308
- const _styles = styles;
309
- return group
310
- .pattern(10, 10, function (add) {
311
- add.rect(10, 10).fill(_styles.barStyles.fc.fill);
312
- add
313
- .line(0, 5, 5, 0)
314
- .stroke({ width: _styles.barStyles.fc.width, color: _styles.barStyles.fc.stroke, linecap: "square" });
315
- add
316
- .line(5, 10, 10, 5)
317
- .stroke({ width: _styles.barStyles.fc.width, color: _styles.barStyles.fc.stroke, linecap: "square" });
318
- })
319
- .id("pattern-structure-fc");
320
- }
321
- getFCPolygonPattern() {
322
- return { background: "", foreground: "", bgOffset: 0, pattern: this.pattern };
323
- }
324
- toString() {
325
- return this.container.svg();
326
- }
327
- }
328
-
329
- var FactoryState;
330
- (function (FactoryState) {
331
- FactoryState[FactoryState["UP_TO_DATE"] = 0] = "UP_TO_DATE";
332
- FactoryState[FactoryState["DIRTY"] = 1] = "DIRTY";
333
- })(FactoryState || (FactoryState = {}));
334
- var VarianceType;
335
- (function (VarianceType) {
336
- VarianceType["RELATIVE"] = "dr";
337
- VarianceType["ABSOLUTE"] = "d";
338
- VarianceType["NONE"] = "";
339
- })(VarianceType || (VarianceType = {}));
340
-
341
- /**
342
- * Configuration for an IBCS structural (categorical) bar chart component.
343
- *
344
- * Controls the vertical scale, category visibility, and chart rendering parameters
345
- * for charts where the x-axis represents categories rather than time periods.
346
- */
347
- class StructureChartComponentConfig {
348
- constructor(data, scenarios) {
349
- this.data = data;
350
- this.scenarios = scenarios;
351
- /** Variance column identifiers (e.g. `["d_ac1_pl1_pos"]`) for delta visualizations. */
352
- this.variances = [];
353
- this.title = "";
354
- /** When true, category labels on the y-axis are hidden. */
355
- this.hideCategories = false;
356
- /** Vertical scale factor: pixels per one data unit. Controls bar height. */
357
- this.pixelPerUnit = 10;
358
- /** Vertical scale factor for percentage variances: pixels per 1.0 (=100%). */
359
- this.pixelPerPercentage = 50;
360
- /** Maximum data points to display; 0 means unlimited. */
361
- this.limit = 0;
362
- this.sortOrder = new OrderAdapter(new StringAdapter()).default();
363
- this.level = AggregationLevel.CATEGORY;
364
- this.filter = "";
365
- /** SI prefix for measure scaling (e.g. "k" for thousands, "M" for millions). */
366
- this.measureScale = new SiPrefix();
367
- /** Unit label displayed alongside the chart (e.g. "EUR", "USD"). */
368
- this.measureUnit = "";
369
- this.showMeasureScale = true;
370
- this.dataFormatDigits = { decimal: 1, percent: 2 };
371
- this.stackConfig = null;
372
- }
373
- }
374
- /**
375
- * Converts untyped JSON into a validated {@link StructureChartComponentConfig}.
376
- *
377
- * Requires the raw dataset for measure scale auto-calculation.
378
- */
379
- class StructureChartComponentConfigAdapter {
380
- constructor(dataRowAdapter, orderAdapter, stringAdapter, dataFormatDigitsAdapter, dataSet) {
381
- this.dataRowAdapter = dataRowAdapter;
382
- this.orderAdapter = orderAdapter;
383
- this.stringAdapter = stringAdapter;
384
- this.dataFormatDigitsAdapter = dataFormatDigitsAdapter;
385
- this.dataSet = dataSet;
386
- }
387
- adapt(data) {
388
- const dataSet = AdapterUtils.adaptArray(data.data, this.dataRowAdapter);
389
- const scenarios = AdapterUtils.adaptArray(data.scenarios, this.stringAdapter);
390
- const config = new StructureChartComponentConfig(dataSet, scenarios);
391
- if (CompareUtil.isArray(data.variances)) {
392
- config.variances = AdapterUtils.adaptArray(data.variances, this.stringAdapter);
393
- }
394
- if (CompareUtil.isString(data.title)) {
395
- config.title = data.title;
396
- }
397
- if (CompareUtil.isBoolean(data.hideCategories)) {
398
- config.hideCategories = data.hideCategories;
399
- }
400
- if (CompareUtil.isNumber(data.pixelPerUnit)) {
401
- config.pixelPerUnit = data.pixelPerUnit;
402
- }
403
- if (CompareUtil.isNumber(data.pixelPerPercentage)) {
404
- config.pixelPerPercentage = data.pixelPerPercentage;
405
- }
406
- if (CompareUtil.isNumber(data.limit)) {
407
- config.limit = data.limit;
408
- }
409
- if (CompareUtil.isExisting(data.sortOrder)) {
410
- config.sortOrder = this.orderAdapter.adapt(data.sortOrder);
411
- }
412
- if (CompareUtil.isExisting(data.level)) {
413
- config.level = data.level;
414
- }
415
- if (CompareUtil.isString(data.filter)) {
416
- config.filter = data.filter.trim();
417
- }
418
- if (CompareUtil.isExisting(data.measureScale)) {
419
- config.measureScale = DataAnalyzer.calculateMeasureScale(this.dataSet, config.scenarios, data.measureScale);
420
- }
421
- if (CompareUtil.isString(data.measureUnit)) {
422
- config.measureUnit = data.measureUnit;
423
- }
424
- if (CompareUtil.isBoolean(data.showMeasureScale)) {
425
- config.showMeasureScale = data.showMeasureScale;
426
- }
427
- if (CompareUtil.isExisting(data.dataFormatDigits)) {
428
- config.dataFormatDigits = this.dataFormatDigitsAdapter.adapt(data.dataFormatDigits);
429
- }
430
- if (CompareUtil.isExisting(data.stackConfig)) {
431
- config.stackConfig = data.stackConfig;
432
- }
433
- return config;
434
- }
435
- default() {
436
- return new StructureChartComponentConfig([], []);
437
- }
438
- }
439
-
440
- /**
441
- * A single renderable data point in a structural (categorical) bar chart.
442
- *
443
- * Encapsulates a numeric value, its IBCS scenario type, and the vertical scale factor.
444
- * Provides scaling and variance styling logic used by the chart renderer.
445
- *
446
- * Variance direction follows IBCS convention: the declared variance ("pos"/"neg") applies
447
- * to non-negative values; for negative values, the style is flipped (pos becomes neg and
448
- * vice versa) so that visual encoding always reflects the economic meaning.
449
- */
450
- class DataPoint {
451
- constructor(value, scenario, pixelPerUnit, variance) {
452
- this.value = value;
453
- this.scenario = scenario;
454
- this.pixelPerUnit = pixelPerUnit || 1;
455
- if (variance === "neg" || variance === Scenario.NEG) {
456
- this.variance = Scenario.NEG;
457
- }
458
- else if (variance === "pos" || variance === Scenario.POS) {
459
- this.variance = Scenario.POS;
460
- }
461
- else {
462
- this.variance = Scenario.NEU;
463
- }
464
- }
465
- isEmpty() {
466
- return null == this.value || null == this.scenario;
467
- }
468
- /** Returns the value scaled to pixel length for absolute (non-percentage) bars. */
469
- getScaledUnit() {
470
- if (this.value == null) {
471
- return 0;
472
- }
473
- return this.value * this.pixelPerUnit;
474
- }
475
- /**
476
- * Returns the percentage value scaled to pixel length, clipped at +/-145%.
477
- *
478
- * Values beyond +/-1.45 (145%) are clamped to prevent extreme bars from
479
- * distorting the chart layout. Use {@link isClipped} to check if clipping occurred.
480
- */
481
- getScaledPercentUnit() {
482
- if (this.value == null) {
483
- return 0;
484
- }
485
- if (Math.abs(this.value) > 1.45) {
486
- if (this.value >= 0) {
487
- return 1.45 * this.pixelPerUnit;
488
- }
489
- else {
490
- return -1.45 * this.pixelPerUnit;
491
- }
492
- }
493
- else {
494
- return this.value * this.pixelPerUnit;
495
- }
496
- }
497
- /**
498
- * Returns the IBCS variance color style, flipping pos/neg for negative values.
499
- *
500
- * IBCS rule: a "positive variance" on a negative value is economically unfavorable,
501
- * so the visual style must invert. NEU (neutral) is never flipped.
502
- */
503
- getVarianceStyle() {
504
- if (this.value == null) {
505
- return this.variance;
506
- }
507
- if (this.value >= 0) {
508
- return this.variance;
509
- }
510
- else {
511
- //flip the style
512
- if (Scenario.NEU === this.variance) {
513
- return Scenario.NEU;
514
- }
515
- if (Scenario.POS === this.variance) {
516
- return Scenario.NEG;
517
- }
518
- else {
519
- return Scenario.POS;
520
- }
521
- }
522
- }
523
- /** Returns true if the percentage value exceeds the +/-145% clipping threshold. */
524
- isClipped() {
525
- if (this.value == null) {
526
- return false;
527
- }
528
- return Math.abs(this.value) > 1.45;
529
- }
530
- /** Returns the fixed display value (145) shown on clipped percentage bars. */
531
- getClippedValue() {
532
- return 145;
533
- }
534
- /** Extracts the 2-character scenario type prefix (e.g. "ac" from "ac1", "pl" from "pl2"). */
535
- getScenario() {
536
- var _a;
537
- return (_a = this.scenario) === null || _a === void 0 ? void 0 : _a.slice(0, 2);
538
- }
539
- }
540
-
541
- /**
542
- * IBCS-compliant data row for structural (categorical) bar chart visualizations.
543
- *
544
- * Follows the same schema as {@link TableDataRow} with the addition of optional `setName`
545
- * and `date` fields. The `date` is present because structure charts may coexist with
546
- * time-series data, but it is not used for x-axis positioning (categories are used instead).
547
- */
548
- class StructureChartDataRow {
549
- constructor() {
550
- this.operation = "+";
551
- }
552
- addRowGroup(name, index) {
553
- this.rowGroup = name;
554
- this.rowGroupIndex = index;
555
- }
556
- addCategory(name, index) {
557
- this.category = name;
558
- this.categoryIndex = index;
559
- }
560
- addSubCategory(name, index) {
561
- this.subCategory = name;
562
- this.subCategoryIndex = index;
563
- }
564
- addColumnGroup(name, index) {
565
- this.columnGroup = name;
566
- this.columnGroupIndex = index;
567
- }
568
- addSubColumnGroup(name, index) {
569
- this.columnSubGroup = name;
570
- this.columnSubGroupIndex = index;
571
- }
572
- }
573
- /**
574
- * Converts untyped JSON records into validated {@link StructureChartDataRow} instances.
575
- *
576
- * Only assigns fields that pass type validation via {@link CompareUtil}, so malformed
577
- * input data is silently dropped and defaults are preserved.
578
- */
579
- class StructureChartDataRowAdapter {
580
- constructor() { }
581
- adapt(data) {
582
- const dataRow = new StructureChartDataRow();
583
- if (CompareUtil.isOperator(data.operation)) {
584
- dataRow.operation = data.operation;
585
- }
586
- if (CompareUtil.isNumber(data.rowGroupIndex) && CompareUtil.isString(data.rowGroup)) {
587
- dataRow.addRowGroup(data.rowGroup, data.rowGroupIndex);
588
- }
589
- if (CompareUtil.isNumber(data.categoryIndex) && CompareUtil.isString(data.category)) {
590
- dataRow.addCategory(data.category, data.categoryIndex);
591
- }
592
- if (CompareUtil.isNumber(data.subCategoryIndex) && CompareUtil.isString(data.subCategory)) {
593
- dataRow.addSubCategory(data.subCategory, data.subCategoryIndex);
594
- }
595
- if (CompareUtil.isNumber(data.columnGroupIndex) && CompareUtil.isString(data.columnGroup)) {
596
- dataRow.addColumnGroup(data.columnGroup, data.columnGroupIndex);
597
- }
598
- if (CompareUtil.isNumber(data.columnSubGroupIndex) && CompareUtil.isString(data.columnSubGroup)) {
599
- dataRow.addSubColumnGroup(data.columnSubGroup, data.columnSubGroupIndex);
600
- }
601
- this.setActualValues(data, dataRow);
602
- this.setPlanValues(data, dataRow);
603
- this.setPreviousPeriodValues(data, dataRow);
604
- this.setForecastValues(data, dataRow);
605
- return dataRow;
606
- }
607
- default() {
608
- return new StructureChartDataRow();
609
- }
610
- setActualValues(data, dataRow) {
611
- if (CompareUtil.isNumber(data.ac1)) {
612
- dataRow.ac1 = data.ac1;
613
- }
614
- if (CompareUtil.isNumber(data.ac2)) {
615
- dataRow.ac2 = data.ac2;
616
- }
617
- if (CompareUtil.isNumber(data.ac3)) {
618
- dataRow.ac3 = data.ac3;
619
- }
620
- if (CompareUtil.isNumber(data.ac4)) {
621
- dataRow.ac4 = data.ac4;
622
- }
623
- }
624
- setPlanValues(data, dataRow) {
625
- if (CompareUtil.isNumber(data.pl1)) {
626
- dataRow.pl1 = data.pl1;
627
- }
628
- if (CompareUtil.isNumber(data.pl2)) {
629
- dataRow.pl2 = data.pl2;
630
- }
631
- if (CompareUtil.isNumber(data.pl3)) {
632
- dataRow.pl3 = data.pl3;
633
- }
634
- if (CompareUtil.isNumber(data.pl4)) {
635
- dataRow.pl4 = data.pl4;
636
- }
637
- }
638
- setPreviousPeriodValues(data, dataRow) {
639
- if (CompareUtil.isNumber(data.pp1)) {
640
- dataRow.pp1 = data.pp1;
641
- }
642
- if (CompareUtil.isNumber(data.pp2)) {
643
- dataRow.pp2 = data.pp2;
644
- }
645
- if (CompareUtil.isNumber(data.pp3)) {
646
- dataRow.pp3 = data.pp3;
647
- }
648
- if (CompareUtil.isNumber(data.pp4)) {
649
- dataRow.pp4 = data.pp4;
650
- }
651
- }
652
- setForecastValues(data, dataRow) {
653
- if (CompareUtil.isNumber(data.fc1)) {
654
- dataRow.fc1 = data.fc1;
655
- }
656
- if (CompareUtil.isNumber(data.fc2)) {
657
- dataRow.fc2 = data.fc2;
658
- }
659
- if (CompareUtil.isNumber(data.fc3)) {
660
- dataRow.fc3 = data.fc3;
661
- }
662
- if (CompareUtil.isNumber(data.fc4)) {
663
- dataRow.fc4 = data.fc4;
664
- }
665
- }
666
- }
667
-
668
- // import { IAdapter } from "../../../../../utils/helper/IAdapter";
669
- // import { FontStyle, FontStyleAdapter } from "../../../../../utils/model/styles/FontStyle";
670
- // import { SVGStyleGroup, SVGStyleGroupAdapter } from "../../../../../utils/model/styles/SVGStyleGroup";
671
- // import { SVGVariancesStyleGroup, SVGVariancesStyleGroupAdapter } from "../../../../../utils/model/styles/SVGVariancesStyleGroup";
672
- // import { SVGPolgonPattern } from "../../../../../utils/model";
673
- // import { Padding, PaddingAdapter } from "../../../../../utils/model/styles/Padding";
674
- /** Aggregates all style configuration for a structure chart: scale factors, fonts, colors, patterns, and padding. */
675
- class StructureChartStyle {
676
- constructor(scaleFactors, fontStyles, axisStyles, barStyles, varianceStyles, padding) {
677
- this.scaleFactors = scaleFactors;
678
- this.fontStyles = fontStyles;
679
- this.axisStyles = axisStyles;
680
- this.barStyles = barStyles;
681
- this.varianceStyles = varianceStyles;
682
- this.padding = padding;
683
- this.pattern = new Map();
684
- }
685
- }
686
- /** Adapts raw componentStyle JSON into a StructureChartStyle, falling back to defaults for missing properties. */
687
- class StructureChartStylesAdapter {
688
- constructor(scaleFactorsStructureChartAdapter, fontStyleAdapter, svgStyleGroupAdapter, svgVariancesStyleGroupAdapter, paddingadapter) {
689
- this.scaleFactorsStructureChartAdapter = scaleFactorsStructureChartAdapter;
690
- this.fontStyleAdapter = fontStyleAdapter;
691
- this.svgStyleGroupAdapter = svgStyleGroupAdapter;
692
- this.svgVariancesStyleGroupAdapter = svgVariancesStyleGroupAdapter;
693
- this.paddingadapter = paddingadapter;
694
- }
695
- adapt(data) {
696
- const styles = new StructureChartStyle(this.scaleFactorsStructureChartAdapter.default(), this.fontStyleAdapter.default(), this.svgStyleGroupAdapter.default(), this.svgStyleGroupAdapter.default(), this.svgVariancesStyleGroupAdapter.default(), this.paddingadapter.default());
697
- if (CompareUtil.isExisting(data)) {
698
- if (CompareUtil.isExisting(data.scaleFactors)) {
699
- styles.scaleFactors = this.scaleFactorsStructureChartAdapter.adapt(data.scaleFactors);
700
- }
701
- if (CompareUtil.isExisting(data.fontStyles)) {
702
- styles.fontStyles = this.fontStyleAdapter.adapt(data.fontStyles);
703
- }
704
- if (CompareUtil.isExisting(data.axisStyles)) {
705
- styles.axisStyles = this.svgStyleGroupAdapter.adapt(data.axisStyles);
706
- }
707
- if (CompareUtil.isExisting(data.barStyles)) {
708
- styles.barStyles = this.svgStyleGroupAdapter.adapt(data.barStyles);
709
- }
710
- if (CompareUtil.isExisting(data.varianceStyles)) {
711
- styles.varianceStyles = this.svgVariancesStyleGroupAdapter.adapt(data.varianceStyles);
712
- }
713
- if (CompareUtil.isExisting(data.padding)) {
714
- styles.padding = this.paddingadapter.adapt(data.padding);
715
- }
716
- styles.pattern = new MarkerPattern(styles.fontStyles.size).createPatternMapForStructureBar();
717
- }
718
- return styles;
719
- }
720
- default() {
721
- return new StructureChartStyle(this.scaleFactorsStructureChartAdapter.default(), this.fontStyleAdapter.default(), this.svgStyleGroupAdapter.default(), this.svgStyleGroupAdapter.default(), this.svgVariancesStyleGroupAdapter.default(), this.paddingadapter.default());
722
- }
723
- }
724
-
725
- // import { IAdapter } from "../../../../../utils/helper/IAdapter";
726
- // import { CompareUtil } from "../../../../../utils/helper/CompareUtil";
727
- /**
728
- * Proportional scale factors for structural (categorical) bar chart elements.
729
- *
730
- * All values are expressed in **font-size multiples** (em-like units), so the chart
731
- * scales uniformly when the base font size changes. The chart renderer multiplies
732
- * each factor by the computed font size to get pixel dimensions.
733
- */
734
- class ScaleFactorsStructureChart {
735
- constructor() {
736
- /** Horizontal gap between adjacent scenario bars within a category. */
737
- this.scenarioOffset = 0.3;
738
- /** Gap between the scenario label and the end of its bar. */
739
- this.scenarioLabelToBar = 0.1;
740
- /** Gap between the value label and the end of its bar. */
741
- this.labelToBar = 0.3;
742
- /** Gap between axis labels and the axis line. */
743
- this.labelToAxis = 0.3;
744
- /** Width of the variance needle (pin chart element). */
745
- this.needleWidth = 0.3;
746
- /** Width of the arrowhead on variance needles. */
747
- this.needleHeadWidth = 0.6;
748
- /** Height of a single data bar. */
749
- this.barWidth = 1.2;
750
- /** Stroke width of the variance chart axis line. */
751
- this.varianceAxisLineWidth = 0.3;
752
- /** Stroke width of the main value axis line. */
753
- this.axisLineWidth = 0.1;
754
- /** Stroke width of auxiliary/grid lines. */
755
- this.auxiliaryLineWidth = 0.1;
756
- /** Stroke width of scenario indicator lines (e.g. forecast hatching). */
757
- this.scenarioLineWidth = 0.2;
758
- /** Size of plan/previous-period marker symbols. */
759
- this.markerWidth = 0.7;
760
- /** Vertical offset of markers from the bar center. */
761
- this.markerOffset = 0.0;
762
- /** Total vertical space allocated per category (bar + padding). */
763
- this.categoryWidth = 1.9;
764
- /** Length of axis tick marks. */
765
- this.axisTickLength = 0.3;
766
- }
767
- }
768
- /** Converts untyped JSON into a validated {@link ScaleFactorsStructureChart}. */
769
- class ScaleFactorsStructureChartAdapter {
770
- adapt(data) {
771
- const scaleFactors = new ScaleFactorsStructureChart();
772
- if (CompareUtil.isNumber(data.scenarioOffset)) {
773
- scaleFactors.scenarioOffset = data.scenarioOffset;
774
- }
775
- if (CompareUtil.isNumber(data.scenarioLabelToBar)) {
776
- scaleFactors.scenarioLabelToBar = data.scenarioLabelToBar;
777
- }
778
- if (CompareUtil.isNumber(data.labelToBar)) {
779
- scaleFactors.labelToBar = data.labelToBar;
780
- }
781
- if (CompareUtil.isNumber(data.labelToAxis)) {
782
- scaleFactors.labelToAxis = data.labelToAxis;
783
- }
784
- if (CompareUtil.isNumber(data.needleWidth)) {
785
- scaleFactors.needleWidth = data.needleWidth;
786
- }
787
- if (CompareUtil.isNumber(data.needleHeadWidth)) {
788
- scaleFactors.needleHeadWidth = data.needleHeadWidth;
789
- }
790
- if (CompareUtil.isNumber(data.barWidth)) {
791
- scaleFactors.barWidth = data.barWidth;
792
- }
793
- if (CompareUtil.isNumber(data.varianceAxisLineWidth)) {
794
- scaleFactors.varianceAxisLineWidth = data.varianceAxisLineWidth;
795
- }
796
- if (CompareUtil.isNumber(data.axisLineWidth)) {
797
- scaleFactors.axisLineWidth = data.axisLineWidth;
798
- }
799
- if (CompareUtil.isNumber(data.auxiliaryLineWidth)) {
800
- scaleFactors.auxiliaryLineWidth = data.auxiliaryLineWidth;
801
- }
802
- if (CompareUtil.isNumber(data.scenarioLineWidth)) {
803
- scaleFactors.scenarioLineWidth = data.scenarioLineWidth;
804
- }
805
- if (CompareUtil.isNumber(data.markerWidth)) {
806
- scaleFactors.markerWidth = data.markerWidth;
807
- }
808
- if (CompareUtil.isNumber(data.markerOffset)) {
809
- scaleFactors.markerOffset = data.markerOffset;
810
- }
811
- if (CompareUtil.isNumber(data.categoryWidth)) {
812
- scaleFactors.categoryWidth = data.categoryWidth;
813
- }
814
- if (CompareUtil.isNumber(data.axisTickLength)) {
815
- scaleFactors.axisTickLength = data.axisTickLength;
816
- }
817
- return scaleFactors;
818
- }
819
- default() {
820
- return new ScaleFactorsStructureChart();
821
- }
822
- }
823
-
824
- /**
825
- * IBCS scenario enumeration for structural charts.
826
- *
827
- * Includes all 16 scenario slots (4 each of ac, pp, fc, pl) plus three
828
- * variance direction markers: POS (positive/favorable), NEG (negative/unfavorable),
829
- * NEU (neutral).
830
- */
831
- var Scenario;
832
- (function (Scenario) {
833
- Scenario["AC1"] = "ac1";
834
- Scenario["PP1"] = "pp1";
835
- Scenario["FC1"] = "fc1";
836
- Scenario["PL1"] = "pl1";
837
- Scenario["AC2"] = "ac2";
838
- Scenario["PP2"] = "pp2";
839
- Scenario["FC2"] = "fc2";
840
- Scenario["PL2"] = "pl2";
841
- Scenario["AC3"] = "ac3";
842
- Scenario["PP3"] = "pp3";
843
- Scenario["FC3"] = "fc3";
844
- Scenario["PL3"] = "pl3";
845
- Scenario["AC4"] = "ac4";
846
- Scenario["PP4"] = "pp4";
847
- Scenario["FC4"] = "fc4";
848
- Scenario["PL4"] = "pl4";
849
- /** Positive/favorable variance (rendered in green per IBCS). */
850
- Scenario["POS"] = "pos";
851
- /** Negative/unfavorable variance (rendered in red per IBCS). */
852
- Scenario["NEG"] = "neg";
853
- /** Neutral variance (rendered in grey per IBCS). */
854
- Scenario["NEU"] = "neu";
855
- })(Scenario || (Scenario = {}));
856
- /** Chart-internal table aggregation modes. */
857
- var TableType;
858
- (function (TableType) {
859
- TableType["LIST"] = "LIST";
860
- TableType["SUM"] = "SUM";
861
- TableType["OPT"] = "OPT";
862
- })(TableType || (TableType = {}));
863
-
864
- // import {Formatter} from "../../../../utils";
865
- // import {StructureChartStyle} from "../model";
866
- // import { DataFormatDigits } from "../../../../utils/model/DataFormatDigits";
867
- // import { SiPrefix } from "../../../../utils/model/SiPrefix";
868
- /**
869
- * Anchor point for label positioning relative to its coordinates (structure chart variant).
870
- * Vertical hooks shift the label up/down; horizontal hooks set SVG text-anchor alignment.
871
- */
872
- var HookLocation;
873
- (function (HookLocation) {
874
- HookLocation[HookLocation["Left"] = 0] = "Left";
875
- HookLocation[HookLocation["Center"] = 1] = "Center";
876
- HookLocation[HookLocation["Right"] = 2] = "Right";
877
- HookLocation[HookLocation["Top"] = 3] = "Top";
878
- HookLocation[HookLocation["Bottom"] = 4] = "Bottom";
879
- })(HookLocation || (HookLocation = {}));
880
- /**
881
- * SVG text label for structure chart elements (bars, needles, markers, axes).
882
- *
883
- * Handles numeric formatting via Formatter.number(), variance sign prefixing,
884
- * and hook-based positioning. Draws a semi-transparent white background rectangle
885
- * for readability, or uses contrast text color when placed inside stacked segments.
886
- *
887
- * Horizontal equivalent of the time chart Label class, adapted for horizontal bar layout.
888
- */
889
- class Label {
890
- constructor(parent, xPosition, yPosition, groupPrefix, value, styles, verticalHookLocation, horizontalHookLocation) {
891
- this.group = null;
892
- this.segmentFillColor = null;
893
- this.ID_SCENARIOLABEL = "Label";
894
- this.CSS_CATEGORIES = "categories";
895
- this.x = xPosition;
896
- this.y = yPosition;
897
- this.value = value;
898
- if (parent != null) {
899
- this.group = parent.group().id(this.createElementID(parent.toString(), groupPrefix));
900
- }
901
- this.styles = styles;
902
- this.isVarianceLabel = false;
903
- this.isRelativeLabel = false;
904
- this.verticalHookLocation = verticalHookLocation || HookLocation.Top;
905
- this.horizontalHookLocation = horizontalHookLocation || HookLocation.Left;
906
- }
907
- setToVarianceLabel() {
908
- this.isVarianceLabel = true;
909
- return this;
910
- }
911
- setToRelativeVarianceLabel() {
912
- this.isVarianceLabel = true;
913
- this.isRelativeLabel = true;
914
- return this;
915
- }
916
- setSegmentFill(color) {
917
- this.segmentFillColor = color;
918
- return this;
919
- }
920
- updateGroup(newGroup) {
921
- this.group = newGroup;
922
- return this;
923
- }
924
- createElementID(prefix, groupPrefix) {
925
- return prefix + "_" + groupPrefix + "_" + this.ID_SCENARIOLABEL;
926
- }
927
- draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
928
- if (this.isEmpty()) {
929
- return this;
930
- }
931
- const label = this.group;
932
- let valueStr;
933
- const background = this.styles.fontStyles.background || "#ffffff";
934
- let prefix = "";
935
- let labelAnchor = "start";
936
- if (Number.isNaN(Number(this.value)) === false) {
937
- let digits = dataFormatDigits.percent;
938
- let digitsMin = dataFormatDigits.percent;
939
- let scale = 1;
940
- const value = this.value;
941
- let type = "percent";
942
- if (this.isRelativeLabel === false) {
943
- digits = dataFormatDigits.decimal;
944
- digitsMin = dataFormatDigits.decimal;
945
- scale = measureScale.value;
946
- type = "decimal";
947
- }
948
- valueStr = Formatter.number(Number(value), type, digits, digitsMin, scale);
949
- if (Number(this.value) < 0) {
950
- labelAnchor = "end";
951
- }
952
- if (this.isVarianceLabel && Number(this.value) >= 0) {
953
- prefix = "+";
954
- }
955
- }
956
- else {
957
- valueStr = "" + this.value;
958
- labelAnchor = "start";
959
- }
960
- // @ts-ignore
961
- const text = label.text(prefix + valueStr);
962
- text.move(this.x, this.y);
963
- const boxWidth = text.bbox().w;
964
- const boxHeight = text.bbox().h;
965
- if (this.horizontalHookLocation === HookLocation.Right) {
966
- labelAnchor = "end";
967
- text.move(text.x() - text.length(), text.y());
968
- }
969
- else if (this.horizontalHookLocation === HookLocation.Center) {
970
- labelAnchor = "middle";
971
- text.move(text.x() - text.length() / 2, text.y());
972
- }
973
- if (this.verticalHookLocation === HookLocation.Center) {
974
- text.move(text.x(), text.y() - boxHeight / 2);
975
- }
976
- else if (this.verticalHookLocation === HookLocation.Bottom) {
977
- text.move(text.x(), text.y() - boxHeight);
978
- }
979
- text.font({ anchor: labelAnchor });
980
- if (this.segmentFillColor != null) {
981
- text.fill(getContrastTextColor(this.segmentFillColor));
982
- }
983
- else {
984
- label === null || label === void 0 ? void 0 : label.rect(boxWidth, boxHeight * 0.9).stroke(background).fill(background).opacity(0.7).move(text.x(), text.y() + boxHeight * 0.1).insertBefore(text);
985
- }
986
- return this;
987
- }
988
- isEmpty() {
989
- return this.value == null || "" === this.value;
990
- }
991
- setPos(xPosition, yPosition) {
992
- this.x = xPosition;
993
- this.y = yPosition;
994
- return this;
995
- }
996
- }
997
-
998
- // import {HookLocation} from "../../../ibcs-chart-time/utils/elements";
999
- /**
1000
- * Renders the vertical baseline axis for a structure chart.
1001
- *
1002
- * The axis line runs vertically from top to bottom of the data area.
1003
- * A CSS class based on the scenario type (e.g. "axis-ac") controls stroke style.
1004
- * An optional title label is drawn at the top of the axis.
1005
- */
1006
- class Axis {
1007
- constructor(axis, position, svgParentGroup, style) {
1008
- this.height = 0;
1009
- this.ID_AXIS = "axis";
1010
- this.ID_AXIS_TITLE = "axis-title";
1011
- this.CSS_AXIS_TITLE = "categories";
1012
- this.scenarioType = axis.scenarioType;
1013
- this.labelText = axis.labelText || null;
1014
- this.position = position;
1015
- this.style = style;
1016
- this.label = new Label(svgParentGroup, this.position.getAxisTitlePositionX(), this.position.getAxisTitlePositionY(), this.ID_AXIS_TITLE, this.labelText, this.style, HookLocation.Bottom, HookLocation.Center);
1017
- this.svgGroup = svgParentGroup.group().id(this.ID_AXIS);
1018
- }
1019
- draw() {
1020
- if (this.labelText) {
1021
- this.label.draw();
1022
- }
1023
- this.svgGroup
1024
- .line(this.position.getAxisPositionX(), this.position.getAxisPositionY(), this.position.getAxisEndPositionX(), this.position.getAxisEndPositionY())
1025
- .addClass(this.ID_AXIS + "-" + this.convertScenarioType());
1026
- this.height = this.svgGroup.height();
1027
- return this;
1028
- }
1029
- convertScenarioType() {
1030
- if (this.scenarioType === undefined || this.scenarioType == null) {
1031
- return "default";
1032
- }
1033
- return `${this.scenarioType}`.slice(0, 2);
1034
- }
1035
- }
1036
-
1037
- // import {HookLocation} from "../../../ibcs-chart-time/utils/elements";
1038
- // import {SVGPolgonPattern, SVGStyle} from "../../../../utils/model";
1039
- // import {SVGStyleGroup} from "../../../../utils/model/styles/SVGStyleGroup";
1040
- // import { DataFormatDigits } from "../../../../utils/model/DataFormatDigits";
1041
- // import { SiPrefix } from "../../../../utils/model/SiPrefix";
1042
- /**
1043
- * Renders a horizontal bar in an IBCS structure chart (the horizontal equivalent of Column).
1044
- *
1045
- * Positive values extend rightward from the vertical axis; negative values extend leftward.
1046
- * Data labels are placed to the right of positive bars and to the left of negative bars.
1047
- *
1048
- * Overflow handling mirrors the Column's broken-bar algorithm but on the horizontal axis:
1049
- * when a bar exceeds the effective cut width, it is split into a base segment and an
1050
- * overdrive segment separated by vertical zigzag break indicators.
1051
- *
1052
- * Primary bars (AC foreground) carry data labels; secondary bars (PP background) do not.
1053
- */
1054
- class Bar {
1055
- constructor(position, styles, dataPoint, index, isPrimaryBar, scenarioGroup, barLabel, overflowConfig = null) {
1056
- this.ID_DATA_PREFIX = "DATA";
1057
- this.ID_SCENARIO_PREFIX = "SCENARIO";
1058
- this.ID_RECT = "RECT";
1059
- this.FALLBACK_COLOUR = "#000000";
1060
- this.label = null;
1061
- this.scenarioLabel = null;
1062
- this.barGroup = null;
1063
- this.isVarianceBar = false;
1064
- this.overflowConfig = null;
1065
- this.isOverflowing = false;
1066
- this.overdriveWidth = 0;
1067
- this.dimensions = {
1068
- barLength: 0,
1069
- xPos: 0,
1070
- yPos: 0,
1071
- labelXPos: 0,
1072
- scenarioLabelXPos: 0,
1073
- scenarioLabelYPos: 0,
1074
- clipped: false,
1075
- };
1076
- this.hasData = false;
1077
- this.dataPoint = dataPoint;
1078
- this.index = index;
1079
- this.isPrimaryBar = isPrimaryBar;
1080
- this.position = position;
1081
- this.barStyles = styles.barStyles;
1082
- this.overflowConfig = overflowConfig;
1083
- this.scenarioGroup = scenarioGroup;
1084
- this.styles = styles;
1085
- if (scenarioGroup != null) {
1086
- this.barGroup = scenarioGroup.group().id(scenarioGroup.toString() + "_" + this.ID_RECT);
1087
- }
1088
- if ((dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.isEmpty()) !== true && dataPoint.value != null) {
1089
- this.hasData = true;
1090
- let textLabelHook = HookLocation.Left;
1091
- if (dataPoint.value < 0) {
1092
- textLabelHook = HookLocation.Right;
1093
- }
1094
- this.dimensions = this.createDimensions(position, dataPoint, index, isPrimaryBar);
1095
- this.label = new Label(this.scenarioGroup, this.dimensions.labelXPos, this.dimensions.yPos, this.ID_DATA_PREFIX, dataPoint.value, this.styles, HookLocation.Center, textLabelHook);
1096
- this.scenarioLabel = this.getScenarioLabel(barLabel);
1097
- }
1098
- }
1099
- setAsVariance() {
1100
- var _a;
1101
- this.isVarianceBar = true;
1102
- (_a = this.label) === null || _a === void 0 ? void 0 : _a.setToVarianceLabel();
1103
- return this;
1104
- }
1105
- isRelativeVariance() {
1106
- var _a;
1107
- this.isVarianceBar = true;
1108
- (_a = this.label) === null || _a === void 0 ? void 0 : _a.setToRelativeVarianceLabel();
1109
- return this;
1110
- }
1111
- updateLabelGroup(newGroup) {
1112
- var _a;
1113
- if (this.isEmpty() || newGroup == null) {
1114
- return this;
1115
- }
1116
- (_a = this.label) === null || _a === void 0 ? void 0 : _a.updateGroup(newGroup);
1117
- return this;
1118
- }
1119
- draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
1120
- if (this.isEmpty() || this.dataPoint.getScenario() == null) {
1121
- return this;
1122
- }
1123
- // Bars default to barStyles (falls back to 'ac'); variance bars switch to varianceStyles below
1124
- let scenarioStyle = this.barStyles.getSVGStyle(this.dataPoint.getScenario());
1125
- if (this.isVarianceBar) {
1126
- scenarioStyle = this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle());
1127
- }
1128
- const strokeStyle = this.convertToSVGStyle(scenarioStyle, "stroke");
1129
- let fillStyle = this.convertToSVGStyle(scenarioStyle, "fill");
1130
- const fillPattern = this.barStyles.getSVGStyle(this.dataPoint.getScenario()).fillpattern;
1131
- if (fillPattern != null) {
1132
- const polygonPattern = this.styles.pattern.get(fillPattern);
1133
- if (polygonPattern != null) {
1134
- fillStyle = polygonPattern.pattern;
1135
- }
1136
- }
1137
- if (this.barGroup != null) {
1138
- if (this.isOverflowing && this.overflowConfig) {
1139
- this.drawOverdriveBar(fillStyle, strokeStyle);
1140
- }
1141
- else {
1142
- this.barGroup
1143
- .rect(this.dimensions.barLength, this.position.getBarWidth())
1144
- .fill(fillStyle)
1145
- .stroke(strokeStyle)
1146
- .cy(this.dimensions.yPos)
1147
- .x(this.dimensions.xPos);
1148
- }
1149
- }
1150
- this.drawBarDataLabel(dataFormatDigits, measureScale);
1151
- this.drawScenarioLabel();
1152
- }
1153
- /** Draws a broken bar: base segment + break gap + overdrive segment (horizontal). */
1154
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1155
- drawOverdriveBar(fillStyle, strokeStyle) {
1156
- if (!this.barGroup || !this.overflowConfig)
1157
- return;
1158
- const axisX = this.position.getBarPositionX();
1159
- const barHeight = this.position.getBarWidth();
1160
- const effectiveCut = this.dimensions.barLength; // scenario-aware cut width
1161
- const { breakGap } = this.overflowConfig;
1162
- const isNegative = this.dataPoint.getScaledUnit() < 0;
1163
- if (isNegative) {
1164
- // Base bar: from axis leftward
1165
- this.barGroup
1166
- .rect(effectiveCut, barHeight)
1167
- .fill(fillStyle)
1168
- .stroke(strokeStyle)
1169
- .x(axisX - effectiveCut)
1170
- .cy(this.dimensions.yPos);
1171
- // Overdrive bar: further left past the break gap
1172
- this.barGroup
1173
- .rect(this.overdriveWidth, barHeight)
1174
- .fill(fillStyle)
1175
- .stroke(strokeStyle)
1176
- .x(axisX - effectiveCut - breakGap - this.overdriveWidth)
1177
- .cy(this.dimensions.yPos);
1178
- // Break indicator covers the full gap on top
1179
- this.drawBreakIndicator(axisX - effectiveCut - breakGap, breakGap);
1180
- }
1181
- else {
1182
- // Base bar: from axis rightward
1183
- this.barGroup.rect(effectiveCut, barHeight).fill(fillStyle).stroke(strokeStyle).x(axisX).cy(this.dimensions.yPos);
1184
- // Overdrive bar: further right past the break gap
1185
- this.barGroup
1186
- .rect(this.overdriveWidth, barHeight)
1187
- .fill(fillStyle)
1188
- .stroke(strokeStyle)
1189
- .x(axisX + effectiveCut + breakGap)
1190
- .cy(this.dimensions.yPos);
1191
- // Break indicator covers the full gap on top
1192
- this.drawBreakIndicator(axisX + effectiveCut, breakGap);
1193
- }
1194
- }
1195
- /** Draws left and right vertical zigzag lines to indicate a broken axis (horizontal bars). */
1196
- drawBreakIndicator(breakX, breakGap) {
1197
- if (!this.barGroup)
1198
- return;
1199
- const barHeight = this.position.getBarWidth();
1200
- const yTop = this.dimensions.yPos - barHeight / 2;
1201
- const midX = breakX + breakGap / 2;
1202
- const halfGap = breakGap * 0.35;
1203
- const zigCount = 3;
1204
- const segHeight = barHeight / zigCount;
1205
- // Left zigzag line
1206
- let leftPath = `M ${midX - halfGap} ${yTop}`;
1207
- for (let i = 0; i < zigCount; i++) {
1208
- const y1 = yTop + segHeight * (i + 0.5);
1209
- const y2 = yTop + segHeight * (i + 1);
1210
- const xPeak = midX - halfGap - breakGap * 0.3;
1211
- leftPath += ` L ${xPeak} ${y1} L ${midX - halfGap} ${y2}`;
1212
- }
1213
- // Right zigzag line
1214
- let rightPath = `M ${midX + halfGap} ${yTop}`;
1215
- for (let i = 0; i < zigCount; i++) {
1216
- const y1 = yTop + segHeight * (i + 0.5);
1217
- const y2 = yTop + segHeight * (i + 1);
1218
- const xPeak = midX + halfGap + breakGap * 0.3;
1219
- rightPath += ` L ${xPeak} ${y1} L ${midX + halfGap} ${y2}`;
1220
- }
1221
- // White background covers the full break gap (bar edges provide background for peaks)
1222
- this.barGroup
1223
- .rect(breakGap, barHeight + 2)
1224
- .fill("#ffffff")
1225
- .stroke("none")
1226
- .x(breakX)
1227
- .cy(this.dimensions.yPos);
1228
- this.barGroup.path(leftPath).fill("none").stroke({ color: "#000000", width: 1 });
1229
- this.barGroup.path(rightPath).fill("none").stroke({ color: "#000000", width: 1 });
1230
- }
1231
- /**
1232
- * Computes the pixel geometry for the bar: position, length, label anchors.
1233
- * Handles three cases: overflow (broken bar), negative value, and normal positive.
1234
- */
1235
- createDimensions(position, dataPoint, index, isPrimaryBar) {
1236
- const scaledUnit = dataPoint.getScaledUnit();
1237
- const absScaledUnit = Math.abs(scaledUnit);
1238
- // Check for overdrive overflow
1239
- if (this.overflowConfig && absScaledUnit > 0) {
1240
- const isAC = dataPoint.getScenario() === "ac";
1241
- const effectiveCut = isAC
1242
- ? this.overflowConfig.cutWidth
1243
- : this.overflowConfig.cutWidth - this.overflowConfig.scenarioCutOffset;
1244
- if (absScaledUnit > effectiveCut) {
1245
- this.isOverflowing = true;
1246
- const { breakGap, overdriveZoneWidth, maxOverflow } = this.overflowConfig;
1247
- const overflowAmount = absScaledUnit - effectiveCut;
1248
- this.overdriveWidth = maxOverflow > 0 ? (overflowAmount / maxOverflow) * overdriveZoneWidth : 0;
1249
- const totalVisualWidth = effectiveCut + breakGap + this.overdriveWidth;
1250
- if (scaledUnit < 0) {
1251
- return {
1252
- clipped: false,
1253
- barLength: effectiveCut,
1254
- xPos: position.getBarPositionX() - effectiveCut,
1255
- yPos: position.getBarPositionY(index, isPrimaryBar),
1256
- labelXPos: position.getLabelPositionX(-totalVisualWidth),
1257
- scenarioLabelXPos: position.getBarPositionX() - effectiveCut * 0.5,
1258
- scenarioLabelYPos: position.getBarPositionY(index, isPrimaryBar) + position.getScenarioLabelPositionOffsetY(isPrimaryBar),
1259
- };
1260
- }
1261
- else {
1262
- return {
1263
- clipped: false,
1264
- barLength: effectiveCut,
1265
- xPos: position.getBarPositionX(),
1266
- yPos: position.getBarPositionY(index, isPrimaryBar),
1267
- labelXPos: position.getLabelPositionX(totalVisualWidth),
1268
- scenarioLabelXPos: position.getBarPositionX() + effectiveCut * 0.5,
1269
- scenarioLabelYPos: position.getBarPositionY(index, isPrimaryBar) + position.getScenarioLabelPositionOffsetY(isPrimaryBar),
1270
- };
1271
- }
1272
- }
1273
- }
1274
- if (scaledUnit < 0) {
1275
- return {
1276
- clipped: false,
1277
- barLength: absScaledUnit,
1278
- xPos: position.getBarPositionX() + scaledUnit,
1279
- yPos: position.getBarPositionY(index, isPrimaryBar),
1280
- labelXPos: this.position.getLabelPositionX(scaledUnit),
1281
- scenarioLabelXPos: this.position.getBarPositionX() - absScaledUnit * 0.5,
1282
- scenarioLabelYPos: this.position.getBarPositionY(index, isPrimaryBar) +
1283
- this.position.getScenarioLabelPositionOffsetY(isPrimaryBar),
1284
- };
1285
- }
1286
- else {
1287
- return {
1288
- clipped: false,
1289
- barLength: scaledUnit,
1290
- xPos: position.getBarPositionX(),
1291
- yPos: position.getBarPositionY(index, isPrimaryBar),
1292
- labelXPos: this.position.getLabelPositionX(scaledUnit),
1293
- scenarioLabelXPos: this.position.getBarPositionX() + absScaledUnit * 0.5,
1294
- scenarioLabelYPos: this.position.getBarPositionY(index, isPrimaryBar) +
1295
- this.position.getScenarioLabelPositionOffsetY(isPrimaryBar),
1296
- };
1297
- }
1298
- }
1299
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1300
- convertToSVGStyle(style, mode) {
1301
- if (style == null) {
1302
- style = [];
1303
- }
1304
- style["color"] = style[mode] || this.FALLBACK_COLOUR;
1305
- return Object.assign({}, style);
1306
- }
1307
- drawScenarioLabel() {
1308
- if (this.scenarioLabel != null && !this.scenarioLabel.isEmpty() && !this.isVarianceBar) {
1309
- this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos, this.dimensions.scenarioLabelYPos).draw();
1310
- }
1311
- }
1312
- drawBarDataLabel(dataFormatDigits, measureScale = new SiPrefix()) {
1313
- var _a;
1314
- if (this.isPrimaryBar) {
1315
- (_a = this.label) === null || _a === void 0 ? void 0 : _a.draw(dataFormatDigits, measureScale);
1316
- }
1317
- }
1318
- isEmpty() {
1319
- return false === this.hasData || Number.isNaN(this.dataPoint.value);
1320
- }
1321
- getScenarioLabel(barLabel) {
1322
- if (this.isPrimaryBar) {
1323
- return new Label(this.scenarioGroup, -1, -1, this.ID_SCENARIO_PREFIX, barLabel, this.styles, HookLocation.Top, HookLocation.Center);
1324
- }
1325
- return new Label(this.scenarioGroup, -1, -1, this.ID_SCENARIO_PREFIX, barLabel, this.styles, HookLocation.Bottom, HookLocation.Center);
1326
- }
1327
- }
1328
-
1329
- /**
1330
- * Renders a polygon marker for PP or PL reference values in a structure chart (horizontal layout).
1331
- *
1332
- * Markers are positioned horizontally at the data point's scaled value distance from the axis.
1333
- * They consist of a white background polygon and a scenario-styled foreground polygon.
1334
- * Primary markers sit above the bar center; secondary markers sit below it.
1335
- */
1336
- class Marker {
1337
- constructor(position, markerGroup, markerPattern, scenario, styles, dataPoint, index, labelText, isPrimaryMarker) {
1338
- this.ID_DATA_PREFIX = "DATA";
1339
- this.ID_SCENARIO_PREFIX = "SCENARIO";
1340
- this.FALLBACK_COLOUR = "#000000";
1341
- this.scenarioLabel = null;
1342
- this._defaultMarkerPattern = null;
1343
- this.dimensions = {
1344
- barLength: 0,
1345
- xPos: 0,
1346
- yPos: 0,
1347
- labelXPos: 0,
1348
- scenarioLabelXPos: 0,
1349
- scenarioLabelYPos: 0,
1350
- clipped: false,
1351
- };
1352
- this.hasData = false;
1353
- this.position = position;
1354
- this.markerGroup = markerGroup || null;
1355
- this.markerPattern = markerPattern || this._defaultMarkerPattern;
1356
- this.styles = styles;
1357
- this.barStyles = styles ? styles.barStyles : null;
1358
- this.scenario = scenario;
1359
- if ((dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.isEmpty()) !== true) {
1360
- this.hasData = true;
1361
- this.dimensions = this.createMarkerDimensions(dataPoint, index, isPrimaryMarker);
1362
- this.scenarioLabel = this.getScenarioLabel(labelText, styles, isPrimaryMarker);
1363
- }
1364
- }
1365
- createMarkerDimensions(dataPoint, index, isPrimaryMarker) {
1366
- if (dataPoint.getScaledUnit() < 0) {
1367
- return {
1368
- clipped: false,
1369
- labelXPos: 0,
1370
- barLength: Math.abs(dataPoint.getScaledUnit()),
1371
- xPos: this.position.getMarkerPositionX() - Math.abs(dataPoint.getScaledUnit()),
1372
- yPos: this.position.getMarkerPositionY(index, isPrimaryMarker),
1373
- scenarioLabelXPos: this.position.getMarkerPositionX() - Math.abs(dataPoint.getScaledUnit()),
1374
- scenarioLabelYPos: this.position.getMarkerPositionY(index, isPrimaryMarker) +
1375
- this.position.getMarkerScenarioLabelPositionOffsetY(isPrimaryMarker),
1376
- };
1377
- }
1378
- else {
1379
- return {
1380
- clipped: false,
1381
- labelXPos: 0,
1382
- barLength: dataPoint.getScaledUnit(),
1383
- xPos: this.position.getMarkerPositionX() + dataPoint.getScaledUnit(),
1384
- yPos: this.position.getMarkerPositionY(index, isPrimaryMarker),
1385
- scenarioLabelXPos: this.position.getMarkerPositionX() + dataPoint.getScaledUnit(),
1386
- scenarioLabelYPos: this.position.getMarkerPositionY(index, isPrimaryMarker) +
1387
- this.position.getMarkerScenarioLabelPositionOffsetY(isPrimaryMarker),
1388
- };
1389
- }
1390
- }
1391
- getScenarioLabel(labelText, styles, isPrimaryMarker) {
1392
- if (this.markerGroup == null) {
1393
- return null;
1394
- }
1395
- if (isPrimaryMarker) {
1396
- return new Label(this.markerGroup, -1, -1, this.ID_DATA_PREFIX, labelText, styles, HookLocation.Bottom, HookLocation.Center);
1397
- }
1398
- return new Label(this.markerGroup, -1, -1, this.ID_DATA_PREFIX, labelText, styles, HookLocation.Top, HookLocation.Center);
1399
- }
1400
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1401
- convertToSVGStyle(style, mode) {
1402
- if (style == null) {
1403
- style = [];
1404
- }
1405
- style["color"] = style[mode] || this.FALLBACK_COLOUR;
1406
- return Object.assign({}, style);
1407
- }
1408
- draw() {
1409
- if (this.isEmpty()) {
1410
- return this;
1411
- }
1412
- const whiteBorder = "#ffffff";
1413
- const strokeStyle = this.convertToSVGStyle(this.barStyles[this.getScenario()], "stroke");
1414
- let fillStyle = this.convertToSVGStyle(this.barStyles[this.getScenario()], "fill");
1415
- const pattern = this.barStyles[this.getScenario()];
1416
- if (pattern != null && pattern.fillpattern) {
1417
- const polygonPattern = this.styles.pattern.get(pattern.fillpattern);
1418
- if (polygonPattern != null) {
1419
- fillStyle = polygonPattern.pattern;
1420
- }
1421
- }
1422
- this.markerGroup
1423
- .polygon(this.markerPattern.background)
1424
- .fill(whiteBorder)
1425
- .cy(this.dimensions.yPos)
1426
- .cx(this.dimensions.xPos);
1427
- this.markerGroup
1428
- .polygon(this.markerPattern.foreground)
1429
- .fill(fillStyle)
1430
- .stroke(strokeStyle)
1431
- .cy(this.dimensions.yPos)
1432
- .cx(this.dimensions.xPos);
1433
- if (this.scenarioLabel != null && !this.scenarioLabel.isEmpty()) {
1434
- this.scenarioLabel.setPos(this.dimensions.scenarioLabelXPos, this.dimensions.scenarioLabelYPos).draw();
1435
- }
1436
- return this;
1437
- }
1438
- isEmpty() {
1439
- return false === this.hasData;
1440
- }
1441
- getScenario() {
1442
- var _a;
1443
- return (_a = this.scenario) === null || _a === void 0 ? void 0 : _a.slice(0, 2);
1444
- }
1445
- }
1446
-
1447
- // import {SVGStyle} from "../../../../utils/model/styles/SVGStyle";
1448
- /**
1449
- * Renders a horizontal relative variance pin (needle) in an IBCS structure chart.
1450
- *
1451
- * The needle is a thin horizontal bar representing a percentage variance, with a head:
1452
- * - Normal: a square crossbar at the end of the pin
1453
- * - Clipped (value exceeds the percentage scale): a double-arrow polygon (left or right)
1454
- * indicating the value was truncated
1455
- *
1456
- * Positive pins extend rightward from the axis; negative pins extend leftward.
1457
- * Labels are placed beyond the needle head with variance-style formatting (percentage + sign).
1458
- */
1459
- class Needle {
1460
- constructor(position, styles, dataPoint, index, scenarioGroup) {
1461
- this.ID_DATA_PREFIX = "DATA";
1462
- this.ID_SCENARIO_PREFIX = "SCENARIO";
1463
- this.ID_RECT = "RECT";
1464
- this.FALLBACK_COLOUR = "#000000";
1465
- this.label = null;
1466
- this.dimensions = {
1467
- barLength: 0,
1468
- xPos: 0,
1469
- yPos: 0,
1470
- labelXPos: 0,
1471
- scenarioLabelXPos: 0,
1472
- scenarioLabelYPos: 0,
1473
- clipped: false,
1474
- };
1475
- this.hasData = false;
1476
- this.dataPoint = dataPoint;
1477
- this.index = index;
1478
- this.position = position;
1479
- this.barStyles = styles.barStyles;
1480
- this.scenarioGroup = scenarioGroup;
1481
- this.styles = styles;
1482
- this.barGroup = scenarioGroup.group().id(scenarioGroup.toString() + "_" + this.ID_RECT);
1483
- if ((dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.isEmpty()) !== true && dataPoint.value != null) {
1484
- this.hasData = true;
1485
- this.dimensions = this.createDimensions(position, dataPoint, index);
1486
- let textLabelHook = HookLocation.Left;
1487
- if (dataPoint.value < 0) {
1488
- textLabelHook = HookLocation.Right;
1489
- }
1490
- this.label = new Label(this.scenarioGroup, this.dimensions.labelXPos, this.dimensions.yPos, this.ID_DATA_PREFIX, dataPoint.value, this.styles, HookLocation.Center, textLabelHook);
1491
- this.label.setToRelativeVarianceLabel();
1492
- }
1493
- }
1494
- updateLabelGroup(newGroup) {
1495
- var _a;
1496
- if (this.isEmpty() || newGroup == null) {
1497
- return this;
1498
- }
1499
- (_a = this.label) === null || _a === void 0 ? void 0 : _a.updateGroup(newGroup);
1500
- return this;
1501
- }
1502
- draw() {
1503
- var _a;
1504
- if (this.isEmpty()) {
1505
- return this;
1506
- }
1507
- if (this.dimensions == null) {
1508
- return this;
1509
- }
1510
- // Needles always use varianceStyles (falls back to 'neu'); bars use barStyles (falls back to 'ac')
1511
- const scenarioStyle = this.styles.varianceStyles.getSVGStyle(this.dataPoint.getVarianceStyle());
1512
- const strokeStyle = scenarioStyle.stroke;
1513
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1514
- let fillStyle = scenarioStyle.fill;
1515
- const pattern = this.barStyles[this.dataPoint.getScenario()];
1516
- if (pattern != null && pattern.fillpattern) {
1517
- const polygonPattern = this.styles.pattern.get(pattern.fillpattern);
1518
- if (polygonPattern != null && polygonPattern.pattern != null) {
1519
- fillStyle = polygonPattern.pattern;
1520
- }
1521
- }
1522
- this.drawNeedleHead(fillStyle, strokeStyle);
1523
- this.barGroup
1524
- .rect(this.dimensions.barLength, this.position.getNeedleWidth())
1525
- .fill(fillStyle)
1526
- .stroke(strokeStyle)
1527
- .cy(this.dimensions.yPos)
1528
- .x(this.dimensions.xPos);
1529
- (_a = this.label) === null || _a === void 0 ? void 0 : _a.draw();
1530
- }
1531
- createDimensions(position, dataPoint, index) {
1532
- if (dataPoint.getScaledPercentUnit() < 0) {
1533
- return {
1534
- barLength: Math.abs(dataPoint.getScaledPercentUnit()),
1535
- xPos: position.getBarPositionX() + dataPoint.getScaledPercentUnit(),
1536
- yPos: position.getBarCenterPositionY(index),
1537
- labelXPos: this.position.getLabelPositionX(dataPoint.getScaledPercentUnit() - this.position.getNeedleWidth()),
1538
- clipped: dataPoint.isClipped(),
1539
- scenarioLabelXPos: 0,
1540
- scenarioLabelYPos: 0,
1541
- };
1542
- }
1543
- else {
1544
- return {
1545
- barLength: dataPoint.getScaledPercentUnit(),
1546
- xPos: position.getBarPositionX(),
1547
- yPos: position.getBarCenterPositionY(index),
1548
- labelXPos: this.position.getLabelPositionX(dataPoint.getScaledPercentUnit() + this.position.getNeedleWidth()),
1549
- clipped: dataPoint.isClipped(),
1550
- scenarioLabelXPos: 0,
1551
- scenarioLabelYPos: 0,
1552
- };
1553
- }
1554
- }
1555
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1556
- drawNeedleHead(fillStyle, strokeStyle) {
1557
- if (this.dimensions === null) {
1558
- return;
1559
- }
1560
- const strokeStyleHead = this.styles.varianceStyles.needleHeadColour;
1561
- const fillStyleHead = this.styles.varianceStyles.needleHeadColour;
1562
- if (this.dimensions.clipped) {
1563
- const LEFTARROW = "0,0 9,-5 9,5 0,0 5,0 13,-5 13,5 5,0";
1564
- const RIGHTARROW = "13,0 4,-5 4,5 13,0 8,0 0,-5 0,5 8,0";
1565
- let polygonPath = RIGHTARROW;
1566
- if (this.dataPoint.value != null && this.dataPoint.value < 0) {
1567
- polygonPath = LEFTARROW;
1568
- }
1569
- this.barGroup
1570
- .polygon(polygonPath)
1571
- .fill(fillStyle)
1572
- .cx(this.getHeadXPosition())
1573
- .cy(this.dimensions.yPos)
1574
- .fill(fillStyle)
1575
- .stroke(strokeStyle);
1576
- }
1577
- else {
1578
- this.barGroup
1579
- .rect(2 * this.position.getNeedleWidth(), 2 * this.position.getNeedleWidth())
1580
- .cx(this.getHeadXPosition())
1581
- .cy(this.dimensions.yPos)
1582
- .fill(strokeStyleHead)
1583
- .stroke(fillStyleHead);
1584
- }
1585
- }
1586
- isEmpty() {
1587
- return false === this.hasData || Number.isNaN(this.dataPoint.value);
1588
- }
1589
- getHeadXPosition() {
1590
- let xPosition = this.dimensions.xPos;
1591
- if (this.dataPoint.value != null && this.dataPoint.value > 0) {
1592
- xPosition += this.dimensions.barLength;
1593
- }
1594
- return xPosition;
1595
- }
1596
- }
1597
-
1598
- /**
1599
- * Renders a single horizontal stacked bar segment for the structure chart.
1600
- */
1601
- class StackedBar {
1602
- constructor(position, styles, dataPoint, index, baselineValue, _segmentLabel, segmentIndex, stackMode, totalValue, _isScenarioStack, parentGroup) {
1603
- this.hasData = false;
1604
- this.position = position;
1605
- this.styles = styles;
1606
- this.dataPoint = dataPoint;
1607
- this.index = index;
1608
- this.baselineValue = baselineValue;
1609
- this.segmentIndex = segmentIndex;
1610
- this.stackMode = stackMode;
1611
- this.totalValue = totalValue;
1612
- this.group = parentGroup;
1613
- this.barGroup = parentGroup.group().id(`stacked_bar_${index}_seg_${segmentIndex}`);
1614
- if ((dataPoint === null || dataPoint === void 0 ? void 0 : dataPoint.isEmpty()) !== true && dataPoint.value != null) {
1615
- this.hasData = true;
1616
- }
1617
- }
1618
- draw(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
1619
- if (!this.hasData || this.dataPoint.value == null) {
1620
- return;
1621
- }
1622
- const value = this.dataPoint.value;
1623
- const pixelPerUnit = this.dataPoint.pixelPerUnit;
1624
- const axisX = this.position.getBarPositionX();
1625
- const barWidth = this.position.getBarWidth();
1626
- let segmentLength;
1627
- let xPos;
1628
- if (this.stackMode === StackMode.RELATIVE) {
1629
- const proportion = this.totalValue !== 0 ? Math.abs(value) / Math.abs(this.totalValue) : 0;
1630
- const totalPixelLength = pixelPerUnit;
1631
- segmentLength = proportion * totalPixelLength;
1632
- const baselinePixels = (this.baselineValue / Math.abs(this.totalValue)) * totalPixelLength;
1633
- xPos = axisX + baselinePixels;
1634
- }
1635
- else {
1636
- segmentLength = Math.abs(value * pixelPerUnit);
1637
- const baselinePixels = this.baselineValue * pixelPerUnit;
1638
- xPos = axisX + baselinePixels;
1639
- }
1640
- const yPos = this.position.getBarPositionY(this.index, true);
1641
- // Unified IBCS 3-color palette for all stacking modes
1642
- const fillColor = getStackFill(this.segmentIndex);
1643
- const fillStyle = { color: fillColor };
1644
- const strokeStyle = { color: getStackStroke(this.segmentIndex), width: 0.5 };
1645
- this.barGroup.rect(Math.max(segmentLength, 0.5), barWidth).fill(fillStyle).stroke(strokeStyle).cy(yPos).x(xPos);
1646
- // Draw segment value label centered on bar if wide enough
1647
- const MIN_SEGMENT_WIDTH_FOR_LABEL = 30;
1648
- if (segmentLength >= MIN_SEGMENT_WIDTH_FOR_LABEL) {
1649
- const labelX = xPos + segmentLength / 2;
1650
- if (this.stackMode === StackMode.RELATIVE || this.stackMode === StackMode.ABSOLUTE_RELATIVE) {
1651
- const pct = this.totalValue !== 0 ? (value / this.totalValue) * 100 : 0;
1652
- const labelValue = pct.toFixed(dataFormatDigits.percent) + "%";
1653
- new Label(this.group, labelX, yPos, "STACK_SEG", labelValue, this.styles, HookLocation.Center, HookLocation.Center)
1654
- .setSegmentFill(fillColor)
1655
- .draw();
1656
- }
1657
- else {
1658
- // Pass raw numeric value — Label.draw() formats with measureScale
1659
- new Label(this.group, labelX, yPos, "STACK_SEG", value, this.styles, HookLocation.Center, HookLocation.Center)
1660
- .setSegmentFill(fillColor)
1661
- .draw(dataFormatDigits, measureScale);
1662
- }
1663
- }
1664
- }
1665
- drawTotalLabel(dataFormatDigits = { percent: 2, decimal: 1 }, measureScale = new SiPrefix()) {
1666
- if (this.stackMode === StackMode.RELATIVE) {
1667
- return;
1668
- }
1669
- const axisX = this.position.getBarPositionX();
1670
- const totalPixels = this.totalValue * this.dataPoint.pixelPerUnit;
1671
- const labelX = axisX + totalPixels + this.position.spacings.labelToBar;
1672
- const yPos = this.position.getBarPositionY(this.index, true);
1673
- const label = new Label(this.group, labelX, yPos, "STACK_TOTAL", this.totalValue, this.styles, HookLocation.Center, HookLocation.Left);
1674
- label.draw(dataFormatDigits, measureScale);
1675
- }
1676
- }
1677
-
1678
- // import { SVGPolgonPattern} from "../../../../utils/model";
1679
- /**
1680
- * Factory for creating horizontal bar chart elements (Bar, Needle, Marker) within the
1681
- * correct SVG group hierarchy for a structure chart.
1682
- *
1683
- * Manages 4 SVG group layers for z-ordering (back-to-front):
1684
- * - scenario2: secondary bars (PP) -- inserted before scenario1 so they render behind
1685
- * - scenario1: primary bars (AC) -- foreground
1686
- * - scenario3: primary markers (positioned above bar center)
1687
- * - scenario4: secondary markers (positioned below bar center)
1688
- * - scenario1Label: label group, always on top
1689
- *
1690
- * createPrimaryBar() / createSecondaryBar() produce foreground/background Bar instances.
1691
- * createVarianceBar() wraps a Bar with variance styling.
1692
- * createRelativeVarianceBar() creates a horizontal Needle for percentage variance.
1693
- */
1694
- class ScenarioFactory {
1695
- constructor(position, scenariosGroupParent, styles, elementCnt, i18n) {
1696
- this.overflowConfig = null;
1697
- this.i18n = i18n;
1698
- const primScenario = scenariosGroupParent.group().id("Scenario1");
1699
- const secondScenario = scenariosGroupParent.group().id("Scenario2").insertBefore(primScenario);
1700
- this.svgGroups = {
1701
- parent: scenariosGroupParent,
1702
- scenario1: primScenario,
1703
- scenario2: secondScenario,
1704
- scenario3: scenariosGroupParent.group().id("Scenario3"),
1705
- scenario4: scenariosGroupParent.group().id("Scenario4"),
1706
- scenario1Label: scenariosGroupParent.group().id("label"),
1707
- };
1708
- this.styles = styles;
1709
- this.position = position;
1710
- this.elementCnt = elementCnt;
1711
- }
1712
- setOverflowConfig(config) {
1713
- this.overflowConfig = config;
1714
- }
1715
- isLastDataPoint(index) {
1716
- return this.elementCnt - 1 === index;
1717
- }
1718
- isFirsttDataPoint(index) {
1719
- return 0 === index;
1720
- }
1721
- createPrimaryBar(dataPoint, index) {
1722
- var _a, _b, _c, _d;
1723
- const isPrimaryBar = true;
1724
- const barGroup = (_b = (_a = this.svgGroups) === null || _a === void 0 ? void 0 : _a.scenario1) === null || _b === void 0 ? void 0 : _b.group().id("" + index);
1725
- const labelGroup = (_d = (_c = this.svgGroups) === null || _c === void 0 ? void 0 : _c.scenario1Label) === null || _d === void 0 ? void 0 : _d.group().id("" + index);
1726
- let barLabel = null;
1727
- if (this.isLastDataPoint(index)) {
1728
- barLabel = `${this.i18n.get(dataPoint.scenario) || dataPoint.scenario}`;
1729
- }
1730
- return new Bar(this.position, this.styles, dataPoint, index, isPrimaryBar, barGroup, barLabel, this.overflowConfig).updateLabelGroup(labelGroup);
1731
- }
1732
- createVarianceBar(dataPoint, index) {
1733
- var _a, _b, _c, _d;
1734
- const isPrimaryBar = true;
1735
- const barGroup = (_b = (_a = this.svgGroups) === null || _a === void 0 ? void 0 : _a.scenario1) === null || _b === void 0 ? void 0 : _b.group().id("" + index);
1736
- const labelGroup = (_d = (_c = this.svgGroups) === null || _c === void 0 ? void 0 : _c.scenario1Label) === null || _d === void 0 ? void 0 : _d.group().id("" + index);
1737
- let barLabel = null;
1738
- if (this.isLastDataPoint(index)) {
1739
- barLabel = `${this.i18n.get(dataPoint.scenario) || dataPoint.scenario}`;
1740
- }
1741
- return new Bar(this.position, this.styles, dataPoint, index, isPrimaryBar, barGroup, barLabel, this.overflowConfig)
1742
- .updateLabelGroup(labelGroup)
1743
- .setAsVariance();
1744
- }
1745
- createRelativeVarianceBar(dataPoint, index) {
1746
- var _a, _b, _c, _d;
1747
- const barGroup = (_b = (_a = this.svgGroups) === null || _a === void 0 ? void 0 : _a.scenario1) === null || _b === void 0 ? void 0 : _b.group().id("" + index);
1748
- const labelGroup = (_d = (_c = this.svgGroups) === null || _c === void 0 ? void 0 : _c.scenario1Label) === null || _d === void 0 ? void 0 : _d.group().id("" + index);
1749
- return new Needle(this.position, this.styles, dataPoint, index, barGroup).updateLabelGroup(labelGroup);
1750
- }
1751
- createSecondaryBar(dataPoint, index) {
1752
- var _a, _b;
1753
- const barGroup = (_b = (_a = this.svgGroups) === null || _a === void 0 ? void 0 : _a.scenario2) === null || _b === void 0 ? void 0 : _b.group().id("" + index);
1754
- let barLabel = null;
1755
- if (this.isFirsttDataPoint(index)) {
1756
- barLabel = `${this.i18n.get(dataPoint.scenario) || dataPoint.scenario}`;
1757
- }
1758
- return new Bar(this.position, this.styles, dataPoint, index, false, barGroup, barLabel, this.overflowConfig);
1759
- }
1760
- createPrimaryMarker(dataPoint, index) {
1761
- var _a, _b;
1762
- const markerGroup = (_b = (_a = this.svgGroups) === null || _a === void 0 ? void 0 : _a.scenario3) === null || _b === void 0 ? void 0 : _b.group().id("" + index);
1763
- const markerPattern = this.styles.pattern.get("marker-down") || {
1764
- foreground: "0,0 1,0 1,1 0,1",
1765
- background: "0,0 1,0 1,1 0,1",
1766
- bgOffset: 0,
1767
- };
1768
- const isPrimaryMarker = true;
1769
- let labelText = null;
1770
- if (this.isFirstDataPoint(index)) {
1771
- labelText = `${this.i18n.get(dataPoint.scenario) || dataPoint.scenario}`;
1772
- }
1773
- return new Marker(this.position, markerGroup, markerPattern, dataPoint.scenario, this.styles, dataPoint, index, labelText, isPrimaryMarker);
1774
- }
1775
- createSecondaryMarker(dataPoint, index) {
1776
- var _a, _b;
1777
- const markerGroup = (_b = (_a = this.svgGroups) === null || _a === void 0 ? void 0 : _a.scenario4) === null || _b === void 0 ? void 0 : _b.group().id("" + index);
1778
- const markerPattern = this.styles.pattern.get("marker-up") || {
1779
- foreground: "0,0 1,0 1,1 0,1",
1780
- background: "0,0 1,0 1,1 0,1",
1781
- bgOffset: 0,
1782
- };
1783
- const isPrimaryMarker = false;
1784
- let labelText = null;
1785
- if (this.isLastDataPoint(index)) {
1786
- labelText = `${this.i18n.get(dataPoint.scenario) || dataPoint.scenario}`;
1787
- }
1788
- return new Marker(this.position, markerGroup, markerPattern, dataPoint.scenario, this.styles, dataPoint, index, labelText, isPrimaryMarker);
1789
- }
1790
- isFirstDataPoint(index) {
1791
- return 0 === index;
1792
- }
1793
- }
1794
-
1795
- /**
1796
- * Orchestrates the full rendering pipeline for an IBCS structure (categorical) chart.
1797
- *
1798
- * Rendering pipeline (in draw()):
1799
- * 1. Clears the SVG container
1800
- * 2. Routes to the appropriate drawing method:
1801
- * - Variance chart: drawVarianceScenario() for absolute/relative variance bars
1802
- * - Stacked chart: drawStackedScenarios() + drawStackedHeaders()
1803
- * - Standard chart: drawScenarios() with primary/secondary bars and markers
1804
- * 3. Draws vertical axis + category labels via drawAxisAndLabels()
1805
- *
1806
- * Data pipeline (in setConfig()):
1807
- * 1. Raw data is filtered via AlaSQL
1808
- * 2. Categories are aggregated (GROUP BY) with operation-sign-aware SUM
1809
- * 3. Optional limit + REST row aggregation for top-N display
1810
- * 4. Variance model is computed from base/delta scenario pairs
1811
- * 5. Min/max DataPoints drive the coordinate system sizing
1812
- *
1813
- * Overflow handling: setAvailableWidth() can enable broken-bar rendering
1814
- * when bars exceed the container width.
1815
- */
1816
- class StructureChart {
1817
- constructor(ruleSet, config, styles) {
1818
- this.dataModel = [];
1819
- this.variancesDataModel = [];
1820
- this.title = "";
1821
- this.smallestDataPointValue = new DataPoint(0, Scenario.AC1, 1, Scenario.NEU);
1822
- this.highestDataPointValue = new DataPoint(0, Scenario.AC1, 1, Scenario.NEU);
1823
- this.smallestVarianceDataPointValue = new DataPoint(0, Scenario.AC1, 1, Scenario.NEU);
1824
- this.highestVarianceDataPointValue = new DataPoint(0, Scenario.AC1, 1, Scenario.NEU);
1825
- this.pixelPerUnit = 1;
1826
- this.pixelPerPercentage = 1;
1827
- this.hideCategories = false;
1828
- this.axisScenario = Scenario.AC1;
1829
- this.CSS_CATEGORIES = "categories";
1830
- this.preparedDataSet = [];
1831
- this.state = FactoryState.DIRTY;
1832
- this.titleLength = 0;
1833
- this.leftSideOffsetForHorizontalSync = 0;
1834
- this.limit = 0;
1835
- this.measureScale = new SiPrefix();
1836
- this.measureUnit = "";
1837
- this.dataFormatDigits = { percent: 2, decimal: 1 };
1838
- this.stackConfig = null;
1839
- this.overflowConfig = null;
1840
- this.initSQLFunctions();
1841
- this.ruleSet = ruleSet || new IBCSRuleSet();
1842
- this.i18n = this.createI18n(new Map());
1843
- this.styles = styles;
1844
- this.setConfig(config);
1845
- this.position = this.createElementPosition();
1846
- }
1847
- updatePosition() {
1848
- this.position = this.createElementPosition();
1849
- }
1850
- createElementPosition() {
1851
- this.titleLength = this.calculateTitleLength(0);
1852
- let leftSideWidth = this.calculateLeftSideWidth(this.getVarianceType());
1853
- const categoryWidth = this.calculateCategoryWidth();
1854
- if (this.titleLength > leftSideWidth) {
1855
- leftSideWidth = this.titleLength;
1856
- }
1857
- return new ElementPositions(new Padding(this.styles.padding), this.styles.scaleFactors, this.styles.fontStyles.size, this.dataModel.length, this.leftSideOffsetForHorizontalSync, this.titleLength, leftSideWidth, categoryWidth);
1858
- }
1859
- initSQLFunctions() {
1860
- alasql.fn.transformOperator = function (a) {
1861
- return a === "-" ? -1 : 1;
1862
- };
1863
- }
1864
- setStyles(newStyle) {
1865
- this.styles = newStyle;
1866
- }
1867
- setConfig(config) {
1868
- var _a;
1869
- this.state = FactoryState.DIRTY;
1870
- this.sortScenariosbyVisualisationRules(config);
1871
- this.hideCategories = config.hideCategories || false;
1872
- this.limit = config.limit;
1873
- this.pixelPerUnit = config.pixelPerUnit || 1;
1874
- this.pixelPerPercentage = config.pixelPerPercentage || 100;
1875
- this.setData([...config.data], config.filter);
1876
- this.dataModel = this.populateModel(config.scenarios, config.level, config.sortOrder);
1877
- // Populate per-dimension stack segments when stacking by a data dimension
1878
- if (config.stackConfig && config.stackConfig.by !== StackBy.SCENARIO) {
1879
- this.populateDimensionStackSegments(config.scenarios, config.stackConfig, config.level);
1880
- }
1881
- this.variancesDataModel = this.populateVarianceModel(config.variances, this.dataModel);
1882
- 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);
1883
- this.smallestDataPointValue = this.findSmallestDataPointValue(this.dataModel);
1884
- this.smallestVarianceDataPointValue = this.findSmallestDataPointValue(this.variancesDataModel);
1885
- this.highestDataPointValue = this.findHighestDataPointValue(this.dataModel);
1886
- this.highestVarianceDataPointValue = this.findHighestDataPointValue(this.variancesDataModel);
1887
- this.axisScenario = this.setAxisScenario(config.variances);
1888
- this.measureScale = config.measureScale;
1889
- this.measureUnit = config.measureUnit;
1890
- this.dataFormatDigits = config.dataFormatDigits;
1891
- this.stackConfig = config.stackConfig;
1892
- this.updatePosition();
1893
- }
1894
- sortScenariosbyVisualisationRules(config) {
1895
- const self = this;
1896
- config.scenarios
1897
- .sort((n1, n2) => {
1898
- return self.ruleSet.getScenarioSorIndex(n1) - self.ruleSet.getScenarioSorIndex(n2);
1899
- })
1900
- .reverse();
1901
- }
1902
- /**
1903
- * Init load of translation dictionary map
1904
- * map is used to translate lables in the table
1905
- *
1906
- * example:
1907
- * ```
1908
- * let i18n: Map<string, string> = new Map();
1909
- * [{key: 'ac',value: 'AC'}].forEach(function(entry){
1910
- * i18n.set(entry.key, entry.value);
1911
- * })
1912
- * ```
1913
- * @param i18n
1914
- */
1915
- setI18n(i18n) {
1916
- this.i18n = this.createI18n(i18n);
1917
- }
1918
- createI18n(i18n) {
1919
- this.state = FactoryState.DIRTY;
1920
- const defaultI18n = new Map([
1921
- ["SEPERATOR_WS", ", "],
1922
- ["in", "in"],
1923
- ["ORDER_asc", "↑"],
1924
- ["ORDER_desc", "↓"],
1925
- ["ac1", "AC"],
1926
- ["pp1", "PY"],
1927
- ["fc1", "FC"],
1928
- ["pl1", "PL"],
1929
- ["ac2", "AC2"],
1930
- ["pp2", "PY2"],
1931
- ["fc2", "FC2"],
1932
- ["pl2", "PL2"],
1933
- ["ac3", "AC3"],
1934
- ["pp3", "PY3"],
1935
- ["fc3", "FC3"],
1936
- ["pl3", "PL3"],
1937
- ["ac4", "AC4"],
1938
- ["pp4", "PY4"],
1939
- ["fc4", "FC4"],
1940
- ["pl4", "PL4"],
1941
- ["category", " "],
1942
- ["operation", " "],
1943
- ["there_of", "davon"],
1944
- ["part_of", "in % von"],
1945
- ["ibcssymbol_delta_ac", "Δ{%}"],
1946
- ["ibcssymbol_delta_generic", "Δ({%})"],
1947
- ["ibcssymbol_delta_ac_relative", "Δ{%}%"],
1948
- ["ibcssymbol_delta_generic_relative", "Δ({%})%"],
1949
- ["SUM_TOTAL", "❖"],
1950
- ]);
1951
- return new Map([...defaultI18n, ...i18n]);
1952
- }
1953
- /**
1954
- * Init load raw datasets the loaded dataset is
1955
- * the base on which the filters defined in the config
1956
- * are apllied on internaly it is called prepared DataSet
1957
- *
1958
- * @param data
1959
- * @param filter - data filter
1960
- * @param customColumnNameMap Custon ColumnNameMap can be used if data uses non standard columnames
1961
- */
1962
- setData(data, filter) {
1963
- if (data == null) {
1964
- return;
1965
- }
1966
- this.state = FactoryState.DIRTY; // mark dataSet for update
1967
- this.preparedDataSet.length = 0; // cleans formerly loaded and prepared dataset
1968
- if (filter != null && filter.length > 0) {
1969
- try {
1970
- this.preparedDataSet = alasql(`SELECT * FROM ? WHERE ${filter}`, [data]);
1971
- }
1972
- catch (e) {
1973
- console.error("StructureChart: filter query failed, using unfiltered data", filter, e);
1974
- this.preparedDataSet = data;
1975
- }
1976
- }
1977
- else {
1978
- this.preparedDataSet = data;
1979
- }
1980
- }
1981
- getAllocatedCanvasWidth() {
1982
- //let columnLabelWidth = this.calculateCategoryWidth();
1983
- const leftSideWidth = this.position.getAxisPositionX(); //this.calculateLeftSideWidth(this.getVarianceType());
1984
- const rightSideWidth = this.calculateRightSideWidth(this.getVarianceType());
1985
- let width = leftSideWidth + rightSideWidth + +this.styles.padding.left + this.styles.padding.right;
1986
- if (rightSideWidth < this.titleLength / 2) {
1987
- width += this.titleLength / 2;
1988
- }
1989
- if (leftSideWidth < this.titleLength / 2) {
1990
- width += this.titleLength / 2;
1991
- }
1992
- return width;
1993
- }
1994
- getAllocatedCanvasHeight() {
1995
- return ((this.dataModel.length + 1) * this.position.spacings.categoryWidth +
1996
- this.styles.padding.top +
1997
- this.styles.padding.bottom);
1998
- }
1999
- patternToString() {
2000
- return "<svg></svg>";
2001
- }
2002
- toString() {
2003
- const container = new Svg();
2004
- this.draw(container);
2005
- container.id("drawCanvas");
2006
- container.width(this.getAllocatedCanvasWidth());
2007
- container.height(this.getAllocatedCanvasHeight());
2008
- return container.svg();
2009
- }
2010
- draw(svgContainer) {
2011
- this.cleanSVGforRedraw(svgContainer);
2012
- if (this.state === FactoryState.DIRTY) {
2013
- this.state = FactoryState.UP_TO_DATE;
2014
- }
2015
- if (this.variancesDataModel && this.variancesDataModel.length > 0) {
2016
- this.drawVarianceScenario(this.variancesDataModel, svgContainer);
2017
- this.drawAxisAndLabels(this.variancesDataModel, svgContainer);
2018
- }
2019
- else if (this.stackConfig != null) {
2020
- this.drawStackedScenarios(this.dataModel, svgContainer);
2021
- this.drawStackedHeaders(this.dataModel, svgContainer);
2022
- this.drawAxisAndLabels(this.dataModel, svgContainer);
2023
- }
2024
- else {
2025
- this.drawScenarios(this.dataModel, svgContainer);
2026
- this.drawAxisAndLabels(this.dataModel, svgContainer);
2027
- }
2028
- }
2029
- setPattern(fc, fcPolygonPattern) {
2030
- this.styles.pattern.set(fc, fcPolygonPattern);
2031
- }
2032
- calculateTitleLength(minWidth) {
2033
- const tmpTitle = "_______"; // default width if this.title is sorther
2034
- const width = CalculateSize(this.title.length > tmpTitle.length ? this.title : tmpTitle, {
2035
- font: this.styles.fontStyles.font,
2036
- fontSize: this.styles.fontStyles.size + "px",
2037
- }).width;
2038
- if (width < minWidth) {
2039
- return minWidth;
2040
- }
2041
- return width / 2;
2042
- }
2043
- getFooter() {
2044
- if (this.measureScale.value === 1 && this.measureUnit === "") {
2045
- return " ";
2046
- }
2047
- return Formatter.translateScenarioLabel("in", this.i18n) + " " + this.measureScale.prefix + this.measureUnit;
2048
- }
2049
- setAxisScenario(scenarios) {
2050
- let result = Scenario.AC1;
2051
- if (scenarios != null && scenarios.length > 0) {
2052
- const axis = new VarianceScenario(scenarios.toString());
2053
- if (axis.isValid) {
2054
- result = axis.delta;
2055
- }
2056
- }
2057
- if (result === null) {
2058
- // arrays with invalid scenarios are set to Senario.AC Fallback
2059
- result = Scenario.AC1;
2060
- }
2061
- return result;
2062
- }
2063
- populateModel(selectedScenarios, level, sortOrder) {
2064
- var _a;
2065
- if (((_a = this.preparedDataSet) === null || _a === void 0 ? void 0 : _a.length) === 0) {
2066
- return [];
2067
- }
2068
- const dataModel = [];
2069
- const orderStr = this.createOrderStr(level, sortOrder);
2070
- const select = this.createSelectString(level, sortOrder);
2071
- const groupByStr = this.createGroupByStr(level, sortOrder);
2072
- const result = alasql(`SELECT ${select} ${selectedScenarios.length > 0
2073
- ? "," +
2074
- selectedScenarios
2075
- .map((scenario) => {
2076
- return `SUM(${scenario} * transformOperator(operation)) as ${scenario}, COUNT(ISNULL(${scenario})) as ${scenario}_cnt`;
2077
- })
2078
- .join(",")
2079
- : ""}
2080
- FROM ?
2081
- GROUP BY ${groupByStr}
2082
- ORDER BY ${orderStr}`, [this.preparedDataSet]);
2083
- this.detectNaNCells(selectedScenarios, result);
2084
- this.createDataRows(result, dataModel, selectedScenarios);
2085
- this.crateRESTRow(result, selectedScenarios, dataModel);
2086
- return dataModel;
2087
- }
2088
- detectNaNCells(scenarios, res) {
2089
- res.forEach((row) => {
2090
- scenarios.forEach((scenario) => {
2091
- const varianceScenario = new VarianceScenario(scenario);
2092
- if (varianceScenario.isValid === true) {
2093
- if (row[varianceScenario.base + "_cnt"] === 0 || row[varianceScenario.delta + "_cnt"] === 0) {
2094
- row[scenario] = Number.NaN;
2095
- }
2096
- }
2097
- else {
2098
- if (row[scenario + "_cnt"] === 0) {
2099
- row[scenario] = Number.NaN;
2100
- }
2101
- }
2102
- });
2103
- return row;
2104
- });
2105
- }
2106
- crateRESTRow(result, selectedScenarios, dataModel) {
2107
- if (this.limit === 0 || this.limit > result.length) {
2108
- return;
2109
- }
2110
- const restDataModel = [];
2111
- const restResult = result.slice(this.limit, result.length);
2112
- this.createDataRows(restResult, restDataModel, selectedScenarios);
2113
- const reducedRestRow = restDataModel.reduce(function (sum, current) {
2114
- const obj = {
2115
- id: sum.id,
2116
- category: sum.category,
2117
- type: sum.type,
2118
- scenario1: new DataPoint(sum.scenario1.value + current.scenario1.value, selectedScenarios[0], sum.scenario1.pixelPerUnit, Scenario.NEU),
2119
- scenario2: new DataPoint(sum.scenario2.value + current.scenario2.value, selectedScenarios[1], sum.scenario2.pixelPerUnit, Scenario.NEU),
2120
- scenario3: new DataPoint(sum.scenario3.value + current.scenario3.value, selectedScenarios[2], sum.scenario3.pixelPerUnit, Scenario.NEU),
2121
- scenario4: new DataPoint(sum.scenario4.value + current.scenario4.value, selectedScenarios[3], sum.scenario4.pixelPerUnit, Scenario.NEU),
2122
- };
2123
- return obj;
2124
- }, {
2125
- id: 9999,
2126
- category: "REST",
2127
- type: VarianceType.NONE,
2128
- scenario1: new DataPoint(0, selectedScenarios[0], this.pixelPerUnit, Scenario.NEU),
2129
- scenario2: new DataPoint(0, selectedScenarios[1], this.pixelPerUnit, Scenario.NEU),
2130
- scenario3: new DataPoint(0, selectedScenarios[2], this.pixelPerUnit, Scenario.NEU),
2131
- scenario4: new DataPoint(0, selectedScenarios[3], this.pixelPerUnit, Scenario.NEU),
2132
- });
2133
- dataModel.push(reducedRestRow);
2134
- }
2135
- createDataRows(result, dataModel, selectedScenarios) {
2136
- let primaryResult = result;
2137
- if (this.limit > 0) {
2138
- primaryResult = result.slice(0, this.limit);
2139
- }
2140
- primaryResult.forEach((element, index) => {
2141
- dataModel.push({
2142
- id: index,
2143
- category: element.category,
2144
- type: VarianceType.NONE,
2145
- scenario1: new DataPoint(element[selectedScenarios[0]], selectedScenarios[0], this.pixelPerUnit, Scenario.NEU),
2146
- scenario2: new DataPoint(element[selectedScenarios[1]], selectedScenarios[1], this.pixelPerUnit, Scenario.NEU),
2147
- scenario3: new DataPoint(element[selectedScenarios[2]], selectedScenarios[2], this.pixelPerUnit, Scenario.NEU),
2148
- scenario4: new DataPoint(element[selectedScenarios[3]], selectedScenarios[3], this.pixelPerUnit, Scenario.NEU),
2149
- });
2150
- });
2151
- }
2152
- createOrderStr(level, sortOrder) {
2153
- let orderStr = `${level.toLowerCase()}`;
2154
- if (sortOrder.hierarchy.length >= 1) {
2155
- orderStr = `${sortOrder.hierarchy.toString()} ${sortOrder === null || sortOrder === void 0 ? void 0 : sortOrder.direction}`;
2156
- }
2157
- return orderStr;
2158
- }
2159
- createSelectString(level, sortOrder) {
2160
- if (level === AggregationLevel.CATEGORY && sortOrder.hierarchy.includes(OrderColumn.CATEGORYINDEX)) {
2161
- return `${OrderColumn.CATEGORYINDEX}, ${AggregationLevel.CATEGORY} as category`;
2162
- }
2163
- else if (level === AggregationLevel.ROWGROUP && sortOrder.hierarchy.includes(OrderColumn.ROWGROUPINDEX)) {
2164
- return `${OrderColumn.ROWGROUPINDEX}, ${AggregationLevel.ROWGROUP} as category`;
2165
- }
2166
- else if (level === AggregationLevel.SUBCATEGORY && sortOrder.hierarchy.includes(OrderColumn.SUBCATEGORYINDEX)) {
2167
- return `${OrderColumn.SUBCATEGORYINDEX}, ${AggregationLevel.SUBCATEGORY} as category`;
2168
- }
2169
- else {
2170
- return `${level.toString()} as category`;
2171
- }
2172
- }
2173
- createGroupByStr(level, sortOrder) {
2174
- if (level === AggregationLevel.CATEGORY && sortOrder.hierarchy.includes(OrderColumn.CATEGORYINDEX)) {
2175
- return `${OrderColumn.CATEGORYINDEX}, ${AggregationLevel.CATEGORY}`;
2176
- }
2177
- else if (level === AggregationLevel.ROWGROUP && sortOrder.hierarchy.includes(OrderColumn.ROWGROUPINDEX)) {
2178
- return `${OrderColumn.ROWGROUPINDEX}, ${AggregationLevel.ROWGROUP}`;
2179
- }
2180
- else if (level === AggregationLevel.SUBCATEGORY && sortOrder.hierarchy.includes(OrderColumn.SUBCATEGORYINDEX)) {
2181
- return `${OrderColumn.SUBCATEGORYINDEX}, ${AggregationLevel.SUBCATEGORY}`;
2182
- }
2183
- else {
2184
- return `${level.toString()}`;
2185
- }
2186
- }
2187
- calculateCategoryWidth() {
2188
- if (this.hideCategories) {
2189
- return 5;
2190
- }
2191
- let longestLength = 0;
2192
- for (const entry of this.dataModel) {
2193
- const columnLength = CalculateSize(entry.category, {
2194
- font: this.styles.fontStyles.font,
2195
- fontSize: this.styles.fontStyles.size + "px",
2196
- });
2197
- if (columnLength.width > longestLength) {
2198
- longestLength = columnLength.width;
2199
- }
2200
- }
2201
- // MagicNumber used to compensate differnet fontwidth rendered vs calculated
2202
- const magicNumber = 1.1125;
2203
- return longestLength * magicNumber;
2204
- }
2205
- findSmallestDataPointValue(dataModel) {
2206
- let smallestDataPoint = new DataPoint(0, "default", this.pixelPerUnit, null);
2207
- for (const entry of dataModel) {
2208
- for (const current of [entry.scenario1, entry.scenario2, entry.scenario3, entry.scenario4]) {
2209
- if (current != null && smallestDataPoint.value != null) {
2210
- if (current.value < smallestDataPoint.value) {
2211
- smallestDataPoint = current;
2212
- }
2213
- }
2214
- }
2215
- }
2216
- return smallestDataPoint;
2217
- }
2218
- findHighestDataPointValue(dataModel) {
2219
- let highestDataPoint = new DataPoint(0, "default", this.pixelPerUnit, null);
2220
- for (const entry of dataModel) {
2221
- for (const current of [entry.scenario1, entry.scenario2, entry.scenario3, entry.scenario4]) {
2222
- if (current != null && highestDataPoint.value != null) {
2223
- if (current.value > highestDataPoint.value) {
2224
- highestDataPoint = current;
2225
- }
2226
- }
2227
- }
2228
- }
2229
- return highestDataPoint;
2230
- }
2231
- populateVarianceModel(variancesConfig, dataModel) {
2232
- const varianceModel = [];
2233
- if (variancesConfig.length === 0) {
2234
- return varianceModel;
2235
- }
2236
- let firstRow = null;
2237
- if (dataModel != null && dataModel.length > 0) {
2238
- firstRow = dataModel[0];
2239
- }
2240
- for (const varianceScenario in variancesConfig) {
2241
- const scenarios = new VarianceScenario(variancesConfig[varianceScenario]);
2242
- if (scenarios.isValid) {
2243
- const scenariomap = this.mapScenarios(scenarios, firstRow);
2244
- const directon = scenarios.direction;
2245
- let pixelPerUnit = this.pixelPerUnit;
2246
- if (scenarios.type === "dr") {
2247
- pixelPerUnit = this.pixelPerPercentage;
2248
- }
2249
- for (const index in dataModel) {
2250
- varianceModel.push({
2251
- id: Number(index),
2252
- category: dataModel[index].category,
2253
- type: scenarios.type === "dr" ? VarianceType.RELATIVE : VarianceType.ABSOLUTE,
2254
- scenario1: new DataPoint(this.calculateVariance(scenarios, dataModel[index], scenariomap), scenarios.base, pixelPerUnit, directon),
2255
- scenario2: new DataPoint(null, null, null, null),
2256
- scenario3: new DataPoint(null, null, null, null),
2257
- scenario4: new DataPoint(null, null, null, null),
2258
- });
2259
- }
2260
- }
2261
- }
2262
- return varianceModel;
2263
- }
2264
- calculateVariance(scenarios, element, scenarioMap) {
2265
- const scenarioBase = scenarioMap.get(scenarios.base);
2266
- const scenarioDelta = scenarioMap.get(scenarios.delta);
2267
- if (scenarioBase == null || scenarioDelta == null) {
2268
- return null;
2269
- }
2270
- const isRelativeVarianze = scenarios.type === VarianceType.RELATIVE;
2271
- if (isRelativeVarianze) {
2272
- return (element[scenarioBase].value - element[scenarioDelta].value) / element[scenarioDelta].value;
2273
- }
2274
- else {
2275
- return element[scenarioBase].value - element[scenarioDelta].value;
2276
- }
2277
- }
2278
- mapScenarios(scenarios, firstRow) {
2279
- const varianceMap = new Map();
2280
- if (firstRow == null) {
2281
- return varianceMap;
2282
- }
2283
- ["scenario1", "scenario2", "scenario3", "scenario4"].forEach((scenarioKey) => {
2284
- if (firstRow[scenarioKey].scenario === scenarios.delta) {
2285
- varianceMap.set(scenarios.delta, scenarioKey);
2286
- }
2287
- else if (firstRow[scenarioKey].scenario === scenarios.base) {
2288
- varianceMap.set(scenarios.base, scenarioKey);
2289
- }
2290
- });
2291
- return varianceMap;
2292
- }
2293
- calculateTextBoxWidth(value) {
2294
- return CalculateSize(Formatter.number(value, "decimal", 1, 0), {
2295
- font: this.styles.fontStyles.font,
2296
- fontSize: this.styles.fontStyles.size + "px",
2297
- }).width;
2298
- }
2299
- calculatePercentageTextBoxWidth(value) {
2300
- let signWidth = 0;
2301
- if (value >= 0) {
2302
- signWidth += CalculateSize("+", {
2303
- font: this.styles.fontStyles.font,
2304
- fontSize: this.styles.fontStyles.size + "px",
2305
- }).width;
2306
- }
2307
- signWidth += CalculateSize(" %", {
2308
- font: this.styles.fontStyles.font,
2309
- fontSize: this.styles.fontStyles.size + "px",
2310
- }).width;
2311
- const labelWidth = CalculateSize(Formatter.number(value, "decimal", 1, 1), {
2312
- font: this.styles.fontStyles.font,
2313
- fontSize: this.styles.fontStyles.size + "px",
2314
- }).width + signWidth;
2315
- return labelWidth + signWidth;
2316
- }
2317
- cleanSVGforRedraw(svgContainer) {
2318
- svgContainer.clear();
2319
- }
2320
- drawAxisAndLabels(dataModel, svgContainer) {
2321
- const axisLabelGroup = svgContainer.group().id("AxisAndDateLables");
2322
- let isRelative = false;
2323
- if (!this.hideCategories) {
2324
- dataModel.forEach((elements, index) => {
2325
- if (elements["type"] === VarianceType.RELATIVE) {
2326
- isRelative = true;
2327
- }
2328
- let textHook = HookLocation.Right;
2329
- let isPositive = true;
2330
- if (elements["scenario1"].value < 0) {
2331
- textHook = HookLocation.Left;
2332
- isPositive = false;
2333
- }
2334
- new Label(axisLabelGroup, this.position.getCategoryPositionX(isPositive), this.position.getBarCenterPositionY(index), "", elements.category, this.styles, HookLocation.Center, textHook).draw();
2335
- });
2336
- }
2337
- new Axis({
2338
- scenarioType: this.axisScenario,
2339
- labelText: this.title,
2340
- isRelative: isRelative,
2341
- }, this.position, axisLabelGroup, this.styles).draw();
2342
- }
2343
- drawScenarios(dataModel, svgContainer) {
2344
- const barsGroup = svgContainer.group().id("Scenarios");
2345
- const scenarioFactory = new ScenarioFactory(this.position, barsGroup, this.styles, dataModel.length, this.i18n);
2346
- scenarioFactory.setOverflowConfig(this.overflowConfig);
2347
- dataModel.forEach((elements, index) => {
2348
- scenarioFactory.createPrimaryBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
2349
- scenarioFactory.createSecondaryBar(elements["scenario2"], index).draw();
2350
- scenarioFactory.createPrimaryMarker(elements["scenario3"], index).draw();
2351
- scenarioFactory.createSecondaryMarker(elements["scenario4"], index).draw();
2352
- });
2353
- }
2354
- drawVarianceScenario(dataModel, svgContainer) {
2355
- const barsGroup = svgContainer.group().id("Scenarios");
2356
- const scenarioFactory = new ScenarioFactory(this.position, barsGroup, this.styles, dataModel.length, this.i18n);
2357
- scenarioFactory.setOverflowConfig(this.overflowConfig);
2358
- dataModel.forEach((elements, index) => {
2359
- if (elements["type"] === VarianceType.RELATIVE) {
2360
- scenarioFactory.createRelativeVarianceBar(elements["scenario1"], index).draw();
2361
- }
2362
- else {
2363
- scenarioFactory.createVarianceBar(elements["scenario1"], index).draw(this.dataFormatDigits, this.measureScale);
2364
- }
2365
- });
2366
- return barsGroup;
2367
- }
2368
- /**
2369
- * Draw stacked horizontal bars. Supports stacking by scenario or by data dimension.
2370
- * When stacking by scenario with multiple scenario types (e.g. ac+pl),
2371
- * uses overlay mode: each type group is drawn from the same baseline,
2372
- * back-to-front per IBCS convention (PL behind, AC on top).
2373
- */
2374
- drawStackedScenarios(dataModel, svgContainer) {
2375
- if (!this.stackConfig)
2376
- return;
2377
- const stackGroup = svgContainer.group().id("StackedScenarios");
2378
- const isScenarioStack = this.stackConfig.by === StackBy.SCENARIO;
2379
- dataModel.forEach((elements, index) => {
2380
- const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
2381
- const segments = [];
2382
- if (isScenarioStack) {
2383
- for (const key of scenarioKeys) {
2384
- const dp = elements[key];
2385
- if (dp && !dp.isEmpty() && dp.value != null) {
2386
- segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
2387
- }
2388
- }
2389
- }
2390
- else {
2391
- const dp = elements["scenario1"];
2392
- if (dp && !dp.isEmpty() && dp.value != null) {
2393
- segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
2394
- }
2395
- }
2396
- if (segments.length === 0)
2397
- return;
2398
- // Check if we have multiple scenario type groups for overlay mode
2399
- const prefixes = isScenarioStack
2400
- ? new Set(segments.map((s) => getScenarioPrefix(s.scenario)))
2401
- : new Set();
2402
- if (prefixes.size > 1) {
2403
- // Overlay mode: group by scenario prefix, draw each group from same baseline
2404
- const groupMap = new Map();
2405
- for (const seg of segments) {
2406
- const prefix = getScenarioPrefix(seg.scenario);
2407
- if (!groupMap.has(prefix))
2408
- groupMap.set(prefix, []);
2409
- groupMap.get(prefix).push(seg);
2410
- }
2411
- // Sort groups by IBCS layer order (back-to-front: pl, fc, pp, ac)
2412
- const groups = [];
2413
- for (const prefix of IBCS_LAYER_ORDER) {
2414
- if (groupMap.has(prefix)) {
2415
- groups.push({ prefix, segments: groupMap.get(prefix) });
2416
- groupMap.delete(prefix);
2417
- }
2418
- }
2419
- for (const [prefix, segs] of groupMap) {
2420
- groups.push({ prefix, segments: segs });
2421
- }
2422
- // Draw each group from baseline=0 (overlapping)
2423
- groups.forEach((group, groupIdx) => {
2424
- const groupTotal = group.segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
2425
- const colorIndex = groups.length - 1 - groupIdx; // back=lighter, front=darker
2426
- let cumulativeValue = 0;
2427
- let lastBar = null;
2428
- group.segments.forEach((seg) => {
2429
- const bar = new StackedBar(this.position, this.styles, seg.dataPoint, index, cumulativeValue, seg.scenario, colorIndex, this.stackConfig.mode, groupTotal, true, stackGroup);
2430
- bar.draw(this.dataFormatDigits, this.measureScale);
2431
- cumulativeValue += Math.abs(seg.value);
2432
- lastBar = bar;
2433
- });
2434
- if (lastBar) {
2435
- lastBar.drawTotalLabel(this.dataFormatDigits, this.measureScale);
2436
- }
2437
- });
2438
- }
2439
- else {
2440
- // Single group, scenario or dimension stacking
2441
- // For dimension stacking, use stackSegments if available
2442
- let finalSegments = segments;
2443
- if (!isScenarioStack && elements.stackSegments && elements.stackSegments.length > 0) {
2444
- finalSegments = elements.stackSegments.map((seg) => ({
2445
- value: seg.value,
2446
- scenario: seg.label,
2447
- dataPoint: seg.dataPoint,
2448
- }));
2449
- }
2450
- if (this.stackConfig.order === "asc") {
2451
- finalSegments.sort((a, b) => a.value - b.value);
2452
- }
2453
- else if (this.stackConfig.order === "desc") {
2454
- finalSegments.sort((a, b) => b.value - a.value);
2455
- }
2456
- const total = finalSegments.reduce((sum, s) => sum + Math.abs(s.value), 0);
2457
- let cumulativeValue = 0;
2458
- let lastBar = null;
2459
- finalSegments.forEach((seg, segIdx) => {
2460
- const bar = new StackedBar(this.position, this.styles, seg.dataPoint, index, cumulativeValue, seg.scenario, segIdx, this.stackConfig.mode, total, isScenarioStack, stackGroup);
2461
- bar.draw(this.dataFormatDigits, this.measureScale);
2462
- cumulativeValue += Math.abs(seg.value);
2463
- lastBar = bar;
2464
- });
2465
- if (lastBar) {
2466
- lastBar.drawTotalLabel(this.dataFormatDigits, this.measureScale);
2467
- }
2468
- }
2469
- });
2470
- }
2471
- /**
2472
- * Draw column headers above stacked bars showing what each segment/group represents.
2473
- * For overlay mode (multiple scenario types): shows one header per group.
2474
- * For single-group scenario stacking: shows individual segment headers.
2475
- */
2476
- drawStackedHeaders(dataModel, svgContainer) {
2477
- if (!this.stackConfig || dataModel.length === 0)
2478
- return;
2479
- const isScenarioStack = this.stackConfig.by === StackBy.SCENARIO;
2480
- const headerGroup = svgContainer.group().id("StackedHeaders");
2481
- const firstRow = dataModel[0];
2482
- // Dimension stacking: use stackSegments from first row for headers
2483
- if (!isScenarioStack) {
2484
- const stackSegs = firstRow.stackSegments;
2485
- if (!stackSegs || stackSegs.length === 0)
2486
- return;
2487
- const orderedSegs = [...stackSegs];
2488
- if (this.stackConfig.order === "asc")
2489
- orderedSegs.sort((a, b) => a.value - b.value);
2490
- else if (this.stackConfig.order === "desc")
2491
- orderedSegs.sort((a, b) => b.value - a.value);
2492
- const total = orderedSegs.reduce((sum, s) => sum + Math.abs(s.value), 0);
2493
- const axisX = this.position.getBarPositionX();
2494
- const headerY = this.position.getAxisTitlePositionY();
2495
- let cumulativePixels = 0;
2496
- orderedSegs.forEach((seg) => {
2497
- const pixelPerUnit = seg.dataPoint.pixelPerUnit;
2498
- let segmentLength;
2499
- if (this.stackConfig.mode === StackMode.RELATIVE) {
2500
- const proportion = total !== 0 ? Math.abs(seg.value) / total : 0;
2501
- segmentLength = proportion * pixelPerUnit;
2502
- }
2503
- else {
2504
- segmentLength = Math.abs(seg.value * pixelPerUnit);
2505
- }
2506
- const centerX = axisX + cumulativePixels + segmentLength / 2;
2507
- const labelText = this.i18n.get(seg.label) || seg.label;
2508
- new Label(headerGroup, centerX, headerY, "STACK_HEADER", labelText, this.styles, HookLocation.Bottom, HookLocation.Center).draw();
2509
- cumulativePixels += segmentLength;
2510
- });
2511
- return;
2512
- }
2513
- const scenarioKeys = ["scenario1", "scenario2", "scenario3", "scenario4"];
2514
- const segments = [];
2515
- for (const key of scenarioKeys) {
2516
- const dp = firstRow[key];
2517
- if (dp && !dp.isEmpty() && dp.value != null) {
2518
- segments.push({ value: dp.value, scenario: dp.scenario, dataPoint: dp });
2519
- }
2520
- }
2521
- if (segments.length === 0)
2522
- return;
2523
- const prefixes = new Set(segments.map((s) => getScenarioPrefix(s.scenario)));
2524
- const axisX = this.position.getBarPositionX();
2525
- const headerY = this.position.getAxisTitlePositionY();
2526
- if (prefixes.size > 1) {
2527
- // Overlay mode: one header per group, centered on group's bar extent
2528
- const groupMap = new Map();
2529
- for (const seg of segments) {
2530
- const prefix = getScenarioPrefix(seg.scenario);
2531
- if (!groupMap.has(prefix))
2532
- groupMap.set(prefix, []);
2533
- groupMap.get(prefix).push(seg);
2534
- }
2535
- const groups = [];
2536
- for (const prefix of IBCS_LAYER_ORDER) {
2537
- if (groupMap.has(prefix)) {
2538
- groups.push({ prefix, segments: groupMap.get(prefix) });
2539
- groupMap.delete(prefix);
2540
- }
2541
- }
2542
- for (const [prefix, segs] of groupMap) {
2543
- groups.push({ prefix, segments: segs });
2544
- }
2545
- groups.forEach((group) => {
2546
- const groupTotal = group.segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
2547
- const pixelPerUnit = group.segments[0].dataPoint.pixelPerUnit;
2548
- const groupPixelLength = this.stackConfig.mode === StackMode.RELATIVE ? pixelPerUnit : groupTotal * pixelPerUnit;
2549
- const centerX = axisX + groupPixelLength / 2;
2550
- const labelText = this.i18n.get(group.prefix + "1") || group.prefix.toUpperCase();
2551
- new Label(headerGroup, centerX, headerY, "STACK_HEADER", labelText, this.styles, HookLocation.Bottom, HookLocation.Center).draw();
2552
- });
2553
- }
2554
- else {
2555
- // Single group: show individual segment headers
2556
- if (this.stackConfig.order === "asc")
2557
- segments.sort((a, b) => a.value - b.value);
2558
- else if (this.stackConfig.order === "desc")
2559
- segments.sort((a, b) => b.value - a.value);
2560
- const total = segments.reduce((sum, s) => sum + Math.abs(s.value), 0);
2561
- let cumulativePixels = 0;
2562
- segments.forEach((seg) => {
2563
- const pixelPerUnit = seg.dataPoint.pixelPerUnit;
2564
- let segmentLength;
2565
- if (this.stackConfig.mode === StackMode.RELATIVE) {
2566
- const proportion = total !== 0 ? Math.abs(seg.value) / total : 0;
2567
- segmentLength = proportion * pixelPerUnit;
2568
- }
2569
- else {
2570
- segmentLength = Math.abs(seg.value * pixelPerUnit);
2571
- }
2572
- const centerX = axisX + cumulativePixels + segmentLength / 2;
2573
- const labelText = this.i18n.get(seg.scenario) || seg.scenario;
2574
- new Label(headerGroup, centerX, headerY, "STACK_HEADER", labelText, this.styles, HookLocation.Bottom, HookLocation.Center).draw();
2575
- cumulativePixels += segmentLength;
2576
- });
2577
- }
2578
- }
2579
- getVarianceType() {
2580
- if (this.variancesDataModel.length > 0) {
2581
- return this.variancesDataModel[0].type;
2582
- }
2583
- return VarianceType.NONE;
2584
- }
2585
- calculateLeftSideWidth(varianceType) {
2586
- var _a, _b, _c;
2587
- let width = 0;
2588
- const labelToBar = this.styles.fontStyles.size * this.styles.scaleFactors.labelToBar;
2589
- if (VarianceType.NONE === varianceType &&
2590
- ((_a = this.smallestDataPointValue) === null || _a === void 0 ? void 0 : _a.value) != null &&
2591
- this.smallestDataPointValue.value < 0) {
2592
- const sizeLabelValue = this.calculateTextBoxWidth(this.smallestDataPointValue.value);
2593
- width = Math.abs(this.smallestDataPointValue.getScaledUnit()) + labelToBar + sizeLabelValue;
2594
- }
2595
- else if (VarianceType.RELATIVE === varianceType &&
2596
- ((_b = this.smallestVarianceDataPointValue) === null || _b === void 0 ? void 0 : _b.value) != null &&
2597
- this.smallestVarianceDataPointValue.value < 0) {
2598
- const sizeLabelValue = this.calculatePercentageTextBoxWidth(this.smallestVarianceDataPointValue.value);
2599
- width = Math.abs(this.smallestVarianceDataPointValue.getScaledPercentUnit()) + labelToBar + sizeLabelValue;
2600
- }
2601
- else if (VarianceType.ABSOLUTE === varianceType &&
2602
- ((_c = this.smallestVarianceDataPointValue) === null || _c === void 0 ? void 0 : _c.value) != null &&
2603
- this.smallestVarianceDataPointValue.value < 0) {
2604
- const sizeLabelValue = this.calculateTextBoxWidth(this.smallestVarianceDataPointValue.value);
2605
- width = Math.abs(this.smallestVarianceDataPointValue.getScaledUnit()) + labelToBar + sizeLabelValue;
2606
- }
2607
- if (width <= this.titleLength) {
2608
- return this.titleLength;
2609
- }
2610
- return width;
2611
- }
2612
- calculateRightSideWidth(varianceType) {
2613
- var _a, _b, _c;
2614
- let width = 0;
2615
- const labelToBar = this.styles.fontStyles.size * this.styles.scaleFactors.labelToBar;
2616
- if (VarianceType.NONE === varianceType &&
2617
- ((_a = this.highestDataPointValue) === null || _a === void 0 ? void 0 : _a.value) != null &&
2618
- this.highestDataPointValue.value >= 0) {
2619
- const sizeLabelValue = this.calculateTextBoxWidth(this.highestDataPointValue.value);
2620
- width = Math.abs(this.highestDataPointValue.getScaledUnit()) + labelToBar + sizeLabelValue;
2621
- }
2622
- else if (VarianceType.RELATIVE === varianceType &&
2623
- ((_b = this.highestVarianceDataPointValue) === null || _b === void 0 ? void 0 : _b.value) != null &&
2624
- this.highestVarianceDataPointValue.value >= 0) {
2625
- const sizeLabelValue = this.calculatePercentageTextBoxWidth(this.highestVarianceDataPointValue.value);
2626
- width = Math.abs(this.highestVarianceDataPointValue.getScaledPercentUnit()) + labelToBar + sizeLabelValue;
2627
- }
2628
- else if (VarianceType.ABSOLUTE === varianceType &&
2629
- ((_c = this.highestVarianceDataPointValue) === null || _c === void 0 ? void 0 : _c.value) != null &&
2630
- this.highestVarianceDataPointValue.value >= 0) {
2631
- const sizeLabelValue = this.calculateTextBoxWidth(this.highestVarianceDataPointValue.value);
2632
- width = Math.abs(this.highestVarianceDataPointValue.getScaledUnit()) + labelToBar + sizeLabelValue;
2633
- }
2634
- if (width <= this.titleLength) {
2635
- return this.titleLength;
2636
- }
2637
- return width;
2638
- }
2639
- /**
2640
- * For dimension stacking (by category, subcategory, or rowgroup), query the raw data
2641
- * at the stack dimension level and attach stackSegments to each dataModel row.
2642
- */
2643
- populateDimensionStackSegments(scenarios, stackConfig, level) {
2644
- var _a;
2645
- if (((_a = this.preparedDataSet) === null || _a === void 0 ? void 0 : _a.length) === 0 || scenarios.length === 0)
2646
- return;
2647
- // Map StackBy value to the actual data column name
2648
- const stackColumnMap = {
2649
- [StackBy.CATEGORY]: "category",
2650
- [StackBy.SUBCATEGORY]: "subCategory",
2651
- [StackBy.ROWGROUP]: "rowGroup",
2652
- };
2653
- const stackColumn = stackColumnMap[stackConfig.by];
2654
- if (!stackColumn)
2655
- return;
2656
- // The display level column (what each bar represents)
2657
- const displayColumn = level.toString(); // e.g. 'rowGroup', 'category', 'subCategory'
2658
- const scenario = scenarios[0]; // dimension stacking uses first scenario
2659
- const result = alasql(`SELECT [${displayColumn}] as displayGroup, [${stackColumn}] as stackLabel, ` +
2660
- `SUM([${scenario}] * transformOperator(operation)) as stackValue ` +
2661
- `FROM ? GROUP BY [${displayColumn}], [${stackColumn}]`, [this.preparedDataSet]);
2662
- // Group results by displayGroup
2663
- const groupMap = new Map();
2664
- for (const row of result) {
2665
- const key = row.displayGroup;
2666
- if (!groupMap.has(key))
2667
- groupMap.set(key, []);
2668
- if (row.stackValue != null && row.stackLabel != null) {
2669
- groupMap.get(key).push({ label: row.stackLabel, value: row.stackValue });
2670
- }
2671
- }
2672
- // Attach stackSegments to each dataModel row
2673
- for (const row of this.dataModel) {
2674
- const segments = groupMap.get(row.category);
2675
- if (segments && segments.length > 0) {
2676
- row.stackSegments = segments.map((seg) => ({
2677
- label: seg.label,
2678
- value: seg.value,
2679
- dataPoint: new DataPoint(seg.value, scenario, this.pixelPerUnit, Scenario.NEU),
2680
- }));
2681
- }
2682
- else {
2683
- row.stackSegments = [];
2684
- }
2685
- }
2686
- }
2687
- hasNoData() {
2688
- return this.dataModel.length === 0;
2689
- }
2690
- setAvailableWidth(availableWidth) {
2691
- if (this.pixelPerUnit <= 0 || availableWidth <= 0) {
2692
- this.overflowConfig = null;
2693
- return;
2694
- }
2695
- if (this.stackConfig != null) {
2696
- this.overflowConfig = null;
2697
- return;
2698
- }
2699
- this.overflowConfig = this.calculateOverflowConfig(availableWidth);
2700
- if (this.overflowConfig) {
2701
- const { cutWidth, overdriveZoneWidth, breakGap } = this.overflowConfig;
2702
- const virtualWidth = cutWidth + overdriveZoneWidth + breakGap;
2703
- const isVariance = this.variancesDataModel && this.variancesDataModel.length > 0;
2704
- if (isVariance) {
2705
- if (this.highestVarianceDataPointValue.getScaledUnit() > cutWidth) {
2706
- this.highestVarianceDataPointValue = new DataPoint(virtualWidth, this.highestVarianceDataPointValue.scenario, 1, this.highestVarianceDataPointValue.variance);
2707
- }
2708
- if (this.smallestVarianceDataPointValue.value != null &&
2709
- Math.abs(this.smallestVarianceDataPointValue.getScaledUnit()) > cutWidth) {
2710
- this.smallestVarianceDataPointValue = new DataPoint(-virtualWidth, this.smallestVarianceDataPointValue.scenario, 1, this.smallestVarianceDataPointValue.variance);
2711
- }
2712
- }
2713
- else {
2714
- if (this.highestDataPointValue.getScaledUnit() > cutWidth) {
2715
- this.highestDataPointValue = new DataPoint(virtualWidth, this.highestDataPointValue.scenario, 1, this.highestDataPointValue.variance);
2716
- }
2717
- if (this.smallestDataPointValue.value != null &&
2718
- Math.abs(this.smallestDataPointValue.getScaledUnit()) > cutWidth) {
2719
- this.smallestDataPointValue = new DataPoint(-virtualWidth, this.smallestDataPointValue.scenario, 1, this.smallestDataPointValue.variance);
2720
- }
2721
- }
2722
- this.updatePosition();
2723
- }
2724
- }
2725
- calculateOverflowConfig(availableWidth) {
2726
- const isVariance = this.variancesDataModel && this.variancesDataModel.length > 0;
2727
- const varianceType = this.getVarianceType();
2728
- // Don't apply to relative variance (Needle handles its own clipping at 145%)
2729
- if (varianceType === VarianceType.RELATIVE)
2730
- return null;
2731
- const highest = isVariance ? this.highestVarianceDataPointValue : this.highestDataPointValue;
2732
- const smallest = isVariance ? this.smallestVarianceDataPointValue : this.smallestDataPointValue;
2733
- const highestScaledUnit = highest.getScaledUnit();
2734
- const smallestAbsScaledUnit = smallest.value != null ? Math.abs(smallest.getScaledUnit()) : 0;
2735
- const maxAbsScaledUnit = Math.max(highestScaledUnit, smallestAbsScaledUnit);
2736
- if (maxAbsScaledUnit <= 0)
2737
- return null;
2738
- const fontSize = this.styles.fontStyles.size;
2739
- const labelToBar = fontSize * this.styles.scaleFactors.labelToBar;
2740
- // Available space on the right side of the axis
2741
- const axisX = this.position.getAxisPositionX();
2742
- // Match getAllocatedCanvasWidth() which adds padding.left + padding.right on top of axisX
2743
- const rightSideAvailable = availableWidth - axisX - this.styles.padding.left - this.styles.padding.right;
2744
- // Estimate the label width of the largest value
2745
- const maxLabelWidth = this.calculateTextBoxWidth(highest.value || 0);
2746
- const overdriveZoneWidth = fontSize * 1.5;
2747
- const breakGap = fontSize * 0.3;
2748
- const scenarioCutOffset = fontSize * 0.8;
2749
- const cutWidth = rightSideAvailable - labelToBar - maxLabelWidth - overdriveZoneWidth - breakGap;
2750
- if (cutWidth <= scenarioCutOffset)
2751
- return null;
2752
- const lowestCutWidth = cutWidth - scenarioCutOffset;
2753
- if (maxAbsScaledUnit <= lowestCutWidth)
2754
- return null;
2755
- const maxOverflow = maxAbsScaledUnit - lowestCutWidth;
2756
- return { cutWidth, overdriveZoneWidth, breakGap, maxOverflow, scenarioCutOffset };
2757
- }
2758
- }
2759
-
2760
- const bnChartStructureCss = () => `:host{display:inline-block;position:relative;overflow:hidden}.container{display:flex;flex-direction:row}.background-image{display:flex;flex-wrap:wrap;justify-content:flex-end}.categories{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.label-bg{fill:var(--bn-font-background, white);opacity:0.7}.label-text{text-align:right;font-size:var(--bn-font-size, 1em);font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-title{text-align:center;font-family:var(--bn-font-family, "Noto Sans", "Helvetica Neue", Helvetica, sans-serif);color:var(--bn-font-color, black)}.axis-ac{stroke:black;stroke-width:0.1em}.axis-pp{stroke:grey;stroke-width:0.1em}.axis-fc{stroke:black;stroke-dasharray:2;stroke-width:0.1em}.axis-pl{stroke:white;stroke-width:0.1em;outline-offset:0em;outline:0.1em solid black}canvas{image-rendering:-moz-crisp-edges;image-rendering:-webkit-crisp-edges;image-rendering:pixelated;image-rendering:crisp-edges}.measure{font-weight:bold}span{display:inline-block}.hidePatternContainer{height:0;width:0}div{float:left}.warning{font-size:0.8em;font-style:italic}.footer{margin:0.2em;font-size:0.6em}.footer-hide{margin:0.2em;font-size:0.6em;opacity:0}`;
2761
-
2762
- const IbcsChartStructure = class {
2763
- constructor(hostRef) {
2764
- registerInstance(this, hostRef);
2765
- this.data = [];
2766
- this.chartTitle = "";
2767
- this.scenarios = [];
2768
- this.variances = [];
2769
- this.hideCategories = false;
2770
- this.pixelPerUnit = 10;
2771
- this.pixelPerPercentage = 50;
2772
- this.limit = 0;
2773
- this.i18n = new Map(); // I18nMode;
2774
- this.order = {
2775
- hierarchy: [],
2776
- direction: OrderDirection.ASC,
2777
- };
2778
- this.level = AggregationLevel.CATEGORY;
2779
- this.filter = "";
2780
- this.measureScale = "_";
2781
- this.measureUnit = "";
2782
- this.showMeasureScale = true;
2783
- this.dataFormatDigits = { percent: 2, decimal: 1 };
2784
- this.stackConfig = null;
2785
- this.parentDimensions = { width: 0, height: 0 };
2786
- }
2787
- render() {
2788
- var _a, _b, _c;
2789
- if (this.chart === undefined) {
2790
- return h(Host, null);
2791
- }
2792
- if (this.chart.hasNoData()) {
2793
- const errorMsg = this.i18n.get("NO_DATA") || "==No Data==";
2794
- return (h(Host, null, h("p", { class: "warning" }, errorMsg)));
2795
- }
2796
- return (h(Host, null, h("div", { innerHTML: (_a = this.pattern) === null || _a === void 0 ? void 0 : _a.toString(), class: "hidePatternContainer" }), h("div", { class: this.showMeasureScale ? "footer" : "footer-hide" }, (_b = this.chart) === null || _b === void 0 ? void 0 : _b.getFooter()), h("div", { innerHTML: (_c = this.chart) === null || _c === void 0 ? void 0 : _c.toString() })));
2797
- }
2798
- async componentWillLoad() {
2799
- var _a;
2800
- const config = this.prepareConfig();
2801
- const styles = this.prepareStyle();
2802
- this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
2803
- this.chart.setI18n(this.i18n);
2804
- this.autoFitScaling(config, styles);
2805
- this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
2806
- this.pattern = new CustomPattern(this.chart.styles);
2807
- this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
2808
- }
2809
- async componentWillUpdate() {
2810
- var _a;
2811
- if (this.chart == null) {
2812
- return;
2813
- }
2814
- const config = this.prepareConfig();
2815
- const styles = this.prepareStyle();
2816
- this.chart.setI18n(this.i18n);
2817
- this.chart.setStyles(styles);
2818
- this.chart.setConfig(config);
2819
- this.autoFitScaling(config, styles);
2820
- this.chart.setAvailableWidth(((_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width) || 0);
2821
- this.pattern = new CustomPattern(this.chart.styles);
2822
- this.chart.setPattern("fc", this.pattern.getFCPolygonPattern());
2823
- }
2824
- /**
2825
- * Two-pass auto-fit: only when pixelPerUnit is 0 (auto mode).
2826
- * Explicit values are never overridden — the outer component warns
2827
- * about overflow via componentDidRender.
2828
- * Structure charts grow horizontally, so we fit to width.
2829
- */
2830
- autoFitScaling(config, styles) {
2831
- var _a;
2832
- if (config.pixelPerUnit > 0) {
2833
- return; // Explicit value — respect it, do not override
2834
- }
2835
- const targetWidth = (_a = this.parentDimensions) === null || _a === void 0 ? void 0 : _a.width;
2836
- if (!targetWidth || targetWidth <= 0) {
2837
- config.pixelPerUnit = 1;
2838
- this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
2839
- this.chart.setI18n(this.i18n);
2840
- return;
2841
- }
2842
- // First pass with pixelPerUnit=1 to measure the real SVG width
2843
- config.pixelPerUnit = 1;
2844
- this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
2845
- this.chart.setI18n(this.i18n);
2846
- this.chart.toString();
2847
- const svgWidth = this.chart.getAllocatedCanvasWidth();
2848
- if (svgWidth <= 0) {
2849
- return;
2850
- }
2851
- // Scale so the chart fits in ~90% of the available width
2852
- config.pixelPerUnit = (targetWidth * 0.9) / svgWidth;
2853
- // Second pass with the corrected scaling
2854
- this.chart = new StructureChart(new IBCSRuleSet(), config, styles);
2855
- this.chart.setI18n(this.i18n);
2856
- }
2857
- async componentWillRender() {
2858
- // return await (async () => {
2859
- //
2860
- // if (this.chart) {
2861
- // this.chart.draw(SVG(this.drawElement) as Svg);
2862
- // }
2863
- // })()
2864
- }
2865
- componentDidLoad() {
2866
- // if (this.chart == null) {
2867
- // return;
2868
- // }
2869
- // this.chart.draw(SVG(this.drawElement) as Svg);
2870
- // forceUpdate(getElement(this));
2871
- }
2872
- componentDidUpdate() {
2873
- // if (this.chart) {
2874
- // this.chart.draw(SVG(this.drawElement) as Svg);
2875
- // }
2876
- }
2877
- prepareConfig() {
2878
- return new StructureChartComponentConfigAdapter(new StructureChartDataRowAdapter(), new OrderAdapter(new StringAdapter()), new StringAdapter(), new DataFormatDigitsAdapter(), this.data).adapt({
2879
- data: this.data,
2880
- scenarios: this.scenarios,
2881
- variances: this.variances,
2882
- title: this.chartTitle,
2883
- hideCategories: this.hideCategories,
2884
- pixelPerUnit: this.pixelPerUnit,
2885
- pixelPerPercentage: this.pixelPerPercentage,
2886
- level: this.level,
2887
- limit: this.limit,
2888
- sortOrder: this.order,
2889
- filter: this.filter,
2890
- measureScale: this.measureScale,
2891
- measureUnit: this.measureUnit,
2892
- showMeasureScale: this.showMeasureScale,
2893
- dataFormatDigits: this.dataFormatDigits,
2894
- stackConfig: this.stackConfig,
2895
- });
2896
- }
2897
- prepareStyle() {
2898
- return new StructureChartStylesAdapter(new ScaleFactorsStructureChartAdapter(), new FontStyleAdapter(), new SVGStyleGroupAdapter(new SVGStyleAdapter()), new SVGVariancesStyleGroupAdapter(new SVGStyleAdapter()), new PaddingAdapter()).adapt(this.styles);
2899
- }
2900
- get element() { return getElement(this); }
2901
- };
2902
- IbcsChartStructure.style = bnChartStructureCss();
2903
-
2904
- export { IbcsChartStructure as ibcs_chart_structure };