@fluentui/react-charts 9.2.2 → 9.2.4

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 (229) hide show
  1. package/CHANGELOG.md +74 -2
  2. package/dist/index.d.ts +187 -15
  3. package/lib/components/AreaChart/AreaChart.js +7 -4
  4. package/lib/components/AreaChart/AreaChart.js.map +1 -1
  5. package/lib/components/AreaChart/useAreaChartStyles.styles.js +4 -3
  6. package/lib/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  7. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js +5 -16
  8. package/lib/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.js +90 -6
  10. package/lib/components/ChartTable/ChartTable.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.js +83 -38
  12. package/lib/components/CommonComponents/CartesianChart.js.map +1 -1
  13. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  14. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +19 -3
  15. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  16. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +8 -23
  17. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  18. package/lib/components/DeclarativeChart/DeclarativeChart.js +214 -107
  19. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  20. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js +25 -1
  21. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  22. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +1618 -259
  23. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  24. package/lib/components/DonutChart/Arc/useArcStyles.styles.js +8 -3
  25. package/lib/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  26. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -2
  27. package/lib/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  28. package/lib/components/DonutChart/DonutChart.js +8 -3
  29. package/lib/components/DonutChart/DonutChart.js.map +1 -1
  30. package/lib/components/DonutChart/DonutChart.types.js.map +1 -1
  31. package/lib/components/DonutChart/useDonutChartStyles.styles.js +21 -4
  32. package/lib/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  33. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
  34. package/lib/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  35. package/lib/components/FunnelChart/FunnelChart.js +4 -2
  36. package/lib/components/FunnelChart/FunnelChart.js.map +1 -1
  37. package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
  38. package/lib/components/GanttChart/useGanttChartStyles.styles.js +2 -1
  39. package/lib/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  40. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
  41. package/lib/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  42. package/lib/components/GaugeChart/GaugeChart.js +1 -2
  43. package/lib/components/GaugeChart/GaugeChart.js.map +1 -1
  44. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +31 -10
  45. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  46. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +6 -18
  47. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  48. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +6 -22
  49. package/lib/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  50. package/lib/components/HeatMapChart/HeatMapChart.js +175 -114
  51. package/lib/components/HeatMapChart/HeatMapChart.js.map +1 -1
  52. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
  53. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  54. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
  55. package/lib/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  56. package/lib/components/HorizontalBarChart/HorizontalBarChart.js +1 -1
  57. package/lib/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  58. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +7 -3
  59. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  60. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -2
  61. package/lib/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  62. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +26 -6
  63. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  64. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
  65. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  66. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
  67. package/lib/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  68. package/lib/components/LineChart/LineChart.js +349 -176
  69. package/lib/components/LineChart/LineChart.js.map +1 -1
  70. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  71. package/lib/components/LineChart/useLineChartStyles.styles.js +28 -8
  72. package/lib/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  73. package/lib/components/LineChart/useLineChartStyles.styles.raw.js +9 -14
  74. package/lib/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  75. package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  76. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  77. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js +12 -25
  78. package/lib/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  79. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js +2 -12
  80. package/lib/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  81. package/lib/components/ScatterChart/ScatterChart.js +139 -81
  82. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  83. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -1
  84. package/lib/components/ScatterChart/useScatterChartStyles.styles.js +29 -8
  85. package/lib/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  86. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js +10 -15
  87. package/lib/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  88. package/lib/components/VerticalBarChart/VerticalBarChart.js +28 -5
  89. package/lib/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  90. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +10 -7
  91. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  92. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +7 -20
  93. package/lib/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  94. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +159 -47
  95. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  96. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  97. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +9 -7
  98. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  99. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +6 -20
  100. package/lib/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  101. package/lib/types/DataPoint.js +3 -1
  102. package/lib/types/DataPoint.js.map +1 -1
  103. package/lib/utilities/Common.styles.js +47 -0
  104. package/lib/utilities/Common.styles.js.map +1 -0
  105. package/lib/utilities/Common.styles.raw.js +47 -0
  106. package/lib/utilities/Common.styles.raw.js.map +1 -0
  107. package/lib/utilities/SVGTooltipText.js.map +1 -1
  108. package/lib/utilities/image-export-utils.js.map +1 -1
  109. package/lib/utilities/index.js +1 -0
  110. package/lib/utilities/index.js.map +1 -1
  111. package/lib/utilities/scatterpolar-utils.js +52 -0
  112. package/lib/utilities/scatterpolar-utils.js.map +1 -0
  113. package/lib/utilities/utilities.js +324 -147
  114. package/lib/utilities/utilities.js.map +1 -1
  115. package/lib/utilities/vbc-utils.js.map +1 -1
  116. package/lib-commonjs/components/AreaChart/AreaChart.js +6 -3
  117. package/lib-commonjs/components/AreaChart/AreaChart.js.map +1 -1
  118. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js +2 -1
  119. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.js.map +1 -1
  120. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js +4 -15
  121. package/lib-commonjs/components/AreaChart/useAreaChartStyles.styles.raw.js.map +1 -1
  122. package/lib-commonjs/components/ChartTable/ChartTable.js +90 -6
  123. package/lib-commonjs/components/ChartTable/ChartTable.js.map +1 -1
  124. package/lib-commonjs/components/CommonComponents/CartesianChart.js +83 -37
  125. package/lib-commonjs/components/CommonComponents/CartesianChart.js.map +1 -1
  126. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  127. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +17 -2
  128. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  129. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +6 -22
  130. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  131. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +212 -107
  132. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  133. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js +31 -1
  134. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  135. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +1652 -260
  136. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  137. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js +12 -3
  138. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.js.map +1 -1
  139. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js +6 -2
  140. package/lib-commonjs/components/DonutChart/Arc/useArcStyles.styles.raw.js.map +1 -1
  141. package/lib-commonjs/components/DonutChart/DonutChart.js +7 -2
  142. package/lib-commonjs/components/DonutChart/DonutChart.js.map +1 -1
  143. package/lib-commonjs/components/DonutChart/DonutChart.types.js.map +1 -1
  144. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js +32 -4
  145. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.js.map +1 -1
  146. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js +8 -4
  147. package/lib-commonjs/components/DonutChart/useDonutChartStyles.styles.raw.js.map +1 -1
  148. package/lib-commonjs/components/FunnelChart/FunnelChart.js +4 -2
  149. package/lib-commonjs/components/FunnelChart/FunnelChart.js.map +1 -1
  150. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
  151. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js +2 -1
  152. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.js.map +1 -1
  153. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js +2 -1
  154. package/lib-commonjs/components/GanttChart/useGanttChartStyles.styles.raw.js.map +1 -1
  155. package/lib-commonjs/components/GaugeChart/GaugeChart.js +1 -2
  156. package/lib-commonjs/components/GaugeChart/GaugeChart.js.map +1 -1
  157. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js +30 -9
  158. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.js.map +1 -1
  159. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js +4 -20
  160. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.js.map +1 -1
  161. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js +5 -21
  162. package/lib-commonjs/components/GroupedVerticalBarChart/useGroupedVerticalBarChartStyles.styles.raw.js.map +1 -1
  163. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js +174 -113
  164. package/lib-commonjs/components/HeatMapChart/HeatMapChart.js.map +1 -1
  165. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js +2 -1
  166. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.js.map +1 -1
  167. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js +2 -1
  168. package/lib-commonjs/components/HeatMapChart/useHeatMapChartStyles.styles.raw.js.map +1 -1
  169. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js +1 -1
  170. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.js.map +1 -1
  171. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js +10 -3
  172. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.js.map +1 -1
  173. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js +5 -2
  174. package/lib-commonjs/components/HorizontalBarChart/useHorizontalBarChartStyles.styles.raw.js.map +1 -1
  175. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js +25 -5
  176. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.js.map +1 -1
  177. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js +2 -1
  178. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.js.map +1 -1
  179. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js +2 -1
  180. package/lib-commonjs/components/HorizontalBarChartWithAxis/useHorizontalBarChartWithAxisStyles.styles.raw.js.map +1 -1
  181. package/lib-commonjs/components/LineChart/LineChart.js +347 -175
  182. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  183. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  184. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js +35 -5
  185. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.js.map +1 -1
  186. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js +7 -13
  187. package/lib-commonjs/components/LineChart/useLineChartStyles.styles.raw.js.map +1 -1
  188. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  189. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  190. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js +23 -33
  191. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.js.map +1 -1
  192. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js +1 -12
  193. package/lib-commonjs/components/SankeyChart/useSankeyChartStyles.styles.raw.js.map +1 -1
  194. package/lib-commonjs/components/ScatterChart/ScatterChart.js +137 -79
  195. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  196. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -1
  197. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js +39 -6
  198. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.js.map +1 -1
  199. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js +9 -14
  200. package/lib-commonjs/components/ScatterChart/useScatterChartStyles.styles.raw.js.map +1 -1
  201. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js +27 -4
  202. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.js.map +1 -1
  203. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js +7 -4
  204. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.js.map +1 -1
  205. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js +5 -18
  206. package/lib-commonjs/components/VerticalBarChart/useVerticalBarChartStyles.styles.raw.js.map +1 -1
  207. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +158 -46
  208. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  209. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  210. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js +7 -4
  211. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.js.map +1 -1
  212. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js +5 -19
  213. package/lib-commonjs/components/VerticalStackedBarChart/useVerticalStackedBarChartStyles.styles.raw.js.map +1 -1
  214. package/lib-commonjs/types/DataPoint.js +3 -1
  215. package/lib-commonjs/types/DataPoint.js.map +1 -1
  216. package/lib-commonjs/utilities/Common.styles.js +71 -0
  217. package/lib-commonjs/utilities/Common.styles.js.map +1 -0
  218. package/lib-commonjs/utilities/Common.styles.raw.js +71 -0
  219. package/lib-commonjs/utilities/Common.styles.raw.js.map +1 -0
  220. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  221. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  222. package/lib-commonjs/utilities/index.js +1 -0
  223. package/lib-commonjs/utilities/index.js.map +1 -1
  224. package/lib-commonjs/utilities/scatterpolar-utils.js +67 -0
  225. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -0
  226. package/lib-commonjs/utilities/utilities.js +337 -137
  227. package/lib-commonjs/utilities/utilities.js.map +1 -1
  228. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  229. package/package.json +10 -10
@@ -6,12 +6,17 @@ import { scaleLinear as d3ScaleLinear, scaleBand as d3ScaleBand, scaleUtc as d3S
6
6
  import { useId } from '@fluentui/react-utilities';
7
7
  import { tokens } from '@fluentui/react-theme';
8
8
  import { CartesianChart, ChartPopover, Legends } from '../../index';
9
- import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, formatDate, areArraysEqual, calculateLongestLabelWidth, useRtl, DataVizPalette, getColorFromToken, findVSBCNumericMinMaxOfY, createNumericYAxis, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, calcTotalWidth, calcBandwidth, calcRequiredWidth } from '../../utilities/index';
9
+ import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfAxislabels, formatScientificLimitWidth, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, formatDate, areArraysEqual, calculateLongestLabelWidth, useRtl, DataVizPalette, getColorFromToken, findVSBCNumericMinMaxOfY, YAxisType, createNumericYAxis, domainRangeOfDateForAreaLineScatterVerticalBarCharts, domainRangeOfVSBCNumeric, domainRangeOfXStringAxis, createStringYAxis, calcTotalWidth, calcBandwidth, calcRequiredWidth, sortAxisCategories } from '../../utilities/index';
10
10
  import { toImage } from '../../utilities/image-export-utils';
11
+ import { formatDateToLocaleString } from '@fluentui/chart-utilities';
11
12
  const barGapMultiplier = 0.2;
12
13
  const barGapMin = 1;
13
14
  const MIN_DOMAIN_MARGIN = 8;
14
- export const VerticalStackedBarChart = (props)=>{
15
+ export const VerticalStackedBarChart = /*#__PURE__*/ React.forwardRef((props = {
16
+ xAxisCategoryOrder: 'default',
17
+ yAxisCategoryOrder: 'default',
18
+ data: []
19
+ }, forwardedRef)=>{
15
20
  var _props_legendProps;
16
21
  const _isRtl = useRtl();
17
22
  const _createLegendsForLine = (data)=>_getLineLegends(data);
@@ -35,6 +40,8 @@ export const VerticalStackedBarChart = (props)=>{
35
40
  const cartesianChartRef = React.useRef(null);
36
41
  const Y_ORIGIN = 0;
37
42
  const _legendsRef = React.useRef(null);
43
+ let _yAxisType;
44
+ let _yAxisLabels = [];
38
45
  const [selectedLegends, setSelectedLegends] = React.useState(((_props_legendProps = props.legendProps) === null || _props_legendProps === void 0 ? void 0 : _props_legendProps.selectedLegends) || []);
39
46
  const [activeLegend, setActiveLegend] = React.useState(undefined);
40
47
  const [dataForHoverCard, setDataForHoverCard] = React.useState(0);
@@ -235,21 +242,26 @@ export const VerticalStackedBarChart = (props)=>{
235
242
  _lineObject = _getFormattedLineData(props.data);
236
243
  _xAxisInnerPadding = getScalePadding(props.xAxisInnerPadding, props.xAxisPadding, _xAxisType === XAxisTypes.StringAxis ? 2 / 3 : 1 / 2);
237
244
  _xAxisOuterPadding = getScalePadding(props.xAxisOuterPadding, props.xAxisPadding, 0);
245
+ _initYAxisParams();
238
246
  }
239
247
  function _createDataSetLayer() {
240
- const tempArr = [];
241
248
  const dataset = _points.map((singlePointData)=>{
249
+ if (_yAxisType === YAxisType.StringAxis) {
250
+ return {
251
+ x: singlePointData.xAxisPoint,
252
+ y: 0
253
+ };
254
+ }
242
255
  let total = 0;
243
256
  singlePointData.chartData.forEach((point)=>{
244
257
  total = total + point.data;
245
258
  });
246
- tempArr.push(singlePointData.xAxisPoint);
247
259
  return {
248
260
  x: singlePointData.xAxisPoint,
249
261
  y: total
250
262
  };
251
263
  });
252
- _xAxisLabels = tempArr;
264
+ _xAxisLabels = _getOrderedXAxisLabels();
253
265
  return dataset;
254
266
  }
255
267
  function _onLegendHover(legendTitle) {
@@ -274,7 +286,7 @@ export const VerticalStackedBarChart = (props)=>{
274
286
  }
275
287
  function _getGraphData(xScale, yScale, containerHeight, containerWidth, xElement) {
276
288
  const { xBarScale, yBarScale } = _getScales(containerHeight, containerWidth);
277
- return _bars = _createBar(xBarScale, yBarScale, containerHeight, xElement);
289
+ return _bars = _createBar(xBarScale, _yAxisType === YAxisType.StringAxis ? yScale : yBarScale, containerHeight, xElement);
278
290
  }
279
291
  function _getAxisData(yAxisData) {
280
292
  if (yAxisData && yAxisData.yAxisDomainValues.length) {
@@ -284,16 +296,16 @@ export const VerticalStackedBarChart = (props)=>{
284
296
  }
285
297
  }
286
298
  /**
287
- * This function checks if the given legend is highlighted or not.
288
- * A legend can be highlighted in 2 ways:
289
- * 1. selection: if the user clicks on it
290
- * 2. hovering: if there is no selected legend and the user hovers over it
291
- */ function _isLegendHighlighted(legendTitle) {
299
+ * This function checks if the given legend is highlighted or not.
300
+ * A legend can be highlighted in 2 ways:
301
+ * 1. selection: if the user clicks on it
302
+ * 2. hovering: if there is no selected legend and the user hovers over it
303
+ */ function _isLegendHighlighted(legendTitle) {
292
304
  return _getHighlightedLegend().includes(legendTitle);
293
305
  }
294
306
  /**
295
- * This function checks if none of the legends is selected or hovered.
296
- */ function _noLegendHighlighted() {
307
+ * This function checks if none of the legends is selected or hovered.
308
+ */ function _noLegendHighlighted() {
297
309
  return _getHighlightedLegend().length === 0;
298
310
  }
299
311
  function _getAriaLabel(singleChartData, point, isLinePoint) {
@@ -341,7 +353,7 @@ export const VerticalStackedBarChart = (props)=>{
341
353
  if (xAxisType === XAxisTypes.NumericAxis) {
342
354
  domainNRangeValue = domainRangeOfVSBCNumeric(points, margins, width, isRTL, barWidth);
343
355
  } else if (xAxisType === XAxisTypes.DateAxis) {
344
- domainNRangeValue = domainRangeOfDateForAreaLineVerticalBarChart(points, margins, width, isRTL, tickValues, chartType, barWidth);
356
+ domainNRangeValue = domainRangeOfDateForAreaLineScatterVerticalBarCharts(points, margins, width, isRTL, tickValues, chartType, barWidth);
345
357
  } else {
346
358
  domainNRangeValue = domainRangeOfXStringAxis(margins, width, isRTL);
347
359
  }
@@ -401,6 +413,7 @@ export const VerticalStackedBarChart = (props)=>{
401
413
  const y1 = useSecondaryYScale ? yScaleSecondary(lineObject[item][i - 1].y) : yScalePrimary(lineObject[item][i - 1].y);
402
414
  const x2 = xScale(lineObject[item][i].xItem.xAxisPoint);
403
415
  const y2 = useSecondaryYScale ? yScaleSecondary(lineObject[item][i].y) : yScalePrimary(lineObject[item][i].y);
416
+ const yScaleBandwidthTranslate = !useSecondaryYScale && _yAxisType === YAxisType.StringAxis ? yScalePrimary.bandwidth() / 2 : 0;
404
417
  if (lineBorderWidth > 0) {
405
418
  borderForLines.push(/*#__PURE__*/ React.createElement("line", {
406
419
  key: `${index}-${i}-BorderLine`,
@@ -413,7 +426,7 @@ export const VerticalStackedBarChart = (props)=>{
413
426
  fill: "transparent",
414
427
  strokeLinecap: "round",
415
428
  stroke: tokens.colorNeutralBackground1,
416
- transform: `translate(${xScaleBandwidthTranslate}, 0)`
429
+ transform: `translate(${xScaleBandwidthTranslate}, ${yScaleBandwidthTranslate})`
417
430
  }));
418
431
  }
419
432
  var _lineObject_item__lineOptions_strokeWidth, _lineObject_item__lineOptions_strokeLinecap;
@@ -428,7 +441,7 @@ export const VerticalStackedBarChart = (props)=>{
428
441
  strokeLinecap: (_lineObject_item__lineOptions_strokeLinecap = (_lineObject_item__lineOptions1 = lineObject[item][0].lineOptions) === null || _lineObject_item__lineOptions1 === void 0 ? void 0 : _lineObject_item__lineOptions1.strokeLinecap) !== null && _lineObject_item__lineOptions_strokeLinecap !== void 0 ? _lineObject_item__lineOptions_strokeLinecap : 'round',
429
442
  strokeDasharray: (_lineObject_item__lineOptions2 = lineObject[item][0].lineOptions) === null || _lineObject_item__lineOptions2 === void 0 ? void 0 : _lineObject_item__lineOptions2.strokeDasharray,
430
443
  stroke: lineObject[item][i].color,
431
- transform: `translate(${xScaleBandwidthTranslate}, 0)`,
444
+ transform: `translate(${xScaleBandwidthTranslate}, ${yScaleBandwidthTranslate})`,
432
445
  onMouseOver: (event)=>_lineHover(lineObject[item][i - 1], event),
433
446
  onMouseLeave: _handleMouseOut
434
447
  }));
@@ -440,6 +453,7 @@ export const VerticalStackedBarChart = (props)=>{
440
453
  refElement: null
441
454
  };
442
455
  const noBarsAndLinesActive = circlePoint.xItem.chartData.filter((dataPoint)=>_noLegendHighlighted() || _isLegendHighlighted(dataPoint.legend)).length === 0;
456
+ const yScaleBandwidthTranslate = !circlePoint.useSecondaryYScale && _yAxisType === YAxisType.StringAxis ? yScalePrimary.bandwidth() / 2 : 0;
443
457
  dots.push(/*#__PURE__*/ React.createElement("circle", {
444
458
  key: `${index}-${subIndex}-dot`,
445
459
  cx: xScale(circlePoint.xItem.xAxisPoint),
@@ -453,7 +467,7 @@ export const VerticalStackedBarChart = (props)=>{
453
467
  // Elements with visibility: hidden cannot receive focus, so use opacity: 0 instead to hide them.
454
468
  // For more information, see https://fuzzbomb.github.io/accessibility-demos/visually-hidden-focus-test.html
455
469
  opacity: _getCircleOpacityAndRadius(circlePoint.xItem.xAxisPoint, circlePoint.legend).opacity,
456
- transform: `translate(${xScaleBandwidthTranslate}, 0)`,
470
+ transform: `translate(${xScaleBandwidthTranslate}, ${yScaleBandwidthTranslate})`,
457
471
  ref: (e)=>circleRef.refElement = e,
458
472
  ...noBarsAndLinesActive ? {
459
473
  tabIndex: !props.hideTooltip ? 0 : undefined,
@@ -525,14 +539,15 @@ export const VerticalStackedBarChart = (props)=>{
525
539
  if ((_calloutAnchorPoint === null || _calloutAnchorPoint === void 0 ? void 0 : _calloutAnchorPoint.chartDataPoint) !== point || (_calloutAnchorPoint === null || _calloutAnchorPoint === void 0 ? void 0 : _calloutAnchorPoint.xAxisDataPoint) !== xAxisPoint) {
526
540
  _calloutAnchorPoint = {
527
541
  chartDataPoint: point,
528
- xAxisDataPoint: `${xAxisPoint}`
542
+ xAxisDataPoint: xAxisPoint instanceof Date ? formatDateToLocaleString(xAxisPoint, props.culture, props.useUTC) : xAxisPoint.toString()
529
543
  };
544
+ const xCalloutValue = point.xAxisCalloutData || (xAxisPoint instanceof Date ? formatDateToLocaleString(xAxisPoint, props.culture, props.useUTC) : xAxisPoint.toString());
530
545
  _updatePosition(clientX, clientY);
531
546
  setPopoverOpen(_noLegendHighlighted() || _isLegendHighlighted(point.legend));
532
547
  setCalloutLegend(point.legend);
533
548
  setDataForHoverCard(point.data);
534
549
  setColor(color);
535
- setXCalloutValue(point.xAxisCalloutData ? point.xAxisCalloutData : `${xAxisPoint}`);
550
+ setXCalloutValue(xCalloutValue);
536
551
  setYCalloutValue(point.yAxisCalloutData);
537
552
  setDataPointCalloutProps(point);
538
553
  setCallOutAccessibilityData(point.callOutAccessibilityData);
@@ -566,22 +581,29 @@ export const VerticalStackedBarChart = (props)=>{
566
581
  }
567
582
  function _getBarGapAndScale(bars, yBarScale, defaultTotalHeight) {
568
583
  const { barGapMax = 0 } = props;
569
- // When displaying gaps between the bars, the height of each bar is
570
- // adjusted so that the total of all bars is not changed by the gaps
571
- const totalData = bars.reduce((iter, value)=>iter + Math.abs(value.data), 0);
572
- const totalHeight = defaultTotalHeight !== null && defaultTotalHeight !== void 0 ? defaultTotalHeight : Math.abs(yBarScale(totalData) - yBarScale(Y_ORIGIN));
584
+ let totalData = 0;
585
+ let totalHeight;
573
586
  let sumOfPercent = 0;
574
- bars.forEach((point)=>{
575
- let value = Math.abs(point.data) / totalData * 100;
576
- if (value < 1 && value !== 0) {
577
- value = 1;
578
- }
579
- sumOfPercent += value;
580
- });
581
- const scalingRatio = sumOfPercent !== 0 ? sumOfPercent / 100 : 1;
587
+ let scalingRatio;
588
+ if (_yAxisType === YAxisType.StringAxis) {
589
+ totalHeight = defaultTotalHeight !== null && defaultTotalHeight !== void 0 ? defaultTotalHeight : bars.reduce((total, bar)=>total + yBarScale(bar.data), 0);
590
+ } else {
591
+ // When displaying gaps between the bars, the height of each bar is
592
+ // adjusted so that the total of all bars is not changed by the gaps
593
+ totalData = bars.reduce((iter, value)=>iter + Math.abs(value.data), 0);
594
+ totalHeight = defaultTotalHeight !== null && defaultTotalHeight !== void 0 ? defaultTotalHeight : Math.abs(yBarScale(totalData) - yBarScale(Y_ORIGIN));
595
+ bars.forEach((point)=>{
596
+ let value = Math.abs(point.data) / totalData * 100;
597
+ if (value < 1 && value !== 0) {
598
+ value = 1;
599
+ }
600
+ sumOfPercent += value;
601
+ });
602
+ scalingRatio = sumOfPercent !== 0 ? sumOfPercent / 100 : 1;
603
+ }
582
604
  const gaps = barGapMax && bars.length - 1;
583
605
  const gapHeight = gaps && Math.max(barGapMin, Math.min(barGapMax, totalHeight * barGapMultiplier / gaps));
584
- const heightValueScale = (totalHeight - gapHeight * gaps) / (totalData * scalingRatio);
606
+ const heightValueScale = _yAxisType === YAxisType.StringAxis ? 0 : (totalHeight - gapHeight * gaps) / (totalData * scalingRatio);
585
607
  return {
586
608
  gapHeight,
587
609
  heightValueScale,
@@ -731,7 +753,7 @@ export const VerticalStackedBarChart = (props)=>{
731
753
  const xPoint = xBarScale(_xAxisType === XAxisTypes.NumericAxis ? singleChartData.xAxisPoint : _xAxisType === XAxisTypes.DateAxis ? singleChartData.xAxisPoint : singleChartData.xAxisPoint);
732
754
  const xScaleBandwidthTranslate = _xAxisType !== XAxisTypes.StringAxis ? -_barWidth / 2 : (xBarScale.bandwidth() - _barWidth) / 2;
733
755
  let barTotalValue = 0;
734
- const barsToDisplay = singleChartData.chartData.filter((point)=>point.data !== 0);
756
+ const barsToDisplay = singleChartData.chartData.filter((point)=>point.data !== 0 && point.data !== '' && !(_yAxisType === YAxisType.StringAxis && typeof yBarScale(point.data) === 'undefined'));
735
757
  if (!barsToDisplay.length) {
736
758
  return undefined;
737
759
  }
@@ -739,7 +761,7 @@ export const VerticalStackedBarChart = (props)=>{
739
761
  if (heightValueScale < 0) {
740
762
  return undefined;
741
763
  }
742
- const yBaseline = containerHeight - _margins.bottom - yBarScale(Y_ORIGIN);
764
+ const yBaseline = containerHeight - _margins.bottom - (_yAxisType === YAxisType.StringAxis ? 0 : yBarScale(Y_ORIGIN));
743
765
  let yPositiveStart = yBaseline;
744
766
  let yNegativeStart = yBaseline;
745
767
  let yPoint = 0;
@@ -759,22 +781,29 @@ export const VerticalStackedBarChart = (props)=>{
759
781
  role: 'img',
760
782
  tabIndex: !props.hideTooltip && shouldHighlight ? 0 : undefined
761
783
  };
762
- let barHeight = Math.abs(heightValueScale * point.data);
763
- // FIXME: The current scaling logic may produce different min and gap heights for each bar stack.
764
- const minHeight = Math.max(heightValueScale * absStackTotal / 100.0, barMinimumHeight);
765
- if (barHeight < minHeight) {
766
- barHeight = minHeight;
767
- }
784
+ let barHeight;
768
785
  const gapOffset = index ? gapHeight : 0;
769
- if (point.data >= Y_ORIGIN) {
786
+ if (_yAxisType === YAxisType.StringAxis) {
787
+ barHeight = Math.max(containerHeight - _margins.bottom - (yBarScale(point.data) + yBarScale.bandwidth() / 2) - gapOffset, barMinimumHeight, 1);
770
788
  yPositiveStart -= barHeight + gapOffset;
771
789
  yPoint = yPositiveStart;
772
790
  } else {
773
- yPoint = yNegativeStart + gapOffset;
774
- yNegativeStart = yPoint + barHeight;
791
+ barHeight = Math.abs(heightValueScale * point.data);
792
+ // FIXME: The current scaling logic may produce different min and gap heights for each bar stack.
793
+ const minHeight = Math.max(heightValueScale * absStackTotal / 100.0, barMinimumHeight);
794
+ if (barHeight < minHeight) {
795
+ barHeight = minHeight;
796
+ }
797
+ if (point.data >= Y_ORIGIN) {
798
+ yPositiveStart -= barHeight + gapOffset;
799
+ yPoint = yPositiveStart;
800
+ } else {
801
+ yPoint = yNegativeStart + gapOffset;
802
+ yNegativeStart = yPoint + barHeight;
803
+ }
804
+ barTotalValue += point.data;
805
+ heightOfLastBar = index === barsToDisplay.length - 1 ? barHeight : 0;
775
806
  }
776
- barTotalValue += point.data;
777
- heightOfLastBar = index === barsToDisplay.length - 1 ? barHeight : 0;
778
807
  if (barCornerRadius && barHeight > barCornerRadius && index === barsToDisplay.length - 1) {
779
808
  return /*#__PURE__*/ React.createElement(React.Fragment, {
780
809
  key: index + indexNumber + `${shouldFocusWholeStack}`
@@ -837,7 +866,7 @@ export const VerticalStackedBarChart = (props)=>{
837
866
  };
838
867
  let showLabel = false;
839
868
  let barLabel = 0;
840
- if (!props.hideLabels) {
869
+ if (!props.hideLabels && _yAxisType !== YAxisType.StringAxis) {
841
870
  if (_noLegendHighlighted()) {
842
871
  showLabel = true;
843
872
  barLabel = barTotalValue;
@@ -907,6 +936,83 @@ export const VerticalStackedBarChart = (props)=>{
907
936
  endValue: d3Max(values)
908
937
  };
909
938
  }
939
+ function _initYAxisParams() {
940
+ if (_points[0].chartData.length > 0) {
941
+ _yAxisType = getTypeOfAxis(_points[0].chartData[0].data, false);
942
+ } else {
943
+ Object.keys(_lineObject).forEach((lineLegend)=>{
944
+ if (!_lineObject[lineLegend][0].useSecondaryYScale) {
945
+ _yAxisType = getTypeOfAxis(_lineObject[lineLegend][0].y, false);
946
+ }
947
+ });
948
+ }
949
+ _yAxisLabels = _getOrderedYAxisLabels();
950
+ }
951
+ function _getYDomainMargins(containerHeight) {
952
+ /**
953
+ * Specifies the extra top margin to apply above the highest y-axis tick label.
954
+ * Useful when stacked bars extend beyond the combined height of all y-axis labels (or categories).
955
+ */ let yAxisTickMarginTop = 0;
956
+ /** Total height available to render the bars */ const totalHeight = containerHeight - _margins.bottom - _margins.top;
957
+ if (_yAxisType === YAxisType.StringAxis) {
958
+ /** Maximum height of the stacked bars, expressed in multiples of the height of a y-axis label (or category) */ let maxBarHeightInLabels = 0;
959
+ _points.forEach((xPoint)=>{
960
+ /** Height of the stacked bar, expressed in multiples of the height of a y-axis label (or category) */ let barHeightInLabels = 0;
961
+ xPoint.chartData.forEach((bar)=>{
962
+ barHeightInLabels += _yAxisLabels.indexOf(`${bar.data}`) + 1;
963
+ });
964
+ maxBarHeightInLabels = Math.max(maxBarHeightInLabels, barHeightInLabels);
965
+ });
966
+ /** Height of a y-axis label (or category) */ const yAxisLabelHeight = maxBarHeightInLabels === 0 ? 0 : totalHeight / maxBarHeightInLabels;
967
+ yAxisTickMarginTop += yAxisLabelHeight * (maxBarHeightInLabels - _yAxisLabels.length);
968
+ }
969
+ return {
970
+ ..._margins,
971
+ top: _margins.top + yAxisTickMarginTop
972
+ };
973
+ }
974
+ function _getOrderedXAxisLabels() {
975
+ if (_xAxisType !== XAxisTypes.StringAxis) {
976
+ return [];
977
+ }
978
+ return sortAxisCategories(_mapCategoryToValues(), props.xAxisCategoryOrder);
979
+ }
980
+ function _getOrderedYAxisLabels() {
981
+ if (_yAxisType !== YAxisType.StringAxis) {
982
+ return [];
983
+ }
984
+ return sortAxisCategories(_mapCategoryToValues(true), props.yAxisCategoryOrder);
985
+ }
986
+ function _mapCategoryToValues(isYAxis = false) {
987
+ const categoryToValues = {};
988
+ _points.forEach((point)=>{
989
+ var _point_lineData;
990
+ point.chartData.forEach((bar)=>{
991
+ const category = isYAxis ? bar.data : point.xAxisPoint;
992
+ const value = isYAxis ? point.xAxisPoint : bar.data;
993
+ if (!categoryToValues[category]) {
994
+ categoryToValues[category] = [];
995
+ }
996
+ if (typeof value === 'number') {
997
+ categoryToValues[category].push(value);
998
+ }
999
+ });
1000
+ (_point_lineData = point.lineData) === null || _point_lineData === void 0 ? void 0 : _point_lineData.forEach((linePoint)=>{
1001
+ if (isYAxis && linePoint.useSecondaryYScale) {
1002
+ return;
1003
+ }
1004
+ const category = isYAxis ? linePoint.y : point.xAxisPoint;
1005
+ const value = isYAxis ? point.xAxisPoint : linePoint.y;
1006
+ if (!categoryToValues[category]) {
1007
+ categoryToValues[category] = [];
1008
+ }
1009
+ if (typeof value === 'number') {
1010
+ categoryToValues[category].push(value);
1011
+ }
1012
+ });
1013
+ });
1014
+ return categoryToValues;
1015
+ }
910
1016
  if (!_isChartEmpty()) {
911
1017
  _adjustProps();
912
1018
  const _isHavingLines = props.data.some((item)=>item.lineData && item.lineData.length > 0);
@@ -962,6 +1068,12 @@ export const VerticalStackedBarChart = (props)=>{
962
1068
  },
963
1069
  componentRef: cartesianChartRef,
964
1070
  showRoundOffXTickValues: !isScalePaddingDefined(props.xAxisInnerPadding, props.xAxisPadding),
1071
+ yAxisType: _yAxisType,
1072
+ stringDatasetForYAxisDomain: [
1073
+ '',
1074
+ ..._yAxisLabels
1075
+ ],
1076
+ getYDomainMargins: _getYDomainMargins,
965
1077
  /* eslint-disable react/jsx-no-bind */ children: (props)=>{
966
1078
  return /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("g", null, _bars), /*#__PURE__*/ React.createElement("g", null, _isHavingLines && _createLines(props.xScale, props.yScalePrimary, props.containerHeight, props.containerWidth, props.yScaleSecondary)));
967
1079
  }
@@ -975,5 +1087,5 @@ export const VerticalStackedBarChart = (props)=>{
975
1087
  },
976
1088
  "aria-label": 'Graph has no data to display'
977
1089
  });
978
- };
1090
+ });
979
1091
  VerticalStackedBarChart.displayName = 'VerticalStackedBarChart';