@fluentui/react-charts 9.3.6 → 9.3.8

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 (210) hide show
  1. package/CHANGELOG.md +46 -2
  2. package/dist/index.d.ts +70 -17
  3. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
  4. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  5. package/lib/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
  6. package/lib/components/AreaChart/AreaChart.js +3 -43
  7. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.js +1 -2
  9. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  10. package/lib/components/ChartTable/ChartTable.js +8 -11
  11. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  12. package/lib/components/ChartTable/ChartTable.types.js.map +1 -1
  13. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
  14. package/lib/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  15. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
  16. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  17. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
  18. package/lib/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  19. package/lib/components/CommonComponents/CartesianChart.js +52 -32
  20. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  21. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  22. package/lib/components/CommonComponents/ChartPopover.js +1 -2
  23. package/lib/components/CommonComponents/ChartPopover.js.map +1 -1
  24. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +9 -7
  25. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  26. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -5
  27. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  28. package/lib/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  29. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
  30. package/lib/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  31. package/lib/components/DeclarativeChart/DeclarativeChart.js +48 -25
  32. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  33. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -209
  34. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  35. package/lib/components/DonutChart/DonutChart.js +9 -15
  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 +4 -2
  39. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  40. package/lib/components/FunnelChart/FunnelChart.js +8 -13
  41. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  42. package/lib/components/FunnelChart/FunnelChart.types.js.map +1 -1
  43. package/lib/components/GanttChart/GanttChart.js +4 -17
  44. package/lib/components/GanttChart/GanttChart.js.map +1 -1
  45. package/lib/components/GaugeChart/GaugeChart.js +8 -13
  46. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  47. package/lib/components/GaugeChart/GaugeChart.types.js.map +1 -1
  48. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +24 -36
  49. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  50. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +1 -2
  51. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  52. package/lib/components/HeatMapChart/HeatMapChart.js +3 -16
  53. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  54. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +5 -25
  55. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  56. package/lib/components/Legends/Legends.js +3 -4
  57. package/lib/components/Legends/Legends.js.map +1 -1
  58. package/lib/components/Legends/Legends.types.js.map +1 -1
  59. package/lib/components/Legends/OverflowMenu.js.map +1 -1
  60. package/lib/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  61. package/lib/components/LineChart/LineChart.js +68 -75
  62. package/lib/components/LineChart/LineChart.js.map +1 -1
  63. package/lib/components/LineChart/LineChart.types.js +1 -1
  64. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  65. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js +3 -4
  66. package/lib/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  67. package/lib/components/LineChart/useLineChartStyles.styles.js +1 -2
  68. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  69. package/lib/components/SankeyChart/SankeyChart.js +4 -10
  70. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  71. package/lib/components/SankeyChart/SankeyChart.types.js.map +1 -1
  72. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +1 -2
  73. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  74. package/lib/components/ScatterChart/ScatterChart.js +41 -49
  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 +1 -2
  78. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  79. package/lib/components/Sparkline/Sparkline.js +11 -7
  80. package/lib/components/Sparkline/Sparkline.js.map +1 -1
  81. package/lib/components/VerticalBarChart/VerticalBarChart.js +15 -92
  82. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  83. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +1 -2
  84. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  85. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +28 -49
  86. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  87. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +1 -2
  88. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  89. package/lib/types/ChartAnnotation.js.map +1 -1
  90. package/lib/types/DataPoint.js.map +1 -1
  91. package/lib/utilities/Common.styles.js +0 -1
  92. package/lib/utilities/Common.styles.js.map +1 -1
  93. package/lib/utilities/Common.styles.raw.js +0 -1
  94. package/lib/utilities/Common.styles.raw.js.map +1 -1
  95. package/lib/utilities/FocusableTooltipText.js +1 -1
  96. package/lib/utilities/FocusableTooltipText.js.map +1 -1
  97. package/lib/utilities/getWindow.js +0 -1
  98. package/lib/utilities/getWindow.js.map +1 -1
  99. package/lib/utilities/hooks.js +34 -0
  100. package/lib/utilities/hooks.js.map +1 -0
  101. package/lib/utilities/image-export-utils.js +118 -78
  102. package/lib/utilities/image-export-utils.js.map +1 -1
  103. package/lib/utilities/utilities.js +243 -102
  104. package/lib/utilities/utilities.js.map +1 -1
  105. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js +2 -16
  106. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.js.map +1 -1
  107. package/lib-commonjs/components/AnnotationOnlyChart/AnnotationOnlyChart.types.js.map +1 -1
  108. package/lib-commonjs/components/AreaChart/AreaChart.js +2 -41
  109. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  110. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +0 -2
  111. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  112. package/lib-commonjs/components/ChartTable/ChartTable.js +9 -11
  113. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  114. package/lib-commonjs/components/ChartTable/ChartTable.types.js.map +1 -1
  115. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js +107 -67
  116. package/lib-commonjs/components/CommonComponents/Annotations/ChartAnnotationLayer.js.map +1 -1
  117. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js +7 -1
  118. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.js.map +1 -1
  119. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js +7 -1
  120. package/lib-commonjs/components/CommonComponents/Annotations/useChartAnnotationLayer.styles.raw.js.map +1 -1
  121. package/lib-commonjs/components/CommonComponents/CartesianChart.js +51 -31
  122. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  123. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  124. package/lib-commonjs/components/CommonComponents/ChartPopover.js +1 -2
  125. package/lib-commonjs/components/CommonComponents/ChartPopover.js.map +1 -1
  126. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +7 -6
  127. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  128. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +7 -4
  129. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  130. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.js.map +1 -1
  131. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js +0 -2
  132. package/lib-commonjs/components/CommonComponents/useChartPopoverStyles.styles.raw.js.map +1 -1
  133. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +48 -25
  134. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  135. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +309 -208
  136. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  137. package/lib-commonjs/components/DonutChart/DonutChart.js +7 -13
  138. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  139. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  140. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  141. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  142. package/lib-commonjs/components/FunnelChart/FunnelChart.js +7 -12
  143. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  144. package/lib-commonjs/components/FunnelChart/FunnelChart.types.js.map +1 -1
  145. package/lib-commonjs/components/GanttChart/GanttChart.js +3 -16
  146. package/lib-commonjs/components/GanttChart/GanttChart.js.map +1 -1
  147. package/lib-commonjs/components/GaugeChart/GaugeChart.js +7 -12
  148. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  149. package/lib-commonjs/components/GaugeChart/GaugeChart.types.js.map +1 -1
  150. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +22 -34
  151. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  152. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +0 -2
  153. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  154. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +2 -15
  155. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  156. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +4 -23
  157. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  158. package/lib-commonjs/components/Legends/Legends.js +3 -4
  159. package/lib-commonjs/components/Legends/Legends.js.map +1 -1
  160. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  161. package/lib-commonjs/components/Legends/OverflowMenu.js.map +1 -1
  162. package/lib-commonjs/components/Legends/useLegendsStyles.styles.raw.js.map +1 -1
  163. package/lib-commonjs/components/LineChart/LineChart.js +67 -74
  164. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  165. package/lib-commonjs/components/LineChart/LineChart.types.js +1 -1
  166. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  167. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js +2 -2
  168. package/lib-commonjs/components/LineChart/eventAnnotation/EventAnnotation.js.map +1 -1
  169. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +0 -2
  170. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  171. package/lib-commonjs/components/SankeyChart/SankeyChart.js +4 -10
  172. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  173. package/lib-commonjs/components/SankeyChart/SankeyChart.types.js.map +1 -1
  174. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +0 -2
  175. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  176. package/lib-commonjs/components/ScatterChart/ScatterChart.js +38 -46
  177. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  178. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  179. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +0 -2
  180. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  181. package/lib-commonjs/components/Sparkline/Sparkline.js +11 -7
  182. package/lib-commonjs/components/Sparkline/Sparkline.js.map +1 -1
  183. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +14 -91
  184. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  185. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +0 -2
  186. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  187. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +26 -47
  188. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  189. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +0 -2
  190. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  191. package/lib-commonjs/types/ChartAnnotation.js.map +1 -1
  192. package/lib-commonjs/types/DataPoint.js.map +1 -1
  193. package/lib-commonjs/utilities/Common.styles.js +0 -1
  194. package/lib-commonjs/utilities/Common.styles.js.map +1 -1
  195. package/lib-commonjs/utilities/Common.styles.raw.js +0 -1
  196. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -1
  197. package/lib-commonjs/utilities/FocusableTooltipText.js.map +1 -1
  198. package/lib-commonjs/utilities/getWindow.js +0 -1
  199. package/lib-commonjs/utilities/getWindow.js.map +1 -1
  200. package/lib-commonjs/utilities/hooks.js +45 -0
  201. package/lib-commonjs/utilities/hooks.js.map +1 -0
  202. package/lib-commonjs/utilities/image-export-utils.js +119 -79
  203. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  204. package/lib-commonjs/utilities/utilities.js +253 -101
  205. package/lib-commonjs/utilities/utilities.js.map +1 -1
  206. package/package.json +9 -9
  207. package/lib/components/DeclarativeChart/imageExporter.js +0 -223
  208. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  209. package/lib-commonjs/components/DeclarativeChart/imageExporter.js +0 -233
  210. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/Sparkline/Sparkline.tsx"],"sourcesContent":["'use client';\n\nimport * 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","val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C2B,kBAAAA,WAAAA,GACN,OAAA,aAAA,CAACwB,OAAAA;QAAIX,WAAWS,QAAQG,WAAW;QAAG,GAAGF,eAAe;OACrDhC,SAAS,MAAMC,UAAU,KAAA,WAAA,GACxB,OAAA,aAAA,CAACkC,OAAAA;QACCnC,OAAOA;QACPC,QAAQA;QACRmC,cAAY,CAAC,qBAAqB,EAAEzB,KAAMC,aAAc,CAAC,EAAE,CAACyB,MAAM,EAAG;QACrEC,UAAU;OAETzC,SAASuB,kBAAkB,QAAA,WAAA,GAG9B,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA,OAEDlC,MAAMqD,UAAU,IAAIrD,MAAMyB,IAAI,CAAEC,aAAc,CAAC,EAAE,CAACyB,MAAM,GAAA,WAAA,GACvD,OAAA,aAAA,CAACF,OAAAA;QAAInC,OAAOE;QAAgBD,QAAQA;qBAClC,OAAA,aAAA,CAACuC,QAAAA;QAAK/C,GAAE;QAAKgD,YAAY7C,SAAS,QAAQ;QAAS8C,IAAI;QAAGhD,GAAE;QAAOiD,IAAI,CAAC;QAAGrB,WAAWS,QAAQa,SAAS;OACpG1D,MAAMyB,IAAI,CAAEC,aAAc,CAAC,EAAE,CAACyB,MAAM,KAAA,WAAA,GAIzC,OAAA,aAAA,CAAA,OAAA,QAAA,EAAA,SAAA,WAAA,GAIJ,OAAA,aAAA,CAACJ,OAAAA;QAAIY,IAAIlD;QAAekC,MAAM;QAASiB,OAAO;YAAEtB,SAAS;QAAI;QAAGY,cAAY;;AAEhF,GACA;AACFpD,UAAU+D,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/Sparkline/Sparkline.tsx"],"sourcesContent":["'use client';\n\nimport { useFocusableGroup } from '@fluentui/react-tabster';\nimport { extent as d3Extent, max as d3Max } from 'd3-array';\nimport { scaleLinear as d3ScaleLinear } from 'd3-scale';\nimport { area as d3Area, line as d3Line, curveLinear as d3curveLinear } from 'd3-shape';\nimport * as React from 'react';\nimport { SparklineProps } from '../../index';\nimport { LineChartDataPoint } from '../../types/DataPoint';\nimport { useRtl } from '../../utilities/index';\nimport { useSparklineStyles } from './useSparklineStyles.styles';\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\n // Use props with default fallbacks instead of hardcoded values\n const width = props.width ?? 80;\n const height = props.height ?? 20;\n const valueTextWidth = props.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":["useFocusableGroup","extent","d3Extent","max","d3Max","scaleLinear","d3ScaleLinear","area","d3Area","line","d3Line","curveLinear","d3curveLinear","React","useRtl","useSparklineStyles","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"],"mappings":"AAAA;;;;;+BAkBagB;;;;;;;8BAhBqB,0BAA0B;yBACX,WAAW;yBACf,WAAW;yBACqB,WAAW;iEACjE,QAAQ;uBAGR,wBAAwB;0CACZ,8BAA8B;AAQ1D,kBAAMA,WAAAA,GAAqDH,OAAMI,UAAU,CAChF,CAACC,OAAOC;IACN,IAAIC,SAAS;QACXC,KAAK;QACLC,OAAO;QACPC,QAAQ;QACRC,MAAM;IACR;IACA,IAAIC;IACJ,IAAIC;IACJ,IAAIC,gBAAwB;IAC5B,IAAIC,aAAkBd,aAAAA;IACtB,MAAM,CAACe,QAAQC,UAAU,GAAGjB,OAAMkB,QAAQ,CAAuB,EAAE;QAGrDb;IADd,+DAA+D;IAC/D,MAAMc,QAAQd,CAAAA,eAAAA,MAAMc,KAAAA,AAAK,MAAA,QAAXd,iBAAAA,KAAAA,IAAAA,eAAe;QACdA;IAAf,MAAMe,SAASf,iBAAAA,MAAMe,MAAAA,AAAM,MAAA,QAAZf,kBAAAA,KAAAA,IAAAA,gBAAgB;QACRA;IAAvB,MAAMgB,iBAAiBhB,CAAAA,wBAAAA,MAAMgB,cAAc,AAAdA,MAAc,QAApBhB,0BAAAA,KAAAA,IAAAA,wBAAwB;IAE/C,MAAMT,OAAOI,OAAMsB,OAAO,CAAC;QACzB,WAAOzB,aAAAA,IACJe,CAAC,CAAC,CAACW,IAA0BX,EAAEW,EAAEX,CAAC,GAClCC,CAAC,CAAC,CAACU,IAA0BV,EAAEU,EAAEV,CAAC,GAClCW,KAAK,CAACzB,oBAAAA;IACX,GAAG;QAACa;QAAGC;KAAE;IAET,MAAMnB,OAAOM,OAAMsB,OAAO,CAAC;QACzB,WAAO3B,aAAAA,IACJiB,CAAC,CAAC,CAACW,IAA0BX,EAAEW,EAAEX,CAAC,GAClCa,EAAE,CAACL,QACHM,EAAE,CAAC,CAACH,I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B,SAAS;QAAI;QAAGY,cAAY;;AAEhF,GACA;AACFpD,UAAU+D,WAAW,GAAG"}
@@ -14,13 +14,12 @@ const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
14
14
  const _useVerticalBarChartStylesstyles = require("./useVerticalBarChartStyles.styles");
15
15
  const _d3array = require("d3-array");
16
16
  const _d3shape = require("d3-shape");
17
- const _d3selection = require("d3-selection");
18
17
  const _d3scale = require("d3-scale");
19
18
  const _reactutilities = require("@fluentui/react-utilities");
20
19
  const _reacttheme = require("@fluentui/react-theme");
21
20
  const _index = require("../../index");
22
21
  const _index1 = require("../../utilities/index");
23
- const _imageexportutils = require("../../utilities/image-export-utils");
22
+ const _hooks = require("../../utilities/hooks");
24
23
  var CircleVisbility = /*#__PURE__*/ function(CircleVisbility) {
25
24
  CircleVisbility["show"] = "visibility";
26
25
  CircleVisbility["hide"] = "hidden";
@@ -45,7 +44,6 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
45
44
  let _yMax;
46
45
  let _yMin;
47
46
  let _isHavingLine = _checkForLine();
48
- const _tooltipId = (0, _reactutilities.useId)('VCTooltipID_');
49
47
  let _xAxisType;
50
48
  let _calloutAnchorPoint;
51
49
  let _domainMargin;
@@ -55,8 +53,7 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
55
53
  const _vbcBarId = (0, _reactutilities.useId)('_VBC_bar_');
56
54
  let _xAxisInnerPadding = 0;
57
55
  let _xAxisOuterPadding = 0;
58
- const cartesianChartRef = _react.useRef(null);
59
- const _legendsRef = _react.useRef(null);
56
+ const { cartesianChartRef, legendsRef: _legendsRef } = (0, _hooks.useImageExport)(props.componentRef, props.hideLegend);
60
57
  const [color, setColor] = _react.useState('');
61
58
  const [dataForHoverCard, setDataForHoverCard] = _react.useState(0);
62
59
  const [activeLegend, setActiveLegend] = _react.useState(undefined);
@@ -75,17 +72,6 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
75
72
  const [isPopoverOpen, setPopoverOpen] = _react.useState(false);
76
73
  const [selectedLegends, setSelectedLegends] = _react.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
77
74
  const prevPropsRef = _react.useRef(null);
78
- _react.useImperativeHandle(props.componentRef, ()=>{
79
- var _cartesianChartRef_current;
80
- var _cartesianChartRef_current_chartContainer;
81
- return {
82
- 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,
83
- toImage: (opts)=>{
84
- var _cartesianChartRef_current, _legendsRef_current;
85
- return (0, _imageexportutils.toImage)((_cartesianChartRef_current = cartesianChartRef.current) === null || _cartesianChartRef_current === void 0 ? void 0 : _cartesianChartRef_current.chartContainer, (_legendsRef_current = _legendsRef.current) === null || _legendsRef_current === void 0 ? void 0 : _legendsRef_current.toSVG, _useRtl, opts);
86
- }
87
- };
88
- }, []);
89
75
  _react.useEffect(()=>{
90
76
  if (prevPropsRef.current) {
91
77
  var _prevProps_legendProps, _props_legendProps;
@@ -533,31 +519,8 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
533
519
  tabIndex: !props.hideTooltip && shouldHighlight ? 0 : undefined,
534
520
  opacity: shouldHighlight ? 1 : 0.1,
535
521
  rx: props.roundCorners ? 3 : 0
536
- }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
522
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative, point.barLabel));
537
523
  });
538
- // Removing un wanted tooltip div from DOM, when prop not provided.
539
- if (!props.showXAxisLablesTooltip) {
540
- try {
541
- // eslint-disable-next-line no-restricted-globals
542
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
543
- // eslint-disable-next-line no-empty
544
- } catch (e) {}
545
- }
546
- // Used to display tooltip at x axis labels.
547
- if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
548
- const xAxisElement = (0, _d3selection.select)(xElement).call(xBarScale);
549
- try {
550
- // eslint-disable-next-line no-restricted-globals
551
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
552
- // eslint-disable-next-line no-empty
553
- } catch (e) {}
554
- const tooltipProps = {
555
- tooltipCls: classes.tooltip,
556
- id: _tooltipId,
557
- axis: xAxisElement
558
- };
559
- xAxisElement && (0, _index1.tooltipOfAxislabels)(tooltipProps);
560
- }
561
524
  return bars;
562
525
  }
563
526
  function _createStringBars(containerHeight, containerWidth, xElement) {
@@ -608,32 +571,8 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
608
571
  tabIndex: !props.hideTooltip && shouldHighlight ? 0 : undefined,
609
572
  rx: props.roundCorners ? 3 : 0,
610
573
  opacity: shouldHighlight ? 1 : 0.1
611
- }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
574
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative, point.barLabel));
612
575
  });
613
- // Removing un wanted tooltip div from DOM, when prop not provided.
614
- if (!props.showXAxisLablesTooltip) {
615
- try {
616
- // eslint-disable-next-line no-restricted-globals
617
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
618
- // eslint-disable-next-line no-empty
619
- } catch (e) {}
620
- }
621
- // Used to display tooltip at x axis labels.
622
- if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
623
- const xAxisElement = (0, _d3selection.select)(xElement).call(xBarScale);
624
- try {
625
- // eslint-disable-next-line no-restricted-globals
626
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
627
- // eslint-disable-next-line no-empty
628
- } catch (e) {}
629
- const tooltipProps = {
630
- tooltipCls: classes.tooltip,
631
- id: _tooltipId,
632
- axis: xAxisElement,
633
- showTooltip: props.showXAxisLablesTooltip
634
- };
635
- xAxisElement && (0, _index1.tooltipOfAxislabels)(tooltipProps);
636
- }
637
576
  return bars;
638
577
  }
639
578
  function _createDateBars(containerHeight, containerWidth, xElement) {
@@ -682,31 +621,8 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
682
621
  tabIndex: !props.hideTooltip && shouldHighlight ? 0 : undefined,
683
622
  rx: props.roundCorners ? 3 : 0,
684
623
  opacity: shouldHighlight ? 1 : 0.1
685
- }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative));
624
+ }), _renderBarLabel(xPoint, yPoint, point.y, point.legend, isHeightNegative, point.barLabel));
686
625
  });
687
- // Removing un wanted tooltip div from DOM, when prop not provided.
688
- if (!props.showXAxisLablesTooltip) {
689
- try {
690
- // eslint-disable-next-line no-restricted-globals
691
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
692
- // eslint-disable-next-line no-empty
693
- } catch (e) {}
694
- }
695
- // Used to display tooltip at x axis labels.
696
- if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
697
- const xAxisElement = (0, _d3selection.select)(xElement).call(xBarScale);
698
- try {
699
- // eslint-disable-next-line no-restricted-globals
700
- document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
701
- // eslint-disable-next-line no-empty
702
- } catch (e) {}
703
- const tooltipProps = {
704
- tooltipCls: classes.tooltip,
705
- id: _tooltipId,
706
- axis: xAxisElement
707
- };
708
- xAxisElement && (0, _index1.tooltipOfAxislabels)(tooltipProps);
709
- }
710
626
  return bars;
711
627
  }
712
628
  function _onLegendHover(legendTitle) {
@@ -811,10 +727,12 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
811
727
  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);
812
728
  return ((_point_callOutAccessibilityData = point.callOutAccessibilityData) === null || _point_callOutAccessibilityData === void 0 ? void 0 : _point_callOutAccessibilityData.ariaLabel) || `${xValue}. ` + (legend ? `${legend}, ` : '') + `${yValue}.` + (typeof lineYValue !== 'undefined' ? ` ${lineLegend}, ${lineYValue}.` : '');
813
729
  }
814
- function _renderBarLabel(xPoint, yPoint, barValue, legend, isNegativeBar) {
730
+ function _renderBarLabel(xPoint, yPoint, barValue, legend, isNegativeBar, customBarLabel) {
815
731
  if (props.hideLabels || _barWidth < 16 || !(_legendHighlighted(legend) || _noLegendHighlighted())) {
816
732
  return null;
817
733
  }
734
+ // Use custom barLabel if provided, otherwise use the formatted barValue
735
+ const displayLabel = customBarLabel !== undefined ? customBarLabel : typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barValue) : (0, _index1.formatScientificLimitWidth)(barValue);
818
736
  return /*#__PURE__*/ _react.createElement("text", {
819
737
  x: xPoint + _barWidth / 2,
820
738
  y: isNegativeBar ? yPoint + 12 : yPoint - 6,
@@ -825,7 +743,7 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
825
743
  direction: 'ltr',
826
744
  unicodeBidi: 'isolate'
827
745
  }
828
- }, typeof props.yAxisTickFormat === 'function' ? props.yAxisTickFormat(barValue) : (0, _index1.formatScientificLimitWidth)(barValue));
746
+ }, displayLabel);
829
747
  }
830
748
  function _getDomainMargins(containerWidth) {
831
749
  var _props_data;
@@ -901,6 +819,10 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
901
819
  right: margins.right + _domainMargin
902
820
  };
903
821
  }
822
+ function _getChartTitle() {
823
+ const { chartTitle, data } = props;
824
+ return (chartTitle ? `${chartTitle}. ` : '') + `Vertical bar chart with ${(data === null || data === void 0 ? void 0 : data.length) || 0} bars` + (_isHavingLine ? ' and 1 line' : '') + '. ';
825
+ }
904
826
  function _isChartEmpty() {
905
827
  return _points.length === 0 || _points.every((point)=>point.y === 0) && !_isHavingLine;
906
828
  }
@@ -971,6 +893,7 @@ const VerticalBarChart = /*#__PURE__*/ _react.forwardRef((_props, forwardedRef)=
971
893
  return !_isChartEmpty() ? /*#__PURE__*/ _react.createElement(_index.CartesianChart, {
972
894
  ...props,
973
895
  points: _points,
896
+ chartTitle: _getChartTitle(),
974
897
  chartType: _index1.ChartTypes.VerticalBarChart,
975
898
  xAxisType: _xAxisType,
976
899
  createYAxis: _index1.createNumericYAxis,