@fluentui/react-charting 5.24.37 → 5.24.39

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 (182) hide show
  1. package/CHANGELOG.json +73 -1
  2. package/CHANGELOG.md +27 -2
  3. package/dist/react-charting.d.ts +2 -1
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +2 -1
  7. package/lib/components/AreaChart/AreaChart.base.d.ts +2 -1
  8. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  9. package/lib/components/ChartTable/ChartTable.base.d.ts +2 -1
  10. package/lib/components/ChartTable/ChartTable.base.js.map +1 -1
  11. package/lib/components/CommonComponents/CartesianChart.base.d.ts +2 -1
  12. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  13. package/lib/components/CommonComponents/CartesianChart.types.d.ts +2 -1
  14. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  15. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  16. package/lib/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  17. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  18. package/lib/components/DonutChart/Arc/Arc.d.ts +2 -1
  19. package/lib/components/DonutChart/Arc/Arc.js.map +1 -1
  20. package/lib/components/DonutChart/DonutChart.base.d.ts +2 -1
  21. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  22. package/lib/components/DonutChart/Pie/Pie.d.ts +3 -2
  23. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  24. package/lib/components/FunnelChart/FunnelChart.base.js.map +1 -1
  25. package/lib/components/FunnelChart/funnelGeometry.js.map +1 -1
  26. package/lib/components/GanttChart/GanttChart.base.js.map +1 -1
  27. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  28. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  29. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  30. package/lib/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
  31. package/lib/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  32. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
  33. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  34. package/lib/components/Legends/Legends.base.d.ts +2 -1
  35. package/lib/components/Legends/Legends.base.js.map +1 -1
  36. package/lib/components/LineChart/LineChart.base.d.ts +2 -1
  37. package/lib/components/LineChart/LineChart.base.js +2 -2
  38. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  39. package/lib/components/PieChart/Arc/Arc.d.ts +3 -2
  40. package/lib/components/PieChart/Arc/Arc.js.map +1 -1
  41. package/lib/components/PieChart/Pie/Pie.d.ts +3 -2
  42. package/lib/components/PieChart/Pie/Pie.js.map +1 -1
  43. package/lib/components/PieChart/PieChart.base.d.ts +2 -1
  44. package/lib/components/PieChart/PieChart.base.js.map +1 -1
  45. package/lib/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  46. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  47. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -1
  48. package/lib/components/Sparkline/Sparkline.base.d.ts +3 -2
  49. package/lib/components/Sparkline/Sparkline.base.js.map +1 -1
  50. package/lib/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
  51. package/lib/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  52. package/lib/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
  53. package/lib/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  54. package/lib/components/TreeChart/TreeChart.base.d.ts +2 -1
  55. package/lib/components/TreeChart/TreeChart.base.js.map +1 -1
  56. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
  57. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  58. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  59. package/lib/utilities/image-export-utils.js.map +1 -1
  60. package/lib/utilities/scatterpolar-utils.d.ts +2 -2
  61. package/lib/utilities/scatterpolar-utils.js.map +1 -1
  62. package/lib/utilities/utilities.d.ts +14 -14
  63. package/lib/utilities/utilities.js.map +1 -1
  64. package/lib/utilities/vbc-utils.js.map +1 -1
  65. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +2 -1
  66. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  67. package/lib-amd/components/ChartTable/ChartTable.base.d.ts +2 -1
  68. package/lib-amd/components/ChartTable/ChartTable.base.js.map +1 -1
  69. package/lib-amd/components/CommonComponents/CartesianChart.base.d.ts +2 -1
  70. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  71. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +2 -1
  72. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  73. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  74. package/lib-amd/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  75. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  76. package/lib-amd/components/DonutChart/Arc/Arc.d.ts +2 -1
  77. package/lib-amd/components/DonutChart/Arc/Arc.js.map +1 -1
  78. package/lib-amd/components/DonutChart/DonutChart.base.d.ts +2 -1
  79. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  80. package/lib-amd/components/DonutChart/Pie/Pie.d.ts +3 -2
  81. package/lib-amd/components/DonutChart/Pie/Pie.js.map +1 -1
  82. package/lib-amd/components/FunnelChart/FunnelChart.base.js.map +1 -1
  83. package/lib-amd/components/FunnelChart/funnelGeometry.js.map +1 -1
  84. package/lib-amd/components/GanttChart/GanttChart.base.js.map +1 -1
  85. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  86. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  87. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  88. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
  89. package/lib-amd/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  90. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
  91. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  92. package/lib-amd/components/Legends/Legends.base.d.ts +2 -1
  93. package/lib-amd/components/Legends/Legends.base.js.map +1 -1
  94. package/lib-amd/components/LineChart/LineChart.base.d.ts +2 -1
  95. package/lib-amd/components/LineChart/LineChart.base.js +2 -2
  96. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  97. package/lib-amd/components/PieChart/Arc/Arc.d.ts +3 -2
  98. package/lib-amd/components/PieChart/Arc/Arc.js.map +1 -1
  99. package/lib-amd/components/PieChart/Pie/Pie.d.ts +3 -2
  100. package/lib-amd/components/PieChart/Pie/Pie.js.map +1 -1
  101. package/lib-amd/components/PieChart/PieChart.base.d.ts +2 -1
  102. package/lib-amd/components/PieChart/PieChart.base.js.map +1 -1
  103. package/lib-amd/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  104. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  105. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -1
  106. package/lib-amd/components/Sparkline/Sparkline.base.d.ts +3 -2
  107. package/lib-amd/components/Sparkline/Sparkline.base.js.map +1 -1
  108. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
  109. package/lib-amd/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  110. package/lib-amd/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
  111. package/lib-amd/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  112. package/lib-amd/components/TreeChart/TreeChart.base.d.ts +2 -1
  113. package/lib-amd/components/TreeChart/TreeChart.base.js.map +1 -1
  114. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
  115. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  116. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  117. package/lib-amd/utilities/image-export-utils.js.map +1 -1
  118. package/lib-amd/utilities/scatterpolar-utils.d.ts +2 -2
  119. package/lib-amd/utilities/scatterpolar-utils.js.map +1 -1
  120. package/lib-amd/utilities/utilities.d.ts +14 -14
  121. package/lib-amd/utilities/utilities.js.map +1 -1
  122. package/lib-amd/utilities/vbc-utils.js.map +1 -1
  123. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +2 -1
  124. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  125. package/lib-commonjs/components/ChartTable/ChartTable.base.d.ts +2 -1
  126. package/lib-commonjs/components/ChartTable/ChartTable.base.js.map +1 -1
  127. package/lib-commonjs/components/CommonComponents/CartesianChart.base.d.ts +2 -1
  128. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  129. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +2 -1
  130. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  131. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  132. package/lib-commonjs/components/DeclarativeChart/PlotlyColorAdapter.js.map +1 -1
  133. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  134. package/lib-commonjs/components/DonutChart/Arc/Arc.d.ts +2 -1
  135. package/lib-commonjs/components/DonutChart/Arc/Arc.js.map +1 -1
  136. package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +2 -1
  137. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  138. package/lib-commonjs/components/DonutChart/Pie/Pie.d.ts +3 -2
  139. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  140. package/lib-commonjs/components/FunnelChart/FunnelChart.base.js.map +1 -1
  141. package/lib-commonjs/components/FunnelChart/funnelGeometry.js.map +1 -1
  142. package/lib-commonjs/components/GanttChart/GanttChart.base.js.map +1 -1
  143. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  144. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  145. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  146. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.d.ts +2 -1
  147. package/lib-commonjs/components/HorizontalBarChart/HorizontalBarChart.base.js.map +1 -1
  148. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +2 -1
  149. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  150. package/lib-commonjs/components/Legends/Legends.base.d.ts +2 -1
  151. package/lib-commonjs/components/Legends/Legends.base.js.map +1 -1
  152. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +2 -1
  153. package/lib-commonjs/components/LineChart/LineChart.base.js +2 -2
  154. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  155. package/lib-commonjs/components/PieChart/Arc/Arc.d.ts +3 -2
  156. package/lib-commonjs/components/PieChart/Arc/Arc.js.map +1 -1
  157. package/lib-commonjs/components/PieChart/Pie/Pie.d.ts +3 -2
  158. package/lib-commonjs/components/PieChart/Pie/Pie.js.map +1 -1
  159. package/lib-commonjs/components/PieChart/PieChart.base.d.ts +2 -1
  160. package/lib-commonjs/components/PieChart/PieChart.base.js.map +1 -1
  161. package/lib-commonjs/components/ResponsiveContainer/withResponsiveContainer.js.map +1 -1
  162. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  163. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -1
  164. package/lib-commonjs/components/Sparkline/Sparkline.base.d.ts +3 -2
  165. package/lib-commonjs/components/Sparkline/Sparkline.base.js.map +1 -1
  166. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.d.ts +2 -1
  167. package/lib-commonjs/components/StackedBarChart/MultiStackedBarChart.base.js.map +1 -1
  168. package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.d.ts +2 -1
  169. package/lib-commonjs/components/StackedBarChart/StackedBarChart.base.js.map +1 -1
  170. package/lib-commonjs/components/TreeChart/TreeChart.base.d.ts +2 -1
  171. package/lib-commonjs/components/TreeChart/TreeChart.base.js.map +1 -1
  172. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +2 -1
  173. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  174. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  175. package/lib-commonjs/utilities/image-export-utils.js.map +1 -1
  176. package/lib-commonjs/utilities/scatterpolar-utils.d.ts +2 -2
  177. package/lib-commonjs/utilities/scatterpolar-utils.js.map +1 -1
  178. package/lib-commonjs/utilities/utilities.d.ts +14 -14
  179. package/lib-commonjs/utilities/utilities.js.map +1 -1
  180. package/lib-commonjs/utilities/vbc-utils.js.map +1 -1
  181. package/package.json +5 -5
  182. package/src/components/CommonComponents/CartesianChart.types.ts +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"vbc-utils.js","sourceRoot":"../src/","sources":["utilities/vbc-utils.ts"],"names":[],"mappings":";;;AAEO,IAAM,0BAA0B,GAAG,UAAC,IAAuB;IAChE,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IACD,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC;QACpB,OAAA,CAAC,YAAY,IAAI,CAAC,CAAC,CAAE,CAAU,CAAC,OAAO,EAAE,GAAI,CAAU,CAAC,OAAO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IAAA,0BAAkB,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB","sourcesContent":["import { IMargins } from './utilities';\n\nexport const getClosestPairDiffAndRange = (data: number[] | Date[]): [number, number] | undefined => {\n if (data.length < 2) {\n return;\n }\n data = data.sort((a, b) =>\n a instanceof Date ? (a as Date).getTime() - (b as Date).getTime() : (a as number) - (b as number),\n );\n let minDiff = Number.MAX_VALUE;\n for (let i = 1; i < data.length; i++) {\n const diff =\n data[i] instanceof Date\n ? (data[i] as Date).getTime() - (data[i - 1] as Date).getTime()\n : (data[i] as number) - (data[i - 1] as number);\n minDiff = Math.min(minDiff, diff);\n }\n const range =\n data[0] instanceof Date\n ? (data[data.length - 1] as Date).getTime() - (data[0] as Date).getTime()\n : (data[data.length - 1] as number) - (data[0] as number);\n return [minDiff, range];\n};\n\nexport const calculateAppropriateBarWidth = (data: number[] | Date[], totalWidth: number, innerPadding: number) => {\n const result = getClosestPairDiffAndRange(data);\n if (!result || result[1] === 0) {\n return 16;\n }\n const [closestPairDiff, range] = result;\n // Refer to https://microsoft.github.io/fluentui-charting-contrib/docs/rfcs/fix-overlapping-bars-on-continuous-axes\n // for the derivation of the following formula.\n const barWidth = Math.floor(\n (totalWidth * closestPairDiff * (1 - innerPadding)) / (range + closestPairDiff * (1 - innerPadding)),\n );\n return barWidth;\n};\n\n/**\n * Calculates the total width available for rendering bars.\n */\nexport const calcTotalWidth = (containerWidth: number, margins: IMargins, extraMargin = 0): number => {\n return containerWidth - (margins.left || 0) - (margins.right || 0) - extraMargin * 2;\n};\n\n/**\n * Calculates the combined size of all bands and the gaps between them, in units relative to the bandwidth.\n */\nexport const calcTotalBandUnits = (numBands: number, innerPadding: number) => {\n // inner_padding = space_between_bands / (space_between_bands + bandwidth)\n // => space_between_bands = (inner_padding / (1 - inner_padding)) * bandwidth\n const gapToBandRatio = innerPadding / (1 - innerPadding);\n return numBands + (numBands - 1) * gapToBandRatio;\n};\n\n/**\n * Calculates the total width required to render all bands including the gaps between them.\n */\nexport const calcRequiredWidth = (bandwidth: number, numBands: number, innerPadding: number) => {\n return bandwidth * calcTotalBandUnits(numBands, innerPadding);\n};\n\n/**\n * Calculates the maximum possible bandwidth such that the combined widths of all bands\n * and the gaps between them exactly fill the total available width.\n */\nexport const calcBandwidth = (totalWidth: number, numBands: number, innerPadding: number) => {\n return totalWidth / calcTotalBandUnits(numBands, innerPadding);\n};\n"]}
1
+ {"version":3,"file":"vbc-utils.js","sourceRoot":"../src/","sources":["utilities/vbc-utils.ts"],"names":[],"mappings":";;;AAEO,IAAM,0BAA0B,GAAG,UAAC,IAAuB;IAChE,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO;IACT,CAAC;IACD,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,UAAC,CAAC,EAAE,CAAC;QACpB,OAAA,CAAC,YAAY,IAAI,CAAC,CAAC,CAAE,CAAU,CAAC,OAAO,EAAE,GAAI,CAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAE,CAAY,GAAI,CAAY;IAAjG,CAAiG,CAClG,CAAC;IACF,IAAI,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAM,IAAI,GACR,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI;YACrB,CAAC,CAAE,IAAI,CAAC,CAAC,CAAU,CAAC,OAAO,EAAE,GAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAU,CAAC,OAAO,EAAE;YAC/D,CAAC,CAAE,IAAI,CAAC,CAAC,CAAY,GAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAY,CAAC;QACpD,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACpC,CAAC;IACD,I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,GAAG,CAAC,CAAC;AACvF,CAAC,CAAC;AAFW,QAAA,cAAc,kBAEzB;AAEF;;GAEG;AACI,IAAM,kBAAkB,GAAG,UAAC,QAAgB,EAAE,YAAoB;IACvE,0EAA0E;IAC1E,6EAA6E;IAC7E,IAAM,cAAc,GAAG,YAAY,GAAG,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC;IACzD,OAAO,QAAQ,GAAG,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,cAAc,CAAC;AACpD,CAAC,CAAC;AALW,QAAA,kBAAkB,sBAK7B;AAEF;;GAEG;AACI,IAAM,iBAAiB,GAAG,UAAC,SAAiB,EAAE,QAAgB,EAAE,YAAoB;IACzF,OAAO,SAAS,GAAG,IAAA,0BAAkB,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAChE,CAAC,CAAC;AAFW,QAAA,iBAAiB,qBAE5B;AAEF;;;GAGG;AACI,IAAM,aAAa,GAAG,UAAC,UAAkB,EAAE,QAAgB,EAAE,YAAoB;IACtF,OAAO,UAAU,GAAG,IAAA,0BAAkB,EAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AACjE,CAAC,CAAC;AAFW,QAAA,aAAa,iBAExB","sourcesContent":["import { IMargins } from './utilities';\n\nexport const getClosestPairDiffAndRange = (data: number[] | Date[]): [number, number] | undefined => {\n if (data.length < 2) {\n return;\n }\n data = data.sort((a, b) =>\n a instanceof Date ? (a as Date).getTime() - (b as Date).getTime() : (a as number) - (b as number),\n );\n let minDiff = Number.MAX_VALUE;\n for (let i = 1; i < data.length; i++) {\n const diff =\n data[i] instanceof Date\n ? (data[i] as Date).getTime() - (data[i - 1] as Date).getTime()\n : (data[i] as number) - (data[i - 1] as number);\n minDiff = Math.min(minDiff, diff);\n }\n const range =\n data[0] instanceof Date\n ? (data[data.length - 1] as Date).getTime() - (data[0] as Date).getTime()\n : (data[data.length - 1] as number) - (data[0] as number);\n return [minDiff, range];\n};\n\nexport const calculateAppropriateBarWidth = (\n data: number[] | Date[],\n totalWidth: number,\n innerPadding: number,\n): number => {\n const result = getClosestPairDiffAndRange(data);\n if (!result || result[1] === 0) {\n return 16;\n }\n const [closestPairDiff, range] = result;\n // Refer to https://microsoft.github.io/fluentui-charting-contrib/docs/rfcs/fix-overlapping-bars-on-continuous-axes\n // for the derivation of the following formula.\n const barWidth = Math.floor(\n (totalWidth * closestPairDiff * (1 - innerPadding)) / (range + closestPairDiff * (1 - innerPadding)),\n );\n return barWidth;\n};\n\n/**\n * Calculates the total width available for rendering bars.\n */\nexport const calcTotalWidth = (containerWidth: number, margins: IMargins, extraMargin = 0): number => {\n return containerWidth - (margins.left || 0) - (margins.right || 0) - extraMargin * 2;\n};\n\n/**\n * Calculates the combined size of all bands and the gaps between them, in units relative to the bandwidth.\n */\nexport const calcTotalBandUnits = (numBands: number, innerPadding: number): number => {\n // inner_padding = space_between_bands / (space_between_bands + bandwidth)\n // => space_between_bands = (inner_padding / (1 - inner_padding)) * bandwidth\n const gapToBandRatio = innerPadding / (1 - innerPadding);\n return numBands + (numBands - 1) * gapToBandRatio;\n};\n\n/**\n * Calculates the total width required to render all bands including the gaps between them.\n */\nexport const calcRequiredWidth = (bandwidth: number, numBands: number, innerPadding: number): number => {\n return bandwidth * calcTotalBandUnits(numBands, innerPadding);\n};\n\n/**\n * Calculates the maximum possible bandwidth such that the combined widths of all bands\n * and the gaps between them exactly fill the total available width.\n */\nexport const calcBandwidth = (totalWidth: number, numBands: number, innerPadding: number): number => {\n return totalWidth / calcTotalBandUnits(numBands, innerPadding);\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-charting",
3
- "version": "5.24.37",
3
+ "version": "5.24.39",
4
4
  "description": "React web charting controls for Microsoft fluentui system.",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -36,9 +36,9 @@
36
36
  "jest-canvas-mock": "2.4.0"
37
37
  },
38
38
  "dependencies": {
39
- "@fluentui/chart-utilities": "^1.1.33",
40
- "@fluentui/react-focus": "^8.9.27",
41
- "@fluentui/theme-samples": "^8.7.216",
39
+ "@fluentui/chart-utilities": "^1.1.34",
40
+ "@fluentui/react-focus": "^8.9.29",
41
+ "@fluentui/theme-samples": "^8.7.218",
42
42
  "@microsoft/load-themed-styles": "^1.10.26",
43
43
  "@types/d3-array": "^3.0.0",
44
44
  "@types/d3-axis": "^3.0.0",
@@ -66,7 +66,7 @@
66
66
  "tslib": "^2.1.0"
67
67
  },
68
68
  "peerDependencies": {
69
- "@fluentui/react": "^8.124.0",
69
+ "@fluentui/react": "^8.124.2",
70
70
  "@types/react": ">=16.8.0 <19.0.0",
71
71
  "@types/react-dom": ">=16.8.0 <19.0.0",
72
72
  "react": ">=16.8.0 <19.0.0",
@@ -26,6 +26,7 @@ import { IChartHoverCardProps } from '../../utilities/index';
26
26
  import { TimeLocaleDefinition } from 'd3-time-format';
27
27
  import { ChartTypes, IAxisData, IDomainNRange, IYAxisParams, XAxisTypes, YAxisType } from '../../utilities/utilities';
28
28
  import { ScaleBand, ScaleLinear } from 'd3-scale';
29
+ import type { JSXElement } from '@fluentui/utilities';
29
30
 
30
31
  /**
31
32
  * Cartesian Chart style properties
@@ -609,7 +610,7 @@ export interface IModifiedCartesianChartProps extends ICartesianChartProps {
609
610
  * Legends of the chart.
610
611
  */
611
612
  // eslint-disable-next-line @typescript-eslint/no-deprecated
612
- legendBars: JSX.Element | null;
613
+ legendBars: JSXElement | null;
613
614
 
614
615
  /**
615
616
  * Callout props