@fluentui/react-charts 9.0.1 → 9.0.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 (235) hide show
  1. package/CHANGELOG.md +58 -2
  2. package/dist/index.d.ts +1432 -238
  3. package/lib/AreaChart.js +1 -0
  4. package/lib/AreaChart.js.map +1 -0
  5. package/lib/GaugeChart.js +1 -0
  6. package/lib/GaugeChart.js.map +1 -0
  7. package/lib/GroupedVerticalBarChart.js +1 -0
  8. package/lib/GroupedVerticalBarChart.js.map +1 -0
  9. package/lib/HeatMapChart.js +1 -0
  10. package/lib/HeatMapChart.js.map +1 -0
  11. package/lib/HorizontalBarChartWithAxis.js +1 -0
  12. package/lib/HorizontalBarChartWithAxis.js.map +1 -0
  13. package/lib/SankeyChart.js +1 -0
  14. package/lib/SankeyChart.js.map +1 -0
  15. package/lib/ScatterChart.js +1 -0
  16. package/lib/ScatterChart.js.map +1 -0
  17. package/lib/VerticalStackedBarChart.js +1 -0
  18. package/lib/VerticalStackedBarChart.js.map +1 -0
  19. package/lib/components/AreaChart/AreaChart.js +775 -0
  20. package/lib/components/AreaChart/AreaChart.js.map +1 -0
  21. package/lib/components/AreaChart/AreaChart.types.js +4 -0
  22. package/lib/components/AreaChart/AreaChart.types.js.map +1 -0
  23. package/lib/components/AreaChart/index.js +3 -0
  24. package/lib/components/AreaChart/index.js.map +1 -0
  25. package/lib/components/AreaChart/useAreaChartStyles.styles.js +64 -0
  26. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  27. package/lib/components/CommonComponents/CartesianChart.js +30 -14
  28. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  29. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  30. package/lib/components/DeclarativeChart/DeclarativeChart.js +112 -65
  31. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  32. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +570 -159
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  34. package/lib/components/DonutChart/Arc/Arc.js +1 -1
  35. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  36. package/lib/components/DonutChart/DonutChart.js +1 -1
  37. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  38. package/lib/components/GaugeChart/GaugeChart.js +592 -0
  39. package/lib/components/GaugeChart/GaugeChart.js.map +1 -0
  40. package/lib/components/GaugeChart/GaugeChart.types.js +4 -0
  41. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -0
  42. package/lib/components/GaugeChart/index.js +3 -0
  43. package/lib/components/GaugeChart/index.js.map +1 -0
  44. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js +174 -0
  45. package/lib/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
  46. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +501 -0
  47. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
  48. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +4 -0
  49. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
  50. package/lib/components/GroupedVerticalBarChart/index.js +3 -0
  51. package/lib/components/GroupedVerticalBarChart/index.js.map +1 -0
  52. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +90 -0
  53. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
  54. package/lib/components/HeatMapChart/HeatMapChart.js +588 -0
  55. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -0
  56. package/lib/components/HeatMapChart/HeatMapChart.types.js +4 -0
  57. package/lib/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  58. package/lib/components/HeatMapChart/index.js +3 -0
  59. package/lib/components/HeatMapChart/index.js.map +1 -0
  60. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +46 -0
  61. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  62. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +571 -0
  63. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  64. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +4 -0
  65. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  66. package/lib/components/HorizontalBarChartWithAxis/index.js +3 -0
  67. package/lib/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  68. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +76 -0
  69. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  70. package/lib/components/Legends/Legends.js +38 -37
  71. package/lib/components/Legends/Legends.js.map +1 -1
  72. package/lib/components/Legends/Legends.types.js.map +1 -1
  73. package/lib/components/LineChart/LineChart.js +43 -35
  74. package/lib/components/LineChart/LineChart.js.map +1 -1
  75. package/lib/components/SankeyChart/SankeyChart.js +1022 -0
  76. package/lib/components/SankeyChart/SankeyChart.js.map +1 -0
  77. package/lib/components/SankeyChart/SankeyChart.types.js +3 -0
  78. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -0
  79. package/lib/components/SankeyChart/index.js +3 -0
  80. package/lib/components/SankeyChart/index.js.map +1 -0
  81. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +109 -0
  82. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  83. package/lib/components/ScatterChart/ScatterChart.js +465 -0
  84. package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
  85. package/lib/components/ScatterChart/ScatterChart.types.js +4 -0
  86. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
  87. package/lib/components/ScatterChart/index.js +3 -0
  88. package/lib/components/ScatterChart/index.js.map +1 -0
  89. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +65 -0
  90. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
  91. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  92. package/lib/components/VerticalBarChart/VerticalBarChart.js +165 -88
  93. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  94. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  95. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +904 -0
  96. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  97. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +1 -0
  98. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  99. package/lib/components/VerticalStackedBarChart/index.js +3 -0
  100. package/lib/components/VerticalStackedBarChart/index.js.map +1 -0
  101. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +73 -0
  102. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  103. package/lib/index.js +8 -0
  104. package/lib/index.js.map +1 -1
  105. package/lib/types/DataPoint.js +1 -3
  106. package/lib/types/DataPoint.js.map +1 -1
  107. package/lib/utilities/SVGTooltipText.js +49 -4
  108. package/lib/utilities/SVGTooltipText.js.map +1 -1
  109. package/lib/utilities/colors.js +20 -0
  110. package/lib/utilities/colors.js.map +1 -1
  111. package/lib/utilities/string.js +32 -0
  112. package/lib/utilities/string.js.map +1 -0
  113. package/lib/utilities/test-data.js +53 -0
  114. package/lib/utilities/test-data.js.map +1 -1
  115. package/lib/utilities/utilities.js +210 -20
  116. package/lib/utilities/utilities.js.map +1 -1
  117. package/lib-commonjs/AreaChart.js +6 -0
  118. package/lib-commonjs/AreaChart.js.map +1 -0
  119. package/lib-commonjs/GaugeChart.js +6 -0
  120. package/lib-commonjs/GaugeChart.js.map +1 -0
  121. package/lib-commonjs/GroupedVerticalBarChart.js +6 -0
  122. package/lib-commonjs/GroupedVerticalBarChart.js.map +1 -0
  123. package/lib-commonjs/HeatMapChart.js +6 -0
  124. package/lib-commonjs/HeatMapChart.js.map +1 -0
  125. package/lib-commonjs/HorizontalBarChartWithAxis.js +6 -0
  126. package/lib-commonjs/HorizontalBarChartWithAxis.js.map +1 -0
  127. package/lib-commonjs/SankeyChart.js +6 -0
  128. package/lib-commonjs/SankeyChart.js.map +1 -0
  129. package/lib-commonjs/ScatterChart.js +6 -0
  130. package/lib-commonjs/ScatterChart.js.map +1 -0
  131. package/lib-commonjs/VerticalStackedBarChart.js +6 -0
  132. package/lib-commonjs/VerticalStackedBarChart.js.map +1 -0
  133. package/lib-commonjs/components/AreaChart/AreaChart.js +781 -0
  134. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -0
  135. package/lib-commonjs/components/AreaChart/AreaChart.types.js +7 -0
  136. package/lib-commonjs/components/AreaChart/AreaChart.types.js.map +1 -0
  137. package/lib-commonjs/components/AreaChart/index.js +8 -0
  138. package/lib-commonjs/components/AreaChart/index.js.map +1 -0
  139. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +104 -0
  140. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -0
  141. package/lib-commonjs/components/CommonComponents/CartesianChart.js +29 -14
  142. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  143. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  144. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +120 -73
  145. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  146. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +592 -178
  147. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  148. package/lib-commonjs/components/DonutChart/Arc/Arc.js +1 -1
  149. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  150. package/lib-commonjs/components/DonutChart/DonutChart.js +1 -1
  151. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  152. package/lib-commonjs/components/GaugeChart/GaugeChart.js +621 -0
  153. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -0
  154. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js +7 -0
  155. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -0
  156. package/lib-commonjs/components/GaugeChart/index.js +8 -0
  157. package/lib-commonjs/components/GaugeChart/index.js.map +1 -0
  158. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js +252 -0
  159. package/lib-commonjs/components/GaugeChart/useGaugeChartStyles.styles.js.map +1 -0
  160. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +507 -0
  161. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -0
  162. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js +7 -0
  163. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -0
  164. package/lib-commonjs/components/GroupedVerticalBarChart/index.js +8 -0
  165. package/lib-commonjs/components/GroupedVerticalBarChart/index.js.map +1 -0
  166. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +139 -0
  167. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -0
  168. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +599 -0
  169. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -0
  170. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js +7 -0
  171. package/lib-commonjs/components/HeatMapChart/HeatMapChart.types.js.map +1 -0
  172. package/lib-commonjs/components/HeatMapChart/index.js +8 -0
  173. package/lib-commonjs/components/HeatMapChart/index.js.map +1 -0
  174. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +68 -0
  175. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -0
  176. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +580 -0
  177. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -0
  178. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js +7 -0
  179. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.types.js.map +1 -0
  180. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js +8 -0
  181. package/lib-commonjs/components/HorizontalBarChartWithAxis/index.js.map +1 -0
  182. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +116 -0
  183. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -0
  184. package/lib-commonjs/components/Legends/Legends.js +37 -37
  185. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  186. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  187. package/lib-commonjs/components/LineChart/LineChart.js +41 -33
  188. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  189. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1038 -0
  190. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -0
  191. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js +6 -0
  192. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -0
  193. package/lib-commonjs/components/SankeyChart/index.js +8 -0
  194. package/lib-commonjs/components/SankeyChart/index.js.map +1 -0
  195. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +179 -0
  196. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -0
  197. package/lib-commonjs/components/ScatterChart/ScatterChart.js +471 -0
  198. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
  199. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +7 -0
  200. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
  201. package/lib-commonjs/components/ScatterChart/index.js +8 -0
  202. package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
  203. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +96 -0
  204. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -0
  205. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  206. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +164 -87
  207. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  208. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  209. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +915 -0
  210. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -0
  211. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js +6 -0
  212. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -0
  213. package/lib-commonjs/components/VerticalStackedBarChart/index.js +8 -0
  214. package/lib-commonjs/components/VerticalStackedBarChart/index.js.map +1 -0
  215. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +120 -0
  216. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -0
  217. package/lib-commonjs/index.js +8 -0
  218. package/lib-commonjs/index.js.map +1 -1
  219. package/lib-commonjs/types/DataPoint.js +1 -3
  220. package/lib-commonjs/types/DataPoint.js.map +1 -1
  221. package/lib-commonjs/utilities/SVGTooltipText.js +49 -4
  222. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  223. package/lib-commonjs/utilities/colors.js +23 -0
  224. package/lib-commonjs/utilities/colors.js.map +1 -1
  225. package/lib-commonjs/utilities/string.js +29 -0
  226. package/lib-commonjs/utilities/string.js.map +1 -0
  227. package/lib-commonjs/utilities/test-data.js +59 -0
  228. package/lib-commonjs/utilities/test-data.js.map +1 -1
  229. package/lib-commonjs/utilities/utilities.js +206 -19
  230. package/lib-commonjs/utilities/utilities.js.map +1 -1
  231. package/package.json +11 -8
  232. package/lib/components/DeclarativeChart/PlotlySchema.js +0 -7
  233. package/lib/components/DeclarativeChart/PlotlySchema.js.map +0 -1
  234. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js +0 -10
  235. package/lib-commonjs/components/DeclarativeChart/PlotlySchema.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["__styles","mergeClasses","shorthands","tokens","scatterChartClassNames","tooltip","root","xAxis","yAxis","legendContainer","hover","calloutContentRoot","calloutContentX","calloutContentY","descriptionMessage","calloutDateTimeContainer","calloutInfoContainer","calloutBlockContainer","calloutlegendText","axisTitle","chartTitle","opacityChangeOnHover","shapeStyles","chartWrapper","calloutBlockContainertoDrawShapefalse","calloutBlockContainertoDrawShapetrue","useStyles","mc9l5x","Beiy3e4","z8tnut","z189sj","Byoj8tv","uwmqm3","qhf8xq","fsow6f","Bhzewxz","Bkfmm31","Beyfa6y","Bbmb7ep","Btl43ni","B7oj6ja","Dimara","Bkecrkj","d","p","useScatterChartStyles_unstable","props","baseStyles"],"sources":["useScatterChartStyles.styles.js"],"sourcesContent":["import { makeStyles, mergeClasses, shorthands } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\n/**\n * @internal\n */ export const scatterChartClassNames = {\n tooltip: 'fui-line__tooltip',\n root: 'fui-line__root',\n xAxis: 'fui-line__xAxis',\n yAxis: 'fui-line__yAxis',\n legendContainer: 'fui-line__legendContainer',\n hover: 'fui-line__hover',\n calloutContentRoot: 'fui-line__calloutContentRoot',\n calloutContentX: 'fui-line__calloutContentX',\n calloutContentY: 'fui-line__calloutContentY',\n descriptionMessage: 'fui-line__descriptionMessage',\n calloutDateTimeContainer: 'fui-line__calloutDateTimeContainer',\n calloutInfoContainer: 'fui-line__calloutInfoContainer',\n calloutBlockContainer: 'fui-line__calloutBlockContainer',\n calloutlegendText: 'fui-line__calloutLegendText',\n axisTitle: 'fui-line__axisTitle',\n chartTitle: 'fui-line__chartTitle',\n opacityChangeOnHover: 'fui-line__opacityChangeOnHover',\n shapeStyles: 'fui-line__shapeStyles',\n chartWrapper: 'fui-line__chartWrapper',\n calloutBlockContainertoDrawShapefalse: '',\n calloutBlockContainertoDrawShapetrue: ''\n};\n/**\n * Base Styles\n */ const useStyles = makeStyles({\n tooltip: {\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.padding(tokens.spacingHorizontalS),\n position: 'absolute',\n textAlign: 'center',\n top: tokens.spacingVerticalNone,\n fill: tokens.colorNeutralBackground1,\n borderRadius: tokens.borderRadiusSmall,\n pointerEvents: 'none'\n }\n});\n/**\n * Apply styling to the Carousel slots based on the state\n */ export const useScatterChartStyles_unstable = (props)=>{\n const baseStyles = useStyles();\n return {\n tooltip: mergeClasses(scatterChartClassNames.tooltip, baseStyles.tooltip /*props.styles?.tooltip*/ )\n };\n};\n"],"mappings":"AAAA,SAAAA,QAAA,EAAqBC,YAAY,EAAEC,UAAU,QAAQ,gBAAgB;AACrE,SAASC,MAAM,QAAQ,uBAAuB;AAC9C;AACA;AACA;AAAI,OAAO,MAAMC,sBAAsB,GAAG;EACtCC,OAAO,EAAE,mBAAmB;EAC5BC,IAAI,EAAE,gBAAgB;EACtBC,KAAK,EAAE,iBAAiB;EACxBC,KAAK,EAAE,iBAAiB;EACxBC,eAAe,EAAE,2BAA2B;EAC5CC,KAAK,EAAE,iBAAiB;EACxBC,kBAAkB,EAAE,8BAA8B;EAClDC,eAAe,EAAE,2BAA2B;EAC5CC,eAAe,EAAE,2BAA2B;EAC5CC,kBAAkB,EAAE,8BAA8B;EAClDC,wBAAwB,EAAE,oCAAoC;EAC9DC,oBAAoB,EAAE,gCAAgC;EACtDC,qBAAqB,EAAE,iCAAiC;EACxDC,iBAAiB,EAAE,6BAA6B;EAChDC,SAAS,EAAE,qBAAqB;EAChCC,UAAU,EAAE,sBAAsB;EAClCC,oBAAoB,EAAE,gCAAgC;EACtDC,WAAW,EAAE,uBAAuB;EACpCC,YAAY,EAAE,wBAAwB;EACtCC,qCAAqC,EAAE,EAAE;EACzCC,oCAAoC,EAAE;AAC1C,CAAC;AACD;AACA;AACA;AAAI,MAAMC,SAAS,gBAAG1B,QAAA;EAAAK,OAAA;IAAAsB,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,MAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;IAAAC,CAAA;EAAA;AAAA,CAYrB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,8BAA8B,GAAIC,KAAK,IAAG;EACvD,MAAMC,UAAU,GAAGrB,SAAS,CAAC,CAAC;EAC9B,OAAO;IACHrB,OAAO,EAAEJ,YAAY,CAACG,sBAAsB,CAACC,OAAO,EAAE0C,UAAU,CAAC1C,OAAO,CAAC,yBAA0B;EACvG,CAAC;AACL,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["Sparkline.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSparklineStyles } from './useSparklineStyles.styles';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { area as d3Area, line as d3Line, curveLinear as d3curveLinear } from 'd3-shape';\nimport { max as d3Max, extent as d3Extent } from 'd3-array';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { LineChartDataPoint } from '../../types/DataPoint';\nimport { useRtl } from '../../utilities/index';\nimport { SparklineProps } from '../../index';\n\n/**\n * Sparkline is the context wrapper and container for all Sparkline content/controls,\n * It has no direct style or slot opinions.\n *\n * Sparkline also provides API interfaces for callbacks that will occur on navigation events.\n */\nexport const Sparkline: React.FunctionComponent<SparklineProps> = React.forwardRef<HTMLDivElement, SparklineProps>(\n (props, forwardedRef) => {\n let margin = {\n top: 2,\n right: 0,\n bottom: 0,\n left: 0,\n };\n let x: any;\n let y: any;\n let _emptyChartId: string = '_SparklineChart_empty';\n let _isRTL: boolean = useRtl();\n const [points, setPoints] = React.useState<LineChartDataPoint[]>([]);\n const width = 80;\n const height = 20;\n const valueTextWidth = 80;\n\n const line = React.useMemo(() => {\n return d3Line<LineChartDataPoint>()\n .x((d: LineChartDataPoint) => x(d.x))\n .y((d: LineChartDataPoint) => y(d.y))\n .curve(d3curveLinear);\n }, [x, y]);\n\n const area = React.useMemo(() => {\n return d3Area<LineChartDataPoint>()\n .x((d: LineChartDataPoint) => x(d.x))\n .y0(height)\n .y1((d: LineChartDataPoint) => y(d.y))\n .curve(d3curveLinear);\n }, [height, x, y]);\n\n React.useEffect(() => {\n if (!_isChartEmpty()) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const _points = props.data!.lineChartData![0].data;\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n const [xMin, xMax] = d3Extent(_points, (d: any) => d.x);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n x = d3ScaleLinear()\n .domain([xMin, xMax])\n .range([margin.left!, width - margin.right!]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n y = d3ScaleLinear()\n /* eslint-disable @typescript-eslint/no-explicit-any */\n .domain([0, d3Max(_points, (d: any) => d.y)])\n .range([height - margin.bottom!, margin.top!]);\n\n setPoints(_points);\n }\n }, []);\n\n const { data } = props;\n function _isChartEmpty(): boolean {\n return !(\n data &&\n data.lineChartData &&\n data.lineChartData.length > 0 &&\n data.lineChartData.filter(item => item.data.length === 0).length === 0\n );\n }\n function drawSparkline() {\n if (!line || !area) {\n return null;\n }\n return (\n <>\n <path\n className=\"line\"\n d={line(points)!}\n fill={'transparent'}\n opacity={1}\n strokeWidth={2}\n stroke={data!.lineChartData![0].color!}\n />\n <path\n className=\"area\"\n d={area(points)!}\n opacity={1}\n fillOpacity={0.2}\n fill={data!.lineChartData![0].color!}\n role=\"img\"\n aria-hidden\n />\n </>\n );\n }\n\n const classes = useSparklineStyles(props);\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div className={classes.inlineBlock} {...focusAttributes}>\n {width >= 50 && height >= 16 ? (\n <svg\n width={width}\n height={height}\n aria-label={`Sparkline with label ${data!.lineChartData![0].legend!}`}\n tabIndex={0}\n >\n {points ? drawSparkline() : null}\n </svg>\n ) : (\n <></>\n )}\n {props.showLegend && props.data!.lineChartData![0].legend ? (\n <svg width={valueTextWidth} height={height}>\n <text x=\"0%\" textAnchor={_isRTL ? 'end' : 'start'} dx={8} y=\"100%\" dy={-5} className={classes.valueText}>\n {props.data!.lineChartData![0].legend!}\n </text>\n </svg>\n ) : (\n <></>\n )}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\nSparkline.displayName = 'Sparkline';\n"],"names":["React","useSparklineStyles","scaleLinear","d3ScaleLinear","area","d3Area","line","d3Line","curveLinear","d3curveLinear","max","d3Max","extent","d3Extent","useFocusableGroup","useRtl","Sparkline","forwardRef","props","forwardedRef","margin","top","right","bottom","left","x","y","_emptyChartId","_isRTL","points","setPoints","useState","width","height","valueTextWidth","useMemo","d","curve","y0","y1","useEffect","_isChartEmpty","_points","data","lineChartData","xMin","xMax","domain","range","length","filter","item","drawSparkline","path","className","fill","opacity","strokeWidth","stroke","color","fillOpacity","role","aria-hidden","classes","focusAttributes","div","inlineBlock","svg","aria-label","legend","tabIndex","showLegend","text","textAnchor","dx","dy","valueText","id","style","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ,8BAA8B;AACjE,SAASC,eAAeC,aAAa,QAAQ,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MAAMC,UAAU,mBACxB,oBAACkC;QACCnC,OAAOA;QACPC,QAAQA;QACRmC,cAAY,CAAC,qBAAqB,EAAEzB,KAAMC,aAAa,AAAC,CAAC,EAAE,CAACyB,MAAM,CAAE,CAAC;QACrEC,UAAU;OAETzC,SAASuB,kBAAkB,sBAG9B,2CAEDlC,MAAMqD,UAAU,IAAIrD,MAAMyB,IAAI,CAAEC,aAAa,AAAC,CAAC,EAAE,CAACyB,MAAM,iBACvD,oBAACF;QAAInC,OAAOE;QAAgBD,QAAQA;qBAClC,oBAACuC;QAAK/C,GAAE;QAAKgD,YAAY7C,SAAS,QAAQ;QAAS8C,IAAI;QAAGhD,GAAE;QAAOiD,IAAI,CAAC;QAAGrB,WAAWS,QAAQa,SAAS;OACpG1D,MAAMyB,IAAI,CAAEC,aAAa,AAAC,CAAC,EAAE,CAACyB,MAAM,mBAIzC,2DAIJ,oBAACJ;QAAIY,IAAIlD;QAAekC,MAAM;QAASiB,OAAO;YAAEtB,SAAS;QAAI;QAAGY,cAAY;;AAEhF,GACA;AACFpD,UAAU+D,WAAW,GAAG"}
1
+ {"version":3,"sources":["Sparkline.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useSparklineStyles } from './useSparklineStyles.styles';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { area as d3Area, line as d3Line, curveLinear as d3curveLinear } from 'd3-shape';\nimport { max as d3Max, extent as d3Extent } from 'd3-array';\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { LineChartDataPoint } from '../../types/DataPoint';\nimport { useRtl } from '../../utilities/index';\nimport { SparklineProps } from '../../index';\n\n/**\n * Sparkline is the context wrapper and container for all Sparkline content/controls,\n * It has no direct style or slot opinions.\n *\n * Sparkline also provides API interfaces for callbacks that will occur on navigation events.\n */\nexport const Sparkline: React.FunctionComponent<SparklineProps> = React.forwardRef<HTMLDivElement, SparklineProps>(\n (props, forwardedRef) => {\n let margin = {\n top: 2,\n right: 0,\n bottom: 0,\n left: 0,\n };\n let x: any;\n let y: any;\n let _emptyChartId: string = '_SparklineChart_empty';\n let _isRTL: boolean = useRtl();\n const [points, setPoints] = React.useState<LineChartDataPoint[]>([]);\n const width = 80;\n const height = 20;\n const valueTextWidth = 80;\n\n const line = React.useMemo(() => {\n return d3Line<LineChartDataPoint>()\n .x((d: LineChartDataPoint) => x(d.x))\n .y((d: LineChartDataPoint) => y(d.y))\n .curve(d3curveLinear);\n }, [x, y]);\n\n const area = React.useMemo(() => {\n return d3Area<LineChartDataPoint>()\n .x((d: LineChartDataPoint) => x(d.x))\n .y0(height)\n .y1((d: LineChartDataPoint) => y(d.y))\n .curve(d3curveLinear);\n }, [height, x, y]);\n\n React.useEffect(() => {\n if (!_isChartEmpty()) {\n // eslint-disable-next-line @typescript-eslint/no-shadow\n const _points = props.data!.lineChartData![0].data;\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n const [xMin, xMax] = d3Extent(_points, (d: any) => d.x);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n x = d3ScaleLinear()\n .domain([xMin, xMax])\n .range([margin.left!, width - margin.right!]);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n y = d3ScaleLinear()\n /* eslint-disable @typescript-eslint/no-explicit-any */\n .domain([0, d3Max(_points, (d: any) => d.y)])\n .range([height - margin.bottom!, margin.top!]);\n\n setPoints(_points as LineChartDataPoint[]);\n }\n }, []);\n\n const { data } = props;\n function _isChartEmpty(): boolean {\n return !(\n data &&\n data.lineChartData &&\n data.lineChartData.length > 0 &&\n data.lineChartData.filter(item => item.data.length === 0).length === 0\n );\n }\n function drawSparkline() {\n if (!line || !area) {\n return null;\n }\n return (\n <>\n <path\n className=\"line\"\n d={line(points)!}\n fill={'transparent'}\n opacity={1}\n strokeWidth={2}\n stroke={data!.lineChartData![0].color!}\n />\n <path\n className=\"area\"\n d={area(points)!}\n opacity={1}\n fillOpacity={0.2}\n fill={data!.lineChartData![0].color!}\n role=\"img\"\n aria-hidden\n />\n </>\n );\n }\n\n const classes = useSparklineStyles(props);\n const focusAttributes = useFocusableGroup();\n return !_isChartEmpty() ? (\n <div className={classes.inlineBlock} {...focusAttributes}>\n {width >= 50 && height >= 16 ? (\n <svg\n width={width}\n height={height}\n aria-label={`Sparkline with label ${data!.lineChartData![0].legend!}`}\n tabIndex={0}\n >\n {points ? drawSparkline() : null}\n </svg>\n ) : (\n <></>\n )}\n {props.showLegend && props.data!.lineChartData![0].legend ? (\n <svg width={valueTextWidth} height={height}>\n <text x=\"0%\" textAnchor={_isRTL ? 'end' : 'start'} dx={8} y=\"100%\" dy={-5} className={classes.valueText}>\n {props.data!.lineChartData![0].legend!}\n </text>\n </svg>\n ) : (\n <></>\n )}\n </div>\n ) : (\n <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={'Graph has no data to display'} />\n );\n },\n);\nSparkline.displayName = 'Sparkline';\n"],"names":["React","useSparklineStyles","scaleLinear","d3ScaleLinear","area","d3Area","line","d3Line","curveLinear","d3curveLinear","max","d3Max","extent","d3Extent","useFocusableGroup","useRtl","Sparkline","forwardRef","props","forwardedRef","margin","top","right","bottom","left","x","y","_emptyChartId","_isRTL","points","setPoints","useState","width","height","valueTextWidth","useMemo","d","curve","y0","y1","useEffect","_isChartEmpty","_points","data","lineChartData","xMin","xMax","domain","range","length","filter","item","drawSparkline","path","className","fill","opacity","strokeWidth","stroke","color","fillOpacity","role","aria-hidden","classes","focusAttributes","div","inlineBlock","svg","aria-label","legend","tabIndex","showLegend","text","textAnchor","dx","dy","valueText","id","style","displayName"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,kBAAkB,QAAQ,8BAA8B;AACjE,SAASC,eAAeC,aAAa,QAAQ,WAAW;AACxD,SAASC,QAAQC,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kC;QACCnC,OAAOA;QACPC,QAAQA;QACRmC,cAAY,CAAC,qBAAqB,EAAEzB,KAAMC,aAAa,AAAC,CAAC,EAAE,CAACyB,MAAM,CAAE,CAAC;QACrEC,UAAU;OAETzC,SAASuB,kBAAkB,sBAG9B,2CAEDlC,MAAMqD,UAAU,IAAIrD,MAAMyB,IAAI,CAAEC,aAAa,AAAC,CAAC,EAAE,CAACyB,MAAM,iBACvD,oBAACF;QAAInC,OAAOE;QAAgBD,QAAQA;qBAClC,oBAACuC;QAAK/C,GAAE;QAAKgD,YAAY7C,SAAS,QAAQ;QAAS8C,IAAI;QAAGhD,GAAE;QAAOiD,IAAI,CAAC;QAAGrB,WAAWS,QAAQa,SAAS;OACpG1D,MAAMyB,IAAI,CAAEC,aAAa,AAAC,CAAC,EAAE,CAACyB,MAAM,mBAIzC,2DAIJ,oBAACJ;QAAIY,IAAIlD;QAAekC,MAAM;QAASiB,OAAO;YAAEtB,SAAS;QAAI;QAAGY,cAAY;;AAEhF,GACA;AACFpD,UAAU+D,WAAW,GAAG"}
@@ -7,7 +7,7 @@ import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3S
7
7
  import { useId } from '@fluentui/react-utilities';
8
8
  import { tokens } from '@fluentui/react-theme';
9
9
  import { CartesianChart, Legends, ChartPopover } from '../../index';
10
- import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, useRtl } from '../../utilities/index';
10
+ import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, useRtl, areArraysEqual, calculateLongestLabelWidth } from '../../utilities/index';
11
11
  var CircleVisbility;
12
12
  (function(CircleVisbility) {
13
13
  CircleVisbility["show"] = "visibility";
@@ -19,6 +19,7 @@ const MIN_DOMAIN_MARGIN = 8;
19
19
  * VerticalBarchart component
20
20
  * {@docCategory VerticalBarChart}
21
21
  */ export const VerticalBarChart = /*#__PURE__*/ React.forwardRef((props, forwardedRef)=>{
22
+ var _props_legendProps;
22
23
  let _points = [];
23
24
  let _barWidth = 0;
24
25
  let _colors;
@@ -28,6 +29,7 @@ const MIN_DOMAIN_MARGIN = 8;
28
29
  let _bars;
29
30
  let _xAxisLabels;
30
31
  let _yMax;
32
+ let _yMin;
31
33
  let _isHavingLine = _checkForLine();
32
34
  const _tooltipId = useId('VCTooltipID_');
33
35
  const _xAxisType = props.data && props.data.length > 0 ? getTypeOfAxis(props.data[0].x, true) : XAxisTypes.StringAxis;
@@ -42,12 +44,11 @@ const MIN_DOMAIN_MARGIN = 8;
42
44
  const cartesianChartRef = React.useRef(null);
43
45
  const [color, setColor] = React.useState('');
44
46
  const [dataForHoverCard, setDataForHoverCard] = React.useState(0);
45
- const [selectedLegend, setSelectedLegend] = React.useState('');
46
- const [activeLegend, setActiveLegend] = React.useState('');
47
+ const [activeLegend, setActiveLegend] = React.useState(undefined);
47
48
  const [xCalloutValue, setXCalloutValue] = React.useState('');
48
49
  const [yCalloutValue, setYCalloutValue] = React.useState('');
49
50
  const [activeXdataPoint, setActiveXDatapoint] = React.useState(null);
50
- const [YValueHover, setYValueHover] = React.useState();
51
+ const [hoveredYValues, setYValueHover] = React.useState();
51
52
  const [hoverXValue, setHoverXValue] = React.useState('');
52
53
  const [calloutLegend, setCalloutLegend] = React.useState('');
53
54
  const [callOutAccessibilityData, setCalloutAccessibilityData] = React.useState();
@@ -57,6 +58,8 @@ const MIN_DOMAIN_MARGIN = 8;
57
58
  y: 0
58
59
  });
59
60
  const [isPopoverOpen, setPopoverOpen] = React.useState(false);
61
+ const [selectedLegends, setSelectedLegends] = React.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
62
+ const prevPropsRef = React.useRef(null);
60
63
  React.useImperativeHandle(props.componentRef, ()=>{
61
64
  var _cartesianChartRef_current;
62
65
  var _cartesianChartRef_current_chartContainer;
@@ -64,6 +67,24 @@ const MIN_DOMAIN_MARGIN = 8;
64
67
  chartContainer: (_cartesianChartRef_current_chartContainer = (_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer) !== null && _cartesianChartRef_current_chartContainer !== void 0 ? _cartesianChartRef_current_chartContainer : null
65
68
  };
66
69
  }, []);
70
+ React.useEffect(()=>{
71
+ if (prevPropsRef.current) {
72
+ var _prevProps_legendProps, _props_legendProps;
73
+ const prevProps = prevPropsRef.current;
74
+ if (!areArraysEqual((_prevProps_legendProps = prevProps.legendProps) === null || _prevProps_legendProps === void 0 ? void 0 : _prevProps_legendProps.selectedLegends, (_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends)) {
75
+ var _props_legendProps1;
76
+ setSelectedLegends(((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.selectedLegends) || []);
77
+ }
78
+ if (prevProps.height !== props.height || prevProps.width !== props.width) {
79
+ _adjustProps();
80
+ }
81
+ }
82
+ prevPropsRef.current = props;
83
+ }, [
84
+ props,
85
+ prevPropsRef,
86
+ _adjustProps
87
+ ]);
67
88
  function _createLine(// eslint-disable-next-line @typescript-eslint/no-explicit-any
68
89
  xScale, // eslint-disable-next-line @typescript-eslint/no-explicit-any
69
90
  yScale, containerHeight = 0, containerWidth = 0, // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -125,7 +146,7 @@ const MIN_DOMAIN_MARGIN = 8;
125
146
  id: `${_vbcPointId}-${index}`,
126
147
  cx: isStringAxis ? xScale(item.x) + 0.5 * xScale.bandwidth() : xScale(item.x),
127
148
  cy: item.useSecondaryYScale && yScaleSecondary ? yScaleSecondary(item.y) : yScale(item.y),
128
- onMouseOver: _legendHighlighted(lineLegendText) ? _lineHover.bind(item.point) : (event)=>_onBarHover(item.point, colorScale(item.y), event),
149
+ onMouseOver: (event)=>_legendHighlighted(lineLegendText) ? _lineHover(item.point, event) : _onBarHover(item.point, colorScale(item.y), event),
129
150
  onMouseOut: _onBarLeave,
130
151
  r: _getCircleVisibilityAndRadius(item.x, lineLegendText).radius,
131
152
  stroke: lineLegendColor,
@@ -145,13 +166,13 @@ const MIN_DOMAIN_MARGIN = 8;
145
166
  return /*#__PURE__*/ React.createElement(React.Fragment, null, line, dots);
146
167
  }
147
168
  function _getCircleVisibilityAndRadius(xAxisPoint, legend) {
148
- if (selectedLegend !== '') {
149
- if (xAxisPoint === activeXdataPoint && selectedLegend === legend) {
169
+ if (!_noLegendHighlighted()) {
170
+ if (xAxisPoint === activeXdataPoint && _legendHighlighted(legend)) {
150
171
  return {
151
172
  visibility: "visibility",
152
173
  radius: 8
153
174
  };
154
- } else if (selectedLegend === legend) {
175
+ } else if (_legendHighlighted(legend)) {
155
176
  // Don't hide the circle to keep it focusable. For more information,
156
177
  // see https://fuzzbomb.github.io/accessibility-demos/visually-hidden-focus-test.html
157
178
  return {
@@ -271,10 +292,10 @@ const MIN_DOMAIN_MARGIN = 8;
271
292
  const { useSingleColor = false } = props;
272
293
  const { data, lineLegendText, lineLegendColor = tokens.colorPaletteYellowBackground1 } = props;
273
294
  const selectedPoint = data.filter((xDataPoint)=>xDataPoint.x === point.x);
274
- // there might be no y value of the line for the hovered bar. so we need to check this condition
275
- if (_isHavingLine && ((_selectedPoint__lineData = selectedPoint[0].lineData) === null || _selectedPoint__lineData === void 0 ? void 0 : _selectedPoint__lineData.y) !== undefined) {
295
+ // Check if the line legend is highlighted or no legend is highlighted
296
+ if (_isHavingLine && ((_selectedPoint__lineData = selectedPoint[0].lineData) === null || _selectedPoint__lineData === void 0 ? void 0 : _selectedPoint__lineData.y) !== undefined && (_legendHighlighted(lineLegendText) || _noLegendHighlighted())) {
276
297
  var _selectedPoint__lineData1, _selectedPoint__lineData2, _selectedPoint__lineData3;
277
- // callout data for the line
298
+ // Add callout data for the line
278
299
  YValueHover.push({
279
300
  legend: lineLegendText,
280
301
  color: lineLegendColor,
@@ -283,14 +304,17 @@ const MIN_DOMAIN_MARGIN = 8;
283
304
  yAxisCalloutData: (_selectedPoint__lineData3 = selectedPoint[0].lineData) === null || _selectedPoint__lineData3 === void 0 ? void 0 : _selectedPoint__lineData3.yAxisCalloutData
284
305
  });
285
306
  }
286
- // callout data for the bar
287
- YValueHover.push({
288
- legend: selectedPoint[0].legend,
289
- y: selectedPoint[0].y,
290
- color: !useSingleColor ? selectedPoint[0].color ? selectedPoint[0].color : _createColors()(selectedPoint[0].y) : _createColors()(1),
291
- data: selectedPoint[0].yAxisCalloutData,
292
- yAxisCalloutData: selectedPoint[0].yAxisCalloutData
293
- });
307
+ // Check if the bar legend is highlighted or no legend is highlighted
308
+ if (selectedPoint[0].legend && (selectedLegends.includes(selectedPoint[0].legend) || _noLegendHighlighted())) {
309
+ // Add callout data for the bar
310
+ YValueHover.push({
311
+ legend: selectedPoint[0].legend,
312
+ y: selectedPoint[0].y,
313
+ color: !useSingleColor ? selectedPoint[0].color ? selectedPoint[0].color : _createColors()(selectedPoint[0].y) : _createColors()(1),
314
+ data: selectedPoint[0].yAxisCalloutData,
315
+ yAxisCalloutData: selectedPoint[0].yAxisCalloutData
316
+ });
317
+ }
294
318
  // eslint-disable-next-line @typescript-eslint/no-shadow
295
319
  const hoverXValue = point.x instanceof Date ? point.x.toLocaleString() : point.x.toString();
296
320
  return {
@@ -306,7 +330,7 @@ const MIN_DOMAIN_MARGIN = 8;
306
330
  if (_calloutAnchorPoint !== point) {
307
331
  _calloutAnchorPoint = point;
308
332
  /** Show the callout if highlighted bar is hovered and Hide it if unhighlighted bar is hovered */ updatePosition(mouseEvent.clientX, mouseEvent.clientY);
309
- setPopoverOpen(selectedLegend === '' || selectedLegend === point.legend);
333
+ setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(point.legend));
310
334
  setDataForHoverCard(point.y);
311
335
  setCalloutLegend(point.legend);
312
336
  setColor(point.color || color);
@@ -335,7 +359,7 @@ const MIN_DOMAIN_MARGIN = 8;
335
359
  const { YValueHover, hoverXValue } = _getCalloutContentForLineAndBar(point);
336
360
  _refArray.forEach((obj, index)=>{
337
361
  if (obj.index === point.legend && refArrayIndexNumber === index) {
338
- /** Show the callout if highlighted bar is hovered and Hide it if unhighlighted bar is hovered */ setPopoverOpen(selectedLegend === '' || selectedLegend === point.legend);
362
+ /** Show the callout if highlighted bar is hovered and Hide it if unhighlighted bar is hovered */ setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(point.legend));
339
363
  setDataForHoverCard(point.y);
340
364
  setCalloutLegend(point.legend);
341
365
  setColor(point.color || color);
@@ -362,7 +386,7 @@ const MIN_DOMAIN_MARGIN = 8;
362
386
  }
363
387
  function _lineHoverFocus(point, _refSelected) {
364
388
  const { lineLegendText = '', lineLegendColor = tokens.colorPaletteYellowBackground1 } = props;
365
- setPopoverOpen(false);
389
+ setPopoverOpen(_noLegendHighlighted() || _legendHighlighted(lineLegendText));
366
390
  setCalloutLegend(lineLegendText);
367
391
  setDataForHoverCard(point.lineData.y);
368
392
  setColor(lineLegendColor);
@@ -376,7 +400,7 @@ const MIN_DOMAIN_MARGIN = 8;
376
400
  let xBarScale;
377
401
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
378
402
  const yBarScale = d3ScaleLinear().domain([
379
- 0,
403
+ _yMin,
380
404
  _yMax
381
405
  ]).range([
382
406
  0,
@@ -423,31 +447,40 @@ const MIN_DOMAIN_MARGIN = 8;
423
447
  };
424
448
  }
425
449
  const classes = useVerticalBarChartStyles(props);
450
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
451
+ function _calculateMinBarHeight(yMin, yMax, yReferencePoint, yBarScale) {
452
+ const maxHeightFromBaseline = yMax < 0 ? Math.abs(yMin - yReferencePoint) : Math.max(Math.abs(yMax - yReferencePoint), Math.abs(yMin - yReferencePoint));
453
+ return Math.ceil(yBarScale(maxHeightFromBaseline) / 100.0);
454
+ }
426
455
  function _createNumericBars(containerHeight, containerWidth, xElement) {
427
456
  const { useSingleColor = false } = props;
428
457
  const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
429
458
  const colorScale = _createColors();
459
+ const yReferencePoint = _yMax < 0 ? _yMax : 0;
430
460
  const bars = _points.map((point, index)=>{
431
461
  const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
432
- const barHeight = Math.max(yBarScale(point.y), 0);
433
- let adjustedBarHeight = 0;
434
- if (barHeight <= 0) {
462
+ let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
463
+ const isHeightNegative = barHeight < 0;
464
+ barHeight = Math.abs(barHeight);
465
+ // Calculate threshold for minimum visible bar height
466
+ const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
467
+ let adjustedBarHeight = barHeight;
468
+ if (barHeight === 0) {
435
469
  return /*#__PURE__*/ React.createElement(React.Fragment, {
436
470
  key: point.x
437
471
  }, " ");
438
- } else if (barHeight <= Math.ceil(yBarScale(_yMax) / 100.0)) {
439
- adjustedBarHeight = Math.ceil(yBarScale(_yMax) / 100.0);
440
- } else {
441
- adjustedBarHeight = barHeight;
472
+ } else if (barHeight <= minBarHeight) {
473
+ adjustedBarHeight = minBarHeight;
442
474
  }
443
475
  const xPoint = xBarScale(point.x) - _barWidth / 2;
444
- const yPoint = containerHeight - margins.bottom - adjustedBarHeight;
476
+ const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
477
+ const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
445
478
  return /*#__PURE__*/ React.createElement("g", {
446
- key: point.x
479
+ key: `${point.x}_${index}`
447
480
  }, /*#__PURE__*/ React.createElement("rect", {
448
481
  id: `${_vbcBarId}-${index}`,
449
482
  x: xPoint,
450
- y: yPoint,
483
+ y: !isHeightNegative ? yPoint : baselineHeight,
451
484
  width: _barWidth,
452
485
  "data-is-focusable": !props.hideTooltip && shouldHighlight,
453
486
  height: adjustedBarHeight,
@@ -463,8 +496,9 @@ const MIN_DOMAIN_MARGIN = 8;
463
496
  onBlur: _onBarLeave,
464
497
  fill: point.color && !useSingleColor ? point.color : colorScale(point.y),
465
498
  tabIndex: point.legend !== '' ? 0 : undefined,
466
- opacity: shouldHighlight ? '1' : '0.1'
467
- }), _renderBarLabel(xPoint, yPoint, point.y, point.legend));
499
+ opacity: shouldHighlight ? 1 : 0.1,
500
+ rx: props.roundCorners ? 3 : 0
501
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
468
502
  });
469
503
  // Removing un wanted tooltip div from DOM, when prop not provided.
470
504
  if (!props.showXAxisLablesTooltip) {
@@ -494,30 +528,35 @@ const MIN_DOMAIN_MARGIN = 8;
494
528
  function _createStringBars(containerHeight, containerWidth, xElement) {
495
529
  const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
496
530
  const colorScale = _createColors();
531
+ const yReferencePoint = _yMax < 0 ? _yMax : 0;
497
532
  const bars = _points.map((point, index)=>{
498
- const barHeight = Math.max(yBarScale(point.y), 0);
499
- let adjustedBarHeight = 0;
500
- if (barHeight <= 0) {
533
+ const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
534
+ let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
535
+ const isHeightNegative = barHeight < 0;
536
+ barHeight = Math.abs(barHeight);
537
+ // Calculate threshold for minimum visible bar height
538
+ const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
539
+ let adjustedBarHeight = barHeight;
540
+ if (barHeight === 0) {
501
541
  return /*#__PURE__*/ React.createElement(React.Fragment, {
502
- key: point.x instanceof Date ? point.x.getTime() : point.x
542
+ key: point.x
503
543
  }, " ");
504
- } else if (barHeight <= Math.ceil(yBarScale(_yMax) / 100.0)) {
505
- adjustedBarHeight = Math.ceil(yBarScale(_yMax) / 100.0);
506
- } else {
507
- adjustedBarHeight = barHeight;
544
+ } else if (barHeight <= minBarHeight) {
545
+ adjustedBarHeight = minBarHeight;
508
546
  }
509
547
  const xPoint = xBarScale(point.x);
510
- const yPoint = containerHeight - margins.bottom - adjustedBarHeight;
548
+ const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
549
+ const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
511
550
  // Setting the bar width here is safe because there are no dependencies earlier in the code
512
551
  // that rely on the width of bars in vertical bar charts with string x-axis.
513
552
  _barWidth = getBarWidth(props.barWidth, props.maxBarWidth, xBarScale.bandwidth());
514
553
  return /*#__PURE__*/ React.createElement("g", {
515
- key: point.x instanceof Date ? point.x.getTime() : point.x,
554
+ key: point.x instanceof Date ? `${point.x.getTime()}_${index}` : `${point.x}_${index}`,
516
555
  transform: `translate(${0.5 * (xBarScale.bandwidth() - _barWidth)}, 0)`
517
556
  }, /*#__PURE__*/ React.createElement("rect", {
518
557
  id: `${_vbcBarId}-${index}`,
519
558
  x: xPoint,
520
- y: yPoint,
559
+ y: !isHeightNegative ? yPoint : baselineHeight,
521
560
  width: _barWidth,
522
561
  height: adjustedBarHeight,
523
562
  "aria-label": _getAriaLabel(point),
@@ -529,11 +568,13 @@ const MIN_DOMAIN_MARGIN = 8;
529
568
  onMouseOver: (event)=>_onBarHover(point, colorScale(point.y), event),
530
569
  onMouseLeave: _onBarLeave,
531
570
  onBlur: _onBarLeave,
532
- "data-is-focusable": !props.hideTooltip,
571
+ "data-is-focusable": !props.hideTooltip && shouldHighlight,
533
572
  onFocus: _onBarFocus.bind(point, index, colorScale(point.y)),
534
573
  fill: point.color ? point.color : colorScale(point.y),
535
- tabIndex: point.legend !== '' ? 0 : undefined
536
- }), _renderBarLabel(xPoint, yPoint, point.y, point.legend));
574
+ tabIndex: point.legend !== '' ? 0 : undefined,
575
+ rx: props.roundCorners ? 3 : 0,
576
+ opacity: shouldHighlight ? 1 : 0.1
577
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
537
578
  });
538
579
  // Removing un wanted tooltip div from DOM, when prop not provided.
539
580
  if (!props.showXAxisLablesTooltip) {
@@ -565,28 +606,32 @@ const MIN_DOMAIN_MARGIN = 8;
565
606
  const { useSingleColor = false } = props;
566
607
  const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
567
608
  const colorScale = _createColors();
609
+ const yReferencePoint = _yMax < 0 ? _yMax : 0;
568
610
  const bars = _points.map((point, index)=>{
569
611
  const shouldHighlight = _legendHighlighted(point.legend) || _noLegendHighlighted() ? true : false;
570
- const barHeight = Math.max(yBarScale(point.y), 0);
571
- let adjustedBarHeight = 0;
572
- if (barHeight <= 0) {
612
+ let barHeight = yBarScale(point.y) - yBarScale(yReferencePoint);
613
+ const isHeightNegative = barHeight < 0;
614
+ barHeight = Math.abs(barHeight);
615
+ // Calculate threshold for minimum visible bar height
616
+ const minBarHeight = _calculateMinBarHeight(_yMin, _yMax, yReferencePoint, yBarScale);
617
+ let adjustedBarHeight = barHeight;
618
+ if (barHeight === 0) {
573
619
  return /*#__PURE__*/ React.createElement(React.Fragment, {
574
- key: point.x instanceof Date ? point.x.getTime() : point.x
620
+ key: point.x
575
621
  }, " ");
576
- } else if (barHeight <= Math.ceil(yBarScale(_yMax) / 100.0)) {
577
- adjustedBarHeight = Math.ceil(yBarScale(_yMax) / 100.0);
578
- } else {
579
- adjustedBarHeight = barHeight;
622
+ } else if (barHeight <= minBarHeight) {
623
+ adjustedBarHeight = minBarHeight;
580
624
  }
581
625
  const xPoint = xBarScale(point.x) - _barWidth / 2;
582
- const yPoint = containerHeight - margins.bottom - adjustedBarHeight;
626
+ const yPoint = containerHeight - margins.bottom - (isHeightNegative ? -1 * adjustedBarHeight : adjustedBarHeight) - yBarScale(yReferencePoint);
627
+ const baselineHeight = containerHeight - margins.bottom - yBarScale(yReferencePoint);
583
628
  return /*#__PURE__*/ React.createElement("g", {
584
- key: point.x instanceof Date ? point.x.getTime() : point.x
629
+ key: point.x instanceof Date ? `${point.x.getTime()}_${index}` : `${point.x}_${index}`
585
630
  }, /*#__PURE__*/ React.createElement("rect", {
586
631
  id: `${_vbcBarId}-${index}`,
587
632
  x: xPoint,
588
633
  className: classes.opacityChangeOnHover,
589
- y: yPoint,
634
+ y: !isHeightNegative ? yPoint : baselineHeight,
590
635
  width: _barWidth,
591
636
  "data-is-focusable": !props.hideTooltip && shouldHighlight,
592
637
  height: adjustedBarHeight,
@@ -601,8 +646,10 @@ const MIN_DOMAIN_MARGIN = 8;
601
646
  onFocus: _onBarFocus.bind(point, index, colorScale(point.y)),
602
647
  onBlur: _onBarLeave,
603
648
  fill: point.color && !useSingleColor ? point.color : colorScale(point.y),
604
- tabIndex: point.legend !== '' ? 0 : undefined
605
- }), _renderBarLabel(xPoint, yPoint, point.y, point.legend));
649
+ tabIndex: point.legend !== '' ? 0 : undefined,
650
+ rx: props.roundCorners ? 3 : 0,
651
+ opacity: shouldHighlight ? 1 : 0.1
652
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
606
653
  });
607
654
  // Removing un wanted tooltip div from DOM, when prop not provided.
608
655
  if (!props.showXAxisLablesTooltip) {
@@ -629,36 +676,30 @@ const MIN_DOMAIN_MARGIN = 8;
629
676
  }
630
677
  return bars;
631
678
  }
632
- function _onLegendClick(legendTitle) {
633
- if (selectedLegend === legendTitle) {
634
- setSelectedLegend('');
635
- } else {
636
- setSelectedLegend(legendTitle);
637
- }
638
- }
639
679
  function _onLegendHover(legendTitle) {
640
680
  setActiveLegend(legendTitle);
641
681
  }
642
682
  function _onLegendLeave() {
643
- setActiveLegend('');
683
+ setActiveLegend(undefined);
644
684
  }
645
685
  function _getLegendData(data) {
646
686
  const { useSingleColor } = props;
647
687
  const { lineLegendText, lineLegendColor = tokens.colorPaletteYellowForeground1 } = props;
648
688
  const actions = [];
689
+ const mapLegendToColor = {};
649
690
  data.forEach((point, _index)=>{
650
691
  // eslint-disable-next-line @typescript-eslint/no-shadow
651
692
  const color = !useSingleColor ? point.color : _createColors()(1);
693
+ mapLegendToColor[point.legend] = color;
694
+ });
695
+ Object.entries(mapLegendToColor).forEach(([legendTitle, color])=>{
652
696
  // mapping data to the format Legends component needs
653
697
  const legend = {
654
- title: point.legend,
698
+ title: legendTitle,
655
699
  color,
656
- action: ()=>{
657
- _onLegendClick(point.legend);
658
- },
659
700
  hoverAction: ()=>{
660
701
  _handleChartMouseLeave();
661
- _onLegendHover(point.legend);
702
+ _onLegendHover(legendTitle);
662
703
  },
663
704
  onMouseOutAction: ()=>{
664
705
  _onLegendLeave();
@@ -670,9 +711,6 @@ const MIN_DOMAIN_MARGIN = 8;
670
711
  const lineLegend = {
671
712
  title: lineLegendText,
672
713
  color: lineLegendColor,
673
- action: ()=>{
674
- _onLegendClick(lineLegendText);
675
- },
676
714
  hoverAction: ()=>{
677
715
  _handleChartMouseLeave();
678
716
  _onLegendHover(lineLegendText);
@@ -688,14 +726,28 @@ const MIN_DOMAIN_MARGIN = 8;
688
726
  legends: actions,
689
727
  enabledWrapLines: props.enabledLegendsWrapLines,
690
728
  overflowText: props.legendsOverflowText,
691
- ...props.legendProps
729
+ ...props.legendProps,
730
+ selectedLegends: selectedLegends,
731
+ onChange: _onLegendSelectionChange
692
732
  });
693
733
  return legends;
694
734
  }
735
+ function _onLegendSelectionChange(legendsSelected, event, currentLegend) {
736
+ var _props_legendProps, _props_legendProps1;
737
+ if ((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.canSelectMultipleLegends) {
738
+ setSelectedLegends(legendsSelected);
739
+ } else {
740
+ setSelectedLegends(legendsSelected.slice(-1));
741
+ }
742
+ if ((_props_legendProps1 = props.legendProps) === null || _props_legendProps1 === void 0 ? void 0 : _props_legendProps1.onChange) {
743
+ props.legendProps.onChange(legendsSelected, event, currentLegend);
744
+ }
745
+ }
695
746
  function _getAxisData(yAxisData) {
696
747
  if (yAxisData && yAxisData.yAxisDomainValues.length) {
697
748
  const { yAxisDomainValues: domainValue } = yAxisData;
698
749
  _yMax = Math.max(domainValue[domainValue.length - 1], props.yMaxValue || 0);
750
+ _yMin = Math.min(domainValue[0], props.yMinValue || 0);
699
751
  }
700
752
  }
701
753
  /**
@@ -704,12 +756,17 @@ const MIN_DOMAIN_MARGIN = 8;
704
756
  * 1. selection: if the user clicks on it
705
757
  * 2. hovering: if there is no selected legend and the user hovers over it
706
758
  */ function _legendHighlighted(legendTitle) {
707
- return selectedLegend === legendTitle || selectedLegend === '' && activeLegend === legendTitle;
759
+ return _getHighlightedLegend().includes(legendTitle);
708
760
  }
709
761
  /**
710
762
  * This function checks if none of the legends is selected or hovered.
711
763
  */ function _noLegendHighlighted() {
712
- return selectedLegend === '' && activeLegend === '';
764
+ return _getHighlightedLegend().length === 0;
765
+ }
766
+ function _getHighlightedLegend() {
767
+ return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [
768
+ activeLegend
769
+ ] : [];
713
770
  }
714
771
  function _getAriaLabel(point) {
715
772
  var _point_lineData, _point_lineData1, _point_callOutAccessibilityData;
@@ -720,13 +777,13 @@ const MIN_DOMAIN_MARGIN = 8;
720
777
  const lineYValue = ((_point_lineData = point.lineData) === null || _point_lineData === void 0 ? void 0 : _point_lineData.yAxisCalloutData) || ((_point_lineData1 = point.lineData) === null || _point_lineData1 === void 0 ? void 0 : _point_lineData1.y);
721
778
  return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ` + (legend ? `${legend}, ` : '') + `${yValue}.` + (typeof lineYValue !== 'undefined' ? ` ${lineLegend}, ${lineYValue}.` : '');
722
779
  }
723
- function _renderBarLabel(xPoint, yPoint, barValue, legend) {
780
+ function _renderBarLabel(xPoint, yPoint, barValue, legend, isNegativeBar) {
724
781
  if (props.hideLabels || _barWidth < 16 || !(_legendHighlighted(legend) || _noLegendHighlighted())) {
725
782
  return null;
726
783
  }
727
784
  return /*#__PURE__*/ React.createElement("text", {
728
785
  x: xPoint + _barWidth / 2,
729
- y: yPoint - 6,
786
+ y: isNegativeBar ? yPoint + 12 : yPoint - 6,
730
787
  textAnchor: "middle",
731
788
  className: classes.barLabel,
732
789
  "aria-hidden": true
@@ -735,13 +792,13 @@ const MIN_DOMAIN_MARGIN = 8;
735
792
  function _getDomainMargins(containerWidth) {
736
793
  _domainMargin = MIN_DOMAIN_MARGIN;
737
794
  /** Total width available to render the bars */ const totalWidth = containerWidth - (margins.left + MIN_DOMAIN_MARGIN) - (margins.right + MIN_DOMAIN_MARGIN);
795
+ /** Rate at which the space between the bars changes wrt the bar width */ const barGapRate = _xAxisInnerPadding / (1 - _xAxisInnerPadding);
738
796
  if (_xAxisType === XAxisTypes.StringAxis) {
739
797
  if (isScalePaddingDefined(props.xAxisOuterPadding, props.xAxisPadding)) {
740
798
  // Setting the domain margin for string x-axis to 0 because the xAxisOuterPadding prop is now available
741
799
  // to adjust the space before the first bar and after the last bar.
742
800
  _domainMargin = 0;
743
801
  } else if (props.barWidth !== 'auto') {
744
- /** Rate at which the space between the bars changes wrt the bar width */ const barGapRate = _xAxisInnerPadding / (1 - _xAxisInnerPadding);
745
802
  // Update the bar width so that when CartesianChart rerenders,
746
803
  // the following calculations don't use the previous bar width.
747
804
  _barWidth = getBarWidth(props.barWidth, props.maxBarWidth);
@@ -750,10 +807,29 @@ const MIN_DOMAIN_MARGIN = 8;
750
807
  // Center align the chart by setting equal left and right margins for domain
751
808
  _domainMargin = MIN_DOMAIN_MARGIN + (totalWidth - reqWidth) / 2;
752
809
  }
810
+ } else if (props.mode === 'plotly' && _xAxisLabels.length > 1) {
811
+ // Calculate the remaining width after rendering bars at their maximum allowable width
812
+ const bandwidth = totalWidth / (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate);
813
+ const barWidth = getBarWidth(props.barWidth, props.maxBarWidth, bandwidth);
814
+ let reqWidth = (_xAxisLabels.length + (_xAxisLabels.length - 1) * barGapRate) * barWidth;
815
+ const margin1 = (totalWidth - reqWidth) / 2;
816
+ // Calculate the remaining width after accounting for the space required to render x-axis labels
817
+ const step = calculateLongestLabelWidth(_xAxisLabels) + 20;
818
+ reqWidth = (_xAxisLabels.length - _xAxisInnerPadding) * step;
819
+ const margin2 = (totalWidth - reqWidth) / 2;
820
+ _domainMargin = MIN_DOMAIN_MARGIN + Math.max(0, Math.min(margin1, margin2));
753
821
  }
754
822
  } else {
755
823
  var _props_data;
756
- const data = ((_props_data = props.data) === null || _props_data === void 0 ? void 0 : _props_data.map((point)=>point.x)) || [];
824
+ const uniqueX = {};
825
+ (_props_data = props.data) === null || _props_data === void 0 ? void 0 : _props_data.forEach((point)=>{
826
+ if (point.x instanceof Date) {
827
+ uniqueX[point.x.getTime()] = point.x;
828
+ } else {
829
+ uniqueX[point.x] = point.x;
830
+ }
831
+ });
832
+ const data = Object.values(uniqueX);
757
833
  _barWidth = getBarWidth(props.barWidth, props.maxBarWidth, calculateAppropriateBarWidth(data, totalWidth));
758
834
  _domainMargin = MIN_DOMAIN_MARGIN + _barWidth / 2;
759
835
  }
@@ -764,7 +840,7 @@ const MIN_DOMAIN_MARGIN = 8;
764
840
  };
765
841
  }
766
842
  function _isChartEmpty() {
767
- return _points.length === 0 || d3Max(_points, (point)=>point.y) <= 0 && !_isHavingLine;
843
+ return _points.length === 0 || _points.every((point)=>point.y === 0) && !_isHavingLine;
768
844
  }
769
845
  function updatePosition(newX, newY) {
770
846
  const threshold = 1; // Set a threshold for movement
@@ -783,11 +859,12 @@ const MIN_DOMAIN_MARGIN = 8;
783
859
  _adjustProps();
784
860
  _xAxisLabels = _points.map((point)=>point.x);
785
861
  _yMax = Math.max(d3Max(_points, (point)=>point.y), props.yMaxValue || 0);
862
+ _yMin = Math.min(d3Min(_points, (point)=>point.y), props.yMinValue || 0);
786
863
  const legendBars = _getLegendData(_points);
787
864
  var _props_culture;
788
865
  const calloutProps = {
789
866
  ..._isHavingLine && {
790
- YValueHover: YValueHover,
867
+ YValueHover: hoveredYValues,
791
868
  hoverXValue: hoverXValue
792
869
  },
793
870
  color: color,
@@ -798,7 +875,7 @@ const MIN_DOMAIN_MARGIN = 8;
798
875
  ...getAccessibleDataObject(callOutAccessibilityData),
799
876
  clickPosition: clickPosition,
800
877
  isPopoverOpen: isPopoverOpen,
801
- isCalloutForStack: _isHavingLine && _noLegendHighlighted(),
878
+ isCalloutForStack: _isHavingLine && (_noLegendHighlighted() || _getHighlightedLegend().length > 1),
802
879
  culture: (_props_culture = props.culture) !== null && _props_culture !== void 0 ? _props_culture : 'en-us',
803
880
  isCartesian: true,
804
881
  customCallout: {