@fluentui/react-charts 9.3.21 → 9.74.3-experimental.esm.20260709-49ee7a20cf.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (767) hide show
  1. package/CHANGELOG.md +20 -2
  2. package/package.json +15 -17
  3. package/dist/index.d.ts +0 -5724
  4. package/lib/AnnotationOnlyChart.js +0 -1
  5. package/lib/AnnotationOnlyChart.js.map +0 -1
  6. package/lib/AreaChart.js +0 -1
  7. package/lib/AreaChart.js.map +0 -1
  8. package/lib/CartesianChart.js +0 -1
  9. package/lib/CartesianChart.js.map +0 -1
  10. package/lib/ChartTable.js +0 -1
  11. package/lib/ChartTable.js.map +0 -1
  12. package/lib/DeclarativeChart.js +0 -1
  13. package/lib/DeclarativeChart.js.map +0 -1
  14. package/lib/DonutChart.js +0 -1
  15. package/lib/DonutChart.js.map +0 -1
  16. package/lib/FunnelChart.js +0 -1
  17. package/lib/FunnelChart.js.map +0 -1
  18. package/lib/GanttChart.js +0 -1
  19. package/lib/GanttChart.js.map +0 -1
  20. package/lib/GaugeChart.js +0 -1
  21. package/lib/GaugeChart.js.map +0 -1
  22. package/lib/GroupedVerticalBarChart.js +0 -1
  23. package/lib/GroupedVerticalBarChart.js.map +0 -1
  24. package/lib/HeatMapChart.js +0 -1
  25. package/lib/HeatMapChart.js.map +0 -1
  26. package/lib/HorizontalBarChart.js +0 -1
  27. package/lib/HorizontalBarChart.js.map +0 -1
  28. package/lib/HorizontalBarChartWithAxis.js +0 -1
  29. package/lib/HorizontalBarChartWithAxis.js.map +0 -1
  30. package/lib/Legends.js +0 -1
  31. package/lib/Legends.js.map +0 -1
  32. package/lib/LineChart.js +0 -1
  33. package/lib/LineChart.js.map +0 -1
  34. package/lib/PolarChart.js +0 -1
  35. package/lib/PolarChart.js.map +0 -1
  36. package/lib/Popover.js +0 -1
  37. package/lib/Popover.js.map +0 -1
  38. package/lib/ResponsiveContainer.js +0 -1
  39. package/lib/ResponsiveContainer.js.map +0 -1
  40. package/lib/SankeyChart.js +0 -1
  41. package/lib/SankeyChart.js.map +0 -1
  42. package/lib/ScatterChart.js +0 -1
  43. package/lib/ScatterChart.js.map +0 -1
  44. package/lib/Sparkline.js +0 -1
  45. package/lib/Sparkline.js.map +0 -1
  46. package/lib/VegaDeclarativeChart.js +0 -1
  47. package/lib/VegaDeclarativeChart.js.map +0 -1
  48. package/lib/VerticalBarChart.js +0 -1
  49. package/lib/VerticalBarChart.js.map +0 -1
  50. package/lib/VerticalStackedBarChart.js +0 -1
  51. package/lib/VerticalStackedBarChart.js.map +0 -1
  52. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +0 -196
  53. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +0 -1
  54. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +0 -3
  55. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +0 -1
  56. package/lib/components/AnnotationOnlyChart/index.js +0 -2
  57. package/lib/components/AnnotationOnlyChart/index.js.map +0 -1
  58. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +0 -33
  59. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +0 -1
  60. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +0 -24
  61. package/lib/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +0 -1
  62. package/lib/components/AreaChart/AreaChart.js +0 -932
  63. package/lib/components/AreaChart/AreaChart.js.map +0 -1
  64. package/lib/components/AreaChart/AreaChart.types.js +0 -4
  65. package/lib/components/AreaChart/AreaChart.types.js.map +0 -1
  66. package/lib/components/AreaChart/index.js +0 -3
  67. package/lib/components/AreaChart/index.js.map +0 -1
  68. package/lib/components/AreaChart/useAreaChartStyles.styles.js +0 -63
  69. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +0 -1
  70. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +0 -33
  71. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +0 -1
  72. package/lib/components/ChartTable/ChartTable.js +0 -160
  73. package/lib/components/ChartTable/ChartTable.js.map +0 -1
  74. package/lib/components/ChartTable/ChartTable.types.js +0 -4
  75. package/lib/components/ChartTable/ChartTable.types.js.map +0 -1
  76. package/lib/components/ChartTable/index.js +0 -3
  77. package/lib/components/ChartTable/index.js.map +0 -1
  78. package/lib/components/ChartTable/useChartTableStyles.styles.js +0 -136
  79. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +0 -1
  80. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +0 -68
  81. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +0 -1
  82. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +0 -659
  83. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +0 -1
  84. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +0 -1
  85. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +0 -1
  86. package/lib/components/CommonComponents/Annotations/index.js +0 -2
  87. package/lib/components/CommonComponents/Annotations/index.js.map +0 -1
  88. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +0 -223
  89. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +0 -1
  90. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +0 -139
  91. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +0 -1
  92. package/lib/components/CommonComponents/CartesianChart.js +0 -665
  93. package/lib/components/CommonComponents/CartesianChart.js.map +0 -1
  94. package/lib/components/CommonComponents/CartesianChart.types.js +0 -2
  95. package/lib/components/CommonComponents/CartesianChart.types.js.map +0 -1
  96. package/lib/components/CommonComponents/ChartPopover.js +0 -197
  97. package/lib/components/CommonComponents/ChartPopover.js.map +0 -1
  98. package/lib/components/CommonComponents/ChartPopover.types.js +0 -1
  99. package/lib/components/CommonComponents/ChartPopover.types.js.map +0 -1
  100. package/lib/components/CommonComponents/index.js +0 -6
  101. package/lib/components/CommonComponents/index.js.map +0 -1
  102. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +0 -189
  103. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +0 -1
  104. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +0 -131
  105. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +0 -1
  106. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js +0 -171
  107. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +0 -1
  108. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -127
  109. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +0 -1
  110. package/lib/components/DeclarativeChart/DeclarativeChart.js +0 -397
  111. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +0 -1
  112. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +0 -163
  113. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +0 -1
  114. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +0 -3490
  115. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +0 -1
  116. package/lib/components/DeclarativeChart/index.js +0 -1
  117. package/lib/components/DeclarativeChart/index.js.map +0 -1
  118. package/lib/components/DonutChart/Arc/Arc.js +0 -118
  119. package/lib/components/DonutChart/Arc/Arc.js.map +0 -1
  120. package/lib/components/DonutChart/Arc/Arc.types.js +0 -1
  121. package/lib/components/DonutChart/Arc/Arc.types.js.map +0 -1
  122. package/lib/components/DonutChart/Arc/index.js +0 -2
  123. package/lib/components/DonutChart/Arc/index.js.map +0 -1
  124. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +0 -80
  125. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +0 -1
  126. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +0 -49
  127. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +0 -1
  128. package/lib/components/DonutChart/DonutChart.js +0 -349
  129. package/lib/components/DonutChart/DonutChart.js.map +0 -1
  130. package/lib/components/DonutChart/DonutChart.types.js +0 -4
  131. package/lib/components/DonutChart/DonutChart.types.js.map +0 -1
  132. package/lib/components/DonutChart/Pie/Pie.js +0 -72
  133. package/lib/components/DonutChart/Pie/Pie.js.map +0 -1
  134. package/lib/components/DonutChart/Pie/Pie.types.js +0 -1
  135. package/lib/components/DonutChart/Pie/Pie.types.js.map +0 -1
  136. package/lib/components/DonutChart/Pie/index.js +0 -2
  137. package/lib/components/DonutChart/Pie/index.js.map +0 -1
  138. package/lib/components/DonutChart/Pie/usePieStyles.styles.js +0 -41
  139. package/lib/components/DonutChart/Pie/usePieStyles.styles.js.map +0 -1
  140. package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js +0 -30
  141. package/lib/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +0 -1
  142. package/lib/components/DonutChart/index.js +0 -3
  143. package/lib/components/DonutChart/index.js.map +0 -1
  144. package/lib/components/DonutChart/useDonutChartStyles.styles.js +0 -98
  145. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +0 -1
  146. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +0 -62
  147. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +0 -1
  148. package/lib/components/FunnelChart/FunnelChart.js +0 -401
  149. package/lib/components/FunnelChart/FunnelChart.js.map +0 -1
  150. package/lib/components/FunnelChart/FunnelChart.types.js +0 -4
  151. package/lib/components/FunnelChart/FunnelChart.types.js.map +0 -1
  152. package/lib/components/FunnelChart/funnelGeometry.js +0 -219
  153. package/lib/components/FunnelChart/funnelGeometry.js.map +0 -1
  154. package/lib/components/FunnelChart/index.js +0 -2
  155. package/lib/components/FunnelChart/index.js.map +0 -1
  156. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js +0 -83
  157. package/lib/components/FunnelChart/useFunnelChartStyles.styles.js.map +0 -1
  158. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js +0 -65
  159. package/lib/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +0 -1
  160. package/lib/components/GanttChart/GanttChart.js +0 -535
  161. package/lib/components/GanttChart/GanttChart.js.map +0 -1
  162. package/lib/components/GanttChart/GanttChart.types.js +0 -4
  163. package/lib/components/GanttChart/GanttChart.types.js.map +0 -1
  164. package/lib/components/GanttChart/index.js +0 -2
  165. package/lib/components/GanttChart/index.js.map +0 -1
  166. package/lib/components/GanttChart/useGanttChartStyles.styles.js +0 -27
  167. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +0 -1
  168. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +0 -26
  169. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +0 -1
  170. package/lib/components/GaugeChart/GaugeChart.js +0 -568
  171. package/lib/components/GaugeChart/GaugeChart.js.map +0 -1
  172. package/lib/components/GaugeChart/GaugeChart.types.js +0 -4
  173. package/lib/components/GaugeChart/GaugeChart.types.js.map +0 -1
  174. package/lib/components/GaugeChart/index.js +0 -3
  175. package/lib/components/GaugeChart/index.js.map +0 -1
  176. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +0 -197
  177. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +0 -1
  178. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js +0 -149
  179. package/lib/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +0 -1
  180. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +0 -813
  181. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +0 -1
  182. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +0 -4
  183. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +0 -1
  184. package/lib/components/GroupedVerticalBarChart/index.js +0 -3
  185. package/lib/components/GroupedVerticalBarChart/index.js.map +0 -1
  186. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -77
  187. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +0 -1
  188. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +0 -40
  189. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +0 -1
  190. package/lib/components/HeatMapChart/HeatMapChart.js +0 -677
  191. package/lib/components/HeatMapChart/HeatMapChart.js.map +0 -1
  192. package/lib/components/HeatMapChart/HeatMapChart.types.js +0 -4
  193. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +0 -1
  194. package/lib/components/HeatMapChart/index.js +0 -3
  195. package/lib/components/HeatMapChart/index.js.map +0 -1
  196. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +0 -48
  197. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +0 -1
  198. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +0 -42
  199. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +0 -1
  200. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +0 -411
  201. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +0 -1
  202. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js +0 -7
  203. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +0 -1
  204. package/lib/components/HorizontalBarChart/index.js +0 -3
  205. package/lib/components/HorizontalBarChart/index.js.map +0 -1
  206. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +0 -175
  207. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +0 -1
  208. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +0 -125
  209. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +0 -1
  210. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +0 -720
  211. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +0 -1
  212. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +0 -4
  213. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +0 -1
  214. package/lib/components/HorizontalBarChartWithAxis/index.js +0 -3
  215. package/lib/components/HorizontalBarChartWithAxis/index.js.map +0 -1
  216. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +0 -62
  217. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +0 -1
  218. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +0 -54
  219. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +0 -1
  220. package/lib/components/Legends/Legends.js +0 -323
  221. package/lib/components/Legends/Legends.js.map +0 -1
  222. package/lib/components/Legends/Legends.types.js +0 -3
  223. package/lib/components/Legends/Legends.types.js.map +0 -1
  224. package/lib/components/Legends/OverflowMenu.js +0 -33
  225. package/lib/components/Legends/OverflowMenu.js.map +0 -1
  226. package/lib/components/Legends/index.js +0 -3
  227. package/lib/components/Legends/index.js.map +0 -1
  228. package/lib/components/Legends/shape.js +0 -36
  229. package/lib/components/Legends/shape.js.map +0 -1
  230. package/lib/components/Legends/useLegendsStyles.styles.js +0 -262
  231. package/lib/components/Legends/useLegendsStyles.styles.js.map +0 -1
  232. package/lib/components/Legends/useLegendsStyles.styles.raw.js +0 -142
  233. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +0 -1
  234. package/lib/components/LineChart/LineChart.js +0 -1332
  235. package/lib/components/LineChart/LineChart.js.map +0 -1
  236. package/lib/components/LineChart/LineChart.types.js +0 -3
  237. package/lib/components/LineChart/LineChart.types.js.map +0 -1
  238. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +0 -118
  239. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +0 -1
  240. package/lib/components/LineChart/eventAnnotation/LabelLink.js +0 -59
  241. package/lib/components/LineChart/eventAnnotation/LabelLink.js.map +0 -1
  242. package/lib/components/LineChart/eventAnnotation/Textbox.js +0 -42
  243. package/lib/components/LineChart/eventAnnotation/Textbox.js.map +0 -1
  244. package/lib/components/LineChart/index.js +0 -4
  245. package/lib/components/LineChart/index.js.map +0 -1
  246. package/lib/components/LineChart/useLineChartStyles.styles.js +0 -93
  247. package/lib/components/LineChart/useLineChartStyles.styles.js.map +0 -1
  248. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +0 -50
  249. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +0 -1
  250. package/lib/components/PolarChart/PolarChart.js +0 -577
  251. package/lib/components/PolarChart/PolarChart.js.map +0 -1
  252. package/lib/components/PolarChart/PolarChart.types.js +0 -4
  253. package/lib/components/PolarChart/PolarChart.types.js.map +0 -1
  254. package/lib/components/PolarChart/PolarChart.utils.js +0 -174
  255. package/lib/components/PolarChart/PolarChart.utils.js.map +0 -1
  256. package/lib/components/PolarChart/index.js +0 -2
  257. package/lib/components/PolarChart/index.js.map +0 -1
  258. package/lib/components/PolarChart/usePolarChartStyles.styles.js +0 -72
  259. package/lib/components/PolarChart/usePolarChartStyles.styles.js.map +0 -1
  260. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js +0 -61
  261. package/lib/components/PolarChart/usePolarChartStyles.styles.raw.js.map +0 -1
  262. package/lib/components/ResponsiveContainer/ResponsiveContainer.js +0 -99
  263. package/lib/components/ResponsiveContainer/ResponsiveContainer.js.map +0 -1
  264. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js +0 -4
  265. package/lib/components/ResponsiveContainer/ResponsiveContainer.types.js.map +0 -1
  266. package/lib/components/ResponsiveContainer/index.js +0 -3
  267. package/lib/components/ResponsiveContainer/index.js.map +0 -1
  268. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +0 -30
  269. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +0 -1
  270. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +0 -29
  271. package/lib/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +0 -1
  272. package/lib/components/ResponsiveContainer/withResponsiveContainer.js +0 -20
  273. package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +0 -1
  274. package/lib/components/SankeyChart/SankeyChart.js +0 -1026
  275. package/lib/components/SankeyChart/SankeyChart.js.map +0 -1
  276. package/lib/components/SankeyChart/SankeyChart.types.js +0 -3
  277. package/lib/components/SankeyChart/SankeyChart.types.js.map +0 -1
  278. package/lib/components/SankeyChart/index.js +0 -3
  279. package/lib/components/SankeyChart/index.js.map +0 -1
  280. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +0 -123
  281. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +0 -1
  282. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +0 -79
  283. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +0 -1
  284. package/lib/components/ScatterChart/ScatterChart.js +0 -544
  285. package/lib/components/ScatterChart/ScatterChart.js.map +0 -1
  286. package/lib/components/ScatterChart/ScatterChart.types.js +0 -4
  287. package/lib/components/ScatterChart/ScatterChart.types.js.map +0 -1
  288. package/lib/components/ScatterChart/index.js +0 -3
  289. package/lib/components/ScatterChart/index.js.map +0 -1
  290. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +0 -84
  291. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +0 -1
  292. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +0 -41
  293. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +0 -1
  294. package/lib/components/Sparkline/Sparkline.js +0 -123
  295. package/lib/components/Sparkline/Sparkline.js.map +0 -1
  296. package/lib/components/Sparkline/Sparkline.types.js +0 -4
  297. package/lib/components/Sparkline/Sparkline.types.js.map +0 -1
  298. package/lib/components/Sparkline/index.js +0 -3
  299. package/lib/components/Sparkline/index.js.map +0 -1
  300. package/lib/components/Sparkline/useSparklineStyles.styles.js +0 -40
  301. package/lib/components/Sparkline/useSparklineStyles.styles.js.map +0 -1
  302. package/lib/components/Sparkline/useSparklineStyles.styles.raw.js +0 -31
  303. package/lib/components/Sparkline/useSparklineStyles.styles.raw.js.map +0 -1
  304. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js +0 -405
  305. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +0 -1
  306. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +0 -20
  307. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +0 -1
  308. package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +0 -415
  309. package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +0 -1
  310. package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +0 -537
  311. package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +0 -1
  312. package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +0 -3279
  313. package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +0 -1
  314. package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js +0 -28
  315. package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js.map +0 -1
  316. package/lib/components/VegaDeclarativeChart/index.js +0 -1
  317. package/lib/components/VegaDeclarativeChart/index.js.map +0 -1
  318. package/lib/components/VerticalBarChart/VerticalBarChart.js +0 -930
  319. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +0 -1
  320. package/lib/components/VerticalBarChart/VerticalBarChart.types.js +0 -4
  321. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +0 -1
  322. package/lib/components/VerticalBarChart/index.js +0 -3
  323. package/lib/components/VerticalBarChart/index.js.map +0 -1
  324. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -86
  325. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +0 -1
  326. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +0 -48
  327. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +0 -1
  328. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +0 -1077
  329. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +0 -1
  330. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +0 -4
  331. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +0 -1
  332. package/lib/components/VerticalStackedBarChart/index.js +0 -3
  333. package/lib/components/VerticalStackedBarChart/index.js.map +0 -1
  334. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -74
  335. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +0 -1
  336. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +0 -38
  337. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +0 -1
  338. package/lib/index.js +0 -26
  339. package/lib/index.js.map +0 -1
  340. package/lib/types/ChartAnnotation.js +0 -1
  341. package/lib/types/ChartAnnotation.js.map +0 -1
  342. package/lib/types/DataPoint.js +0 -3
  343. package/lib/types/DataPoint.js.map +0 -1
  344. package/lib/types/EventAnnotation.js +0 -1
  345. package/lib/types/EventAnnotation.js.map +0 -1
  346. package/lib/types/LegendDataItem.js +0 -1
  347. package/lib/types/LegendDataItem.js.map +0 -1
  348. package/lib/types/index.js +0 -3
  349. package/lib/types/index.js.map +0 -1
  350. package/lib/utilities/ChartTitle.js +0 -45
  351. package/lib/utilities/ChartTitle.js.map +0 -1
  352. package/lib/utilities/Common.styles.js +0 -117
  353. package/lib/utilities/Common.styles.js.map +0 -1
  354. package/lib/utilities/Common.styles.raw.js +0 -115
  355. package/lib/utilities/Common.styles.raw.js.map +0 -1
  356. package/lib/utilities/FocusableTooltipText.js +0 -65
  357. package/lib/utilities/FocusableTooltipText.js.map +0 -1
  358. package/lib/utilities/KeyCodes.js +0 -11
  359. package/lib/utilities/KeyCodes.js.map +0 -1
  360. package/lib/utilities/SVGTooltipText.js +0 -179
  361. package/lib/utilities/SVGTooltipText.js.map +0 -1
  362. package/lib/utilities/async-utils.js +0 -380
  363. package/lib/utilities/async-utils.js.map +0 -1
  364. package/lib/utilities/colors.js +0 -281
  365. package/lib/utilities/colors.js.map +0 -1
  366. package/lib/utilities/getWindow.js +0 -25
  367. package/lib/utilities/getWindow.js.map +0 -1
  368. package/lib/utilities/hooks.js +0 -34
  369. package/lib/utilities/hooks.js.map +0 -1
  370. package/lib/utilities/image-export-utils.js +0 -405
  371. package/lib/utilities/image-export-utils.js.map +0 -1
  372. package/lib/utilities/index.js +0 -5
  373. package/lib/utilities/index.js.map +0 -1
  374. package/lib/utilities/overflow-utils.js +0 -27
  375. package/lib/utilities/overflow-utils.js.map +0 -1
  376. package/lib/utilities/scatterpolar-utils.js +0 -52
  377. package/lib/utilities/scatterpolar-utils.js.map +0 -1
  378. package/lib/utilities/string.js +0 -32
  379. package/lib/utilities/string.js.map +0 -1
  380. package/lib/utilities/test-data.js +0 -565
  381. package/lib/utilities/test-data.js.map +0 -1
  382. package/lib/utilities/utilities.js +0 -1990
  383. package/lib/utilities/utilities.js.map +0 -1
  384. package/lib/utilities/vbc-utils.js +0 -51
  385. package/lib/utilities/vbc-utils.js.map +0 -1
  386. package/lib-commonjs/AnnotationOnlyChart.js +0 -6
  387. package/lib-commonjs/AnnotationOnlyChart.js.map +0 -1
  388. package/lib-commonjs/AreaChart.js +0 -6
  389. package/lib-commonjs/AreaChart.js.map +0 -1
  390. package/lib-commonjs/CartesianChart.js +0 -6
  391. package/lib-commonjs/CartesianChart.js.map +0 -1
  392. package/lib-commonjs/ChartTable.js +0 -6
  393. package/lib-commonjs/ChartTable.js.map +0 -1
  394. package/lib-commonjs/DeclarativeChart.js +0 -6
  395. package/lib-commonjs/DeclarativeChart.js.map +0 -1
  396. package/lib-commonjs/DonutChart.js +0 -6
  397. package/lib-commonjs/DonutChart.js.map +0 -1
  398. package/lib-commonjs/FunnelChart.js +0 -6
  399. package/lib-commonjs/FunnelChart.js.map +0 -1
  400. package/lib-commonjs/GanttChart.js +0 -6
  401. package/lib-commonjs/GanttChart.js.map +0 -1
  402. package/lib-commonjs/GaugeChart.js +0 -6
  403. package/lib-commonjs/GaugeChart.js.map +0 -1
  404. package/lib-commonjs/GroupedVerticalBarChart.js +0 -6
  405. package/lib-commonjs/GroupedVerticalBarChart.js.map +0 -1
  406. package/lib-commonjs/HeatMapChart.js +0 -6
  407. package/lib-commonjs/HeatMapChart.js.map +0 -1
  408. package/lib-commonjs/HorizontalBarChart.js +0 -6
  409. package/lib-commonjs/HorizontalBarChart.js.map +0 -1
  410. package/lib-commonjs/HorizontalBarChartWithAxis.js +0 -6
  411. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +0 -1
  412. package/lib-commonjs/Legends.js +0 -6
  413. package/lib-commonjs/Legends.js.map +0 -1
  414. package/lib-commonjs/LineChart.js +0 -6
  415. package/lib-commonjs/LineChart.js.map +0 -1
  416. package/lib-commonjs/PolarChart.js +0 -6
  417. package/lib-commonjs/PolarChart.js.map +0 -1
  418. package/lib-commonjs/Popover.js +0 -6
  419. package/lib-commonjs/Popover.js.map +0 -1
  420. package/lib-commonjs/ResponsiveContainer.js +0 -6
  421. package/lib-commonjs/ResponsiveContainer.js.map +0 -1
  422. package/lib-commonjs/SankeyChart.js +0 -6
  423. package/lib-commonjs/SankeyChart.js.map +0 -1
  424. package/lib-commonjs/ScatterChart.js +0 -6
  425. package/lib-commonjs/ScatterChart.js.map +0 -1
  426. package/lib-commonjs/Sparkline.js +0 -6
  427. package/lib-commonjs/Sparkline.js.map +0 -1
  428. package/lib-commonjs/VegaDeclarativeChart.js +0 -6
  429. package/lib-commonjs/VegaDeclarativeChart.js.map +0 -1
  430. package/lib-commonjs/VerticalBarChart.js +0 -6
  431. package/lib-commonjs/VerticalBarChart.js.map +0 -1
  432. package/lib-commonjs/VerticalStackedBarChart.js +0 -6
  433. package/lib-commonjs/VerticalStackedBarChart.js.map +0 -1
  434. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +0 -207
  435. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +0 -1
  436. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js +0 -6
  437. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +0 -1
  438. package/lib-commonjs/components/AnnotationOnlyChart/index.js +0 -7
  439. package/lib-commonjs/components/AnnotationOnlyChart/index.js.map +0 -1
  440. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js +0 -57
  441. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.js.map +0 -1
  442. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js +0 -34
  443. package/lib-commonjs/components/AnnotationOnlyChart/useAnnotationOnlyChartStyles.styles.raw.js.map +0 -1
  444. package/lib-commonjs/components/AreaChart/AreaChart.js +0 -938
  445. package/lib-commonjs/components/AreaChart/AreaChart.js.map +0 -1
  446. package/lib-commonjs/components/AreaChart/AreaChart.types.js +0 -7
  447. package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +0 -1
  448. package/lib-commonjs/components/AreaChart/index.js +0 -8
  449. package/lib-commonjs/components/AreaChart/index.js.map +0 -1
  450. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -96
  451. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +0 -1
  452. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +0 -49
  453. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +0 -1
  454. package/lib-commonjs/components/ChartTable/ChartTable.js +0 -171
  455. package/lib-commonjs/components/ChartTable/ChartTable.js.map +0 -1
  456. package/lib-commonjs/components/ChartTable/ChartTable.types.js +0 -7
  457. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +0 -1
  458. package/lib-commonjs/components/ChartTable/index.js +0 -8
  459. package/lib-commonjs/components/ChartTable/index.js.map +0 -1
  460. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +0 -200
  461. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +0 -1
  462. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +0 -82
  463. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +0 -1
  464. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +0 -670
  465. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +0 -1
  466. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js +0 -4
  467. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.types.js.map +0 -1
  468. package/lib-commonjs/components/CommonComponents/Annotations/index.js +0 -7
  469. package/lib-commonjs/components/CommonComponents/Annotations/index.js.map +0 -1
  470. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +0 -325
  471. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +0 -1
  472. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +0 -174
  473. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +0 -1
  474. package/lib-commonjs/components/CommonComponents/CartesianChart.js +0 -673
  475. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +0 -1
  476. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js +0 -5
  477. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +0 -1
  478. package/lib-commonjs/components/CommonComponents/ChartPopover.js +0 -207
  479. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +0 -1
  480. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js +0 -4
  481. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +0 -1
  482. package/lib-commonjs/components/CommonComponents/index.js +0 -11
  483. package/lib-commonjs/components/CommonComponents/index.js.map +0 -1
  484. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +0 -268
  485. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +0 -1
  486. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +0 -144
  487. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +0 -1
  488. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js +0 -238
  489. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +0 -1
  490. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -141
  491. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +0 -1
  492. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +0 -400
  493. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +0 -1
  494. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +0 -195
  495. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +0 -1
  496. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +0 -3577
  497. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +0 -1
  498. package/lib-commonjs/components/DeclarativeChart/index.js +0 -6
  499. package/lib-commonjs/components/DeclarativeChart/index.js.map +0 -1
  500. package/lib-commonjs/components/DonutChart/Arc/Arc.js +0 -125
  501. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +0 -1
  502. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js +0 -4
  503. package/lib-commonjs/components/DonutChart/Arc/Arc.types.js.map +0 -1
  504. package/lib-commonjs/components/DonutChart/Arc/index.js +0 -7
  505. package/lib-commonjs/components/DonutChart/Arc/index.js.map +0 -1
  506. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +0 -110
  507. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +0 -1
  508. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +0 -63
  509. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +0 -1
  510. package/lib-commonjs/components/DonutChart/DonutChart.js +0 -356
  511. package/lib-commonjs/components/DonutChart/DonutChart.js.map +0 -1
  512. package/lib-commonjs/components/DonutChart/DonutChart.types.js +0 -7
  513. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +0 -1
  514. package/lib-commonjs/components/DonutChart/Pie/Pie.js +0 -79
  515. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +0 -1
  516. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js +0 -4
  517. package/lib-commonjs/components/DonutChart/Pie/Pie.types.js.map +0 -1
  518. package/lib-commonjs/components/DonutChart/Pie/index.js +0 -7
  519. package/lib-commonjs/components/DonutChart/Pie/index.js.map +0 -1
  520. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js +0 -55
  521. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.js.map +0 -1
  522. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js +0 -44
  523. package/lib-commonjs/components/DonutChart/Pie/usePieStyles.styles.raw.js.map +0 -1
  524. package/lib-commonjs/components/DonutChart/index.js +0 -8
  525. package/lib-commonjs/components/DonutChart/index.js.map +0 -1
  526. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +0 -145
  527. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +0 -1
  528. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +0 -76
  529. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +0 -1
  530. package/lib-commonjs/components/FunnelChart/FunnelChart.js +0 -412
  531. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +0 -1
  532. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js +0 -7
  533. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +0 -1
  534. package/lib-commonjs/components/FunnelChart/funnelGeometry.js +0 -246
  535. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +0 -1
  536. package/lib-commonjs/components/FunnelChart/index.js +0 -7
  537. package/lib-commonjs/components/FunnelChart/index.js.map +0 -1
  538. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js +0 -118
  539. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.js.map +0 -1
  540. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js +0 -79
  541. package/lib-commonjs/components/FunnelChart/useFunnelChartStyles.styles.raw.js.map +0 -1
  542. package/lib-commonjs/components/GanttChart/GanttChart.js +0 -546
  543. package/lib-commonjs/components/GanttChart/GanttChart.js.map +0 -1
  544. package/lib-commonjs/components/GanttChart/GanttChart.types.js +0 -7
  545. package/lib-commonjs/components/GanttChart/GanttChart.types.js.map +0 -1
  546. package/lib-commonjs/components/GanttChart/index.js +0 -7
  547. package/lib-commonjs/components/GanttChart/index.js.map +0 -1
  548. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +0 -42
  549. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +0 -1
  550. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +0 -42
  551. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +0 -1
  552. package/lib-commonjs/components/GaugeChart/GaugeChart.js +0 -597
  553. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +0 -1
  554. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +0 -7
  555. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +0 -1
  556. package/lib-commonjs/components/GaugeChart/index.js +0 -8
  557. package/lib-commonjs/components/GaugeChart/index.js.map +0 -1
  558. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +0 -281
  559. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +0 -1
  560. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js +0 -167
  561. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.raw.js.map +0 -1
  562. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +0 -818
  563. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +0 -1
  564. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +0 -7
  565. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +0 -1
  566. package/lib-commonjs/components/GroupedVerticalBarChart/index.js +0 -8
  567. package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +0 -1
  568. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -116
  569. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +0 -1
  570. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +0 -56
  571. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +0 -1
  572. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +0 -688
  573. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +0 -1
  574. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +0 -7
  575. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +0 -1
  576. package/lib-commonjs/components/HeatMapChart/index.js +0 -8
  577. package/lib-commonjs/components/HeatMapChart/index.js.map +0 -1
  578. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +0 -71
  579. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +0 -1
  580. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +0 -60
  581. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +0 -1
  582. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +0 -417
  583. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +0 -1
  584. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js +0 -17
  585. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +0 -1
  586. package/lib-commonjs/components/HorizontalBarChart/index.js +0 -8
  587. package/lib-commonjs/components/HorizontalBarChart/index.js.map +0 -1
  588. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +0 -264
  589. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +0 -1
  590. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +0 -139
  591. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +0 -1
  592. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +0 -726
  593. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +0 -1
  594. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +0 -7
  595. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +0 -1
  596. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +0 -8
  597. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +0 -1
  598. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +0 -86
  599. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +0 -1
  600. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +0 -70
  601. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +0 -1
  602. package/lib-commonjs/components/Legends/Legends.js +0 -333
  603. package/lib-commonjs/components/Legends/Legends.js.map +0 -1
  604. package/lib-commonjs/components/Legends/Legends.types.js +0 -6
  605. package/lib-commonjs/components/Legends/Legends.types.js.map +0 -1
  606. package/lib-commonjs/components/Legends/OverflowMenu.js +0 -44
  607. package/lib-commonjs/components/Legends/OverflowMenu.js.map +0 -1
  608. package/lib-commonjs/components/Legends/index.js +0 -8
  609. package/lib-commonjs/components/Legends/index.js.map +0 -1
  610. package/lib-commonjs/components/Legends/shape.js +0 -47
  611. package/lib-commonjs/components/Legends/shape.js.map +0 -1
  612. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js +0 -456
  613. package/lib-commonjs/components/Legends/useLegendsStyles.styles.js.map +0 -1
  614. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js +0 -178
  615. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +0 -1
  616. package/lib-commonjs/components/LineChart/LineChart.js +0 -1337
  617. package/lib-commonjs/components/LineChart/LineChart.js.map +0 -1
  618. package/lib-commonjs/components/LineChart/LineChart.types.js +0 -6
  619. package/lib-commonjs/components/LineChart/LineChart.types.js.map +0 -1
  620. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +0 -129
  621. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +0 -1
  622. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js +0 -70
  623. package/lib-commonjs/components/LineChart/eventAnnotation/LabelLink.js.map +0 -1
  624. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js +0 -53
  625. package/lib-commonjs/components/LineChart/eventAnnotation/Textbox.js.map +0 -1
  626. package/lib-commonjs/components/LineChart/index.js +0 -9
  627. package/lib-commonjs/components/LineChart/index.js.map +0 -1
  628. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -132
  629. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +0 -1
  630. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +0 -63
  631. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +0 -1
  632. package/lib-commonjs/components/PolarChart/PolarChart.js +0 -587
  633. package/lib-commonjs/components/PolarChart/PolarChart.js.map +0 -1
  634. package/lib-commonjs/components/PolarChart/PolarChart.types.js +0 -7
  635. package/lib-commonjs/components/PolarChart/PolarChart.types.js.map +0 -1
  636. package/lib-commonjs/components/PolarChart/PolarChart.utils.js +0 -204
  637. package/lib-commonjs/components/PolarChart/PolarChart.utils.js.map +0 -1
  638. package/lib-commonjs/components/PolarChart/index.js +0 -7
  639. package/lib-commonjs/components/PolarChart/index.js.map +0 -1
  640. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js +0 -107
  641. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.js.map +0 -1
  642. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js +0 -75
  643. package/lib-commonjs/components/PolarChart/usePolarChartStyles.styles.raw.js.map +0 -1
  644. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js +0 -107
  645. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.js.map +0 -1
  646. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js +0 -7
  647. package/lib-commonjs/components/ResponsiveContainer/ResponsiveContainer.types.js.map +0 -1
  648. package/lib-commonjs/components/ResponsiveContainer/index.js +0 -8
  649. package/lib-commonjs/components/ResponsiveContainer/index.js.map +0 -1
  650. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js +0 -50
  651. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.js.map +0 -1
  652. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js +0 -47
  653. package/lib-commonjs/components/ResponsiveContainer/useResponsiveChildStyles.styles.raw.js.map +0 -1
  654. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js +0 -28
  655. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +0 -1
  656. package/lib-commonjs/components/SankeyChart/SankeyChart.js +0 -1042
  657. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +0 -1
  658. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +0 -6
  659. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +0 -1
  660. package/lib-commonjs/components/SankeyChart/index.js +0 -8
  661. package/lib-commonjs/components/SankeyChart/index.js.map +0 -1
  662. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -202
  663. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +0 -1
  664. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +0 -97
  665. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +0 -1
  666. package/lib-commonjs/components/ScatterChart/ScatterChart.js +0 -550
  667. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +0 -1
  668. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +0 -7
  669. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +0 -1
  670. package/lib-commonjs/components/ScatterChart/index.js +0 -8
  671. package/lib-commonjs/components/ScatterChart/index.js.map +0 -1
  672. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -120
  673. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +0 -1
  674. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +0 -55
  675. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +0 -1
  676. package/lib-commonjs/components/Sparkline/Sparkline.js +0 -129
  677. package/lib-commonjs/components/Sparkline/Sparkline.js.map +0 -1
  678. package/lib-commonjs/components/Sparkline/Sparkline.types.js +0 -7
  679. package/lib-commonjs/components/Sparkline/Sparkline.types.js.map +0 -1
  680. package/lib-commonjs/components/Sparkline/index.js +0 -8
  681. package/lib-commonjs/components/Sparkline/index.js.map +0 -1
  682. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js +0 -57
  683. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.js.map +0 -1
  684. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js +0 -45
  685. package/lib-commonjs/components/Sparkline/useSparklineStyles.styles.raw.js.map +0 -1
  686. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js +0 -274
  687. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +0 -1
  688. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +0 -35
  689. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +0 -1
  690. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +0 -412
  691. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +0 -1
  692. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +0 -533
  693. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +0 -1
  694. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +0 -3214
  695. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +0 -1
  696. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js +0 -31
  697. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js.map +0 -1
  698. package/lib-commonjs/components/VegaDeclarativeChart/index.js +0 -6
  699. package/lib-commonjs/components/VegaDeclarativeChart/index.js.map +0 -1
  700. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +0 -932
  701. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +0 -1
  702. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js +0 -7
  703. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +0 -1
  704. package/lib-commonjs/components/VerticalBarChart/index.js +0 -8
  705. package/lib-commonjs/components/VerticalBarChart/index.js.map +0 -1
  706. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -128
  707. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +0 -1
  708. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +0 -64
  709. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +0 -1
  710. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +0 -1088
  711. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +0 -1
  712. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +0 -7
  713. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +0 -1
  714. package/lib-commonjs/components/VerticalStackedBarChart/index.js +0 -8
  715. package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +0 -1
  716. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -116
  717. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +0 -1
  718. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +0 -56
  719. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +0 -1
  720. package/lib-commonjs/index.js +0 -31
  721. package/lib-commonjs/index.js.map +0 -1
  722. package/lib-commonjs/types/ChartAnnotation.js +0 -4
  723. package/lib-commonjs/types/ChartAnnotation.js.map +0 -1
  724. package/lib-commonjs/types/DataPoint.js +0 -6
  725. package/lib-commonjs/types/DataPoint.js.map +0 -1
  726. package/lib-commonjs/types/EventAnnotation.js +0 -4
  727. package/lib-commonjs/types/EventAnnotation.js.map +0 -1
  728. package/lib-commonjs/types/LegendDataItem.js +0 -4
  729. package/lib-commonjs/types/LegendDataItem.js.map +0 -1
  730. package/lib-commonjs/types/index.js +0 -8
  731. package/lib-commonjs/types/index.js.map +0 -1
  732. package/lib-commonjs/utilities/ChartTitle.js +0 -53
  733. package/lib-commonjs/utilities/ChartTitle.js.map +0 -1
  734. package/lib-commonjs/utilities/Common.styles.js +0 -138
  735. package/lib-commonjs/utilities/Common.styles.js.map +0 -1
  736. package/lib-commonjs/utilities/Common.styles.raw.js +0 -138
  737. package/lib-commonjs/utilities/Common.styles.raw.js.map +0 -1
  738. package/lib-commonjs/utilities/FocusableTooltipText.js +0 -75
  739. package/lib-commonjs/utilities/FocusableTooltipText.js.map +0 -1
  740. package/lib-commonjs/utilities/KeyCodes.js +0 -21
  741. package/lib-commonjs/utilities/KeyCodes.js.map +0 -1
  742. package/lib-commonjs/utilities/SVGTooltipText.js +0 -189
  743. package/lib-commonjs/utilities/SVGTooltipText.js.map +0 -1
  744. package/lib-commonjs/utilities/async-utils.js +0 -382
  745. package/lib-commonjs/utilities/async-utils.js.map +0 -1
  746. package/lib-commonjs/utilities/colors.js +0 -311
  747. package/lib-commonjs/utilities/colors.js.map +0 -1
  748. package/lib-commonjs/utilities/getWindow.js +0 -28
  749. package/lib-commonjs/utilities/getWindow.js.map +0 -1
  750. package/lib-commonjs/utilities/hooks.js +0 -45
  751. package/lib-commonjs/utilities/hooks.js.map +0 -1
  752. package/lib-commonjs/utilities/image-export-utils.js +0 -423
  753. package/lib-commonjs/utilities/image-export-utils.js.map +0 -1
  754. package/lib-commonjs/utilities/index.js +0 -10
  755. package/lib-commonjs/utilities/index.js.map +0 -1
  756. package/lib-commonjs/utilities/overflow-utils.js +0 -36
  757. package/lib-commonjs/utilities/overflow-utils.js.map +0 -1
  758. package/lib-commonjs/utilities/scatterpolar-utils.js +0 -67
  759. package/lib-commonjs/utilities/scatterpolar-utils.js.map +0 -1
  760. package/lib-commonjs/utilities/string.js +0 -29
  761. package/lib-commonjs/utilities/string.js.map +0 -1
  762. package/lib-commonjs/utilities/test-data.js +0 -628
  763. package/lib-commonjs/utilities/test-data.js.map +0 -1
  764. package/lib-commonjs/utilities/utilities.js +0 -2016
  765. package/lib-commonjs/utilities/utilities.js.map +0 -1
  766. package/lib-commonjs/utilities/vbc-utils.js +0 -72
  767. package/lib-commonjs/utilities/vbc-utils.js.map +0 -1
@@ -1,1990 +0,0 @@
1
- 'use client';
2
- import { axisRight as d3AxisRight, axisBottom as d3AxisBottom, axisLeft as d3AxisLeft } from 'd3-axis';
3
- import { max as d3Max, min as d3Min, ticks as d3Ticks, nice as d3nice, sum as d3Sum, mean as d3Mean, median as d3Median } from 'd3-array';
4
- import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3ScaleUtc, scaleTime as d3ScaleTime, scaleLog as d3ScaleLog } from 'd3-scale';
5
- import { select as d3Select, selectAll as d3SelectAll } from 'd3-selection';
6
- import { format as d3Format } from 'd3-format';
7
- import { timeFormat as d3TimeFormat, timeFormatLocale as d3TimeFormatLocale, utcFormat as d3UtcFormat } from 'd3-time-format';
8
- import { timeSecond as d3TimeSecond, timeMinute as d3TimeMinute, timeHour as d3TimeHour, timeDay as d3TimeDay, timeMonth as d3TimeMonth, timeWeek as d3TimeWeek, timeYear as d3TimeYear, utcSecond as d3UtcSecond, utcMinute as d3UtcMinute, utcHour as d3UtcHour, utcDay as d3UtcDay, utcMonth as d3UtcMonth, utcWeek as d3UtcWeek, utcYear as d3UtcYear } from 'd3-time';
9
- import { curveLinear as d3CurveLinear, curveNatural as d3CurveNatural, curveStep as d3CurveStep, curveStepAfter as d3CurveStepAfter, curveStepBefore as d3CurveStepBefore } from 'd3-shape';
10
- import { formatPrefix as d3FormatPrefix } from 'd3-format';
11
- import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
12
- import { formatDateToLocaleString, formatToLocaleString, getMultiLevelDateTimeFormatOptions, isInvalidValue, isNumber } from '@fluentui/chart-utilities';
13
- export const MIN_DOMAIN_MARGIN = 8;
14
- export const MIN_DONUT_RADIUS = 1;
15
- export const DEFAULT_DATE_STRING = '2000-01-01';
16
- export const CARTESIAN_XAXIS_CLASSNAME = 'fui-cart__xAxis';
17
- const CARTESIAN_XAXIS_TEXT_SELECTOR = `.${CARTESIAN_XAXIS_CLASSNAME} text`;
18
- export var ChartTypes = /*#__PURE__*/ function(ChartTypes) {
19
- ChartTypes[ChartTypes["AreaChart"] = 0] = "AreaChart";
20
- ChartTypes[ChartTypes["LineChart"] = 1] = "LineChart";
21
- ChartTypes[ChartTypes["VerticalBarChart"] = 2] = "VerticalBarChart";
22
- ChartTypes[ChartTypes["VerticalStackedBarChart"] = 3] = "VerticalStackedBarChart";
23
- ChartTypes[ChartTypes["GroupedVerticalBarChart"] = 4] = "GroupedVerticalBarChart";
24
- ChartTypes[ChartTypes["HeatMapChart"] = 5] = "HeatMapChart";
25
- ChartTypes[ChartTypes["HorizontalBarChartWithAxis"] = 6] = "HorizontalBarChartWithAxis";
26
- ChartTypes[ChartTypes["ScatterChart"] = 7] = "ScatterChart";
27
- ChartTypes[ChartTypes["GanttChart"] = 8] = "GanttChart";
28
- return ChartTypes;
29
- }({});
30
- export var XAxisTypes = /*#__PURE__*/ function(XAxisTypes) {
31
- XAxisTypes[XAxisTypes["NumericAxis"] = 0] = "NumericAxis";
32
- XAxisTypes[XAxisTypes["DateAxis"] = 1] = "DateAxis";
33
- XAxisTypes[XAxisTypes["StringAxis"] = 2] = "StringAxis";
34
- return XAxisTypes;
35
- }({});
36
- export var YAxisType = /*#__PURE__*/ function(YAxisType) {
37
- YAxisType[YAxisType["NumericAxis"] = 0] = "NumericAxis";
38
- YAxisType[YAxisType["DateAxis"] = 1] = "DateAxis";
39
- YAxisType[YAxisType["StringAxis"] = 2] = "StringAxis";
40
- return YAxisType;
41
- }({});
42
- function yAxisTickFormatterInternal(value, limitWidth = false) {
43
- // Use SI format prefix with 2 decimal places without insignificant trailing zeros
44
- let formatter = d3FormatPrefix('.2~', value);
45
- if (Math.abs(value) < 1) {
46
- // Don't use SI notation for small numbers as it is less readable
47
- formatter = d3Format('.2~g');
48
- } else if (limitWidth && Math.abs(value) >= 1000) {
49
- // If width is limited, use SI format prefix with 1 point precision
50
- formatter = d3FormatPrefix('.1~', value);
51
- }
52
- const formattedValue = formatter(value);
53
- // Replace 'G' with 'B' if the value is greater than 10^9 as it is a more common convention
54
- if (Math.abs(value) >= 1e9) {
55
- return formattedValue.replace('G', 'B');
56
- }
57
- return formattedValue;
58
- }
59
- /**
60
- * Formatter for y axis ticks.
61
- * @param value - The number to format.
62
- * @returns The formatted string .
63
- */ export function defaultYAxisTickFormatter(value) {
64
- return yAxisTickFormatterInternal(value);
65
- }
66
- /**
67
- * Create Numeric X axis
68
- * @export
69
- * @param {IXAxisParams} xAxisParams
70
- */ export function createNumericXAxis(xAxisParams, tickParams, chartType, culture, scaleType, _useRtl) {
71
- const { domainNRangeValues, showRoundOffXTickValues = false, xAxistickSize = 6, tickPadding = 10, xAxisCount, xAxisElement, hideTickOverlap, calcMaxLabelWidth, tickStep, tick0, tickText } = xAxisParams;
72
- const dStartValue = domainNRangeValues.dStartValue;
73
- const dEndValue = domainNRangeValues.dEndValue;
74
- const finalXmin = xAxisParams.xMinValue !== undefined ? Math.min(dStartValue, xAxisParams.xMinValue) : dStartValue;
75
- const finalXmax = xAxisParams.xMaxValue !== undefined ? Math.max(dEndValue, xAxisParams.xMaxValue) : dEndValue;
76
- const xAxisScale = createNumericScale(scaleType).domain([
77
- finalXmin,
78
- finalXmax
79
- ]).range([
80
- domainNRangeValues.rStartValue,
81
- domainNRangeValues.rEndValue
82
- ]);
83
- showRoundOffXTickValues && xAxisScale.nice();
84
- let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
85
- const tickFormat = (domainValue, _index, defaultFormat)=>{
86
- if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
87
- return tickText[_index];
88
- }
89
- if (tickParams.tickFormat) {
90
- return d3Format(tickParams.tickFormat)(domainValue);
91
- }
92
- const xAxisValue = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
93
- return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(xAxisValue)) === '' ? '' : formatToLocaleString(xAxisValue, culture);
94
- };
95
- if (hideTickOverlap) {
96
- const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map((v, i)=>tickFormat(v, i))) + 20;
97
- const [start, end] = xAxisScale.range();
98
- tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
99
- }
100
- const xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat((v, i)=>tickFormat(v, i, xAxisScale.tickFormat(tickCount)));
101
- if ([
102
- 6,
103
- 8
104
- ].includes(chartType)) {
105
- xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
106
- }
107
- let customTickValues;
108
- if (tickParams.tickValues) {
109
- customTickValues = tickParams.tickValues;
110
- } else if (tickStep) {
111
- customTickValues = generateNumericTicks(scaleType, tickStep, tick0, xAxisScale.domain());
112
- }
113
- if (customTickValues) {
114
- xAxis.tickValues(customTickValues);
115
- }
116
- if (xAxisElement) {
117
- d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true').style('direction', 'ltr').style('unicode-bidi', 'isolate');
118
- }
119
- const tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
120
- const tickLabels = tickValues.map(xAxis.tickFormat());
121
- return {
122
- xScale: xAxisScale,
123
- tickValues,
124
- tickLabels
125
- };
126
- }
127
- /**
128
- * This function returns a multilevel formatter for a given date range.
129
- * It determines the appropriate date format to accommodate each tick value.
130
- * The goal is to represent the date label in the smallest possible format without loss of information.
131
- * The challenge here is to adhere to locale specific formats while ensuring the complete label is shown.
132
- * There is an exhaustive map of all possible date/time units and their respective formats.
133
- * Based on the range of formatting granularity levels, a format spanning the range is returned.
134
- * @param startLevel - The starting level of the date format.
135
- * @param endLevel - The ending level of the date format.
136
- * @param locale - The locale object for formatting.
137
- * @param useUTC
138
- * @returns
139
- */ function getMultiLevelD3DateFormatter(startLevel, endLevel, locale, useUTC) {
140
- const timeFormat = locale ? useUTC ? locale.utcFormat : locale.format : useUTC ? d3UtcFormat : d3TimeFormat;
141
- // Refer to https://d3js.org/d3-time-format#locale_format to see explanation about each format specifier
142
- const DEFAULT = '%c';
143
- const MS = '.%L';
144
- const MS_S = ':%S.%L';
145
- const MS_S_MIN = '%M:%S.%L';
146
- const MS_S_MIN_H = '%-I:%M:%S.%L %p';
147
- const MS_S_MIN_H_D = '%a %d, %X';
148
- const MS_S_MIN_H_D_W = '%b %d, %X';
149
- const MS_S_MIN_H_D_W_M = MS_S_MIN_H_D_W;
150
- const MS_S_MIN_H_D_W_M_Y = DEFAULT;
151
- const S = ':%S';
152
- const S_MIN = '%-I:%M:%S';
153
- const S_MIN_H = '%X';
154
- const S_MIN_H_D = MS_S_MIN_H_D;
155
- const S_MIN_H_D_W = MS_S_MIN_H_D_W;
156
- const S_MIN_H_D_W_M = MS_S_MIN_H_D_W_M;
157
- const S_MIN_H_D_W_M_Y = DEFAULT;
158
- const MIN = '%-I:%M %p';
159
- const MIN_H = MIN;
160
- const MIN_H_D = '%a %d, %-I:%M %p';
161
- const MIN_H_D_W = '%b %d, %-I:%M %p';
162
- const MIN_H_D_W_M = MIN_H_D_W;
163
- const MIN_H_D_W_M_Y = '%x, %-I:%M %p';
164
- const H = '%-I %p';
165
- const H_D = '%a %d, %-I %p';
166
- const H_D_W = '%b %d, %-I %p';
167
- const H_D_W_M = H_D_W;
168
- const H_D_W_M_Y = '%x, %-I %p';
169
- const D = '%a %d';
170
- const D_W = '%b %d';
171
- const D_W_M = D_W;
172
- const D_W_M_Y = '%x';
173
- const W = D_W;
174
- const W_M = W;
175
- const W_M_Y = D_W_M_Y;
176
- const M = '%B';
177
- const M_Y = '%b %Y';
178
- const Y = '%Y';
179
- const MULTI_LEVEL_DATE_TIME_FORMATS = [
180
- // ms, s, min, h, d, w, m, y
181
- [
182
- MS,
183
- MS_S,
184
- MS_S_MIN,
185
- MS_S_MIN_H,
186
- MS_S_MIN_H_D,
187
- MS_S_MIN_H_D_W,
188
- MS_S_MIN_H_D_W_M,
189
- MS_S_MIN_H_D_W_M_Y
190
- ],
191
- [
192
- DEFAULT,
193
- S,
194
- S_MIN,
195
- S_MIN_H,
196
- S_MIN_H_D,
197
- S_MIN_H_D_W,
198
- S_MIN_H_D_W_M,
199
- S_MIN_H_D_W_M_Y
200
- ],
201
- [
202
- DEFAULT,
203
- DEFAULT,
204
- MIN,
205
- MIN_H,
206
- MIN_H_D,
207
- MIN_H_D_W,
208
- MIN_H_D_W_M,
209
- MIN_H_D_W_M_Y
210
- ],
211
- [
212
- DEFAULT,
213
- DEFAULT,
214
- DEFAULT,
215
- H,
216
- H_D,
217
- H_D_W,
218
- H_D_W_M,
219
- H_D_W_M_Y
220
- ],
221
- [
222
- DEFAULT,
223
- DEFAULT,
224
- DEFAULT,
225
- DEFAULT,
226
- D,
227
- D_W,
228
- D_W_M,
229
- D_W_M_Y
230
- ],
231
- [
232
- DEFAULT,
233
- DEFAULT,
234
- DEFAULT,
235
- DEFAULT,
236
- DEFAULT,
237
- W,
238
- W_M,
239
- W_M_Y
240
- ],
241
- [
242
- DEFAULT,
243
- DEFAULT,
244
- DEFAULT,
245
- DEFAULT,
246
- DEFAULT,
247
- DEFAULT,
248
- M,
249
- M_Y
250
- ],
251
- [
252
- DEFAULT,
253
- DEFAULT,
254
- DEFAULT,
255
- DEFAULT,
256
- DEFAULT,
257
- DEFAULT,
258
- DEFAULT,
259
- Y
260
- ]
261
- ];
262
- const formatter = timeFormat(MULTI_LEVEL_DATE_TIME_FORMATS[startLevel][endLevel]);
263
- return formatter;
264
- }
265
- export function getDateFormatLevel(date, useUTC) {
266
- const timeSecond = useUTC ? d3UtcSecond : d3TimeSecond;
267
- const timeMinute = useUTC ? d3UtcMinute : d3TimeMinute;
268
- const timeHour = useUTC ? d3UtcHour : d3TimeHour;
269
- const timeDay = useUTC ? d3UtcDay : d3TimeDay;
270
- const timeMonth = useUTC ? d3UtcMonth : d3TimeMonth;
271
- const timeWeek = useUTC ? d3UtcWeek : d3TimeWeek;
272
- const timeYear = useUTC ? d3UtcYear : d3TimeYear;
273
- const formats = [
274
- {
275
- formatLevel: 0,
276
- condition: (d)=>timeSecond(d) < d
277
- },
278
- {
279
- formatLevel: 1,
280
- condition: (d)=>timeMinute(d) < d
281
- },
282
- {
283
- formatLevel: 2,
284
- condition: (d)=>timeHour(d) < d
285
- },
286
- {
287
- formatLevel: 3,
288
- condition: (d)=>timeDay(d) < d
289
- },
290
- {
291
- formatLevel: 4,
292
- condition: (d)=>timeMonth(d) < d && timeWeek(d) < d
293
- },
294
- {
295
- formatLevel: 5,
296
- condition: (d)=>timeMonth(d) < d
297
- },
298
- {
299
- formatLevel: 6,
300
- condition: (d)=>timeYear(d) < d
301
- },
302
- {
303
- formatLevel: 7,
304
- condition: ()=>true
305
- }
306
- ];
307
- const matchedFormat = formats.find(({ condition })=>condition(date));
308
- var _matchedFormat_formatLevel;
309
- return (_matchedFormat_formatLevel = matchedFormat === null || matchedFormat === void 0 ? void 0 : matchedFormat.formatLevel) !== null && _matchedFormat_formatLevel !== void 0 ? _matchedFormat_formatLevel : 7;
310
- }
311
- /**
312
- * Creating Date x axis of the Chart
313
- * @export
314
- * @param {IXAxisParams} xAxisParams
315
- * @param {ITickParams} tickParams
316
- */ export function createDateXAxis(xAxisParams, tickParams, culture, options, timeFormatLocale, customDateTimeFormatter, useUTC, chartType) {
317
- const { domainNRangeValues, xAxisElement, tickPadding = 6, xAxistickSize = 6, xAxisCount, hideTickOverlap, calcMaxLabelWidth, tickStep, tick0, tickText } = xAxisParams;
318
- const isUtcSet = useUTC === true || useUTC === 'utc';
319
- const xAxisScale = isUtcSet ? d3ScaleUtc() : d3ScaleTime();
320
- xAxisScale.domain([
321
- domainNRangeValues.dStartValue,
322
- domainNRangeValues.dEndValue
323
- ]).range([
324
- domainNRangeValues.rStartValue,
325
- domainNRangeValues.rEndValue
326
- ]).nice();
327
- let tickCount = xAxisCount !== null && xAxisCount !== void 0 ? xAxisCount : 6;
328
- let lowestFormatLevel = 100;
329
- let highestFormatLevel = -1;
330
- const locale = timeFormatLocale ? d3TimeFormatLocale(timeFormatLocale) : undefined;
331
- xAxisScale.ticks().forEach((domainValue)=>{
332
- const formatLevel = getDateFormatLevel(domainValue, isUtcSet);
333
- if (formatLevel > highestFormatLevel) {
334
- highestFormatLevel = formatLevel;
335
- }
336
- if (formatLevel < lowestFormatLevel) {
337
- lowestFormatLevel = formatLevel;
338
- }
339
- });
340
- const formatOptions = options !== null && options !== void 0 ? options : getMultiLevelDateTimeFormatOptions(lowestFormatLevel, highestFormatLevel);
341
- const formatFn = getMultiLevelD3DateFormatter(lowestFormatLevel, highestFormatLevel, locale, isUtcSet);
342
- const tickFormat = (domainValue, _index)=>{
343
- if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
344
- return tickText[_index];
345
- }
346
- if (customDateTimeFormatter) {
347
- return customDateTimeFormatter(domainValue);
348
- }
349
- if (timeFormatLocale) {
350
- return formatFn(domainValue);
351
- }
352
- if (culture === undefined && tickParams.tickFormat) {
353
- if (useUTC) {
354
- return d3UtcFormat(tickParams.tickFormat)(domainValue);
355
- } else {
356
- return d3TimeFormat(tickParams.tickFormat)(domainValue);
357
- }
358
- }
359
- return formatDateToLocaleString(domainValue, culture, useUTC ? true : false, false, formatOptions);
360
- };
361
- if (hideTickOverlap) {
362
- const longestLabelWidth = calcMaxLabelWidth(xAxisScale.ticks().map(tickFormat)) + 40;
363
- const [start, end] = xAxisScale.range();
364
- tickCount = Math.min(Math.max(1, Math.floor(Math.abs(end - start) / longestLabelWidth)), 10);
365
- }
366
- const xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).ticks(tickCount).tickFormat(tickFormat);
367
- if ([
368
- 8
369
- ].includes(chartType)) {
370
- xAxis.tickSizeInner(-(xAxisParams.containerHeight - xAxisParams.margins.top));
371
- }
372
- let customTickValues;
373
- if (tickParams.tickValues) {
374
- customTickValues = tickParams.tickValues;
375
- } else if (tickStep) {
376
- customTickValues = generateDateTicks(tickStep, tick0, xAxisScale.domain(), useUTC);
377
- }
378
- if (customTickValues) {
379
- xAxis.tickValues(customTickValues);
380
- }
381
- if (xAxisElement) {
382
- d3Select(xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true');
383
- }
384
- const tickValues = customTickValues !== null && customTickValues !== void 0 ? customTickValues : xAxisScale.ticks(tickCount);
385
- const tickLabels = tickValues.map(xAxis.tickFormat());
386
- return {
387
- xScale: xAxisScale,
388
- tickValues,
389
- tickLabels
390
- };
391
- }
392
- /**
393
- * Create String X axis
394
- * Currently using for only Vetical stacked bar chart and grouped vertical bar chart
395
- * @export
396
- * @param {IXAxisParams} xAxisParams
397
- * @param {ITickParams} tickParams
398
- * @param {string[]} dataset
399
- * @returns
400
- */ export function createStringXAxis(xAxisParams, tickParams, dataset, culture, _useRtl) {
401
- const { domainNRangeValues, xAxistickSize = 6, tickPadding = 10, xAxisPadding = 0.1, xAxisInnerPadding, xAxisOuterPadding, containerWidth, hideTickOverlap, calcMaxLabelWidth, tickText } = xAxisParams;
402
- const xAxisScale = d3ScaleBand().domain(dataset).range([
403
- domainNRangeValues.rStartValue,
404
- domainNRangeValues.rEndValue
405
- ]).paddingInner(typeof xAxisInnerPadding !== 'undefined' ? xAxisInnerPadding : xAxisPadding).paddingOuter(typeof xAxisOuterPadding !== 'undefined' ? xAxisOuterPadding : xAxisPadding);
406
- var _tickParams_tickValues;
407
- let tickValues = (_tickParams_tickValues = tickParams.tickValues) !== null && _tickParams_tickValues !== void 0 ? _tickParams_tickValues : dataset;
408
- const tickFormat = (domainValue, _index)=>{
409
- if (tickParams.tickValues && tickText && typeof tickText[_index] !== 'undefined') {
410
- return tickText[_index];
411
- }
412
- return domainValue;
413
- };
414
- if (hideTickOverlap) {
415
- let nonOverlappingTickValues = [];
416
- const tickSizes = tickValues.map((value)=>calcMaxLabelWidth([
417
- value
418
- ]));
419
- // for LTR
420
- let start = 0;
421
- let end = containerWidth;
422
- let sign = 1;
423
- const range = xAxisScale.range();
424
- if (range[1] - range[0] < 0) {
425
- // for RTL
426
- start = containerWidth;
427
- end = 0;
428
- sign = -1;
429
- }
430
- for(let i = tickValues.length - 1; i >= 0; i--){
431
- const tickPosition = xAxisScale(tickValues[i]);
432
- if (sign * (tickPosition - sign * tickSizes[i] / 2 - start) >= 0 && sign * (tickPosition + sign * tickSizes[i] / 2 - end) <= 0) {
433
- nonOverlappingTickValues.push(tickValues[i]);
434
- end = tickPosition - sign * (tickSizes[i] / 2 + 10);
435
- }
436
- }
437
- nonOverlappingTickValues = nonOverlappingTickValues.reverse();
438
- tickValues = nonOverlappingTickValues;
439
- }
440
- const xAxis = d3AxisBottom(xAxisScale).tickSize(xAxistickSize).tickPadding(tickPadding).tickValues(tickValues).tickFormat(tickFormat);
441
- if (xAxisParams.xAxisElement) {
442
- d3Select(xAxisParams.xAxisElement).call(xAxis).selectAll('text').attr('aria-hidden', 'true').style('direction', 'ltr').style('unicode-bidi', 'isolate');
443
- }
444
- return {
445
- xScale: xAxisScale,
446
- tickValues,
447
- tickLabels: tickValues.map(xAxis.tickFormat())
448
- };
449
- }
450
- export function useRtl() {
451
- const { dir } = useFluent(); // "dir" returns "ltr" or "rtl"
452
- return dir === 'rtl';
453
- }
454
- function isPowerOf10(num) {
455
- const roundedfinalYMax = handleFloatingPointPrecisionError(num);
456
- return Math.log10(roundedfinalYMax) % 1 === 0;
457
- }
458
- //for reference, go through this 'https://docs.python.org/release/2.5.1/tut/node16.html'
459
- function handleFloatingPointPrecisionError(num) {
460
- const rounded = Math.round(num);
461
- return Math.abs(num - rounded) < 1e-6 ? rounded : num;
462
- }
463
- /**
464
- * This method is used to calculate the rounded tick values for the y-axis
465
- * @param {number} minVal
466
- * @param {number} maxVal
467
- * @param {number} splitInto
468
- * @returns {number[]}
469
- */ function calculateRoundedTicks(minVal, maxVal, splitInto) {
470
- const finalYmin = minVal >= 0 && minVal === maxVal ? 0 : minVal;
471
- const finalYmax = minVal < 0 && minVal === maxVal ? 0 : maxVal;
472
- const ticksInterval = d3nice(finalYmin, finalYmax, splitInto);
473
- const ticks = d3Ticks(ticksInterval[0], ticksInterval[ticksInterval.length - 1], splitInto);
474
- if (ticks[ticks.length - 1] > finalYmax && isPowerOf10(finalYmax)) {
475
- ticks.pop();
476
- }
477
- return ticks;
478
- }
479
- /**
480
- * This method used for creating data points for the y axis.
481
- * @export
482
- * @param {number} maxVal
483
- * @param {number} minVal
484
- * @param {number} splitInto
485
- * @param {boolean} isIntegralDataset
486
- * @returns {number[]}
487
- */ export function prepareDatapoints(maxVal, minVal, splitInto, isIntegralDataset, roundedTicks) {
488
- if (roundedTicks) {
489
- return calculateRoundedTicks(minVal, maxVal, splitInto);
490
- }
491
- const val = isIntegralDataset ? Math.ceil((maxVal - minVal) / splitInto) : (maxVal - minVal) / splitInto >= 1 ? Math.ceil((maxVal - minVal) / splitInto) : (maxVal - minVal) / splitInto;
492
- /*
493
- For cases where we have negative and positive values
494
- The dataPointsArray is filled from 0 to minVal by val difference
495
- Then the array is reversed and values from 0(excluding 0) to maxVal are appended
496
- This ensures presence of 0 to act as an anchor reference.
497
- For simple cases where the scale may not encounter such a need for 0,
498
- We simply fill from minVal to maxVal
499
- */ const dataPointsArray = [
500
- minVal < 0 && maxVal >= 0 ? 0 : minVal
501
- ];
502
- /*For the case of all positive or all negative, we need to add another value
503
- in array for atleast one interval, but in case of mix of positive and negative,
504
- there will always be one more entry that will be added by the logic we have*/ if (dataPointsArray[0] === minVal) {
505
- dataPointsArray.push(minVal + val);
506
- }
507
- if (minVal < 0 && maxVal >= 0) {
508
- while(dataPointsArray[dataPointsArray.length - 1] > minVal){
509
- dataPointsArray.push(dataPointsArray[dataPointsArray.length - 1] - val);
510
- }
511
- dataPointsArray.reverse();
512
- }
513
- while(dataPointsArray[dataPointsArray.length - 1] < maxVal){
514
- dataPointsArray.push(dataPointsArray[dataPointsArray.length - 1] + val);
515
- }
516
- return dataPointsArray;
517
- }
518
- export function createYAxisForHorizontalBarChartWithAxis(yAxisParams, isRtl, axisData) {
519
- const { yMinMaxValues = {
520
- startValue: 0,
521
- endValue: 0
522
- }, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, tickValues, tickStep, tick0, tickText } = yAxisParams;
523
- // maxOfYVal coming from horizontal bar chart with axis (Calculation done at base file)
524
- const tempVal = maxOfYVal || yMinMaxValues.endValue;
525
- const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
526
- const finalYmin = yMinMaxValues.startValue < yMinValue ? Math.min(0, yMinMaxValues.startValue) : yMinValue;
527
- const yAxisScale = d3ScaleLinear().domain([
528
- finalYmin,
529
- finalYmax
530
- ]).range([
531
- containerHeight - margins.bottom,
532
- margins.top
533
- ]);
534
- const axis = isRtl ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
535
- const yAxis = axis.tickPadding(tickPadding).ticks(yAxisTickCount);
536
- const tickFormat = (domainValue, index)=>{
537
- if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
538
- return tickText[index];
539
- }
540
- if (typeof yAxisTickFormat === 'function') {
541
- return yAxisTickFormat(domainValue, index);
542
- }
543
- if (typeof yAxisTickFormat === 'string') {
544
- return d3Format(yAxisTickFormat)(domainValue);
545
- }
546
- const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
547
- return defaultYAxisTickFormatter(value);
548
- };
549
- yAxis.tickFormat(tickFormat);
550
- let customTickValues;
551
- if (tickValues) {
552
- customTickValues = tickValues;
553
- } else if (tickStep) {
554
- customTickValues = generateNumericTicks(undefined, tickStep, tick0, yAxisScale.domain());
555
- }
556
- if (customTickValues) {
557
- yAxis.tickValues(customTickValues);
558
- }
559
- yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true') : '';
560
- axisData.yAxisDomainValues = yAxisScale.domain();
561
- var _yAxis_tickValues;
562
- axisData.yAxisTickText = ((_yAxis_tickValues = yAxis.tickValues()) !== null && _yAxis_tickValues !== void 0 ? _yAxis_tickValues : yAxisScale.ticks(yAxisTickCount)).map(yAxis.tickFormat());
563
- return yAxisScale;
564
- }
565
- export function createNumericYAxis(yAxisParams, isRtl, axisData, isIntegralDataset, chartType, useSecondaryYScale = false, roundedTicks = false, scaleType, _useRtl) {
566
- const { yMinMaxValues = {
567
- startValue: 0,
568
- endValue: 0
569
- }, yAxisElement = null, yMaxValue = 0, yMinValue = 0, containerHeight, containerWidth, margins, tickPadding = 12, maxOfYVal = 0, yAxisTickFormat, yAxisTickCount = 4, eventAnnotationProps, eventLabelHeight, tickValues, tickStep, tick0, tickText } = yAxisParams;
570
- // maxOfYVal coming from only area chart and Grouped vertical bar chart(Calculation done at base file)
571
- const tempVal = maxOfYVal || yMinMaxValues.endValue || 0;
572
- const finalYmax = tempVal > yMaxValue ? tempVal : yMaxValue;
573
- const finalYmin = Math.min(yMinMaxValues.startValue || 0, yMinValue || 0);
574
- const domainValues = prepareDatapoints(finalYmax, finalYmin, yAxisTickCount, isIntegralDataset, roundedTicks);
575
- let yMin = finalYmin;
576
- let yMax = domainValues[domainValues.length - 1];
577
- if (chartType === 7) {
578
- const yPadding = (yMax - yMin) * 0.1;
579
- yMin = yMin - yPadding;
580
- yMax = yMax + yPadding;
581
- }
582
- let scaleDomain = [
583
- domainValues[0],
584
- domainValues[domainValues.length - 1]
585
- ];
586
- if (scaleType === 'log') {
587
- let domainStart = yMinMaxValues.startValue;
588
- let domainEnd = yMinMaxValues.endValue;
589
- if (yMinValue > 0) {
590
- domainStart = Math.min(domainStart, yMinValue);
591
- }
592
- if (yMaxValue > 0) {
593
- domainEnd = Math.max(domainEnd, yMaxValue);
594
- }
595
- scaleDomain = [
596
- domainStart,
597
- domainEnd
598
- ];
599
- }
600
- const yAxisScale = createNumericScale(scaleType).domain(scaleDomain).range([
601
- containerHeight - margins.bottom,
602
- margins.top + (eventAnnotationProps ? eventLabelHeight : 0)
603
- ]);
604
- const axis = !isRtl && useSecondaryYScale || isRtl && !useSecondaryYScale ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
605
- const yAxis = axis.tickPadding(tickPadding).tickSizeInner(-(containerWidth - margins.left - margins.right));
606
- let customTickValues;
607
- if (tickValues) {
608
- customTickValues = tickValues;
609
- } else if (tickStep) {
610
- customTickValues = generateNumericTicks(scaleType, tickStep, tick0, yAxisScale.domain());
611
- }
612
- if (customTickValues) {
613
- yAxis.tickValues(customTickValues);
614
- axisData.yAxisDomainValues = customTickValues;
615
- } else if (scaleType !== 'log') {
616
- yAxis.tickValues(domainValues);
617
- }
618
- const tickFormat = (domainValue, index, defaultFormat)=>{
619
- if (tickValues && tickText && typeof tickText[index] !== 'undefined') {
620
- return tickText[index];
621
- }
622
- if (typeof yAxisTickFormat === 'function') {
623
- return yAxisTickFormat(domainValue, index);
624
- }
625
- if (typeof yAxisTickFormat === 'string') {
626
- return d3Format(yAxisTickFormat)(domainValue);
627
- }
628
- const value = typeof domainValue === 'number' ? domainValue : domainValue.valueOf();
629
- return (defaultFormat === null || defaultFormat === void 0 ? void 0 : defaultFormat(value)) === '' ? '' : defaultYAxisTickFormatter(value);
630
- };
631
- yAxis.tickFormat((v, i)=>tickFormat(v, i, yAxisScale.tickFormat(yAxisTickCount)));
632
- yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text').attr('aria-hidden', 'true').style('direction', 'ltr').style('unicode-bidi', 'isolate').style('text-anchor', !useSecondaryYScale && (_useRtl ? 'start' : 'end')) : '';
633
- axisData.yAxisDomainValues = yAxisScale.domain();
634
- var _yAxis_tickValues;
635
- axisData.yAxisTickText = ((_yAxis_tickValues = yAxis.tickValues()) !== null && _yAxis_tickValues !== void 0 ? _yAxis_tickValues : yAxisScale.ticks(yAxisTickCount)).map(yAxis.tickFormat());
636
- return yAxisScale;
637
- }
638
- /**
639
- * Creating String Y axis of the chart for Horizontal Bar Chart With Axis
640
- * @param yAxisParams
641
- * @param dataPoints
642
- * @param isRtl
643
- */ export const createStringYAxisForHorizontalBarChartWithAxis = (yAxisParams, dataPoints, isRtl, axisData, barWidth)=>{
644
- const { containerHeight, tickPadding = 12, margins, yAxisTickFormat, yAxisElement, yAxisPadding, tickValues, tickText } = yAxisParams;
645
- let yAxisPaddingValue = yAxisPadding !== null && yAxisPadding !== void 0 ? yAxisPadding : 0.5;
646
- yAxisPaddingValue = yAxisPaddingValue === 1 ? 0.99 : yAxisPaddingValue;
647
- const yAxisScale = d3ScaleBand().domain(dataPoints).range([
648
- containerHeight - margins.bottom,
649
- margins.top
650
- ]).padding(yAxisPaddingValue);
651
- const axis = isRtl ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
652
- const customTickValues = tickValues !== null && tickValues !== void 0 ? tickValues : dataPoints;
653
- const tickFormat = (domainValue, _index)=>{
654
- if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
655
- return tickText[_index];
656
- }
657
- if (typeof yAxisTickFormat === 'function') {
658
- return yAxisTickFormat(domainValue, _index);
659
- }
660
- return domainValue;
661
- };
662
- const yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat);
663
- yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text') : '';
664
- axisData.yAxisTickText = yAxis.tickValues().map(yAxis.tickFormat());
665
- return yAxisScale;
666
- };
667
- /**
668
- * Creating String Y axis of the chart for other chart except Horizontal Bar Chart With Axis
669
- * @param yAxisParams
670
- * @param dataPoints
671
- * @param isRtl
672
- */ export const createStringYAxis = (yAxisParams, dataPoints, isRtl, axisData, barWidth, chartType)=>{
673
- const { containerHeight, tickPadding = 12, margins, yAxisTickFormat, yAxisElement, yAxisPadding = 0, containerWidth, tickValues, tickText } = yAxisParams;
674
- const yAxisScale = d3ScaleBand().domain(dataPoints).range([
675
- containerHeight - margins.bottom,
676
- margins.top
677
- ]).padding(yAxisPadding);
678
- if (chartType === 3) {
679
- yAxisScale.paddingInner(1).paddingOuter(0);
680
- }
681
- const axis = isRtl ? d3AxisRight(yAxisScale) : d3AxisLeft(yAxisScale);
682
- const customTickValues = tickValues !== null && tickValues !== void 0 ? tickValues : dataPoints;
683
- const tickFormat = (domainValue, _index)=>{
684
- if (tickValues && tickText && typeof tickText[_index] !== 'undefined') {
685
- return tickText[_index];
686
- }
687
- if (typeof yAxisTickFormat === 'function') {
688
- return yAxisTickFormat(domainValue, _index);
689
- }
690
- return domainValue;
691
- };
692
- const yAxis = axis.tickPadding(tickPadding).tickValues(customTickValues).tickFormat(tickFormat).tickSize(0);
693
- if (chartType === 3) {
694
- axis.tickSizeInner(-(containerWidth - margins.left - margins.right));
695
- }
696
- yAxisElement ? d3Select(yAxisElement).call(yAxis).selectAll('text') : '';
697
- axisData.yAxisTickText = yAxis.tickValues().map(yAxis.tickFormat());
698
- return yAxisScale;
699
- };
700
- /**
701
- * For area chart and line chart, while displaying stackCallout, Need to form a callout data object.
702
- * This methos creates an object for those 2 charts.
703
- * @param values
704
- */ // changing the type to any as it is used by multiple charts with different data types
705
- export function calloutData(values) {
706
- let combinedResult = [];
707
- values.forEach((line)=>{
708
- const elements = line.data.filter((point)=>!point.hideCallout).map((point)=>{
709
- return {
710
- ...point,
711
- legend: line.legend,
712
- color: line.color,
713
- index: line.index
714
- };
715
- });
716
- combinedResult = combinedResult.concat(elements);
717
- });
718
- const xValToDataPoints = {};
719
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
720
- combinedResult.forEach((ele)=>{
721
- const xValue = ele.x instanceof Date ? ele.x.getTime() : ele.x;
722
- const newPoint = {
723
- legend: ele.legend,
724
- y: ele.y,
725
- color: ele.color,
726
- xAxisCalloutData: ele.xAxisCalloutData,
727
- yAxisCalloutData: ele.yAxisCalloutData,
728
- callOutAccessibilityData: ele.callOutAccessibilityData,
729
- index: ele.index
730
- };
731
- if (xValue in xValToDataPoints) {
732
- // Check if a point with the same legend and y-value already exists
733
- const existingPoint = xValToDataPoints[xValue].find((p)=>p.legend === newPoint.legend && p.y === newPoint.y);
734
- if (!existingPoint) {
735
- xValToDataPoints[xValue].push(newPoint);
736
- }
737
- } else {
738
- xValToDataPoints[xValue] = [
739
- newPoint
740
- ];
741
- }
742
- });
743
- return xValToDataPoints;
744
- }
745
- export function getUnique(arr, comp) {
746
- const unique = arr// eslint-disable-next-line @typescript-eslint/no-explicit-any
747
- .map((e)=>e[comp])// store the keys of the unique objects
748
- .map((e, i, final)=>final.indexOf(e) === i && i)// eliminate the dead keys & store unique objects
749
- .filter((e)=>arr[e]).map((e)=>arr[e]);
750
- return unique;
751
- }
752
- /**
753
- * This function takes two paramerter
754
- * 1. an array of strings
755
- * 2. a string value
756
- * if the value is not present in the given array then it will return the new
757
- * array by appending the value to the present arrray.
758
- *
759
- * if the value is already present in the given array then it will return the new
760
- * array by deleteing the value from the the array
761
- * @param array
762
- * @param value
763
- */ export function silceOrAppendToArray(array, value) {
764
- const pos = array.indexOf(value);
765
- if (pos === -1) {
766
- return [
767
- ...array,
768
- value
769
- ];
770
- } else {
771
- return array.slice(0, pos).concat(array.slice(pos + 1));
772
- }
773
- }
774
- export const DEFAULT_WRAP_WIDTH = 10;
775
- /**
776
- * This method used for wrapping of x axis labels (tick values).
777
- * It breaks down given text value by space separated and calculates the total height needed to display all the words.
778
- * That value = removal value. This value needs to be remove from total svg height, svg will shrink and
779
- * total text will be displayed.
780
- * @export
781
- * @param {IWrapLabelProps} wrapLabelProps
782
- * @returns
783
- */ export function createWrapOfXLabels(wrapLabelProps) {
784
- const { node, xAxis, noOfCharsToTruncate, showXAxisLablesTooltip, width = DEFAULT_WRAP_WIDTH, container } = wrapLabelProps;
785
- if (node === null) {
786
- return;
787
- }
788
- const axisNode = d3Select(node).call(xAxis);
789
- let removeVal = 0;
790
- let maxLines = 1;
791
- axisNode.selectAll('.tick text').each(function(_, tickIndex) {
792
- const text = d3Select(this);
793
- const totalWord = text.text();
794
- const truncatedWord = `${text.text().slice(0, noOfCharsToTruncate)}...`;
795
- const totalWordLength = text.text().length;
796
- const words = text.text().split(/\s+/).reverse();
797
- let word = '';
798
- let line = [];
799
- let lineNumber = 0;
800
- const lineHeight = 1.1; // ems
801
- const y = text.attr('y');
802
- const dy = parseFloat(text.attr('dy'));
803
- let tspan = text.text(null).attr('data-full', totalWord).append('tspan').attr('x', 0).attr('y', y).attr('dy', dy + 'em');
804
- if (showXAxisLablesTooltip) {
805
- tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
806
- } else {
807
- const maxWidth = Array.isArray(width) ? width[tickIndex] : width;
808
- while(word = words.pop()){
809
- line.push(word);
810
- const label = line.join(' ');
811
- tspan.text(label);
812
- const labelWidth = getTextSize(label, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
813
- if (labelWidth > maxWidth && line.length > 1) {
814
- line.pop();
815
- tspan.text(line.join(' '));
816
- line = [
817
- word
818
- ];
819
- tspan = text.append('tspan').attr('x', 0).attr('y', y).attr('dy', ++lineNumber * lineHeight + dy + 'em').text(word);
820
- }
821
- }
822
- }
823
- maxLines = Math.max(maxLines, lineNumber + 1);
824
- });
825
- if (!showXAxisLablesTooltip) {
826
- var _querySelector;
827
- let maxHeight = 12; // intial value to render corretly first time
828
- var _querySelector_getBoundingClientRect_height;
829
- const boxHeight = (_querySelector_getBoundingClientRect_height = (_querySelector = (container !== null && container !== void 0 ? container : document).querySelector(`.${CARTESIAN_XAXIS_CLASSNAME} tspan`)) === null || _querySelector === void 0 ? void 0 : _querySelector.getBoundingClientRect().height) !== null && _querySelector_getBoundingClientRect_height !== void 0 ? _querySelector_getBoundingClientRect_height : 0;
830
- if (boxHeight > maxHeight) {
831
- maxHeight = boxHeight;
832
- }
833
- removeVal = (maxLines - 1) * maxHeight;
834
- }
835
- return removeVal > 0 ? removeVal : 0;
836
- }
837
- /**
838
- * This method used for wrapping of y axis labels (tick values).
839
- */ export function createYAxisLabels(node, // eslint-disable-next-line @typescript-eslint/no-explicit-any
840
- yAxis, noOfCharsToTruncate, truncateLabel, isRtl) {
841
- if (node === null) {
842
- return;
843
- }
844
- const axisNode = d3Select(node).call(yAxis);
845
- axisNode.selectAll('.tick text').each(function() {
846
- const text = d3Select(this);
847
- const totalWord = text.text();
848
- const truncatedWord = isRtl ? `...${text.text().slice(0, noOfCharsToTruncate)}` : `${text.text().slice(0, noOfCharsToTruncate)}...`;
849
- const totalWordLength = text.text().length;
850
- const y = text.attr('y');
851
- const x = text.attr('x');
852
- const dy = parseFloat(text.attr('dy'));
853
- const tspan = text.text(null).attr('data-full', totalWord).append('tspan').attr('x', x).attr('y', y).attr('dy', dy + 'em');
854
- if (truncateLabel) {
855
- tspan.text(totalWordLength > noOfCharsToTruncate ? truncatedWord : totalWord);
856
- }
857
- });
858
- }
859
- export const wrapContent = (content, id, maxWidth)=>{
860
- const textElement = d3Select(`#${id}`);
861
- textElement.text(content);
862
- if (!textElement.node()) {
863
- return false;
864
- }
865
- let isOverflowing = false;
866
- let textLength = textElement.node().getComputedTextLength();
867
- while(textLength > maxWidth && content.length > 0){
868
- content = content.slice(0, -1);
869
- textElement.text(content + '...');
870
- isOverflowing = true;
871
- textLength = textElement.node().getComputedTextLength();
872
- }
873
- return isOverflowing;
874
- };
875
- /**
876
- * Calculates the width of the longest axis label in pixels
877
- */ export const calculateLongestLabelWidth = (labels, query = 'none')=>{
878
- let maxLabelWidth = 0;
879
- const canvas = document.createElement('canvas');
880
- const ctx = canvas.getContext('2d');
881
- if (ctx) {
882
- const axisText = document.querySelector(query);
883
- if (axisText) {
884
- const styles = window.getComputedStyle(axisText, null);
885
- const fontWeight = styles.getPropertyValue('font-weight');
886
- const fontSize = styles.getPropertyValue('font-size');
887
- const fontFamily = styles.getPropertyValue('font-family');
888
- ctx.font = `${fontWeight} ${fontSize} ${fontFamily}`;
889
- } else {
890
- ctx.font = '600 10px "Segoe UI"';
891
- }
892
- labels.forEach((label)=>{
893
- maxLabelWidth = Math.max(ctx.measureText(label.toString()).width, maxLabelWidth);
894
- });
895
- }
896
- return maxLabelWidth;
897
- };
898
- /**
899
- * This method displays a tooltip to the x axis lables(tick values)
900
- * when prop 'showXAxisLablesTooltip' enables to the respected chart.
901
- * On hover of the truncated word(at x axis labels tick), a tooltip will be appeared.
902
- */ export function tooltipOfAxislabels(axistooltipProps) {
903
- const { tooltipCls, axis, id, container } = axistooltipProps;
904
- if (axis === null) {
905
- return null;
906
- }
907
- const div = (container ? d3Select(container) : d3Select('body')).append('div').attr('id', id).attr('class', tooltipCls).style('opacity', 0);
908
- axis.selectAll('.tick text').each(function() {
909
- const tickSelection = d3Select(this);
910
- const fullLabel = tickSelection.attr('data-full');
911
- if (tickSelection.text() === fullLabel) {
912
- return;
913
- }
914
- const tickEl = this;
915
- tickSelection// eslint-disable-next-line @typescript-eslint/no-explicit-any
916
- .on('mouseover', (event, d)=>{
917
- const containerBounds = container === null || container === void 0 ? void 0 : container.getBoundingClientRect();
918
- const tickBounds = tickEl.getBoundingClientRect();
919
- const tooltipBottom = containerBounds ? containerBounds.bottom - (tickBounds.top - 4) : tickBounds.top - 4;
920
- var _containerBounds_left;
921
- const tooltipLeft = (tickBounds.left + tickBounds.right) / 2 - ((_containerBounds_left = containerBounds === null || containerBounds === void 0 ? void 0 : containerBounds.left) !== null && _containerBounds_left !== void 0 ? _containerBounds_left : 0);
922
- div.text(fullLabel).style('bottom', `${tooltipBottom}px`).style('left', `${tooltipLeft}px`).style('transform', 'translateX(-50%)').style('opacity', 0.9);
923
- }).on('mouseout', (d)=>{
924
- div.style('opacity', 0);
925
- });
926
- });
927
- }
928
- /**
929
- * Find the axis type of line chart and area chart from given data
930
- * @param points
931
- */ export function getXAxisType(points) {
932
- let isXAxisDateType = false;
933
- if (points && points.length > 0) {
934
- points.forEach((chartData)=>{
935
- if (chartData.data.length > 0) {
936
- isXAxisDateType = chartData.data[0].x instanceof Date;
937
- return;
938
- }
939
- });
940
- }
941
- return isXAxisDateType;
942
- }
943
- /**
944
- * Calculates Domain and range values for Numeric X axis.
945
- * This method calculates Area cart and line chart.
946
- * @export
947
- * @param {LineChartPoints[]} points
948
- * @param {IMargins} margins
949
- * @param {number} width
950
- * @param {boolean} isRTL
951
- * @returns {IDomainNRange}
952
- */ export function domainRangeOfNumericForAreaLineScatterCharts(points, margins, width, isRTL, scaleType, hasMarkersMode, xMinVal, xMaxVal) {
953
- const isScatterPolar = isScatterPolarSeries(points);
954
- let [xMin, xMax] = getScatterXDomainExtent(points, scaleType);
955
- if (hasMarkersMode) {
956
- const xPadding = getDomainPaddingForMarkers(xMin, xMax, scaleType, xMinVal, xMaxVal);
957
- xMin = xMin - xPadding.start;
958
- xMax = xMax + xPadding.end;
959
- }
960
- const rStartValue = margins.left;
961
- const rEndValue = width - margins.right;
962
- return isRTL ? {
963
- dStartValue: isScatterPolar ? 1 : xMax,
964
- dEndValue: isScatterPolar ? -1 : xMin,
965
- rStartValue,
966
- rEndValue
967
- } : {
968
- dStartValue: isScatterPolar ? -1 : xMin,
969
- dEndValue: isScatterPolar ? 1 : xMax,
970
- rStartValue,
971
- rEndValue
972
- };
973
- }
974
- /**
975
- * Groups HorizontalBarChart With Axis data based on YValue
976
- * Used for stacked case
977
- * @param {IHorizontalBarChartWithAxisDataPoint[]} chartData
978
- * @returns {IHorizontalBarChartWithAxisDataPoint[][]}
979
- */ export function groupChartDataByYValue(chartData) {
980
- const map = {};
981
- chartData.forEach((dataPoint)=>{
982
- const key = dataPoint.y;
983
- if (!map[key]) {
984
- map[key] = [];
985
- }
986
- map[key].push(dataPoint);
987
- });
988
- return Object.values(map);
989
- }
990
- /**
991
- * Calculates maximum domain values for Numeric x axis for both positive and negative values
992
- * works for Horizontal Bar Chart With axis
993
- * @param {HorizontalBarChartWithAxisDataPoint[][]} stackedChartData
994
- * @returns {number}
995
- */ export function computeLongestBars(stackedChartData, X_ORIGIN) {
996
- let longestPositiveBar = 0;
997
- let longestNegativeBar = 0;
998
- stackedChartData.forEach((group)=>{
999
- const positiveBarTotal = group.reduce((acc, point)=>acc + (point.x > 0 ? point.x : 0), X_ORIGIN);
1000
- const negativeBarTotal = group.reduce((acc, point)=>acc + (point.x < 0 ? point.x : 0), X_ORIGIN);
1001
- longestPositiveBar = Math.max(longestPositiveBar, positiveBarTotal);
1002
- longestNegativeBar = Math.min(longestNegativeBar, negativeBarTotal);
1003
- });
1004
- return {
1005
- longestPositiveBar,
1006
- longestNegativeBar
1007
- };
1008
- }
1009
- /**
1010
- * Calculates Domain and range values for Numeric X axis.
1011
- * This method calculates Horizontal Chart with Axis
1012
- * @export
1013
- * @param {LineChartPoints[]} points
1014
- * @param {IMargins} margins
1015
- * @param {number} width
1016
- * @param {boolean} isRTL
1017
- * @returns {IDomainNRange}
1018
- */ export function domainRangeOfNumericForHorizontalBarChartWithAxis(points, margins, containerWidth, isRTL, X_ORIGIN) {
1019
- const longestBars = computeLongestBars(groupChartDataByYValue(points), X_ORIGIN);
1020
- const xMax = longestBars.longestPositiveBar;
1021
- const xMin = longestBars.longestNegativeBar;
1022
- const rMin = margins.left;
1023
- const rMax = containerWidth - margins.right;
1024
- return isRTL ? {
1025
- dStartValue: xMax,
1026
- dEndValue: Math.min(xMin, X_ORIGIN),
1027
- rStartValue: rMin,
1028
- rEndValue: rMax
1029
- } : {
1030
- dStartValue: Math.min(xMin, X_ORIGIN),
1031
- dEndValue: xMax,
1032
- rStartValue: rMin,
1033
- rEndValue: rMax
1034
- };
1035
- }
1036
- /**
1037
- * Calculates Range values of x Axis string axis
1038
- * For String axis, we need to give domain values (Not start and end array values)
1039
- * So sending 0 as domain values. Domain will be handled at creation of string axis
1040
- * For charts stacked bar chart, grouped vertical bar chart, HeatMapChart and Vertical bar chart
1041
- * @export
1042
- * @param {IMargins} margins
1043
- * @param {number} width
1044
- * @param {boolean} isRTL
1045
- * @returns {IDomainNRange}
1046
- */ export function domainRangeOfXStringAxis(margins, width, isRTL) {
1047
- const rMin = margins.left;
1048
- const rMax = width - margins.right;
1049
- return isRTL ? {
1050
- dStartValue: 0,
1051
- dEndValue: 0,
1052
- rStartValue: rMax,
1053
- rEndValue: rMin
1054
- } : {
1055
- dStartValue: 0,
1056
- dEndValue: 0,
1057
- rStartValue: rMin,
1058
- rEndValue: rMax
1059
- };
1060
- }
1061
- /**
1062
- * Calculate domain and range values to the Vertical stacked bar chart - For Numeric axis
1063
- * @export
1064
- * @param {DataPoint[]} points
1065
- * @param {IMargins} margins
1066
- * @param {number} width
1067
- * @param {boolean} isRTL
1068
- * @param {number} barWidth
1069
- * @returns {IDomainNRange}
1070
- */ export function domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth) {
1071
- const xMin = d3Min(points, (point)=>point.x);
1072
- const xMax = d3Max(points, (point)=>point.x);
1073
- const rMax = margins.left;
1074
- const rMin = width - margins.right;
1075
- return isRTL ? {
1076
- dStartValue: xMax,
1077
- dEndValue: xMin,
1078
- rStartValue: rMax,
1079
- rEndValue: rMin
1080
- } : {
1081
- dStartValue: xMin,
1082
- dEndValue: xMax,
1083
- rStartValue: rMax,
1084
- rEndValue: rMin
1085
- };
1086
- }
1087
- /**
1088
- * Calculates Domain and range values for Date X axis.
1089
- * This method calculates Bar chart.
1090
- * @export
1091
- * @param {VerticalBarChartDataPoint[]} points
1092
- * @param {IMargins} margins
1093
- * @param {number} width
1094
- * @param {boolean} isRTL
1095
- * @param {Date[] | number[]} tickValues
1096
- * @returns {IDomainNRange}
1097
- */ export function domainRangeOfDateForAreaLineScatterVerticalBarCharts(points, margins, width, isRTL, tickValues = [], chartType, barWidth, hasMarkersMode) {
1098
- let sDate;
1099
- let lDate;
1100
- if ([
1101
- 0,
1102
- 1,
1103
- 7
1104
- ].includes(chartType)) {
1105
- [sDate, lDate] = getScatterXDomainExtent(points);
1106
- // Need to draw graph with given small and large date
1107
- // (Which Involves customization of date axis tick values)
1108
- // That may be Either from given graph data or from prop 'tickValues' date values.
1109
- // So, Finding smallest and largest dates
1110
- sDate = d3Min([
1111
- ...tickValues,
1112
- sDate
1113
- ]);
1114
- lDate = d3Max([
1115
- ...tickValues,
1116
- lDate
1117
- ]);
1118
- if (hasMarkersMode || chartType === 7) {
1119
- const xPadding = getDomainPaddingForMarkers(sDate.getTime(), lDate.getTime());
1120
- sDate = new Date(sDate.getTime() - xPadding.start);
1121
- lDate = new Date(lDate.getTime() + xPadding.end);
1122
- }
1123
- } else {
1124
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1125
- sDate = d3Min(points, (point)=>point.x);
1126
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1127
- lDate = d3Max(points, (point)=>point.x);
1128
- }
1129
- const rStartValue = margins.left;
1130
- const rEndValue = width - margins.right;
1131
- return isRTL ? {
1132
- dStartValue: lDate,
1133
- dEndValue: sDate,
1134
- rStartValue,
1135
- rEndValue
1136
- } : {
1137
- dStartValue: sDate,
1138
- dEndValue: lDate,
1139
- rStartValue,
1140
- rEndValue
1141
- };
1142
- }
1143
- /**
1144
- * Calculate domain and range values to the Vertical bar chart - For Numeric axis
1145
- * @export
1146
- * @param {DataPoint[]} points
1147
- * @param {IMargins} margins
1148
- * @param {number} containerWidth
1149
- * @param {boolean} isRTL
1150
- * @param {number} barWidth
1151
- * @returns {IDomainNRange}
1152
- */ export function domainRangeOfVerticalNumeric(points, margins, containerWidth, isRTL, barWidth) {
1153
- const xMax = d3Max(points, (point)=>point.x);
1154
- const xMin = d3Min(points, (point)=>point.x);
1155
- const rMin = margins.left;
1156
- const rMax = containerWidth - margins.right;
1157
- return isRTL ? {
1158
- dStartValue: xMax,
1159
- dEndValue: xMin,
1160
- rStartValue: rMin,
1161
- rEndValue: rMax
1162
- } : {
1163
- dStartValue: xMin,
1164
- dEndValue: xMax,
1165
- rStartValue: rMin,
1166
- rEndValue: rMax
1167
- };
1168
- }
1169
- /**
1170
- * Calculating start and ending values of the Area chart and LineChart
1171
- * @export
1172
- * @param {LineChartPoints[]} points
1173
- * @returns {{ startValue: number; endValue: number }}
1174
- */ export function findNumericMinMaxOfY(points, yAxisType, useSecondaryYScale, scaleType) {
1175
- const values = [];
1176
- points.forEach((point)=>{
1177
- if (!useSecondaryYScale === !point.useSecondaryYScale) {
1178
- point.data.forEach((data)=>{
1179
- if (isValidDomainValue(data.y, scaleType)) {
1180
- values.push(data.y);
1181
- }
1182
- });
1183
- }
1184
- });
1185
- return {
1186
- startValue: d3Min(values),
1187
- endValue: d3Max(values)
1188
- };
1189
- }
1190
- /**
1191
- * Find the minimum and maximum values of the vertical stacked bar chart y axis data point. Used for create y axis.
1192
- * @export
1193
- * @param {DataPoint[]} dataset
1194
- * @returns {{ startValue: number; endValue: number }}
1195
- */ export function findVSBCNumericMinMaxOfY(dataset) {
1196
- const yMax = d3Max(dataset, (point)=>point.y);
1197
- const yMin = d3Min(dataset, (point)=>point.y);
1198
- return {
1199
- startValue: yMin,
1200
- endValue: yMax
1201
- };
1202
- }
1203
- /**
1204
- * Finds the min and max values of the vertical bar chart y axis data point.
1205
- * @export
1206
- * @param {VerticalBarChartDataPoint[]} points
1207
- * @returns {{ startValue: number; endValue: number }}
1208
- */ export function findVerticalNumericMinMaxOfY(points, yAxisType, useSecondaryYScale) {
1209
- const values = [];
1210
- points.forEach((point)=>{
1211
- if (!useSecondaryYScale) {
1212
- values.push(point.y);
1213
- }
1214
- if (typeof point.lineData !== 'undefined') {
1215
- if (!useSecondaryYScale === !point.lineData.useSecondaryYScale) {
1216
- values.push(point.lineData.y);
1217
- }
1218
- }
1219
- });
1220
- return {
1221
- startValue: d3Min(values),
1222
- endValue: d3Max(values)
1223
- };
1224
- }
1225
- /**
1226
- * Finds the min and max values of the horizontal bar chart y axis data point.
1227
- * @export
1228
- * @param {HorizontalBarChartWithAxisDataPoint[]|GanttChartDataPoint[]} points
1229
- * @returns {{ startValue: number; endValue: number }}
1230
- */ export function findHBCWANumericMinMaxOfY(points, yAxisType) {
1231
- if (yAxisType !== undefined && yAxisType === 0) {
1232
- const yMax = d3Max(points, (point)=>point.y);
1233
- const yMin = d3Min(points, (point)=>point.y);
1234
- return {
1235
- startValue: yMin,
1236
- endValue: yMax
1237
- };
1238
- }
1239
- return {
1240
- startValue: 0,
1241
- endValue: 0
1242
- };
1243
- }
1244
- /**
1245
- * @param p string or number or Date
1246
- *
1247
- * This function takes the single data point of the x-aixs
1248
- * and decides what is the x-axis
1249
- */ export const getTypeOfAxis = (p, isXAxis)=>{
1250
- if (isXAxis) {
1251
- switch(typeof p){
1252
- case 'string':
1253
- return 2;
1254
- case 'number':
1255
- return 0;
1256
- default:
1257
- return 1;
1258
- }
1259
- } else {
1260
- switch(typeof p){
1261
- case 'string':
1262
- return 2;
1263
- case 'number':
1264
- return 0;
1265
- default:
1266
- return 1;
1267
- }
1268
- }
1269
- };
1270
- /**
1271
- * we need to make sure that if we add any property to this, then
1272
- * we need to also add that in pointTypes below and vise-versa
1273
- */ export var Points = /*#__PURE__*/ function(Points) {
1274
- Points[Points["circle"] = 0] = "circle";
1275
- Points[Points["square"] = 1] = "square";
1276
- Points[Points["triangle"] = 2] = "triangle";
1277
- Points[Points["diamond"] = 3] = "diamond";
1278
- Points[Points["pyramid"] = 4] = "pyramid";
1279
- Points[Points["hexagon"] = 5] = "hexagon";
1280
- Points[Points["pentagon"] = 6] = "pentagon";
1281
- Points[Points["octagon"] = 7] = "octagon";
1282
- return Points;
1283
- }({});
1284
- export var CustomPoints = /*#__PURE__*/ function(CustomPoints) {
1285
- CustomPoints[CustomPoints["dottedLine"] = 0] = "dottedLine";
1286
- return CustomPoints;
1287
- }({});
1288
- /**
1289
- * we need to make sure that if we add any property to this, then
1290
- * we need to also add that in enum Point and vise-versa
1291
- */ export const pointTypes = {
1292
- [0]: {
1293
- widthRatio: 1
1294
- },
1295
- [1]: {
1296
- widthRatio: 1
1297
- },
1298
- [2]: {
1299
- widthRatio: 1
1300
- },
1301
- [3]: {
1302
- widthRatio: 1
1303
- },
1304
- [4]: {
1305
- widthRatio: 1
1306
- },
1307
- [5]: {
1308
- widthRatio: 2
1309
- },
1310
- [6]: {
1311
- widthRatio: 1.168
1312
- },
1313
- [7]: {
1314
- widthRatio: 2.414
1315
- }
1316
- };
1317
- /**
1318
- * @param accessibleData accessible data
1319
- * @param role string to define role of tag
1320
- * @param isDataFocusable boolean
1321
- * function returns the accessibility data object
1322
- */ export const getAccessibleDataObject = (accessibleData, role = 'text', isDataFocusable = true)=>{
1323
- accessibleData = accessibleData !== null && accessibleData !== void 0 ? accessibleData : {};
1324
- return {
1325
- role,
1326
- 'data-is-focusable': isDataFocusable,
1327
- 'aria-label': accessibleData.ariaLabel,
1328
- 'aria-labelledby': accessibleData.ariaLabelledBy,
1329
- 'aria-describedby': accessibleData.ariaDescribedBy
1330
- };
1331
- };
1332
- export function rotateXAxisLabels(rotateLabelProps) {
1333
- const { node, xAxis } = rotateLabelProps;
1334
- if (node === null || xAxis === null) {
1335
- return;
1336
- }
1337
- let maxHeight = 0;
1338
- const xAxisTranslations = [];
1339
- d3Select(node).call(xAxis).selectAll('.tick').each(function() {
1340
- const translateValue = this.getAttribute('transform');
1341
- if ((translateValue === null || translateValue === void 0 ? void 0 : translateValue.indexOf('rotate')) === -1) {
1342
- const translatePair = translateValue.substring(translateValue.indexOf('(') + 1, translateValue.indexOf(')')).split(',');
1343
- if (translatePair.length === 2) {
1344
- xAxisTranslations.push(translatePair[0]);
1345
- this.setAttribute('transform', `translate(${translatePair[0]},0)rotate(-45)`);
1346
- }
1347
- }
1348
- const BoxCordinates = this.getBoundingClientRect();
1349
- const boxHeight = BoxCordinates && BoxCordinates.height;
1350
- if (boxHeight > maxHeight) {
1351
- maxHeight = boxHeight;
1352
- }
1353
- });
1354
- let idx = 0;
1355
- d3Select(node).call(xAxis).selectAll('.tick').each(function() {
1356
- if (xAxisTranslations.length > idx) {
1357
- this.setAttribute('transform', `translate(${xAxisTranslations[idx]},${maxHeight / 2})rotate(-45)`); // Translate y by max height/2
1358
- idx += 1;
1359
- }
1360
- });
1361
- return Math.floor(maxHeight / 1.414); // Compute maxHeight/tanInverse(45) to get the vertical height of labels.
1362
- }
1363
- export function wrapTextInsideDonut(selectorClass, maxWidth) {
1364
- let idx = 0;
1365
- d3SelectAll(`.${selectorClass}`).each(function() {
1366
- const text = d3Select(this);
1367
- const words = text.text().split(/\s+/).reverse();
1368
- let word = '';
1369
- let line = [];
1370
- let lineNumber = 0;
1371
- const lineHeight = 1.1; // ems
1372
- const y = text.attr('y');
1373
- let tspan = text.text(null).append('tspan').attr('id', `WordBreakId-${idx}-${lineNumber}`).attr('x', 0).attr('y', y).attr('dy', lineNumber++ * lineHeight + 'em');
1374
- while(word = words.pop()){
1375
- line.push(word);
1376
- tspan.text(line.join(' ') + ' ');
1377
- if (tspan.node().getComputedTextLength() > maxWidth && line.length > 1) {
1378
- line.pop();
1379
- tspan.text(line.join(' ') + ' ');
1380
- line = [
1381
- word
1382
- ];
1383
- tspan = text.append('tspan').attr('id', `WordBreakId-${idx}-${lineNumber}`).attr('x', 0).attr('y', y).attr('dy', lineNumber++ * lineHeight + 'em').text(word);
1384
- }
1385
- }
1386
- idx += 1;
1387
- });
1388
- }
1389
- export function formatScientificLimitWidth(value) {
1390
- return yAxisTickFormatterInternal(value, true);
1391
- }
1392
- const DEFAULT_BAR_WIDTH = 16;
1393
- const MIN_BAR_WIDTH = 1;
1394
- export const getBarWidth = (barWidthProp, maxBarWidthProp, adjustedValue = DEFAULT_BAR_WIDTH, modeProp)=>{
1395
- let barWidth;
1396
- if (barWidthProp === 'auto' || modeProp === 'histogram') {
1397
- barWidth = adjustedValue;
1398
- } else if (typeof barWidthProp === 'number') {
1399
- barWidth = barWidthProp;
1400
- } else {
1401
- barWidth = Math.min(adjustedValue, DEFAULT_BAR_WIDTH);
1402
- }
1403
- if (typeof maxBarWidthProp === 'number') {
1404
- barWidth = Math.min(barWidth, maxBarWidthProp);
1405
- }
1406
- barWidth = Math.max(barWidth, MIN_BAR_WIDTH);
1407
- return barWidth;
1408
- };
1409
- export const getScalePadding = (prop, shorthandProp, defaultValue = 0)=>{
1410
- let padding = typeof prop === 'number' ? prop : typeof shorthandProp === 'number' ? shorthandProp : defaultValue;
1411
- padding = Math.max(0, Math.min(padding, 1));
1412
- return padding;
1413
- };
1414
- export const isScalePaddingDefined = (prop, shorthandProp)=>{
1415
- return typeof prop === 'number' || typeof shorthandProp === 'number';
1416
- };
1417
- /**
1418
- * Helper to find the index of an item within an array, using a callback to
1419
- * determine the match.
1420
- *
1421
- * @public
1422
- * @param array - Array to search.
1423
- * @param cb - Callback which returns true on matches.
1424
- * @param fromIndex - Optional index to start from (defaults to 0)
1425
- */ export function findIndex(array, cb, fromIndex = 0) {
1426
- let index = -1;
1427
- for(let i = fromIndex; array && i < array.length; i++){
1428
- if (cb(array[i], i)) {
1429
- index = i;
1430
- break;
1431
- }
1432
- }
1433
- return index;
1434
- }
1435
- /**
1436
- * Helper to find the first item within an array that satisfies the callback.
1437
- * @param array - Array to search
1438
- * @param cb - Callback which returns true on matches
1439
- */ export function find(array, cb) {
1440
- const index = findIndex(array, cb);
1441
- if (index < 0) {
1442
- return undefined;
1443
- }
1444
- return array[index];
1445
- }
1446
- export const HighContrastSelector = '@media screen and (-ms-high-contrast: active), screen and (forced-colors: active)';
1447
- export const HighContrastSelectorWhite = '@media screen and (-ms-high-contrast: black-on-white), screen and (forced-colors: active) and (prefers-color-scheme: light)';
1448
- export const HighContrastSelectorBlack = '@media screen and (-ms-high-contrast: white-on-black), screen and (forced-colors: active) and (prefers-color-scheme: dark)';
1449
- export const formatDate = (date, useUTC)=>{
1450
- const timeFormat = useUTC ? d3UtcFormat : d3TimeFormat;
1451
- return timeFormat('%-e %b %Y, %H:%M')(date) + (useUTC ? ' GMT' : '');
1452
- };
1453
- export function areArraysEqual(arr1, arr2) {
1454
- if (arr1 === arr2 || !arr1 && !arr2) {
1455
- return true;
1456
- }
1457
- if (!arr1 || !arr2 || arr1.length !== arr2.length) {
1458
- return false;
1459
- }
1460
- for(let i = 0; i < arr1.length; i++){
1461
- if (arr1[i] !== arr2[i]) {
1462
- return false;
1463
- }
1464
- }
1465
- return true;
1466
- }
1467
- const cssVarRegExp = /var\((--[a-zA-Z0-9\-]+)\)/g;
1468
- export function resolveCSSVariables(container, styleRules) {
1469
- const containerStyles = getComputedStyle(container);
1470
- return styleRules.replace(cssVarRegExp, (match, group1)=>{
1471
- return containerStyles.getPropertyValue(group1);
1472
- });
1473
- }
1474
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1475
- export function getSecureProps(props = {}) {
1476
- const { dangerouslySetInnerHTML, ...result } = props;
1477
- return result;
1478
- }
1479
- export function getCurveFactory(curve, defaultFactory = d3CurveLinear) {
1480
- if (typeof curve === 'function') {
1481
- return curve;
1482
- }
1483
- switch(curve){
1484
- case 'linear':
1485
- return d3CurveLinear;
1486
- case 'natural':
1487
- return d3CurveNatural;
1488
- case 'step':
1489
- return d3CurveStep;
1490
- case 'stepAfter':
1491
- return d3CurveStepAfter;
1492
- case 'stepBefore':
1493
- return d3CurveStepBefore;
1494
- default:
1495
- return defaultFactory;
1496
- }
1497
- }
1498
- export const truncateString = (str, maxLength, ellipsis = '...')=>{
1499
- if (str.length <= maxLength) {
1500
- return str;
1501
- }
1502
- return str.slice(0, maxLength) + ellipsis;
1503
- };
1504
- const categoryOrderRegex = /(category|total|sum|min|max|mean|median) (ascending|descending)/;
1505
- /**
1506
- * @see {@link https://github.com/plotly/plotly.js/blob/master/src/plots/plots.js#L3041}
1507
- */ export const sortAxisCategories = (categoryToValues, categoryOrder)=>{
1508
- if (Array.isArray(categoryOrder)) {
1509
- const result = [];
1510
- const seen = new Set();
1511
- // Add elements from categoryOrder array that are in categoryToValues, in the array's order
1512
- categoryOrder.forEach((category)=>{
1513
- if (categoryToValues[category] && !seen.has(category)) {
1514
- result.push(category);
1515
- seen.add(category);
1516
- }
1517
- });
1518
- // Append any keys from categoryToValues not already in result
1519
- Object.keys(categoryToValues).forEach((category)=>{
1520
- if (!seen.has(category)) {
1521
- result.push(category);
1522
- }
1523
- });
1524
- return result;
1525
- }
1526
- const match = categoryOrder === null || categoryOrder === void 0 ? void 0 : categoryOrder.match(categoryOrderRegex);
1527
- if (match) {
1528
- const aggregator = match[1];
1529
- const order = match[2];
1530
- if (aggregator === 'category') {
1531
- const result = Object.keys(categoryToValues).sort();
1532
- return order === 'descending' ? result.reverse() : result;
1533
- }
1534
- const aggFn = {
1535
- min: d3Min,
1536
- max: d3Max,
1537
- sum: d3Sum,
1538
- total: d3Sum,
1539
- mean: d3Mean,
1540
- median: d3Median
1541
- };
1542
- const sortAscending = (a, b)=>{
1543
- return a[1] - b[1];
1544
- };
1545
- const sortDescending = (a, b)=>{
1546
- return b[1] - a[1];
1547
- };
1548
- const categoriesAggregatedValue = [];
1549
- Object.keys(categoryToValues).forEach((category)=>{
1550
- categoriesAggregatedValue.push([
1551
- category,
1552
- aggFn[aggregator](categoryToValues[category]) || 0
1553
- ]);
1554
- });
1555
- categoriesAggregatedValue.sort(order === 'descending' ? sortDescending : sortAscending);
1556
- return categoriesAggregatedValue.map(([category])=>category);
1557
- }
1558
- return Object.keys(categoryToValues);
1559
- };
1560
- export function copyStyle(properties, fromEl, toEl) {
1561
- const styles = getComputedStyle(fromEl);
1562
- if (Array.isArray(properties)) {
1563
- properties.forEach((prop)=>{
1564
- d3Select(toEl).style(prop, styles.getPropertyValue(prop));
1565
- });
1566
- } else {
1567
- Object.entries(properties).forEach(([fromProp, toProp])=>{
1568
- d3Select(toEl).style(toProp, styles.getPropertyValue(fromProp));
1569
- });
1570
- }
1571
- }
1572
- const MEASUREMENT_SPAN_STYLE = {
1573
- position: 'absolute',
1574
- visibility: 'hidden',
1575
- top: '-20000px',
1576
- left: 0,
1577
- padding: 0,
1578
- margin: 0,
1579
- border: 'none',
1580
- whiteSpace: 'pre'
1581
- };
1582
- const MEASUREMENT_SPAN_ID = 'fui_measurement_span';
1583
- const TEXT_STYLE_PROPERTIES = [
1584
- 'font-size',
1585
- 'font-family',
1586
- 'font-weight',
1587
- 'font-style',
1588
- 'letter-spacing',
1589
- 'text-transform'
1590
- ];
1591
- export const measureTextWithDOM = (text, cssSelector, container)=>{
1592
- let measurementSpan = document.getElementById(MEASUREMENT_SPAN_ID);
1593
- if (!measurementSpan) {
1594
- measurementSpan = document.createElement('span');
1595
- measurementSpan.setAttribute('id', MEASUREMENT_SPAN_ID);
1596
- measurementSpan.setAttribute('aria-hidden', 'true');
1597
- (container !== null && container !== void 0 ? container : document.body).appendChild(measurementSpan);
1598
- }
1599
- Object.assign(measurementSpan.style, MEASUREMENT_SPAN_STYLE);
1600
- const refEl = (container !== null && container !== void 0 ? container : document).querySelector(cssSelector);
1601
- if (refEl) {
1602
- copyStyle(TEXT_STYLE_PROPERTIES, refEl, measurementSpan);
1603
- }
1604
- measurementSpan.textContent = `${text}`;
1605
- const rect = measurementSpan.getBoundingClientRect();
1606
- return {
1607
- node: measurementSpan,
1608
- width: rect.width,
1609
- height: rect.height
1610
- };
1611
- };
1612
- const CACHE_SIZE = 2000;
1613
- const textSizeCache = new Map();
1614
- export const getTextSize = (text, cssSelector, container)=>{
1615
- const cacheKey = `${text}|${cssSelector}`;
1616
- const cachedResult = textSizeCache.get(cacheKey);
1617
- if (cachedResult) {
1618
- return cachedResult;
1619
- }
1620
- const { width, height } = measureTextWithDOM(text, cssSelector, container);
1621
- // TODO: Improve cache eviction strategy if needed (e.g., LRU)
1622
- if (textSizeCache.size >= CACHE_SIZE) {
1623
- const firstKey = textSizeCache.keys().next().value;
1624
- if (!isInvalidValue(firstKey)) {
1625
- textSizeCache.delete(firstKey);
1626
- }
1627
- }
1628
- textSizeCache.set(cacheKey, {
1629
- width,
1630
- height
1631
- });
1632
- return {
1633
- width,
1634
- height
1635
- };
1636
- };
1637
- /**
1638
- * Utility function to check if an array of points is scatterpolar
1639
- * @param points - Array of chart points
1640
- * @returns true if any point has lineOptions.mode as 'scatterpolar'
1641
- */ export function isScatterPolarSeries(points) {
1642
- return points.some(// eslint-disable-next-line @typescript-eslint/no-explicit-any
1643
- (item)=>{
1644
- var _item_lineOptions;
1645
- return typeof ((_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : _item_lineOptions.mode) === 'string' && item.lineOptions.mode === 'scatterpolar';
1646
- });
1647
- }
1648
- /**
1649
- * Utility function to check if an array of points contains mode as 'text' only
1650
- * @param points - Array of chart points
1651
- * @returns true if any point has lineOptions.mode as 'text'
1652
- */ export function isTextMode(points) {
1653
- return points.some(// eslint-disable-next-line @typescript-eslint/no-explicit-any
1654
- (item)=>{
1655
- var _item_lineOptions;
1656
- return typeof ((_item_lineOptions = item.lineOptions) === null || _item_lineOptions === void 0 ? void 0 : _item_lineOptions.mode) === 'string' && item.lineOptions.mode === 'text';
1657
- });
1658
- }
1659
- // TODO: Refactor to encapsulate the complete numeric scale creation logic here, including setting domain and range.
1660
- const createNumericScale = (scaleType)=>{
1661
- if (scaleType === 'log') {
1662
- return d3ScaleLog();
1663
- } else {
1664
- return d3ScaleLinear();
1665
- }
1666
- };
1667
- export const getDomainPaddingForMarkers = (minVal, maxVal, scaleType, userMinVal, userMaxVal)=>{
1668
- if (scaleType === 'log') {
1669
- return {
1670
- start: minVal * 0.5,
1671
- end: maxVal
1672
- };
1673
- }
1674
- /* if user explicitly sets userMinVal or userMaxVal, we will check that to avoid excessive padding on either side.
1675
- If the difference between minVal and userMinVal is more than 10% of the data range, we set padding to 0 on that side.
1676
- this is to avoid cases where userMinVal is significantly smaller than minVal or userMaxVal is significantly larger than
1677
- maxVal, which would lead to excessive padding. In other cases, we apply the default 10% padding on both sides.
1678
- */ const rangePadding = (maxVal - minVal) * 0.1;
1679
- // If explicit bounds are set and they're far from the data range, don't add extra padding
1680
- const paddingAlreadySatisfiedAtMin = userMinVal !== undefined && rangePadding > Math.abs(minVal - Math.min(minVal, userMinVal));
1681
- const paddingAlreadySatisfiedAtMax = userMaxVal !== undefined && rangePadding > Math.abs(maxVal - Math.max(maxVal, userMaxVal));
1682
- const startPadding = paddingAlreadySatisfiedAtMin ? 0 : rangePadding;
1683
- const endPadding = paddingAlreadySatisfiedAtMax ? 0 : rangePadding;
1684
- return {
1685
- start: startPadding,
1686
- end: endPadding
1687
- };
1688
- };
1689
- /**
1690
- * Determines whether a value is valid for inclusion in the scale domain.
1691
- * For log scales, ensures the value is strictly positive to prevent undefined scale behavior.
1692
- */ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1693
- export const isValidDomainValue = (value, scaleType)=>{
1694
- return typeof value !== 'number' || scaleType !== 'log' || value > 0;
1695
- };
1696
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1697
- export const isPlottable = (x, y)=>{
1698
- return !isInvalidValue(x) && !isInvalidValue(y);
1699
- };
1700
- export const getScatterXDomainExtent = (points, scaleType)=>{
1701
- const isValidDataPointForScale = (item)=>isValidDomainValue(item.x, scaleType);
1702
- const xMin = d3Min(points, (point)=>{
1703
- return d3Min(point.data.filter(isValidDataPointForScale), (item)=>item.x);
1704
- });
1705
- const xMax = d3Max(points, (point)=>{
1706
- return d3Max(point.data.filter(isValidDataPointForScale), (item)=>{
1707
- return item.x;
1708
- });
1709
- });
1710
- return [
1711
- xMin,
1712
- xMax
1713
- ];
1714
- };
1715
- /**
1716
- * Calculates the radius for a marker/circle in scatter and line charts.
1717
- * Handles both continuous (numeric/date) and categorical (string) axes.
1718
- *
1719
- * @param pointMarkerSize - The marker size value for the current data point
1720
- * @param minMarkerSize - The minimum marker size across all data points
1721
- * @param maxMarkerSize - The maximum marker size across all data points
1722
- * @param extraMaxPixels - The maximum available pixels for markers (from getRangeForScatterMarkerSize)
1723
- * @param isContinuousXY - Whether both X and Y axes are continuous (not string-based)
1724
- * @param isActive - Whether the current point is active/hovered
1725
- * @param defaultRadius - Default radius when no marker size is specified (default: 3.5)
1726
- * @param activeRadius - Radius when the point is active (default: 5.5)
1727
- * @param minRadius - Minimum radius to ensure markers are visible (default: 4)
1728
- * @returns The calculated radius in pixels
1729
- */ export const calculateMarkerRadius = ({ pointMarkerSize, minMarkerSize, maxMarkerSize, extraMaxPixels, isContinuousXY, isActive = false, defaultRadius = 3.5, activeRadius = 5.5, minRadius = 4 })=>{
1730
- const minPixel = 4;
1731
- const maxPixel = 16;
1732
- // If no marker size is specified, use default or active radius
1733
- if (!pointMarkerSize) {
1734
- return isActive ? activeRadius : defaultRadius;
1735
- }
1736
- let radius;
1737
- if (isContinuousXY && maxMarkerSize !== 0) {
1738
- // For continuous axes: scale markers based on available space
1739
- radius = maxMarkerSize < extraMaxPixels ? pointMarkerSize : pointMarkerSize / maxMarkerSize * extraMaxPixels;
1740
- } else if (!isContinuousXY && maxMarkerSize !== minMarkerSize) {
1741
- // For categorical axes: normalize to pixel range [minPixel, maxPixel]
1742
- radius = minPixel + (pointMarkerSize - minMarkerSize) / (maxMarkerSize - minMarkerSize) * (maxPixel - minPixel);
1743
- } else {
1744
- // Fallback to default/active radius
1745
- return isActive ? activeRadius : defaultRadius;
1746
- }
1747
- // Ensure minimum radius for visibility
1748
- return Math.max(radius, minRadius);
1749
- };
1750
- export const getRangeForScatterMarkerSize = ({ data, xScale, yScalePrimary, yScaleSecondary, useSecondaryYScale, xScaleType, yScaleType: primaryYScaleType, secondaryYScaleType })=>{
1751
- // Note: This function is executed after the scale is created, so the actual padding can be
1752
- // obtained by calculating the difference between the respective minimums or maximums of the
1753
- // scale domain and the data. However, doing so often causes the marker size to scale up
1754
- // unnecessarily when the scale uses a wider domain than required (due to the use of D3's nice
1755
- // function or our own tick value calculations).
1756
- // A better approach could be to treat the marker size as a fixed pixel value and adjust the
1757
- // scale domain with sufficient padding to accommodate the maximum marker size—instead of doing
1758
- // it the other way around (i.e., adjusting the scale domain first with padding and then scaling
1759
- // the markers to fit inside the plot area).
1760
- const [xMin, xMax] = getScatterXDomainExtent(data, xScaleType);
1761
- const xPadding = getDomainPaddingForMarkers(+xMin, +xMax, xScaleType);
1762
- const scaleXMin = xMin instanceof Date ? new Date(+xMin - xPadding.start) : xMin - xPadding.start;
1763
- const scaleXMax = xMax instanceof Date ? new Date(+xMax + xPadding.end) : xMax + xPadding.end;
1764
- const extraXPixels = Math.min(Math.abs(xScale(xMin) - xScale(scaleXMin)), Math.abs(xScale(scaleXMax) - xScale(xMax)));
1765
- const yScaleType = useSecondaryYScale ? secondaryYScaleType : primaryYScaleType;
1766
- const { startValue: yMin, endValue: yMax } = findNumericMinMaxOfY(data, undefined, useSecondaryYScale, yScaleType);
1767
- const yPadding = getDomainPaddingForMarkers(yMin, yMax, yScaleType);
1768
- const scaleYMin = yMin - yPadding.start;
1769
- const scaleYMax = yMax + yPadding.end;
1770
- const yScale = useSecondaryYScale ? yScaleSecondary : yScalePrimary;
1771
- const extraYPixels = Math.min(Math.abs(yScale(scaleYMin) - yScale(yMin)), Math.abs(yScale(yMax) - yScale(scaleYMax)));
1772
- return Math.min(extraXPixels, extraYPixels);
1773
- };
1774
- export const generateLinearTicks = (tick0, tickStep, scaleDomain)=>{
1775
- const domainMin = d3Min(scaleDomain);
1776
- const domainMax = d3Max(scaleDomain);
1777
- const precision = Math.max(calculatePrecision(tick0), calculatePrecision(tickStep));
1778
- const start = Math.ceil(precisionRound((domainMin - tick0) / tickStep, precision));
1779
- const end = Math.floor(precisionRound((domainMax - tick0) / tickStep, precision));
1780
- const ticks = [];
1781
- for(let i = start; i <= end; i++){
1782
- ticks.push(precisionRound(tick0 + i * tickStep, precision));
1783
- }
1784
- return ticks;
1785
- };
1786
- export const generateMonthlyTicks = (tick0, tickStepInMonths, scaleDomain, useUTC)=>{
1787
- const domainMin = +d3Min(scaleDomain);
1788
- const domainMax = +d3Max(scaleDomain);
1789
- const getMonth = (d)=>useUTC ? d.getUTCMonth() : d.getMonth();
1790
- const setMonth = (d, month)=>useUTC ? new Date(d.setUTCMonth(month)) : new Date(d.setMonth(month));
1791
- // Find the earliest tick <= domainMin
1792
- let start = 0;
1793
- for(let firstTick = new Date(+tick0); +firstTick > domainMin;){
1794
- firstTick = setMonth(firstTick, getMonth(firstTick) - tickStepInMonths);
1795
- start -= tickStepInMonths;
1796
- }
1797
- const baseMonth = getMonth(tick0);
1798
- const ticks = [];
1799
- // Generate ticks forward until domainMax
1800
- for(let i = start;; i += tickStepInMonths){
1801
- let tickDate = setMonth(new Date(+tick0), baseMonth + i);
1802
- // Handle month rollover (e.g., Jan 31 + 1 month → Mar 3 instead of Feb)
1803
- if (getMonth(tickDate) !== ((baseMonth + i) % 12 + 12) % 12) {
1804
- tickDate = useUTC ? new Date(tickDate.setUTCDate(0)) : new Date(tickDate.setDate(0));
1805
- }
1806
- if (+tickDate > domainMax) {
1807
- break;
1808
- }
1809
- if (+tickDate >= domainMin) {
1810
- ticks.push(tickDate);
1811
- }
1812
- }
1813
- return ticks;
1814
- };
1815
- export const generateNumericTicks = (scaleType, tickStep, tick0, scaleDomain)=>{
1816
- const refTick = typeof tick0 === 'number' ? tick0 : 0;
1817
- if (scaleType === 'log') {
1818
- if (typeof tickStep === 'number' && tickStep > 0) {
1819
- return generateLinearTicks(refTick, tickStep, scaleDomain.map((d)=>Math.log10(d))).map((t)=>10 ** t);
1820
- }
1821
- if (typeof tickStep === 'string') {
1822
- const prefix = tickStep[0];
1823
- const num = isNumber(tickStep.slice(1)) ? Number(tickStep.slice(1)) : 0;
1824
- if (prefix === 'L' && num > 0) {
1825
- return generateLinearTicks(refTick, num, scaleDomain);
1826
- }
1827
- }
1828
- return;
1829
- }
1830
- if (typeof tickStep === 'number' && tickStep > 0) {
1831
- return generateLinearTicks(refTick, tickStep, scaleDomain);
1832
- }
1833
- };
1834
- export const generateDateTicks = (tickStep, tick0, scaleDomain, useUTC)=>{
1835
- const refTick = tick0 instanceof Date ? tick0 : new Date(DEFAULT_DATE_STRING);
1836
- if (typeof tickStep === 'number' && tickStep > 0) {
1837
- return generateLinearTicks(+refTick, tickStep, scaleDomain.map((d)=>+d)).map((t)=>new Date(t));
1838
- }
1839
- if (typeof tickStep === 'string') {
1840
- const prefix = tickStep[0];
1841
- const num = isNumber(tickStep.slice(1)) ? Number(tickStep.slice(1)) : 0;
1842
- if (prefix === 'M' && num > 0 && num === Math.round(num)) {
1843
- return generateMonthlyTicks(refTick, num, scaleDomain, useUTC);
1844
- }
1845
- }
1846
- };
1847
- /**
1848
- * Calculates a number's precision based on the number of trailing
1849
- * zeros if the number does not have a decimal indicated by a negative
1850
- * precision. Otherwise, it calculates the number of digits after
1851
- * the decimal point indicated by a positive precision.
1852
- * @param value - the value to determine the precision of
1853
- */ export function calculatePrecision(value) {
1854
- /**
1855
- * Group 1:
1856
- * [1-9]([0]+$) matches trailing zeros
1857
- * Group 2:
1858
- * \.([0-9]*) matches all digits after a decimal point.
1859
- */ const groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value));
1860
- if (!groups) {
1861
- return 0;
1862
- }
1863
- if (groups[1]) {
1864
- return -groups[1].length;
1865
- }
1866
- if (groups[2]) {
1867
- return groups[2].length;
1868
- }
1869
- return 0;
1870
- }
1871
- /**
1872
- * Rounds a number to a certain level of precision. Accepts negative precision.
1873
- * @param value - The value that is being rounded.
1874
- * @param precision - The number of decimal places to round the number to
1875
- */ export function precisionRound(value, precision, base = 10) {
1876
- const exp = base ** precision;
1877
- return Math.round(value * exp) / exp;
1878
- }
1879
- export const findCalloutPoints = (calloutPointsByX, x)=>{
1880
- if (x === null) {
1881
- return undefined;
1882
- }
1883
- const key = x instanceof Date ? x.getTime() : x;
1884
- if (!calloutPointsByX[key]) {
1885
- return undefined;
1886
- }
1887
- return {
1888
- x,
1889
- values: calloutPointsByX[key]
1890
- };
1891
- };
1892
- export const autoLayoutXAxisLabels = (tickValues, tickLabels, scale, axisNode, containerWidth, container)=>{
1893
- let requiresWrap = false;
1894
- let requiresTruncate = false;
1895
- const maxWidths = [];
1896
- const [rangeStart, rangeEnd] = scale.range();
1897
- const isRTL = rangeEnd - rangeStart < 0;
1898
- const start = isRTL ? containerWidth : 0;
1899
- const end = isRTL ? 0 : containerWidth;
1900
- const getTickPosition = (index)=>{
1901
- var _scale;
1902
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1903
- return ((_scale = scale(tickValues[index])) !== null && _scale !== void 0 ? _scale : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
1904
- };
1905
- const getLabelWidth = (text)=>{
1906
- return getTextSize(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container).width;
1907
- };
1908
- for(let i = 0; i < tickValues.length; i++){
1909
- const position = getTickPosition(i);
1910
- const leftSpace = Math.abs(i > 0 ? (position - getTickPosition(i - 1)) / 2 : position - start);
1911
- const rightSpace = Math.abs(i + 1 < tickValues.length ? (getTickPosition(i + 1) - position) / 2 : end - position);
1912
- const maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
1913
- const label = tickLabels[i];
1914
- const labelWidth = getLabelWidth(label);
1915
- maxWidths.push(maxAvailableWidth);
1916
- if (labelWidth > maxAvailableWidth) {
1917
- const longestWordWidth = Math.max(...label.split(/\s+/).map((word)=>getLabelWidth(word)));
1918
- if (longestWordWidth <= maxAvailableWidth) {
1919
- requiresWrap = true;
1920
- } else {
1921
- requiresTruncate = true;
1922
- }
1923
- }
1924
- }
1925
- if (requiresTruncate) {
1926
- return truncateAndStaggerXAxisLabels(tickValues, tickLabels, scale, axisNode, containerWidth, container);
1927
- }
1928
- if (requiresWrap) {
1929
- var _createWrapOfXLabels;
1930
- return (_createWrapOfXLabels = createWrapOfXLabels({
1931
- node: axisNode,
1932
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1933
- xAxis: scale,
1934
- noOfCharsToTruncate: 100,
1935
- showXAxisLablesTooltip: false,
1936
- width: maxWidths,
1937
- container
1938
- })) !== null && _createWrapOfXLabels !== void 0 ? _createWrapOfXLabels : 0;
1939
- }
1940
- return 0;
1941
- };
1942
- const truncateAndStaggerXAxisLabels = (tickValues, tickLabels, scale, axisNode, containerWidth, container)=>{
1943
- if (!axisNode) {
1944
- return 0;
1945
- }
1946
- let maxHeight = 12;
1947
- const [rangeStart, rangeEnd] = scale.range();
1948
- const isRTL = rangeEnd - rangeStart < 0;
1949
- const start = isRTL ? containerWidth : 0;
1950
- const end = isRTL ? 0 : containerWidth;
1951
- const getTickPosition = (index)=>{
1952
- var _scale;
1953
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1954
- return ((_scale = scale(tickValues[index])) !== null && _scale !== void 0 ? _scale : 0) + ('bandwidth' in scale ? scale.bandwidth() / 2 : 0);
1955
- };
1956
- const getLabelSize = (text)=>{
1957
- return getTextSize(text, CARTESIAN_XAXIS_TEXT_SELECTOR, container);
1958
- };
1959
- d3Select(axisNode).selectAll('.tick text').each(function(_, i) {
1960
- const position = getTickPosition(i);
1961
- const leftSpace = Math.abs(i > 0 ? position - getTickPosition(i - 1) : position - start);
1962
- const rightSpace = Math.abs(i + 1 < tickValues.length ? getTickPosition(i + 1) - position : end - position);
1963
- const maxAvailableWidth = Math.min(leftSpace, rightSpace) * 2 - 8; // 4px padding on both sides
1964
- const label = tickLabels[i];
1965
- const textNode = d3Select(this).text(null).attr('data-full', label);
1966
- const lineHeight = 1.1; // ems
1967
- const y = textNode.attr('y');
1968
- const dy = parseFloat(textNode.attr('dy'));
1969
- textNode.append('tspan').attr('x', 0).attr('y', y).attr('dy', (i % 2 === 1 ? lineHeight : 0) + dy + 'em').text(truncateTextToFitWidth(label, maxAvailableWidth, (s)=>getLabelSize(s).width));
1970
- maxHeight = Math.max(maxHeight, getLabelSize(label).height);
1971
- });
1972
- return tickValues.length > 1 ? maxHeight : 0;
1973
- };
1974
- const truncateTextToFitWidth = (text, maxWidth, measure)=>{
1975
- if (measure(text) <= maxWidth) {
1976
- return text;
1977
- }
1978
- let lo = 1;
1979
- let hi = text.length;
1980
- while(lo < hi){
1981
- const mid = Math.floor((lo + hi + 1) / 2);
1982
- const candidate = text.slice(0, mid) + '...';
1983
- if (measure(candidate) <= maxWidth) {
1984
- lo = mid;
1985
- } else {
1986
- hi = mid - 1;
1987
- }
1988
- }
1989
- return text.slice(0, lo) + '...';
1990
- };