@fluentui/react-charts 9.2.1 → 9.2.3

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 (201) hide show
  1. package/CHANGELOG.md +57 -2
  2. package/dist/index.d.ts +168 -15
  3. package/lib/ChartTable.js +1 -0
  4. package/lib/ChartTable.js.map +1 -0
  5. package/lib/components/AreaChart/AreaChart.js +4 -1
  6. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  7. package/lib/components/AreaChart/useAreaChartStyles.styles.js +2 -1
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
  10. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  11. package/lib/components/ChartTable/ChartTable.js +58 -0
  12. package/lib/components/ChartTable/ChartTable.js.map +1 -0
  13. package/lib/components/ChartTable/ChartTable.types.js +1 -0
  14. package/lib/components/ChartTable/ChartTable.types.js.map +1 -0
  15. package/lib/components/ChartTable/index.js +3 -0
  16. package/lib/components/ChartTable/index.js.map +1 -0
  17. package/lib/components/ChartTable/useChartTableStyles.styles.js +93 -0
  18. package/lib/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
  19. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js +55 -0
  20. package/lib/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
  21. package/lib/components/CommonComponents/CartesianChart.js +170 -100
  22. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  23. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  24. package/lib/components/CommonComponents/ChartPopover.types.js.map +1 -1
  25. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
  26. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  27. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
  28. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  29. package/lib/components/DeclarativeChart/DeclarativeChart.js +180 -102
  30. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  31. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +100 -0
  32. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +890 -211
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  35. package/lib/components/DonutChart/DonutChart.js +2 -2
  36. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  37. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  38. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  39. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  40. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  41. package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
  42. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  43. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
  44. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  45. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +185 -144
  46. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  47. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
  48. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  49. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
  50. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  51. package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
  52. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  53. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
  54. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  55. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
  56. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  57. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  58. package/lib/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  59. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
  60. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  61. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
  62. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  63. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
  64. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  65. package/lib/components/Legends/Legends.js.map +1 -1
  66. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  67. package/lib/components/LineChart/LineChart.js +251 -78
  68. package/lib/components/LineChart/LineChart.js.map +1 -1
  69. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  70. package/lib/components/LineChart/useLineChartStyles.styles.js +10 -3
  71. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  72. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
  73. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  74. package/lib/components/ScatterChart/ScatterChart.js +56 -37
  75. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  76. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  77. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +21 -4
  78. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  79. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +16 -3
  80. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  81. package/lib/components/VerticalBarChart/VerticalBarChart.js +38 -14
  82. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  83. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
  84. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  85. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
  86. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  87. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +214 -96
  88. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  89. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  90. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
  91. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  92. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
  93. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  94. package/lib/index.js +1 -0
  95. package/lib/index.js.map +1 -1
  96. package/lib/types/DataPoint.js.map +1 -1
  97. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  98. package/lib/utilities/utilities.js +41 -42
  99. package/lib/utilities/utilities.js.map +1 -1
  100. package/lib/utilities/vbc-utils.js +24 -0
  101. package/lib/utilities/vbc-utils.js.map +1 -1
  102. package/lib-commonjs/ChartTable.js +6 -0
  103. package/lib-commonjs/ChartTable.js.map +1 -0
  104. package/lib-commonjs/components/AreaChart/AreaChart.js +4 -1
  105. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  106. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
  107. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  108. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +2 -1
  109. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  110. package/lib-commonjs/components/ChartTable/ChartTable.js +69 -0
  111. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -0
  112. package/lib-commonjs/components/ChartTable/ChartTable.types.js +6 -0
  113. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -0
  114. package/lib-commonjs/components/ChartTable/index.js +8 -0
  115. package/lib-commonjs/components/ChartTable/index.js.map +1 -0
  116. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js +196 -0
  117. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.js.map +1 -0
  118. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js +69 -0
  119. package/lib-commonjs/components/ChartTable/useChartTableStyles.styles.raw.js.map +1 -0
  120. package/lib-commonjs/components/CommonComponents/CartesianChart.js +169 -98
  121. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  122. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  123. package/lib-commonjs/components/CommonComponents/ChartPopover.types.js.map +1 -1
  124. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +13 -0
  125. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  126. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +12 -0
  127. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  128. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +176 -100
  129. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  130. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +128 -0
  131. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -0
  132. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +909 -209
  133. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  134. package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
  135. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  136. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  137. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  138. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  139. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  140. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
  141. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  142. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
  143. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  144. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +183 -142
  145. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  146. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +2 -1
  147. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  148. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +2 -1
  149. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  150. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
  151. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  152. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
  153. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  154. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
  155. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  156. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  157. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.types.js.map +1 -1
  158. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
  159. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  160. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
  161. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  162. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
  163. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  164. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  165. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  166. package/lib-commonjs/components/LineChart/LineChart.js +250 -78
  167. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  168. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  169. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +12 -3
  170. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  171. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +14 -2
  172. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  173. package/lib-commonjs/components/ScatterChart/ScatterChart.js +56 -37
  174. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  175. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  176. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +30 -3
  177. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  178. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +15 -2
  179. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  180. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +37 -13
  181. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  182. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +2 -1
  183. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  184. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +2 -1
  185. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  186. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +213 -95
  187. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  188. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  189. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +2 -1
  190. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  191. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +2 -1
  192. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  193. package/lib-commonjs/index.js +1 -0
  194. package/lib-commonjs/index.js.map +1 -1
  195. package/lib-commonjs/types/DataPoint.js.map +1 -1
  196. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  197. package/lib-commonjs/utilities/utilities.js +44 -41
  198. package/lib-commonjs/utilities/utilities.js.map +1 -1
  199. package/lib-commonjs/utilities/vbc-utils.js +27 -0
  200. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  201. package/package.json +10 -10
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__styles","mergeClasses","shorthands","tokens","typographyStyles","chartTableClassNames","root","table","headerCell","bodyCell","chart","useStyles","a9b677","B68tc82","po53p8","Bahqtrf","Be2twd7","Bhrd7zp","Bg96gwp","De3pzq","sj55zd","z8tnut","z189sj","Byoj8tv","uwmqm3","fsow6f","B4j52fo","Bekrc4i","Bn0qgzm","ibv6hh","icvyot","vrafjx","oivjwe","wvpqe5","g2u3we","h3c5rm","B9xav0g","zhjwy3","Bsw6fvg","Bbusuzp","d","m","useChartTableStyles","props","baseStyles"],"sources":["useChartTableStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const chartTableClassNames = {\n root: 'fui-ChartTable__root',\n table: 'fui-ChartTable__table',\n headerCell: 'fui-ChartTable__headerCell',\n bodyCell: 'fui-ChartTable__bodyCell',\n chart: 'fui-ChartTable__chart'\n};\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n overflowX: 'auto'\n },\n table: {\n borderCollapse: 'collapse'\n },\n headerCell: {\n ...typographyStyles.caption1,\n fontWeight: tokens.fontWeightSemibold,\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground1,\n ...shorthands.padding(tokens.spacingHorizontalS),\n textAlign: 'left',\n ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText'\n }\n },\n bodyCell: {\n ...typographyStyles.caption1,\n ...shorthands.padding(tokens.spacingHorizontalS),\n ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),\n color: tokens.colorNeutralForeground1,\n textAlign: 'left',\n '@media (forced-colors: active)': {\n color: 'WindowText'\n }\n }\n});\n/**\n * Apply styling to the ChartTable slots based on the state\n */ export const useChartTableStyles = (props)=>{\n const baseStyles = useStyles();\n return {\n root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/ ),\n table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),\n headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),\n bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),\n chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/ )\n };\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,uBAAuB;AAChE;AACA;AACA;AAAI,OAAO,MAAMC,oBAAoB,GAAG;EACpCC,IAAI,EAAE,sBAAsB;EAC5BC,KAAK,EAAE,uBAAuB;EAC9BC,UAAU,EAAE,4BAA4B;EACxCC,QAAQ,EAAE,0BAA0B;EACpCC,KAAK,EAAE;AACX,CAAC;AACD,MAAMC,SAAS,gBAAGX,QAAA;EAAAM,IAAA;IAAAM,MAAA;IAAAC,OAAA;EAAA;EAAAN,KAAA;IAAAO,MAAA;EAAA;EAAAN,UAAA;IAAAO,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;EAAA;EAAA9B,QAAA;IAAAM,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAG,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAE,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAjB,MAAA;IAAAK,MAAA;IAAAc,OAAA;EAAA;AAAA;EAAAC,CAAA;EAAAC,CAAA;IAAAA,CAAA;EAAA;IAAAA,CAAA;EAAA;AAAA,CA+BjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,mBAAmB,GAAIC,KAAK,IAAG;EAC5C,MAAMC,UAAU,GAAGjC,SAAS,CAAC,CAAC;EAC9B,OAAO;IACHL,IAAI,EAAEL,YAAY,CAACI,oBAAoB,CAACC,IAAI,EAAEsC,UAAU,CAACtC,IAAI,CAAC,sBAAuB,CAAC;IACtFC,KAAK,EAAEN,YAAY,CAACI,oBAAoB,CAACE,KAAK,EAAEqC,UAAU,CAACrC,KAAK,CAAC,uBAAwB,CAAC;IAC1FC,UAAU,EAAEP,YAAY,CAACI,oBAAoB,CAACG,UAAU,EAAEoC,UAAU,CAACpC,UAAU,CAAC,4BAA6B,CAAC;IAC9GC,QAAQ,EAAER,YAAY,CAACI,oBAAoB,CAACI,QAAQ,EAAEmC,UAAU,CAACnC,QAAQ,CAAC,0BAA2B,CAAC;IACtGC,KAAK,EAAET,YAAY,CAACI,oBAAoB,CAACK,KAAK,CAAC,uBAAwB;EAC3E,CAAC;AACL,CAAC","ignoreList":[]}
@@ -0,0 +1,55 @@
1
+ import { makeStyles, mergeClasses, shorthands } from '@griffel/react';
2
+ import { tokens, typographyStyles } from '@fluentui/react-theme';
3
+ /**
4
+ * @internal
5
+ */ export const chartTableClassNames = {
6
+ root: 'fui-ChartTable__root',
7
+ table: 'fui-ChartTable__table',
8
+ headerCell: 'fui-ChartTable__headerCell',
9
+ bodyCell: 'fui-ChartTable__bodyCell',
10
+ chart: 'fui-ChartTable__chart'
11
+ };
12
+ const useStyles = makeStyles({
13
+ root: {
14
+ width: '100%',
15
+ overflowX: 'auto'
16
+ },
17
+ table: {
18
+ borderCollapse: 'collapse'
19
+ },
20
+ headerCell: {
21
+ ...typographyStyles.caption1,
22
+ fontWeight: tokens.fontWeightSemibold,
23
+ backgroundColor: tokens.colorNeutralBackground3,
24
+ color: tokens.colorNeutralForeground1,
25
+ ...shorthands.padding(tokens.spacingHorizontalS),
26
+ textAlign: 'left',
27
+ ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),
28
+ '@media (forced-colors: active)': {
29
+ backgroundColor: 'Window',
30
+ color: 'WindowText'
31
+ }
32
+ },
33
+ bodyCell: {
34
+ ...typographyStyles.caption1,
35
+ ...shorthands.padding(tokens.spacingHorizontalS),
36
+ ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),
37
+ color: tokens.colorNeutralForeground1,
38
+ textAlign: 'left',
39
+ '@media (forced-colors: active)': {
40
+ color: 'WindowText'
41
+ }
42
+ }
43
+ });
44
+ /**
45
+ * Apply styling to the ChartTable slots based on the state
46
+ */ export const useChartTableStyles = (props)=>{
47
+ const baseStyles = useStyles();
48
+ return {
49
+ root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/ ),
50
+ table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/ ),
51
+ headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/ ),
52
+ bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/ ),
53
+ chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/ )
54
+ };
55
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/ChartTable/useChartTableStyles.styles.ts"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport { ChartTableProps, ChartTableStyles } from './ChartTable.types';\nimport { tokens, typographyStyles } from '@fluentui/react-theme';\n\n/**\n * @internal\n */\nexport const chartTableClassNames: SlotClassNames<ChartTableStyles> = {\n root: 'fui-ChartTable__root',\n table: 'fui-ChartTable__table',\n headerCell: 'fui-ChartTable__headerCell',\n bodyCell: 'fui-ChartTable__bodyCell',\n chart: 'fui-ChartTable__chart',\n};\n\nconst useStyles = makeStyles({\n root: {\n width: '100%',\n overflowX: 'auto',\n },\n table: {\n borderCollapse: 'collapse',\n },\n headerCell: {\n ...typographyStyles.caption1,\n fontWeight: tokens.fontWeightSemibold,\n backgroundColor: tokens.colorNeutralBackground3,\n color: tokens.colorNeutralForeground1,\n ...shorthands.padding(tokens.spacingHorizontalS),\n textAlign: 'left',\n ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),\n '@media (forced-colors: active)': {\n backgroundColor: 'Window',\n color: 'WindowText',\n },\n },\n bodyCell: {\n ...typographyStyles.caption1,\n ...shorthands.padding(tokens.spacingHorizontalS),\n ...shorthands.border(tokens.strokeWidthThick, 'solid', tokens.colorNeutralStroke2),\n color: tokens.colorNeutralForeground1,\n textAlign: 'left',\n '@media (forced-colors: active)': {\n color: 'WindowText',\n },\n },\n});\n\n/**\n * Apply styling to the ChartTable slots based on the state\n */\nexport const useChartTableStyles = (props: ChartTableProps): ChartTableStyles => {\n const baseStyles = useStyles();\n\n return {\n root: mergeClasses(chartTableClassNames.root, baseStyles.root /*props.styles?.root*/),\n table: mergeClasses(chartTableClassNames.table, baseStyles.table /*props.styles?.table*/),\n headerCell: mergeClasses(chartTableClassNames.headerCell, baseStyles.headerCell /*props.styles?.headerCell*/),\n bodyCell: mergeClasses(chartTableClassNames.bodyCell, baseStyles.bodyCell /*props.styles?.bodyCell*/),\n chart: mergeClasses(chartTableClassNames.chart /*props.styles?.chart*/),\n };\n};\n"],"names":["makeStyles","mergeClasses","shorthands","tokens","typographyStyles","chartTableClassNames","root","table","headerCell","bodyCell","chart","useStyles","width","overflowX","borderCollapse","caption1","fontWeight","fontWeightSemibold","backgroundColor","colorNeutralBackground3","color","colorNeutralForeground1","padding","spacingHorizontalS","textAlign","border","strokeWidthThick","colorNeutralStroke2","useChartTableStyles","props","baseStyles"],"mappings":"AAAA,SAASA,UAAU,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iBAAiB;AAGtE,SAASC,MAAM,EAAEC,gBAAgB,QAAQ,wBAAwB;AAEjE;;CAEC,GACD,OAAO,MAAMC,uBAAyD;IACpEC,MAAM;IACNC,OAAO;IACPC,YAAY;IACZC,UAAU;IACVC,OAAO;AACT,EAAE;AAEF,MAAMC,YAAYX,WAAW;IAC3BM,MAAM;QACJM,OAAO;QACPC,WAAW;IACb;IACAN,OAAO;QACLO,gBAAgB;IAClB;IACAN,YAAY;QACV,GAAGJ,iBAAiBW,QAAQ;QAC5BC,YAAYb,OAAOc,kBAAkB;QACrCC,iBAAiBf,OAAOgB,uBAAuB;QAC/CC,OAAOjB,OAAOkB,uBAAuB;QACrC,GAAGnB,WAAWoB,OAAO,CAACnB,OAAOoB,kBAAkB,CAAC;QAChDC,WAAW;QACX,GAAGtB,WAAWuB,MAAM,CAACtB,OAAOuB,gBAAgB,EAAE,SAASvB,OAAOwB,mBAAmB,CAAC;QAClF,kCAAkC;YAChCT,iBAAiB;YACjBE,OAAO;QACT;IACF;IACAX,UAAU;QACR,GAAGL,iBAAiBW,QAAQ;QAC5B,GAAGb,WAAWoB,OAAO,CAACnB,OAAOoB,kBAAkB,CAAC;QAChD,GAAGrB,WAAWuB,MAAM,CAACtB,OAAOuB,gBAAgB,EAAE,SAASvB,OAAOwB,mBAAmB,CAAC;QAClFP,OAAOjB,OAAOkB,uBAAuB;QACrCG,WAAW;QACX,kCAAkC;YAChCJ,OAAO;QACT;IACF;AACF;AAEA;;CAEC,GACD,OAAO,MAAMQ,sBAAsB,CAACC;IAClC,MAAMC,aAAanB;IAEnB,OAAO;QACLL,MAAML,aAAaI,qBAAqBC,IAAI,EAAEwB,WAAWxB,IAAI,CAAC,oBAAoB;QAClFC,OAAON,aAAaI,qBAAqBE,KAAK,EAAEuB,WAAWvB,KAAK,CAAC,qBAAqB;QACtFC,YAAYP,aAAaI,qBAAqBG,UAAU,EAAEsB,WAAWtB,UAAU,CAAC,0BAA0B;QAC1GC,UAAUR,aAAaI,qBAAqBI,QAAQ,EAAEqB,WAAWrB,QAAQ,CAAC,wBAAwB;QAClGC,OAAOT,aAAaI,qBAAqBK,KAAK,CAAC,qBAAqB;IACtE;AACF,EAAE"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { useCartesianChartStyles } from './useCartesianChartStyles.styles';
3
3
  import { select as d3Select } from 'd3-selection';
4
- import { createNumericXAxis, createStringXAxis, createDateXAxis, XAxisTypes, YAxisType, createWrapOfXLabels, rotateXAxisLabels, calculateLongestLabelWidth, createYAxisLabels, ChartTypes, wrapContent, useRtl, truncateString, tooltipOfAxislabels, getSecureProps } from '../../utilities/index';
4
+ import { createNumericXAxis, createStringXAxis, createDateXAxis, XAxisTypes, YAxisType, createWrapOfXLabels, rotateXAxisLabels, calculateLongestLabelWidth, createYAxisLabels, ChartTypes, wrapContent, useRtl, truncateString, tooltipOfAxislabels, getSecureProps, DEFAULT_WRAP_WIDTH } from '../../utilities/index';
5
5
  import { useId } from '@fluentui/react-utilities';
6
6
  import { SVGTooltipText } from '../../utilities/SVGTooltipText';
7
7
  import { ChartPopover } from './ChartPopover';
@@ -28,15 +28,20 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
28
28
  let _xScale;
29
29
  let isIntegralDataset = true;
30
30
  let _tooltipId = useId('tooltip_');
31
+ /* Used for when WrapXAxisLabels props appeared.
32
+ * To display the total word (space separated words), Need to have more space than usual.
33
+ * This height will get total height need to disaply total word.
34
+ * These value need to be removed from actual svg height/graph height.
35
+ * Defalut value is 0. And this values calculted when 'wrapXAxisLables' or 'showXAxisLablesTooltip' is true.
36
+ */ let _removalValueForTextTuncate = 0;
31
37
  const [containerWidth, setContainerWidth] = React.useState(0);
32
38
  const [containerHeight, setContainerHeight] = React.useState(0);
33
- const [isRemoveValCalculated, setIsRemoveValCalculated] = React.useState(true);
34
- const [removalValueForTextTuncate, setRemovalValueForTextTuncate] = React.useState(0);
35
39
  const [startFromX, setStartFromX] = React.useState(0);
36
40
  const [prevProps, setPrevProps] = React.useState(null);
37
- const chartTypesToCheck = [
41
+ const chartTypesWithStringYAxis = [
38
42
  ChartTypes.HorizontalBarChartWithAxis,
39
43
  ChartTypes.HeatMapChart,
44
+ ChartTypes.VerticalStackedBarChart,
40
45
  ChartTypes.GanttChart
41
46
  ];
42
47
  var _props_margins_top, _props_margins_bottom, _props_margins_left, _props_margins_right, _props_margins_right1, _props_margins_left1;
@@ -52,17 +57,34 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
52
57
  right: _useRtl ? (_props_margins_left = (_props_margins2 = props.margins) === null || _props_margins2 === void 0 ? void 0 : _props_margins2.left) !== null && _props_margins_left !== void 0 ? _props_margins_left : 40 : ((_props_margins_right = (_props_margins3 = props.margins) === null || _props_margins3 === void 0 ? void 0 : _props_margins3.right) !== null && _props_margins_right !== void 0 ? _props_margins_right : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20,
53
58
  left: _useRtl ? ((_props_margins_right1 = (_props_margins4 = props.margins) === null || _props_margins4 === void 0 ? void 0 : _props_margins4.right) !== null && _props_margins_right1 !== void 0 ? _props_margins_right1 : props === null || props === void 0 ? void 0 : props.secondaryYScaleOptions) ? 40 : 20 : (_props_margins_left1 = (_props_margins5 = props.margins) === null || _props_margins5 === void 0 ? void 0 : _props_margins5.left) !== null && _props_margins_left1 !== void 0 ? _props_margins_left1 : 40
54
59
  };
60
+ const TITLE_MARGIN = 20;
55
61
  if (props.xAxisTitle !== undefined && props.xAxisTitle !== '') {
56
62
  var _props_margins6;
57
63
  var _props_margins_bottom1;
58
- margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 : 55;
64
+ margins.bottom = (_props_margins_bottom1 = (_props_margins6 = props.margins) === null || _props_margins6 === void 0 ? void 0 : _props_margins6.bottom) !== null && _props_margins_bottom1 !== void 0 ? _props_margins_bottom1 : margins.bottom + TITLE_MARGIN;
59
65
  }
60
66
  if (props.yAxisTitle !== undefined && props.yAxisTitle !== '') {
61
67
  var _props_margins7, _props_margins8, _props_margins9, _props_margins10;
62
68
  var _props_margins_right2, _props_margins_left2;
63
- margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? 80 : 40 : (_props_margins_left2 = (_props_margins8 = props.margins) === null || _props_margins8 === void 0 ? void 0 : _props_margins8.left) !== null && _props_margins_left2 !== void 0 ? _props_margins_left2 : 60;
69
+ margins.left = _useRtl ? ((_props_margins_right2 = (_props_margins7 = props.margins) === null || _props_margins7 === void 0 ? void 0 : _props_margins7.right) !== null && _props_margins_right2 !== void 0 ? _props_margins_right2 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN : margins.right + TITLE_MARGIN : (_props_margins_left2 = (_props_margins8 = props.margins) === null || _props_margins8 === void 0 ? void 0 : _props_margins8.left) !== null && _props_margins_left2 !== void 0 ? _props_margins_left2 : margins.left + TITLE_MARGIN;
64
70
  var _props_margins_left3, _props_margins_right3;
65
- margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 : 60 : ((_props_margins_right3 = (_props_margins10 = props.margins) === null || _props_margins10 === void 0 ? void 0 : _props_margins10.right) !== null && _props_margins_right3 !== void 0 ? _props_margins_right3 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? 80 : 40;
71
+ margins.right = _useRtl ? (_props_margins_left3 = (_props_margins9 = props.margins) === null || _props_margins9 === void 0 ? void 0 : _props_margins9.left) !== null && _props_margins_left3 !== void 0 ? _props_margins_left3 : margins.left + TITLE_MARGIN : ((_props_margins_right3 = (_props_margins10 = props.margins) === null || _props_margins10 === void 0 ? void 0 : _props_margins10.right) !== null && _props_margins_right3 !== void 0 ? _props_margins_right3 : props === null || props === void 0 ? void 0 : props.secondaryYAxistitle) ? margins.right + 2 * TITLE_MARGIN : margins.right + TITLE_MARGIN;
72
+ }
73
+ if (props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '') {
74
+ var _props_margins11;
75
+ var _props_margins_top1;
76
+ margins.top = (_props_margins_top1 = (_props_margins11 = props.margins) === null || _props_margins11 === void 0 ? void 0 : _props_margins11.top) !== null && _props_margins_top1 !== void 0 ? _props_margins_top1 : margins.top + TITLE_MARGIN;
77
+ }
78
+ if (props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '')) {
79
+ if (_useRtl) {
80
+ var _props_margins12;
81
+ var _props_margins_right4;
82
+ margins.left = (_props_margins_right4 = (_props_margins12 = props.margins) === null || _props_margins12 === void 0 ? void 0 : _props_margins12.right) !== null && _props_margins_right4 !== void 0 ? _props_margins_right4 : margins.right + TITLE_MARGIN;
83
+ } else {
84
+ var _props_margins13;
85
+ var _props_margins_right5;
86
+ margins.right = (_props_margins_right5 = (_props_margins13 = props.margins) === null || _props_margins13 === void 0 ? void 0 : _props_margins13.right) !== null && _props_margins_right5 !== void 0 ? _props_margins_right5 : margins.right + TITLE_MARGIN;
87
+ }
66
88
  }
67
89
  const classes = useCartesianChartStyles(props);
68
90
  const focusAttributes = useFocusableGroup();
@@ -75,8 +97,8 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
75
97
  if (props !== null) {
76
98
  setPrevProps(props);
77
99
  }
78
- if (chartTypesToCheck.includes(props.chartType) && props.showYAxisLables && yAxisElement) {
79
- const maxYAxisLabelLength = calculateMaxYAxisLabelLength(props.chartType, props.points, classes.yAxis);
100
+ if (chartTypesWithStringYAxis.includes(props.chartType) && props.showYAxisLables && yAxisElement && props.yAxisType === YAxisType.StringAxis) {
101
+ const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
80
102
  if (startFromX !== maxYAxisLabelLength) {
81
103
  setStartFromX(maxYAxisLabelLength);
82
104
  }
@@ -98,8 +120,8 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
98
120
  _fitParentContainer();
99
121
  }
100
122
  }
101
- if (chartTypesToCheck.includes(props.chartType) && props.showYAxisLables && yAxisElement) {
102
- const maxYAxisLabelLength = calculateMaxYAxisLabelLength(props.chartType, props.points, classes.yAxis);
123
+ if (chartTypesWithStringYAxis.includes(props.chartType) && props.showYAxisLables && yAxisElement && props.yAxisType === YAxisType.StringAxis) {
124
+ const maxYAxisLabelLength = calculateMaxYAxisLabelLength(classes.yAxis);
103
125
  if (startFromX !== maxYAxisLabelLength) {
104
126
  setStartFromX(maxYAxisLabelLength);
105
127
  }
@@ -114,19 +136,6 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
114
136
  props,
115
137
  prevProps
116
138
  ]);
117
- React.useEffect(()=>{
118
- if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === XAxisTypes.StringAxis) {
119
- const rotateLabelProps = {
120
- node: xAxisElement.current,
121
- xAxis: _xScale
122
- };
123
- const rotatedHeight = rotateXAxisLabels(rotateLabelProps);
124
- if (isRemoveValCalculated && removalValueForTextTuncate !== rotatedHeight + margins.bottom && rotatedHeight > 0) {
125
- setRemovalValueForTextTuncate(rotatedHeight + margins.bottom);
126
- setIsRemoveValCalculated(false);
127
- }
128
- }
129
- });
130
139
  React.useImperativeHandle(props.componentRef, ()=>{
131
140
  var _chartContainer_current;
132
141
  return {
@@ -143,20 +152,14 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
143
152
  function _generateCallout(calloutProps) {
144
153
  return /*#__PURE__*/ React.createElement(ChartPopover, calloutProps);
145
154
  }
146
- function calculateMaxYAxisLabelLength(chartType, // eslint-disable-next-line @typescript-eslint/no-explicit-any
147
- points, className) {
155
+ function calculateMaxYAxisLabelLength(className) {
148
156
  const formatTickLabel = (str)=>{
149
157
  if (props.showYAxisLablesTooltip) {
150
158
  return truncateString(str, props.noOfCharsToTruncate || 4);
151
159
  }
152
160
  return str;
153
161
  };
154
- if (chartType === ChartTypes.HeatMapChart) {
155
- var _points__data, _points_;
156
- return calculateLongestLabelWidth((_points_ = points[0]) === null || _points_ === void 0 ? void 0 : (_points__data = _points_.data) === null || _points__data === void 0 ? void 0 : _points__data.map((point)=>formatTickLabel(`${point.y}`)), `.${className} text`);
157
- } else {
158
- return calculateLongestLabelWidth(points === null || points === void 0 ? void 0 : points.map((point)=>formatTickLabel(`${point.y}`)), `.${className} text`);
159
- }
162
+ return calculateLongestLabelWidth(props.stringDatasetForYAxisDomain.map((label)=>formatTickLabel(label)), `.${className} text`);
160
163
  }
161
164
  const { calloutProps, points, chartType, svgProps, culture, dateLocalizeOptions, timeFormatLocale, customDateTimeFormatter } = props;
162
165
  if (props.parentRef) {
@@ -165,7 +168,8 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
165
168
  const margin = {
166
169
  ...margins
167
170
  };
168
- if (chartTypesToCheck.includes(props.chartType)) {
171
+ // Note: This check is unnecessary since startFromX is only set for charts with string y-axis.
172
+ if (chartTypesWithStringYAxis.includes(props.chartType)) {
169
173
  if (!_useRtl) {
170
174
  margin.left += startFromX;
171
175
  } else {
@@ -182,7 +186,13 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
182
186
  const XAxisParams = {
183
187
  domainNRangeValues: props.getDomainNRangeValues(points, props.getDomainMargins ? props.getDomainMargins(containerWidth) : margins, containerWidth, chartType, _useRtl, props.xAxisType, props.barwidth, props.tickValues, // This is only used for Horizontal Bar Chart with Axis for y as string axis
184
188
  startFromX),
185
- containerHeight: containerHeight - removalValueForTextTuncate,
189
+ // FIXME: In XAxisParams, containerHeight is used by HBWA to generate vertical gridlines.
190
+ // Since the x-axis in HBWA is numeric, it typically doesn't require transformation.
191
+ // However, if transformation props are enabled, the updated _removalValueForTextTuncate
192
+ // will only be available in the next render, as it's set after the axis is created.
193
+ // Solution: Delay the creation of gridlines until after the transformation has been applied,
194
+ // or precompute the required height for transformed labels (_removalValueForTextTuncate).
195
+ containerHeight: containerHeight - _removalValueForTextTuncate,
186
196
  margins: margins,
187
197
  xAxisElement: xAxisElement.current,
188
198
  showRoundOffXTickValues: (_props_showRoundOffXTickValues = props.showRoundOffXTickValues) !== null && _props_showRoundOffXTickValues !== void 0 ? _props_showRoundOffXTickValues : true,
@@ -193,24 +203,8 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
193
203
  xAxisInnerPadding: props.xAxisInnerPadding,
194
204
  xAxisOuterPadding: props.xAxisOuterPadding,
195
205
  containerWidth: containerWidth,
196
- hideTickOverlap: props.hideTickOverlap && !props.rotateXAxisLables && !props.showXAxisLablesTooltip && !props.wrapXAxisLables
197
- };
198
- const YAxisParams = {
199
- margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,
200
- containerWidth: containerWidth,
201
- containerHeight: containerHeight - removalValueForTextTuncate,
202
- yAxisElement: yAxisElement.current,
203
- yAxisTickFormat: props.yAxisTickFormat,
204
- yAxisTickCount: props.yAxisTickCount,
205
- yMinValue: props.yMinValue || 0,
206
- yMaxValue: props.yMaxValue || 0,
207
- tickPadding: props.showYAxisLablesTooltip ? 15 : 10,
208
- maxOfYVal: props.maxOfYVal,
209
- yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),
210
- // please note these padding default values must be consistent in here
211
- // and the parent chart(HBWA/Vertical etc..) for more details refer example
212
- // http://using-d3js.com/04_07_ordinal_scales.html
213
- yAxisPadding: props.yAxisPadding || 0
206
+ hideTickOverlap: props.rotateXAxisLables ? false : props.hideTickOverlap,
207
+ calcMaxLabelWidth: _calcMaxLabelWidthWithTransform
214
208
  };
215
209
  /**
216
210
  * These scales used for 2 purposes.
@@ -235,25 +229,24 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
235
229
  }
236
230
  _xScale = xScale;
237
231
  _tickValues = tickValues;
238
- /*
239
- * To enable wrapping of x axis tick values or to display complete x axis tick values,
240
- * we need to calculate how much space it needed to render the text.
241
- * No need to re-calculate every time the chart renders and same time need to get an update. So using set
242
- * Required space will be calculated first time chart rendering and if any width/height of chart updated.
243
- * */ if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {
244
- const wrapLabelProps = {
245
- node: xAxisElement.current,
246
- xAxis: xScale,
247
- showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,
248
- noOfCharsToTruncate: props.noOfCharsToTruncate || 4
249
- };
250
- const temp = xScale && createWrapOfXLabels(wrapLabelProps);
251
- // this value need to be updated for draw graph updated. So instead of using private value, using set
252
- if (isRemoveValCalculated && removalValueForTextTuncate !== temp) {
253
- setRemovalValueForTextTuncate(temp);
254
- setIsRemoveValCalculated(false);
255
- }
256
- }
232
+ _transformXAxisLabels();
233
+ const YAxisParams = {
234
+ margins: props.getYDomainMargins ? props.getYDomainMargins(containerHeight) : margins,
235
+ containerWidth: containerWidth,
236
+ containerHeight: containerHeight - _removalValueForTextTuncate,
237
+ yAxisElement: yAxisElement.current,
238
+ yAxisTickFormat: props.yAxisTickFormat,
239
+ yAxisTickCount: props.yAxisTickCount,
240
+ yMinValue: props.yMinValue || 0,
241
+ yMaxValue: props.yMaxValue || 0,
242
+ tickPadding: 10,
243
+ maxOfYVal: props.maxOfYVal,
244
+ yMinMaxValues: props.getMinMaxOfYAxis(points, props.yAxisType),
245
+ // please note these padding default values must be consistent in here
246
+ // and the parent chart(HBWA/Vertical etc..) for more details refer example
247
+ // http://using-d3js.com/04_07_ordinal_scales.html
248
+ yAxisPadding: props.yAxisPadding || 0
249
+ };
257
250
  /**
258
251
  * These scales used for 2 purposes.
259
252
  * 1. To create x and y axis
@@ -267,7 +260,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
267
260
  yAxisDomainValues: []
268
261
  };
269
262
  if (props.yAxisType && props.yAxisType === YAxisType.StringAxis) {
270
- yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.barwidth);
263
+ yScalePrimary = props.createStringYAxis(YAxisParams, props.stringDatasetForYAxisDomain, _useRtl, props.barwidth, props.chartType);
271
264
  } else {
272
265
  // TODO: Since the scale domain values are now computed independently for both the primary and
273
266
  // secondary y-axes, the yMinValue and yMaxValue props are no longer necessary for accurately
@@ -280,7 +273,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
280
273
  const YAxisParamsSecondary = {
281
274
  margins: margins,
282
275
  containerWidth: containerWidth,
283
- containerHeight: containerHeight - removalValueForTextTuncate,
276
+ containerHeight: containerHeight - _removalValueForTextTuncate,
284
277
  yAxisElement: yAxisElementSecondary.current,
285
278
  yAxisTickFormat: props.yAxisTickFormat,
286
279
  yAxisTickCount: props.yAxisTickCount,
@@ -294,7 +287,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
294
287
  }
295
288
  yScalePrimary = props.createYAxis(YAxisParams, _useRtl, axisData, isIntegralDataset, chartType, false, props.roundedTicks);
296
289
  }
297
- if (chartTypesToCheck.includes(props.chartType)) {
290
+ if (chartTypesWithStringYAxis.includes(props.chartType) && props.yAxisType === YAxisType.StringAxis) {
298
291
  // Removing un wanted tooltip div from DOM, when prop not provided, for proper cleanup
299
292
  // of unwanted DOM elements, to prevent flacky behaviour in tooltips , that might occur
300
293
  // in creating tooltips when tooltips are enabled( as we try to recreate a tspan with _tooltipId)
@@ -327,7 +320,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
327
320
  // Call back to the chart.
328
321
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
329
322
  const _getData = (xScale, yScalePrimary, yScaleSecondary)=>{
330
- props.getGraphData && props.getGraphData(xScale, yScalePrimary, containerHeight - removalValueForTextTuncate, containerWidth, xAxisElement.current, yAxisElement.current, yScaleSecondary);
323
+ props.getGraphData && props.getGraphData(xScale, yScalePrimary, containerHeight - _removalValueForTextTuncate, containerWidth, xAxisElement.current, yAxisElement.current, yScaleSecondary);
331
324
  };
332
325
  props.getAxisData && props.getAxisData(axisData);
333
326
  // Callback function for chart, returns axis
@@ -348,7 +341,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
348
341
  height: containerHeight
349
342
  };
350
343
  const xAxisTitleMaximumAllowedWidth = svgDimensions.width - margins.left - margins.right - startFromX;
351
- const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top - removalValueForTextTuncate - titleMargin;
344
+ const yAxisTitleMaximumAllowedHeight = svgDimensions.height - margins.bottom - margins.top - _removalValueForTextTuncate - titleMargin;
352
345
  /**
353
346
  * When screen resizes, along with screen, chart also auto adjusted.
354
347
  * This method used to adjust height and width of the charts.
@@ -379,39 +372,88 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
379
372
  props.onChartMouseLeave && props.onChartMouseLeave();
380
373
  }
381
374
  function _calculateChartMinWidth() {
382
- let labelWidth = 10; // Total padding on the left and right sides of the label
375
+ // Adding 10px for padding on both sides
376
+ const labelWidth = _calcMaxLabelWidthWithTransform(_tickValues) + 10;
377
+ let minChartWidth = margins.left + margins.right + labelWidth * (_tickValues.length - 1);
378
+ if ([
379
+ ChartTypes.GroupedVerticalBarChart,
380
+ ChartTypes.VerticalBarChart,
381
+ ChartTypes.VerticalStackedBarChart
382
+ ].includes(props.chartType)) {
383
+ const minDomainMargin = 8;
384
+ minChartWidth += minDomainMargin * 2;
385
+ }
386
+ return minChartWidth;
387
+ }
388
+ function _calcMaxLabelWidthWithTransform(x) {
383
389
  // Case: rotated labels
384
390
  if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === XAxisTypes.StringAxis) {
385
- const longestLabelWidth = calculateLongestLabelWidth(_tickValues, `.${classes.xAxis} text`);
386
- labelWidth += Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));
387
- } else if (props.showXAxisLablesTooltip) {
388
- const tickValues = _tickValues.map((val)=>{
391
+ const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);
392
+ return Math.ceil(longestLabelWidth * Math.cos(Math.PI / 4));
393
+ }
394
+ // Case: truncated labels
395
+ if (props.showXAxisLablesTooltip) {
396
+ const tickValues = x.map((val)=>{
389
397
  const numChars = props.noOfCharsToTruncate || 4;
390
398
  return val.toString().length > numChars ? `${val.toString().slice(0, numChars)}...` : val;
391
399
  });
392
400
  const longestLabelWidth = calculateLongestLabelWidth(tickValues, `.${classes.xAxis} text`);
393
- labelWidth += Math.ceil(longestLabelWidth);
394
- } else if (props.wrapXAxisLables) {
401
+ return Math.ceil(longestLabelWidth);
402
+ }
403
+ // Case: wrapped labels
404
+ if (props.wrapXAxisLables) {
405
+ // FIXME: Calculate the max width of lines instead of words. This requires applying
406
+ // the wrapping transformation earlier to obtain the actual rendered lines.
395
407
  const words = [];
396
- _tickValues.forEach((val)=>{
408
+ x.forEach((val)=>{
397
409
  words.push(...val.toString().split(/\s+/));
398
410
  });
411
+ // This approach works well in most cases, since overflow typically occurs only when
412
+ // a single word exceeds the specified width — otherwise, the text will wrap as expected.
399
413
  const longestLabelWidth = calculateLongestLabelWidth(words, `.${classes.xAxis} text`);
400
- labelWidth += Math.max(Math.ceil(longestLabelWidth), 10);
401
- } else {
402
- const longestLabelWidth = calculateLongestLabelWidth(_tickValues, `.${classes.xAxis} text`);
403
- labelWidth += Math.ceil(longestLabelWidth);
414
+ return Math.max(Math.ceil(longestLabelWidth), DEFAULT_WRAP_WIDTH);
404
415
  }
405
- let minChartWidth = margins.left + margins.right + labelWidth * (_tickValues.length - 1);
406
- if ([
407
- ChartTypes.GroupedVerticalBarChart,
408
- ChartTypes.VerticalBarChart,
409
- ChartTypes.VerticalStackedBarChart
410
- ].includes(props.chartType)) {
411
- const minDomainMargin = 8;
412
- minChartWidth += minDomainMargin * 2;
416
+ // Default case
417
+ const longestLabelWidth = calculateLongestLabelWidth(x, `.${classes.xAxis} text`);
418
+ return Math.ceil(longestLabelWidth);
419
+ }
420
+ function _transformXAxisLabels() {
421
+ _removalValueForTextTuncate = 0;
422
+ /*
423
+ * To enable wrapping of x axis tick values or to display complete x axis tick values,
424
+ * we need to calculate how much space it needed to render the text.
425
+ * No need to re-calculate every time the chart renders and same time need to get an update. So using setState.
426
+ * Required space will be calculated first time chart rendering and if any width/height of chart updated.
427
+ * */ if (props.wrapXAxisLables || props.showXAxisLablesTooltip) {
428
+ let maxXAxisLabelWidth;
429
+ if (props.xAxisType === XAxisTypes.StringAxis) {
430
+ var _props_datasetForXAxisDomain;
431
+ if ((((_props_datasetForXAxisDomain = props.datasetForXAxisDomain) === null || _props_datasetForXAxisDomain === void 0 ? void 0 : _props_datasetForXAxisDomain.length) || 0) > 1) {
432
+ maxXAxisLabelWidth = _xScale.step();
433
+ } else {
434
+ maxXAxisLabelWidth = containerWidth;
435
+ }
436
+ }
437
+ const wrapLabelProps = {
438
+ node: xAxisElement.current,
439
+ xAxis: _xScale,
440
+ showXAxisLablesTooltip: props.showXAxisLablesTooltip || false,
441
+ noOfCharsToTruncate: props.noOfCharsToTruncate || 4,
442
+ width: maxXAxisLabelWidth
443
+ };
444
+ var _createWrapOfXLabels;
445
+ _removalValueForTextTuncate = (_createWrapOfXLabels = createWrapOfXLabels(wrapLabelProps)) !== null && _createWrapOfXLabels !== void 0 ? _createWrapOfXLabels : 0;
446
+ }
447
+ if (!props.wrapXAxisLables && props.rotateXAxisLables && props.xAxisType === XAxisTypes.StringAxis) {
448
+ const rotateLabelProps = {
449
+ node: xAxisElement.current,
450
+ xAxis: _xScale
451
+ };
452
+ var _rotateXAxisLabels;
453
+ const rotatedHeight = (_rotateXAxisLabels = rotateXAxisLabels(rotateLabelProps)) !== null && _rotateXAxisLabels !== void 0 ? _rotateXAxisLabels : 0;
454
+ // margins.bottom is used as padding here
455
+ _removalValueForTextTuncate = rotatedHeight + margins.bottom;
413
456
  }
414
- return minChartWidth;
415
457
  }
416
458
  /**
417
459
  * We have use the {@link defaultTabbableElement } to fix
@@ -456,7 +498,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
456
498
  },
457
499
  id: `xAxisGElement${idForGraph}`,
458
500
  // To add wrap of x axis lables feature, need to remove word height from svg height.
459
- transform: `translate(0, ${svgDimensions.height - margins.bottom - removalValueForTextTuncate})`,
501
+ transform: `translate(0, ${svgDimensions.height - margins.bottom - _removalValueForTextTuncate})`,
460
502
  className: classes.xAxis
461
503
  }), props.xAxisTitle !== undefined && props.xAxisTitle !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
462
504
  content: props.xAxisTitle,
@@ -470,6 +512,19 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
470
512
  wrapContent: wrapContent,
471
513
  showBackground: true,
472
514
  className: classes.svgTooltip
515
+ }), props.xAxisAnnotation !== undefined && props.xAxisAnnotation !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
516
+ content: props.xAxisAnnotation,
517
+ textProps: {
518
+ x: margins.left + startFromX + xAxisTitleMaximumAllowedWidth / 2,
519
+ y: titleMargin + 3,
520
+ className: classes.axisAnnotation,
521
+ textAnchor: 'middle',
522
+ 'aria-hidden': true
523
+ },
524
+ maxWidth: xAxisTitleMaximumAllowedWidth,
525
+ wrapContent: wrapContent,
526
+ showBackground: true,
527
+ className: classes.svgTooltip
473
528
  }), /*#__PURE__*/ React.createElement("g", {
474
529
  ref: (e)=>{
475
530
  yAxisElement.current = e;
@@ -487,7 +542,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
487
542
  }), props.secondaryYAxistitle !== undefined && props.secondaryYAxistitle !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
488
543
  content: props.secondaryYAxistitle,
489
544
  textProps: {
490
- x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + removalValueForTextTuncate,
545
+ x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
491
546
  y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
492
547
  textAnchor: 'middle',
493
548
  transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
@@ -501,7 +556,7 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
501
556
  })), children, props.yAxisTitle !== undefined && props.yAxisTitle !== '' && /*#__PURE__*/ React.createElement(SVGTooltipText, {
502
557
  content: props.yAxisTitle,
503
558
  textProps: {
504
- x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + removalValueForTextTuncate,
559
+ x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
505
560
  y: _useRtl ? svgDimensions.width - margins.right / 2 + titleMargin : margins.left / 2 - titleMargin,
506
561
  textAnchor: 'middle',
507
562
  transform: `translate(0,
@@ -512,6 +567,21 @@ import { useFocusableGroup, useArrowNavigationGroup } from '@fluentui/react-tabs
512
567
  wrapContent: wrapContent,
513
568
  showBackground: true,
514
569
  className: classes.svgTooltip
570
+ }), props.yAxisAnnotation !== undefined && props.yAxisAnnotation !== '' && (props.secondaryYAxistitle === undefined || props.secondaryYAxistitle === '') && /*#__PURE__*/ React.createElement(SVGTooltipText, {
571
+ content: props.yAxisAnnotation,
572
+ textProps: {
573
+ x: (yAxisTitleMaximumAllowedHeight - margins.bottom) / 2 + _removalValueForTextTuncate,
574
+ y: _useRtl ? startFromX - titleMargin : svgDimensions.width - margins.right,
575
+ textAnchor: 'middle',
576
+ transform: `translate(${_useRtl ? margins.right / 2 - titleMargin : margins.right / 2 + titleMargin},
577
+ ${svgDimensions.height - margins.bottom - margins.top - titleMargin})rotate(-90)`,
578
+ className: classes.axisAnnotation,
579
+ 'aria-hidden': true
580
+ },
581
+ maxWidth: yAxisTitleMaximumAllowedHeight,
582
+ wrapContent: wrapContent,
583
+ showBackground: true,
584
+ className: classes.svgTooltip
515
585
  }))), !props.hideLegend && /*#__PURE__*/ React.createElement("div", {
516
586
  ref: (e)=>legendContainer = e,
517
587
  className: classes.legendContainer