@fluentui/react-charts 9.3.12 → 9.3.14

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 (55) hide show
  1. package/CHANGELOG.md +25 -2
  2. package/dist/index.d.ts +859 -0
  3. package/lib/VegaDeclarativeChart.js +1 -0
  4. package/lib/VegaDeclarativeChart.js.map +1 -0
  5. package/lib/components/LineChart/LineChart.js +47 -7
  6. package/lib/components/LineChart/LineChart.js.map +1 -1
  7. package/lib/components/ScatterChart/ScatterChart.js +12 -12
  8. package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
  9. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js +405 -0
  10. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +1 -0
  11. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +20 -0
  12. package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +1 -0
  13. package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +415 -0
  14. package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +1 -0
  15. package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +537 -0
  16. package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +1 -0
  17. package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +3279 -0
  18. package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +1 -0
  19. package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js +28 -0
  20. package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js.map +1 -0
  21. package/lib/components/VegaDeclarativeChart/index.js +1 -0
  22. package/lib/components/VegaDeclarativeChart/index.js.map +1 -0
  23. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +5 -2
  24. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  25. package/lib/index.js +1 -0
  26. package/lib/index.js.map +1 -1
  27. package/lib/utilities/utilities.js +41 -0
  28. package/lib/utilities/utilities.js.map +1 -1
  29. package/lib-commonjs/VegaDeclarativeChart.js +6 -0
  30. package/lib-commonjs/VegaDeclarativeChart.js.map +1 -0
  31. package/lib-commonjs/components/LineChart/LineChart.js +46 -6
  32. package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
  33. package/lib-commonjs/components/ScatterChart/ScatterChart.js +11 -11
  34. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
  35. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js +274 -0
  36. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +1 -0
  37. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +35 -0
  38. package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +1 -0
  39. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +412 -0
  40. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +1 -0
  41. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +533 -0
  42. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +1 -0
  43. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +3214 -0
  44. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +1 -0
  45. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js +31 -0
  46. package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js.map +1 -0
  47. package/lib-commonjs/components/VegaDeclarativeChart/index.js +6 -0
  48. package/lib-commonjs/components/VegaDeclarativeChart/index.js.map +1 -0
  49. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +4 -1
  50. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
  51. package/lib-commonjs/index.js +1 -0
  52. package/lib-commonjs/index.js.map +1 -1
  53. package/lib-commonjs/utilities/utilities.js +33 -0
  54. package/lib-commonjs/utilities/utilities.js.map +1 -1
  55. package/package.json +3 -3
@@ -1715,6 +1715,41 @@ export const getScatterXDomainExtent = (points, scaleType)=>{
1715
1715
  xMax
1716
1716
  ];
1717
1717
  };
1718
+ /**
1719
+ * Calculates the radius for a marker/circle in scatter and line charts.
1720
+ * Handles both continuous (numeric/date) and categorical (string) axes.
1721
+ *
1722
+ * @param pointMarkerSize - The marker size value for the current data point
1723
+ * @param minMarkerSize - The minimum marker size across all data points
1724
+ * @param maxMarkerSize - The maximum marker size across all data points
1725
+ * @param extraMaxPixels - The maximum available pixels for markers (from getRangeForScatterMarkerSize)
1726
+ * @param isContinuousXY - Whether both X and Y axes are continuous (not string-based)
1727
+ * @param isActive - Whether the current point is active/hovered
1728
+ * @param defaultRadius - Default radius when no marker size is specified (default: 3.5)
1729
+ * @param activeRadius - Radius when the point is active (default: 5.5)
1730
+ * @param minRadius - Minimum radius to ensure markers are visible (default: 4)
1731
+ * @returns The calculated radius in pixels
1732
+ */ export const calculateMarkerRadius = ({ pointMarkerSize, minMarkerSize, maxMarkerSize, extraMaxPixels, isContinuousXY, isActive = false, defaultRadius = 3.5, activeRadius = 5.5, minRadius = 4 })=>{
1733
+ const minPixel = 4;
1734
+ const maxPixel = 16;
1735
+ // If no marker size is specified, use default or active radius
1736
+ if (!pointMarkerSize) {
1737
+ return isActive ? activeRadius : defaultRadius;
1738
+ }
1739
+ let radius;
1740
+ if (isContinuousXY && maxMarkerSize !== 0) {
1741
+ // For continuous axes: scale markers based on available space
1742
+ radius = maxMarkerSize < extraMaxPixels ? pointMarkerSize : pointMarkerSize / maxMarkerSize * extraMaxPixels;
1743
+ } else if (!isContinuousXY && maxMarkerSize !== minMarkerSize) {
1744
+ // For categorical axes: normalize to pixel range [minPixel, maxPixel]
1745
+ radius = minPixel + (pointMarkerSize - minMarkerSize) / (maxMarkerSize - minMarkerSize) * (maxPixel - minPixel);
1746
+ } else {
1747
+ // Fallback to default/active radius
1748
+ return isActive ? activeRadius : defaultRadius;
1749
+ }
1750
+ // Ensure minimum radius for visibility
1751
+ return Math.max(radius, minRadius);
1752
+ };
1718
1753
  export const getRangeForScatterMarkerSize = ({ data, xScale, yScalePrimary, yScaleSecondary, useSecondaryYScale, xScaleType, yScaleType: primaryYScaleType, secondaryYScaleType })=>{
1719
1754
  // Note: This function is executed after the scale is created, so the actual padding can be
1720
1755
  // obtained by calculating the difference between the respective minimums or maximums of the
@@ -1956,3 +1991,9 @@ const truncateTextToFitWidth = (text, maxWidth, measure)=>{
1956
1991
  }
1957
1992
  return text.slice(0, lo) + '...';
1958
1993
  };
1994
+ export function isSafeUrl(href) {
1995
+ if (/^[a-z][a-z0-9+.-]*:/i.test(href)) {
1996
+ return /^https?:/i.test(href);
1997
+ }
1998
+ return true;
1999
+ }