@fluentui/react-charting 5.24.1 → 5.24.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/CHANGELOG.json +61 -1
  2. package/CHANGELOG.md +25 -2
  3. package/dist/react-charting.d.ts +171 -33
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +60 -10
  7. package/lib/ScatterChart.d.ts +1 -0
  8. package/lib/ScatterChart.js +2 -0
  9. package/lib/ScatterChart.js.map +1 -0
  10. package/lib/components/CommonComponents/CartesianChart.base.js +45 -9
  11. package/lib/components/CommonComponents/CartesianChart.base.js.map +1 -1
  12. package/lib/components/CommonComponents/CartesianChart.styles.js +48 -26
  13. package/lib/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  14. package/lib/components/CommonComponents/CartesianChart.types.d.ts +21 -1
  15. package/lib/components/CommonComponents/CartesianChart.types.js.map +1 -1
  16. package/lib/components/DeclarativeChart/DeclarativeChart.js +157 -78
  17. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  18. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +29 -13
  19. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +351 -95
  20. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  21. package/lib/components/LineChart/LineChart.base.js +23 -17
  22. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  23. package/lib/components/LineChart/LineChart.styles.js +9 -0
  24. package/lib/components/LineChart/LineChart.styles.js.map +1 -1
  25. package/lib/components/LineChart/LineChart.types.d.ts +2 -0
  26. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  27. package/lib/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  28. package/lib/components/ScatterChart/ScatterChart.base.js +453 -0
  29. package/lib/components/ScatterChart/ScatterChart.base.js.map +1 -0
  30. package/lib/components/ScatterChart/ScatterChart.d.ts +7 -0
  31. package/lib/components/ScatterChart/ScatterChart.js +10 -0
  32. package/lib/components/ScatterChart/ScatterChart.js.map +1 -0
  33. package/lib/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  34. package/lib/components/ScatterChart/ScatterChart.styles.js +7 -0
  35. package/lib/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  36. package/lib/components/ScatterChart/ScatterChart.types.d.ts +42 -0
  37. package/lib/components/ScatterChart/ScatterChart.types.js +2 -0
  38. package/lib/components/ScatterChart/ScatterChart.types.js.map +1 -0
  39. package/lib/components/ScatterChart/index.d.ts +2 -0
  40. package/lib/components/ScatterChart/index.js +3 -0
  41. package/lib/components/ScatterChart/index.js.map +1 -0
  42. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
  43. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  44. package/lib/index.d.ts +3 -1
  45. package/lib/index.js +1 -0
  46. package/lib/index.js.map +1 -1
  47. package/lib/types/IDataPoint.d.ts +77 -11
  48. package/lib/types/IDataPoint.js.map +1 -1
  49. package/lib/utilities/SVGTooltipText.d.ts +4 -0
  50. package/lib/utilities/SVGTooltipText.js +1 -2
  51. package/lib/utilities/SVGTooltipText.js.map +1 -1
  52. package/lib/utilities/utilities.d.ts +27 -3
  53. package/lib/utilities/utilities.js +102 -1
  54. package/lib/utilities/utilities.js.map +1 -1
  55. package/lib-amd/ScatterChart.d.ts +1 -0
  56. package/lib-amd/ScatterChart.js +6 -0
  57. package/lib-amd/ScatterChart.js.map +1 -0
  58. package/lib-amd/components/CommonComponents/CartesianChart.base.js +45 -9
  59. package/lib-amd/components/CommonComponents/CartesianChart.base.js.map +1 -1
  60. package/lib-amd/components/CommonComponents/CartesianChart.styles.js +48 -26
  61. package/lib-amd/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  62. package/lib-amd/components/CommonComponents/CartesianChart.types.d.ts +21 -1
  63. package/lib-amd/components/CommonComponents/CartesianChart.types.js.map +1 -1
  64. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +155 -78
  65. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  66. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +29 -13
  67. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +362 -102
  68. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  69. package/lib-amd/components/LineChart/LineChart.base.js +23 -17
  70. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  71. package/lib-amd/components/LineChart/LineChart.styles.js +9 -1
  72. package/lib-amd/components/LineChart/LineChart.styles.js.map +1 -1
  73. package/lib-amd/components/LineChart/LineChart.types.d.ts +2 -0
  74. package/lib-amd/components/LineChart/LineChart.types.js.map +1 -1
  75. package/lib-amd/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  76. package/lib-amd/components/ScatterChart/ScatterChart.base.js +447 -0
  77. package/lib-amd/components/ScatterChart/ScatterChart.base.js.map +1 -0
  78. package/lib-amd/components/ScatterChart/ScatterChart.d.ts +7 -0
  79. package/lib-amd/components/ScatterChart/ScatterChart.js +12 -0
  80. package/lib-amd/components/ScatterChart/ScatterChart.js.map +1 -0
  81. package/lib-amd/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  82. package/lib-amd/components/ScatterChart/ScatterChart.styles.js +12 -0
  83. package/lib-amd/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  84. package/lib-amd/components/ScatterChart/ScatterChart.types.d.ts +42 -0
  85. package/lib-amd/components/ScatterChart/ScatterChart.types.js +5 -0
  86. package/lib-amd/components/ScatterChart/ScatterChart.types.js.map +1 -0
  87. package/lib-amd/components/ScatterChart/index.d.ts +2 -0
  88. package/lib-amd/components/ScatterChart/index.js +7 -0
  89. package/lib-amd/components/ScatterChart/index.js.map +1 -0
  90. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
  91. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  92. package/lib-amd/index.d.ts +3 -1
  93. package/lib-amd/index.js +3 -2
  94. package/lib-amd/index.js.map +1 -1
  95. package/lib-amd/types/IDataPoint.d.ts +77 -11
  96. package/lib-amd/types/IDataPoint.js.map +1 -1
  97. package/lib-amd/utilities/SVGTooltipText.d.ts +4 -0
  98. package/lib-amd/utilities/SVGTooltipText.js +1 -2
  99. package/lib-amd/utilities/SVGTooltipText.js.map +1 -1
  100. package/lib-amd/utilities/utilities.d.ts +27 -3
  101. package/lib-amd/utilities/utilities.js +106 -2
  102. package/lib-amd/utilities/utilities.js.map +1 -1
  103. package/lib-commonjs/ScatterChart.d.ts +1 -0
  104. package/lib-commonjs/ScatterChart.js +5 -0
  105. package/lib-commonjs/ScatterChart.js.map +1 -0
  106. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js +45 -9
  107. package/lib-commonjs/components/CommonComponents/CartesianChart.base.js.map +1 -1
  108. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js +48 -26
  109. package/lib-commonjs/components/CommonComponents/CartesianChart.styles.js.map +1 -1
  110. package/lib-commonjs/components/CommonComponents/CartesianChart.types.d.ts +21 -1
  111. package/lib-commonjs/components/CommonComponents/CartesianChart.types.js.map +1 -1
  112. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +157 -78
  113. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  114. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.d.ts +29 -13
  115. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +361 -102
  116. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  117. package/lib-commonjs/components/LineChart/LineChart.base.js +23 -17
  118. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  119. package/lib-commonjs/components/LineChart/LineChart.styles.js +9 -0
  120. package/lib-commonjs/components/LineChart/LineChart.styles.js.map +1 -1
  121. package/lib-commonjs/components/LineChart/LineChart.types.d.ts +2 -0
  122. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  123. package/lib-commonjs/components/ScatterChart/ScatterChart.base.d.ts +7 -0
  124. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js +456 -0
  125. package/lib-commonjs/components/ScatterChart/ScatterChart.base.js.map +1 -0
  126. package/lib-commonjs/components/ScatterChart/ScatterChart.d.ts +7 -0
  127. package/lib-commonjs/components/ScatterChart/ScatterChart.js +13 -0
  128. package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -0
  129. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.d.ts +2 -0
  130. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js +11 -0
  131. package/lib-commonjs/components/ScatterChart/ScatterChart.styles.js.map +1 -0
  132. package/lib-commonjs/components/ScatterChart/ScatterChart.types.d.ts +42 -0
  133. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js +3 -0
  134. package/lib-commonjs/components/ScatterChart/ScatterChart.types.js.map +1 -0
  135. package/lib-commonjs/components/ScatterChart/index.d.ts +2 -0
  136. package/lib-commonjs/components/ScatterChart/index.js +6 -0
  137. package/lib-commonjs/components/ScatterChart/index.js.map +1 -0
  138. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +8 -2
  139. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  140. package/lib-commonjs/index.d.ts +3 -1
  141. package/lib-commonjs/index.js +3 -1
  142. package/lib-commonjs/index.js.map +1 -1
  143. package/lib-commonjs/types/IDataPoint.d.ts +77 -11
  144. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  145. package/lib-commonjs/utilities/SVGTooltipText.d.ts +4 -0
  146. package/lib-commonjs/utilities/SVGTooltipText.js +1 -2
  147. package/lib-commonjs/utilities/SVGTooltipText.js.map +1 -1
  148. package/lib-commonjs/utilities/utilities.d.ts +27 -3
  149. package/lib-commonjs/utilities/utilities.js +106 -2
  150. package/lib-commonjs/utilities/utilities.js.map +1 -1
  151. package/package.json +2 -2
  152. package/src/components/CommonComponents/CartesianChart.types.ts +25 -1
  153. package/src/components/LineChart/LineChart.types.ts +4 -1
  154. package/src/components/ScatterChart/ScatterChart.types.ts +61 -0
@@ -1,7 +1,16 @@
1
1
  import { __assign } from "tslib";
2
+ import { HighContrastSelector } from '@fluentui/react/lib/Styling';
2
3
  export var getStyles = function (props) {
4
+ var _a;
3
5
  return {
4
6
  tooltip: __assign(__assign({}, props.theme.fonts.medium), { display: 'flex', flexDirection: 'column', padding: '8px', position: 'absolute', textAlign: 'center', top: '0px', background: props.theme.semanticColors.bodyBackground, borderRadius: '2px', pointerEvents: 'none', color: props.theme.semanticColors.bodyText }),
7
+ markerLabel: {
8
+ selectors: (_a = {},
9
+ _a[HighContrastSelector] = {
10
+ fill: 'CanvasText',
11
+ },
12
+ _a),
13
+ },
5
14
  };
6
15
  };
7
16
  //# sourceMappingURL=LineChart.styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.styles.js","sourceRoot":"../src/","sources":["components/LineChart/LineChart.styles.ts"],"names":[],"mappings":";AAEA,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,KAA2B;IACnD,OAAO;QACL,OAAO,wBACF,KAAK,CAAC,KAAM,CAAC,KAAK,CAAC,MAAM,KAC5B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,QAAQ,EACvB,OAAO,EAAE,KAAK,EACd,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,QAAQ,EACnB,GAAG,EAAE,KAAK,EACV,UAAU,EAAE,KAAK,CAAC,KAAM,CAAC,cAAc,CAAC,cAAc,EACtD,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,KAAK,CAAC,KAAM,CAAC,cAAc,CAAC,QAAQ,GAC5C;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { ILineChartStyleProps, ILineChartStyles } from './LineChart.types';\n\nexport const getStyles = (props: ILineChartStyleProps): ILineChartStyles => {\n return {\n tooltip: {\n ...props.theme!.fonts.medium,\n display: 'flex',\n flexDirection: 'column',\n padding: '8px',\n position: 'absolute',\n textAlign: 'center',\n top: '0px',\n background: props.theme!.semanticColors.bodyBackground,\n borderRadius: '2px',\n pointerEvents: 'none',\n color: props.theme!.semanticColors.bodyText,\n },\n };\n};\n"]}
1
+ {"version":3,"file":"LineChart.styles.js","sourceRoot":"../src/","sources":["components/LineChart/LineChart.styles.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGnE,MAAM,CAAC,IAAM,SAAS,GAAG,UAAC,KAA2B;;IACnD,OAAO;QACL,OAAO,wBACF,KAAK,CAAC,KAAM,CAAC,KAAK,CAAC,MAAM,KAC5B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,QAAQ,EACvB,OAAO,EAAE,KAAK,EACd,QAAQ,EAAE,UAAU,EACpB,SAAS,EAAE,QAAQ,EACnB,GAAG,EAAE,KAAK,EACV,UAAU,EAAE,KAAK,CAAC,KAAM,CAAC,cAAc,CAAC,cAAc,EACtD,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,KAAK,CAAC,KAAM,CAAC,cAAc,CAAC,QAAQ,GAC5C;QACD,WAAW,EAAE;YACX,SAAS;gBACP,GAAC,oBAAoB,IAAG;oBACtB,IAAI,EAAE,YAAY;iBACnB;mBACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { HighContrastSelector } from '@fluentui/react/lib/Styling';\nimport { ILineChartStyleProps, ILineChartStyles } from './LineChart.types';\n\nexport const getStyles = (props: ILineChartStyleProps): ILineChartStyles => {\n return {\n tooltip: {\n ...props.theme!.fonts.medium,\n display: 'flex',\n flexDirection: 'column',\n padding: '8px',\n position: 'absolute',\n textAlign: 'center',\n top: '0px',\n background: props.theme!.semanticColors.bodyBackground,\n borderRadius: '2px',\n pointerEvents: 'none',\n color: props.theme!.semanticColors.bodyText,\n },\n markerLabel: {\n selectors: {\n [HighContrastSelector]: {\n fill: 'CanvasText',\n },\n },\n },\n };\n};\n"]}
@@ -2,6 +2,7 @@ import { IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Uti
2
2
  import { IChartProps, ILineChartPoints, IMargins, IBasestate, IRefArrayData, ICustomizedCalloutData } from '../../types/index';
3
3
  import { IEventAnnotation } from '../../types/IEventAnnotation';
4
4
  import { ICartesianChartProps, ICartesianChartStyleProps, ICartesianChartStyles, IChildProps } from '../CommonComponents/index';
5
+ import { IStyle } from '@fluentui/react/lib/Styling';
5
6
  export type { IChildProps, ILineChartPoints, IMargins, IBasestate, IRefArrayData };
6
7
  /**
7
8
  * Line Chart properties
@@ -77,6 +78,7 @@ export interface IEventsAnnotationProps {
77
78
  * {@docCategory LineChart}
78
79
  */
79
80
  export interface ILineChartStyles extends ICartesianChartStyles {
81
+ markerLabel?: IStyle;
80
82
  }
81
83
  /**
82
84
  * Line Chart style properties
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.types.js","sourceRoot":"../src/","sources":["components/LineChart/LineChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport {\n IChartProps,\n ILineChartPoints,\n IMargins,\n IBasestate,\n IRefArrayData,\n ICustomizedCalloutData,\n} from '../../types/index';\nimport { IEventAnnotation } from '../../types/IEventAnnotation';\nimport {\n ICartesianChartProps,\n ICartesianChartStyleProps,\n ICartesianChartStyles,\n IChildProps,\n} from '../CommonComponents/index';\n\nexport type { IChildProps, ILineChartPoints, IMargins, IBasestate, IRefArrayData };\n\n/**\n * Line Chart properties\n * {@docCategory LineChart}\n */\nexport interface ILineChartProps extends ICartesianChartProps {\n /**\n * Data to render in the chart.\n */\n data: IChartProps;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<ILineChartStyleProps, ILineChartStyles>;\n\n /**\n * Show event annotation\n */\n eventAnnotationProps?: IEventsAnnotationProps;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: IRenderFunction<ICustomizedCalloutData>;\n\n /**\n * Define a custom callout renderer for a stack; default is to render per data point\n */\n onRenderCalloutPerStack?: IRenderFunction<ICustomizedCalloutData>;\n\n /**\n * Callback for getting callout description message\n */\n getCalloutDescriptionMessage?: (calloutDataProps: ICustomizedCalloutData) => string | undefined;\n\n /*\n * Color fill bars for the chart,\n */\n colorFillBars?: IColorFillBarsProps[];\n\n /**\n * if this is set to true, then for each line there will be a unique shape assigned to the point,\n * there are total 8 shapes which are as follow circle, square, triangele, diamond, pyramid,\n * hexagon, pentagon and octagon, which will get assigned as respectively, if there are more\n * than 8 lines in the line chart then it will again start from cicle to octagon.\n * setting this flag to true will also change the behavior of the points, like for a\n * line, last point shape and first point shape will be visible all the times, and all\n * other points will get enlarge only when hovered over them\n * if set to false default shape will be circle, with the existing behavior\n * @default false\n */\n allowMultipleShapesForPoints?: boolean;\n\n /*\n * Optimize line chart rendering for large data set. If this prop is enabled, line chart\n * can easily render over 10K datapoints with multiple lines smoothly.\n * This rendering mechanism does not support gaps in lines.\n */\n optimizeLargeData?: boolean;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * @default false\n * The prop used to enable the perf optimization\n */\n enablePerfOptimization?: boolean;\n\n /**\n * The prop used to define line chart mode(default or scatter)\n * @deprecated this prop no longer used to identify scatter mode\n */\n lineMode?: 'default' | 'scatter';\n}\n\n/**\n * {@docCategory LineChart}\n */\nexport interface IEventsAnnotationProps {\n events: IEventAnnotation[];\n strokeColor?: string;\n labelColor?: string;\n labelHeight?: number;\n labelWidth?: number;\n mergedLabel: (count: number) => string;\n}\n\n/**\n * Line Chart styles\n * {@docCategory LineChart}\n */\nexport interface ILineChartStyles extends ICartesianChartStyles {}\n\n/**\n * Line Chart style properties\n * {@docCategory LineChart}\n */\nexport interface ILineChartStyleProps extends ICartesianChartStyleProps {}\n\n/**\n * {@docCategory LineChart}\n */\nexport interface IColorFillBarsProps {\n legend: string;\n color: string;\n data: IColorFillBarData[];\n applyPattern?: boolean;\n onLegendClick?: (selectedLegend: string | string[] | null) => void | undefined;\n}\n\n/**\n * {@docCategory LineChart}\n */\nexport interface IColorFillBarData {\n startX: number | Date;\n endX: number | Date;\n}\n"]}
1
+ {"version":3,"file":"LineChart.types.js","sourceRoot":"../src/","sources":["components/LineChart/LineChart.types.ts"],"names":[],"mappings":"","sourcesContent":["import { IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport {\n IChartProps,\n ILineChartPoints,\n IMargins,\n IBasestate,\n IRefArrayData,\n ICustomizedCalloutData,\n} from '../../types/index';\nimport { IEventAnnotation } from '../../types/IEventAnnotation';\nimport {\n ICartesianChartProps,\n ICartesianChartStyleProps,\n ICartesianChartStyles,\n IChildProps,\n} from '../CommonComponents/index';\nimport { IStyle } from '@fluentui/react/lib/Styling';\n\nexport type { IChildProps, ILineChartPoints, IMargins, IBasestate, IRefArrayData };\n\n/**\n * Line Chart properties\n * {@docCategory LineChart}\n */\nexport interface ILineChartProps extends ICartesianChartProps {\n /**\n * Data to render in the chart.\n */\n data: IChartProps;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<ILineChartStyleProps, ILineChartStyles>;\n\n /**\n * Show event annotation\n */\n eventAnnotationProps?: IEventsAnnotationProps;\n\n /**\n * Define a custom callout renderer for a data point\n */\n onRenderCalloutPerDataPoint?: IRenderFunction<ICustomizedCalloutData>;\n\n /**\n * Define a custom callout renderer for a stack; default is to render per data point\n */\n onRenderCalloutPerStack?: IRenderFunction<ICustomizedCalloutData>;\n\n /**\n * Callback for getting callout description message\n */\n getCalloutDescriptionMessage?: (calloutDataProps: ICustomizedCalloutData) => string | undefined;\n\n /*\n * Color fill bars for the chart,\n */\n colorFillBars?: IColorFillBarsProps[];\n\n /**\n * if this is set to true, then for each line there will be a unique shape assigned to the point,\n * there are total 8 shapes which are as follow circle, square, triangele, diamond, pyramid,\n * hexagon, pentagon and octagon, which will get assigned as respectively, if there are more\n * than 8 lines in the line chart then it will again start from cicle to octagon.\n * setting this flag to true will also change the behavior of the points, like for a\n * line, last point shape and first point shape will be visible all the times, and all\n * other points will get enlarge only when hovered over them\n * if set to false default shape will be circle, with the existing behavior\n * @default false\n */\n allowMultipleShapesForPoints?: boolean;\n\n /*\n * Optimize line chart rendering for large data set. If this prop is enabled, line chart\n * can easily render over 10K datapoints with multiple lines smoothly.\n * This rendering mechanism does not support gaps in lines.\n */\n optimizeLargeData?: boolean;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * @default false\n * The prop used to enable the perf optimization\n */\n enablePerfOptimization?: boolean;\n\n /**\n * The prop used to define line chart mode(default or scatter)\n * @deprecated this prop no longer used to identify scatter mode\n */\n lineMode?: 'default' | 'scatter';\n}\n\n/**\n * {@docCategory LineChart}\n */\nexport interface IEventsAnnotationProps {\n events: IEventAnnotation[];\n strokeColor?: string;\n labelColor?: string;\n labelHeight?: number;\n labelWidth?: number;\n mergedLabel: (count: number) => string;\n}\n\n/**\n * Line Chart styles\n * {@docCategory LineChart}\n */\nexport interface ILineChartStyles extends ICartesianChartStyles {\n markerLabel?: IStyle;\n}\n\n/**\n * Line Chart style properties\n * {@docCategory LineChart}\n */\nexport interface ILineChartStyleProps extends ICartesianChartStyleProps {}\n\n/**\n * {@docCategory LineChart}\n */\nexport interface IColorFillBarsProps {\n legend: string;\n color: string;\n data: IColorFillBarData[];\n applyPattern?: boolean;\n onLegendClick?: (selectedLegend: string | string[] | null) => void | undefined;\n}\n\n/**\n * {@docCategory LineChart}\n */\nexport interface IColorFillBarData {\n startX: number | Date;\n endX: number | Date;\n}\n"]}
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { IScatterChartProps } from './ScatterChart.types';
3
+ /**
4
+ * ScatterChart component
5
+ * {@docCategory ScatterChart}
6
+ */
7
+ export declare const ScatterChartBase: React.FunctionComponent<IScatterChartProps>;
@@ -0,0 +1,453 @@
1
+ import { __assign, __spreadArray } from "tslib";
2
+ import * as React from 'react';
3
+ import { select as d3Select } from 'd3-selection';
4
+ import { Legends } from '../Legends/index';
5
+ import { max as d3Max, min as d3Min } from 'd3-array';
6
+ import { areArraysEqual, createStringYAxis, createYAxisForScatterChart, domainRangeOfDateForScatterChart, domainRangeOfNumericForScatterChart, domainRangeOfXStringAxis, findNumericMinMaxOfY, } from '../../utilities/index';
7
+ import { CartesianChart, } from '../../index';
8
+ import { calloutData, ChartTypes, XAxisTypes, tooltipOfAxislabels, getTypeOfAxis, getNextColor, getColorFromToken, } from '../../utilities/index';
9
+ import { classNamesFunction, DirectionalHint, find, getId, getRTL } from '@fluentui/react';
10
+ import { toImage as convertToImage } from '../../utilities/image-export-utils';
11
+ import { formatDateToLocaleString } from '@fluentui/chart-utilities';
12
+ var getClassNames = classNamesFunction();
13
+ // Create a ScatterChart variant which uses these default styles and this styled subcomponent.
14
+ /**
15
+ * ScatterChart component
16
+ * {@docCategory ScatterChart}
17
+ */
18
+ export var ScatterChartBase = React.forwardRef(function (props, forwardedRef) {
19
+ var _circleId = React.useMemo(function () { return getId('circle'); }, []);
20
+ var _seriesId = React.useMemo(function () { return getId('seriesID'); }, []);
21
+ var _verticalLine = React.useMemo(function () { return getId('verticalLine'); }, []);
22
+ var _tooltipId = React.useMemo(function () { return getId('ScatterChartTooltipId_'); }, []);
23
+ var _firstRenderOptimization = true;
24
+ var _emptyChartId = React.useMemo(function () { return getId('_ScatterChart_empty'); }, []);
25
+ var _points = React.useRef(_injectIndexPropertyInScatterChartData(props.data.scatterChartData));
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
+ var _calloutPoints = React.useMemo(function () { return calloutData(_points.current) || []; }, [_points]);
28
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ var _xAxisScale = React.useRef('');
30
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+ var _yAxisScale = React.useRef('');
32
+ var _uniqueCallOutID = React.useRef(null);
33
+ var _refArray = React.useMemo(function () { return []; }, []);
34
+ var margins = React.useRef(null);
35
+ var renderSeries = React.useRef([]);
36
+ var _xAxisLabels = [];
37
+ var _xAxisCalloutAccessibilityData = {};
38
+ var _xBandwidth = React.useRef(0);
39
+ var cartesianChartRef = React.useRef(null);
40
+ var legendsRef = React.useRef(null);
41
+ var _a = React.useState(''), hoverXValue = _a[0], setHoverXValue = _a[1];
42
+ var _b = React.useState(''), activeLegend = _b[0], setActiveLegend = _b[1];
43
+ var _c = React.useState([]), YValueHover = _c[0], setYValueHover = _c[1];
44
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+ var _d = React.useState([]), selectedLegendPoints = _d[0], setSelectedLegendPoints = _d[1];
46
+ var _e = React.useState(false), isSelectedLegend = _e[0], setIsSelectedLegend = _e[1];
47
+ var _f = React.useState(''), activePoint = _f[0], setActivePoint = _f[1];
48
+ var _g = React.useState(), stackCalloutProps = _g[0], setStackCalloutProps = _g[1];
49
+ var _h = React.useState(false), isCalloutVisible = _h[0], setCalloutVisible = _h[1];
50
+ var _j = React.useState([]), selectedLegends = _j[0], setSelectedLegends = _j[1];
51
+ var _k = React.useState(''), refSelected = _k[0], setRefSelected = _k[1];
52
+ var prevPropsRef = React.useRef(null);
53
+ React.useEffect(function () {
54
+ var _a, _b, _c;
55
+ if (prevPropsRef.current) {
56
+ var prevProps = prevPropsRef.current;
57
+ if (!areArraysEqual((_a = prevProps.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends, (_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegends)) {
58
+ setSelectedLegends(((_c = props.legendProps) === null || _c === void 0 ? void 0 : _c.selectedLegends) || []);
59
+ }
60
+ }
61
+ prevPropsRef.current = props;
62
+ }, [props]);
63
+ React.useImperativeHandle(props.componentRef, function () {
64
+ var _a, _b;
65
+ return ({
66
+ chartContainer: (_b = (_a = cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer) !== null && _b !== void 0 ? _b : null,
67
+ toImage: function (opts) {
68
+ var _a, _b;
69
+ return convertToImage((_a = cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer, (_b = legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, getRTL(), opts);
70
+ },
71
+ });
72
+ }, []);
73
+ var _xAxisType = props.data.scatterChartData &&
74
+ props.data.scatterChartData.length > 0 &&
75
+ props.data.scatterChartData[0].data &&
76
+ props.data.scatterChartData[0].data.length > 0
77
+ ? getTypeOfAxis(props.data.scatterChartData[0].data[0].x, true)
78
+ : XAxisTypes.StringAxis;
79
+ var pointsRef = React.useRef([]);
80
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
81
+ var calloutPointsRef = React.useRef([]);
82
+ React.useEffect(function () {
83
+ /** note that height and width are not used to resize or set as dimesions of the chart,
84
+ * fitParentContainer is responisble for setting the height and width or resizing of the svg/chart
85
+ */
86
+ if (_points.current !== _injectIndexPropertyInScatterChartData(props.data.scatterChartData) ||
87
+ props.data !== _points.current) {
88
+ pointsRef.current = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);
89
+ calloutPointsRef.current = calloutData(pointsRef.current);
90
+ }
91
+ }, [props.height, props.width, props.data, _points]);
92
+ function _injectIndexPropertyInScatterChartData(scatterChartData) {
93
+ return scatterChartData
94
+ ? scatterChartData.map(function (item, index) {
95
+ var color;
96
+ if (typeof item.color === 'undefined') {
97
+ color = getNextColor(index, 0);
98
+ }
99
+ else {
100
+ color = getColorFromToken(item.color);
101
+ }
102
+ return __assign(__assign({}, item), { index: -1, color: color });
103
+ })
104
+ : [];
105
+ }
106
+ var _getMargins = React.useCallback(function (_margins) {
107
+ margins.current = _margins;
108
+ }, []);
109
+ function _onHoverCardHide() {
110
+ setSelectedLegendPoints([]);
111
+ setIsSelectedLegend(false);
112
+ }
113
+ function _createLegends(data) {
114
+ var legendProps = props.legendProps;
115
+ var isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
116
+ var legendDataItems = data.map(function (point) {
117
+ var color = point.color;
118
+ // mapping data to the format Legends component needs
119
+ var legend = __assign({ title: point.legend, color: color, onMouseOutAction: function () {
120
+ setActiveLegend('');
121
+ }, hoverAction: function () {
122
+ _handleChartMouseLeave();
123
+ setActiveLegend(point.legend);
124
+ } }, (point.legendShape && {
125
+ shape: point.legendShape,
126
+ }));
127
+ return legend;
128
+ });
129
+ return (React.createElement(Legends, __assign({ legends: __spreadArray([], legendDataItems, true), enabledWrapLines: props.enabledLegendsWrapLines, overflowProps: props.legendsOverflowProps, focusZonePropsInHoverCard: props.focusZonePropsForLegendsInHoverCard, overflowText: props.legendsOverflowText }, (isLegendMultiSelectEnabled && { onLegendHoverCardLeave: _onHoverCardHide }), { onChange: _onLegendSelectionChange }, props.legendProps)));
130
+ }
131
+ function _onLegendSelectionChange(legendsSelected, event, currentLegend) {
132
+ var _a, _b;
133
+ if ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.canSelectMultipleLegends) {
134
+ setSelectedLegends(legendsSelected);
135
+ }
136
+ else {
137
+ setSelectedLegends(legendsSelected.slice(-1));
138
+ }
139
+ if ((_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.onChange) {
140
+ props.legendProps.onChange(legendsSelected, event, currentLegend);
141
+ }
142
+ }
143
+ var _getPointFill = React.useCallback(function (lineColor, pointId) {
144
+ var theme = props.theme;
145
+ if (activePoint === pointId) {
146
+ return theme.semanticColors.bodyBackground;
147
+ }
148
+ else {
149
+ return lineColor;
150
+ }
151
+ }, [activePoint, props]);
152
+ var getDomainNRangeValuesScatterChart = React.useCallback(function (
153
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
154
+ points, domainMargins, width, _chartType, isRTL, xAxisType, _barWidth, tickValues) {
155
+ if (xAxisType === XAxisTypes.NumericAxis) {
156
+ return domainRangeOfNumericForScatterChart(points, domainMargins, width, isRTL);
157
+ }
158
+ else if (xAxisType === XAxisTypes.DateAxis) {
159
+ return domainRangeOfDateForScatterChart(points, domainMargins, width, isRTL, tickValues);
160
+ }
161
+ // String Axis type
162
+ return domainRangeOfXStringAxis(domainMargins, width, isRTL);
163
+ }, []);
164
+ var _handleFocus = React.useCallback(function (seriesId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData) {
165
+ _uniqueCallOutID.current = circleId;
166
+ var formattedData = x instanceof Date ? formatDateToLocaleString(x, props.culture, props.useUTC) : x;
167
+ var xVal = x instanceof Date ? x.getTime() : x;
168
+ var found = find(_calloutPoints, function (element) { return element.x === xVal; });
169
+ // if no points need to be called out then don't show vertical line and callout card
170
+ if (found) {
171
+ d3Select("#".concat(_verticalLine))
172
+ .attr('transform', function () { var _a; return "translate(".concat(((_a = _xAxisScale.current) === null || _a === void 0 ? void 0 : _a.call(_xAxisScale, x)) + _xBandwidth.current, ", 0)"); })
173
+ .attr('visibility', 'visibility');
174
+ _refArray.forEach(function (obj) {
175
+ if (obj.index === seriesId) {
176
+ setCalloutVisible(true);
177
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
178
+ setRefSelected("#".concat(circleId));
179
+ setYValueHover(found.values);
180
+ setActivePoint(circleId);
181
+ }
182
+ });
183
+ }
184
+ else {
185
+ setActivePoint(circleId);
186
+ }
187
+ }, [_verticalLine, _xAxisScale, _xBandwidth, _calloutPoints, _refArray, props.culture, props.useUTC]);
188
+ var _handleHover = React.useCallback(function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent) {
189
+ var _a;
190
+ mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
191
+ var formattedData = x instanceof Date ? formatDateToLocaleString(x, props.culture, props.useUTC) : x;
192
+ var xVal = x instanceof Date ? x.getTime() : x;
193
+ var found = find(_calloutPoints, function (element) { return element.x === xVal; });
194
+ // if no points need to be called out then don't show vertical line and callout card
195
+ if (found) {
196
+ d3Select("#".concat(_verticalLine))
197
+ .attr('transform', function () { var _a, _b; return "translate(".concat(((_a = _xAxisScale.current) === null || _a === void 0 ? void 0 : _a.call(_xAxisScale, x)) + _xBandwidth.current, ", ").concat((_b = _yAxisScale.current) === null || _b === void 0 ? void 0 : _b.call(_yAxisScale, y), ")"); })
198
+ .attr('visibility', 'visibility')
199
+ .attr('y2', "".concat(lineHeight - ((_a = _yAxisScale.current) === null || _a === void 0 ? void 0 : _a.call(_yAxisScale, y))));
200
+ if (_uniqueCallOutID.current !== circleId) {
201
+ _uniqueCallOutID.current = circleId;
202
+ setCalloutVisible(true);
203
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
204
+ setRefSelected("#".concat(circleId));
205
+ setYValueHover(found.values);
206
+ setStackCalloutProps(found);
207
+ setActivePoint(circleId);
208
+ }
209
+ }
210
+ else {
211
+ setActivePoint(circleId);
212
+ }
213
+ }, [_verticalLine, _xAxisScale, _xBandwidth, _calloutPoints, props.culture, props.useUTC]);
214
+ var _handleMouseOut = React.useCallback(function () {
215
+ d3Select("#".concat(_verticalLine)).attr('visibility', 'hidden');
216
+ }, [_verticalLine]);
217
+ var _handleChartMouseLeave = React.useCallback(function () {
218
+ _uniqueCallOutID.current = null;
219
+ setActivePoint('');
220
+ if (isCalloutVisible) {
221
+ setCalloutVisible(false);
222
+ }
223
+ }, [_uniqueCallOutID, isCalloutVisible, setActivePoint, setCalloutVisible]);
224
+ /**
225
+ * This function checks if none of the legends is selected or hovered.*/
226
+ var _noLegendHighlighted = React.useCallback(function () {
227
+ return selectedLegends.length === 0;
228
+ }, [selectedLegends]);
229
+ var _getHighlightedLegend = React.useCallback(function () {
230
+ return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];
231
+ }, [selectedLegends, activeLegend]);
232
+ /**
233
+ * This function checks if the given legend is highlighted or not.
234
+ * A legend can be highlighted in 2 ways:
235
+ * 1. selection: if the user clicks on it
236
+ * 2. hovering: if there is no selected legend and the user hovers over it*/
237
+ var _legendHighlighted = React.useCallback(function (legend) {
238
+ return _getHighlightedLegend().includes(legend);
239
+ }, [_getHighlightedLegend]);
240
+ var _getAriaLabel = React.useCallback(function (seriesIndex, pointIndex) {
241
+ var _a, _b;
242
+ var series = (_a = _points.current) === null || _a === void 0 ? void 0 : _a[seriesIndex];
243
+ var point = series.data[pointIndex];
244
+ var formattedDate = point.x instanceof Date ? formatDateToLocaleString(point.x, props.culture, props.useUTC) : point.x;
245
+ var xValue = point.xAxisCalloutData || formattedDate;
246
+ var legend = series.legend;
247
+ var yValue = point.yAxisCalloutData || point.y;
248
+ return ((_b = point.callOutAccessibilityData) === null || _b === void 0 ? void 0 : _b.ariaLabel) || "".concat(xValue, ". ").concat(legend, ", ").concat(yValue, ".");
249
+ }, [_points, props.culture, props.useUTC]);
250
+ var _createPlot = React.useCallback(function (xElement, containerHeight) {
251
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
252
+ var series = [];
253
+ if (isSelectedLegend) {
254
+ _points.current = selectedLegendPoints;
255
+ }
256
+ else {
257
+ _points.current = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);
258
+ }
259
+ var yMax = d3Max(_points.current, function (point) {
260
+ return d3Max(point.data, function (item) { return item.y; });
261
+ });
262
+ var yMin = d3Min(_points.current, function (point) {
263
+ return d3Min(point.data, function (item) { return item.y; });
264
+ });
265
+ var yPadding = (yMax - yMin) * 0.1;
266
+ var yPaddingRange = Math.abs(((_a = _yAxisScale.current) === null || _a === void 0 ? void 0 : _a.call(_yAxisScale, yMin + yPadding)) - ((_b = _yAxisScale.current) === null || _b === void 0 ? void 0 : _b.call(_yAxisScale, yMin)));
267
+ var maxMarkerRange = 40;
268
+ var xPaddingRange = 0;
269
+ if (_xAxisType === XAxisTypes.StringAxis) {
270
+ _xBandwidth.current = ((_c = _xAxisScale.current) === null || _c === void 0 ? void 0 : _c.bandwidth()) / 2;
271
+ xPaddingRange = _xBandwidth.current;
272
+ }
273
+ else if (_xAxisType === XAxisTypes.DateAxis) {
274
+ var xMin = d3Min(_points.current, function (point) {
275
+ return d3Min(point.data, function (item) { return item.x; });
276
+ });
277
+ var xMax = d3Max(_points.current, function (point) {
278
+ return d3Max(point.data, function (item) {
279
+ return item.x;
280
+ });
281
+ });
282
+ var xPadding = (xMax.getTime() - xMin.getTime()) * 0.1;
283
+ xPaddingRange = Math.abs(((_d = _xAxisScale.current) === null || _d === void 0 ? void 0 : _d.call(_xAxisScale, new Date(xMin.getTime() + xPadding))) - ((_e = _xAxisScale.current) === null || _e === void 0 ? void 0 : _e.call(_xAxisScale, xMin)));
284
+ }
285
+ else {
286
+ var xMin = d3Min(_points.current, function (point) {
287
+ return d3Min(point.data, function (item) { return item.x; });
288
+ });
289
+ var xMax = d3Max(_points.current, function (point) {
290
+ return d3Max(point.data, function (item) {
291
+ return item.x;
292
+ });
293
+ });
294
+ var xPadding = (xMax - xMin) * 0.1;
295
+ xPaddingRange = Math.abs(((_f = _xAxisScale.current) === null || _f === void 0 ? void 0 : _f.call(_xAxisScale, xMin + xPadding)) - ((_g = _xAxisScale.current) === null || _g === void 0 ? void 0 : _g.call(_xAxisScale, xMin)));
296
+ }
297
+ maxMarkerRange = Math.min(maxMarkerRange, Math.min(xPaddingRange, yPaddingRange));
298
+ var maxMarkerSize = d3Max(_points.current, function (point) {
299
+ return d3Max(point.data, function (item) {
300
+ return item.markerSize;
301
+ });
302
+ });
303
+ var _loop_1 = function (i) {
304
+ var pointsForSeries = [];
305
+ var legendVal = (_k = (_j = _points.current) === null || _j === void 0 ? void 0 : _j[i]) === null || _k === void 0 ? void 0 : _k.legend;
306
+ var seriesColor = (_m = (_l = _points.current) === null || _l === void 0 ? void 0 : _l[i]) === null || _m === void 0 ? void 0 : _m.color;
307
+ var verticaLineHeight = containerHeight - ((_p = (_o = margins.current) === null || _o === void 0 ? void 0 : _o.bottom) !== null && _p !== void 0 ? _p : 0) + 6;
308
+ var _loop_2 = function (j) {
309
+ var seriesId = "".concat(_seriesId, "_").concat(i, "_").concat(j);
310
+ var circleId = "".concat(_circleId, "_").concat(i, "_").concat(j);
311
+ var _10 = (_u = (_t = _points.current) === null || _t === void 0 ? void 0 : _t[i]) === null || _u === void 0 ? void 0 : _u.data[j], x = _10.x, y = _10.y, xAxisCalloutData = _10.xAxisCalloutData, xAxisCalloutAccessibilityData = _10.xAxisCalloutAccessibilityData;
312
+ var circleRadius = 3.5;
313
+ var pointMarkerSize = ((_w = (_v = _points.current) === null || _v === void 0 ? void 0 : _v[i]) === null || _w === void 0 ? void 0 : _w.data[j]).markerSize;
314
+ if (pointMarkerSize !== undefined) {
315
+ circleRadius = Math.min((pointMarkerSize * maxMarkerRange) / maxMarkerSize, pointMarkerSize);
316
+ }
317
+ var isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
318
+ var currentPointHidden = ((_y = (_x = _points.current) === null || _x === void 0 ? void 0 : _x[i]) === null || _y === void 0 ? void 0 : _y.hideNonActiveDots) && activePoint !== circleId;
319
+ pointsForSeries.push(React.createElement("circle", __assign({ id: circleId, key: circleId, r: circleRadius, cx: ((_z = _xAxisScale.current) === null || _z === void 0 ? void 0 : _z.call(_xAxisScale, x)) + _xBandwidth.current, cy: (_0 = _yAxisScale.current) === null || _0 === void 0 ? void 0 : _0.call(_yAxisScale, y), "data-is-focusable": isLegendSelected, onMouseOver: function (event) {
320
+ return _handleHover(x, y, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event);
321
+ }, onMouseMove: function (event) {
322
+ return _handleHover(x, y, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event);
323
+ }, onMouseOut: _handleMouseOut, onFocus: function () { return _handleFocus(seriesId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData); }, onBlur: _handleMouseOut }, _getClickHandler((_3 = (_2 = (_1 = _points.current) === null || _1 === void 0 ? void 0 : _1[i]) === null || _2 === void 0 ? void 0 : _2.data[j]) === null || _3 === void 0 ? void 0 : _3.onDataPointClick), { opacity: isLegendSelected && !currentPointHidden ? 1 : 0.1, fill: _getPointFill(seriesColor, circleId), stroke: seriesColor, role: "img", "aria-label": _getAriaLabel(i, j), tabIndex: ((_5 = (_4 = _points.current) === null || _4 === void 0 ? void 0 : _4[i]) === null || _5 === void 0 ? void 0 : _5.legend) !== '' ? 0 : undefined })));
324
+ };
325
+ for (var j = 0; j < ((_s = (_r = (_q = _points.current) === null || _q === void 0 ? void 0 : _q[i]) === null || _r === void 0 ? void 0 : _r.data) === null || _s === void 0 ? void 0 : _s.length); j++) {
326
+ _loop_2(j);
327
+ }
328
+ series.push(React.createElement("g", { key: "series_".concat(i), role: "region", "aria-label": "".concat(legendVal, ", series ").concat(i + 1, " of ").concat((_6 = _points.current) === null || _6 === void 0 ? void 0 : _6.length, " with ").concat((_9 = (_8 = (_7 = _points.current) === null || _7 === void 0 ? void 0 : _7[i]) === null || _8 === void 0 ? void 0 : _8.data) === null || _9 === void 0 ? void 0 : _9.length, " data points.") }, pointsForSeries));
329
+ };
330
+ for (var i = ((_h = _points.current) === null || _h === void 0 ? void 0 : _h.length) - 1; i >= 0; i--) {
331
+ _loop_1(i);
332
+ }
333
+ var classNames = getClassNames(props.styles, {
334
+ theme: props.theme,
335
+ });
336
+ // Removing un wanted tooltip div from DOM, when prop not provided.
337
+ if (!props.showXAxisLablesTooltip) {
338
+ try {
339
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
340
+ // eslint-disable-next-line no-empty
341
+ }
342
+ catch (e) { }
343
+ }
344
+ // Used to display tooltip at x axis labels.
345
+ if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
346
+ var xAxisElement = d3Select(xElement).call(_xAxisScale.current);
347
+ try {
348
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
349
+ // eslint-disable-next-line no-empty
350
+ }
351
+ catch (e) { }
352
+ var tooltipProps = {
353
+ tooltipCls: classNames.tooltip,
354
+ id: _tooltipId,
355
+ xAxis: xAxisElement,
356
+ };
357
+ xAxisElement && tooltipOfAxislabels(tooltipProps);
358
+ }
359
+ return series;
360
+ }, [
361
+ _xAxisScale,
362
+ _yAxisScale,
363
+ props.data.scatterChartData,
364
+ props.theme,
365
+ props.styles,
366
+ props.showXAxisLablesTooltip,
367
+ props.wrapXAxisLables,
368
+ _circleId,
369
+ _getAriaLabel,
370
+ _getPointFill,
371
+ _handleFocus,
372
+ _handleHover,
373
+ _handleMouseOut,
374
+ _legendHighlighted,
375
+ _noLegendHighlighted,
376
+ _seriesId,
377
+ _tooltipId,
378
+ _xAxisType,
379
+ activePoint,
380
+ isSelectedLegend,
381
+ selectedLegendPoints,
382
+ ]);
383
+ var _initializeScatterChartData = React.useCallback(function (xScale, yScale, containerHeight, containerWidth, xElement) {
384
+ _xAxisScale.current = xScale;
385
+ _yAxisScale.current = yScale;
386
+ renderSeries.current = _createPlot(xElement, containerHeight);
387
+ }, [renderSeries, _xAxisScale, _yAxisScale, _createPlot]);
388
+ /**
389
+ * Screen readers announce an element as clickable if the onClick attribute is set.
390
+ * This function sets the attribute only when a click event handler is provided.*/
391
+ function _getClickHandler(func) {
392
+ if (func) {
393
+ return {
394
+ onClick: func,
395
+ };
396
+ }
397
+ return {};
398
+ }
399
+ function _isChartEmpty() {
400
+ return !(props.data &&
401
+ props.data.scatterChartData &&
402
+ props.data.scatterChartData.length > 0 &&
403
+ props.data.scatterChartData.filter(function (item) { return item.data.length; }).length > 0);
404
+ }
405
+ function _closeCallout() {
406
+ setCalloutVisible(false);
407
+ }
408
+ var _createStringYAxis = React.useCallback(function () {
409
+ var createStringAxisprops = [];
410
+ for (var _i = 0; _i < arguments.length; _i++) {
411
+ createStringAxisprops[_i] = arguments[_i];
412
+ }
413
+ return createStringYAxis.apply(void 0, createStringAxisprops);
414
+ }, []);
415
+ var legendProps = props.legendProps, tickValues = props.tickValues, tickFormat = props.tickFormat;
416
+ _points.current = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);
417
+ var points = _points.current;
418
+ if (legendProps && !!legendProps.canSelectMultipleLegends) {
419
+ points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points.current;
420
+ _calloutPoints = calloutData(points);
421
+ }
422
+ var legendBars = null;
423
+ // reduce computation cost by only creating legendBars
424
+ // if when hideLegend is false.
425
+ // NOTE: they are rendered only when hideLegend is false in CartesianChart.
426
+ if (!props.hideLegend) {
427
+ legendBars = _createLegends(_points.current); // ToDo: Memoize legends to improve performance.
428
+ }
429
+ var calloutProps = __assign({ isCalloutVisible: isCalloutVisible, directionalHint: DirectionalHint.topAutoEdge, YValueHover: YValueHover, hoverXValue: hoverXValue, id: "toolTip".concat(_uniqueCallOutID.current), target: refSelected, isBeakVisible: false, gapSpace: 15, onDismiss: _closeCallout, preventDismissOnEvent: function () { return true; }, hidden: !(!props.hideTooltip && isCalloutVisible), descriptionMessage: props.getCalloutDescriptionMessage && stackCalloutProps
430
+ ? props.getCalloutDescriptionMessage(stackCalloutProps)
431
+ : undefined, 'data-is-focusable': true, xAxisCalloutAccessibilityData: _xAxisCalloutAccessibilityData }, props.calloutProps);
432
+ var tickParams = {
433
+ tickValues: tickValues,
434
+ tickFormat: tickFormat,
435
+ };
436
+ var xAxisLabels = _points.current
437
+ .map(function (point) { return point.data.map(function (dp) { return dp.x; }); })
438
+ .flat();
439
+ _xAxisLabels = Array.from(new Set(xAxisLabels));
440
+ return !_isChartEmpty() ? (React.createElement(CartesianChart, __assign({}, props, { ref: cartesianChartRef, chartTitle: props.data.chartTitle, isCalloutForStack: true, points: points, chartType: ChartTypes.ScatterChart, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, getmargins: _getMargins, getMinMaxOfYAxis: findNumericMinMaxOfY, getDomainNRangeValues: getDomainNRangeValuesScatterChart, createYAxis: createYAxisForScatterChart, createStringYAxis: _createStringYAxis, getGraphData: _initializeScatterChartData, xAxisType: _xAxisType, onChartMouseLeave: _handleChartMouseLeave, enableFirstRenderOptimization: _firstRenderOptimization, datasetForXAxisDomain: _xAxisLabels, componentRef: cartesianChartRef,
441
+ /* eslint-disable react/jsx-no-bind */
442
+ // eslint-disable-next-line react/no-children-prop
443
+ children: function (childProps) {
444
+ _xAxisScale.current = childProps.xScale;
445
+ _yAxisScale.current = childProps.yScalePrimary;
446
+ return (React.createElement(React.Fragment, null,
447
+ React.createElement("g", null,
448
+ React.createElement("line", { x1: 0, y1: 0, x2: 0, y2: childProps.containerHeight, stroke: '#323130', id: _verticalLine, visibility: 'hidden', strokeDasharray: '5,5' }),
449
+ React.createElement("g", null, renderSeries.current))));
450
+ } }))) : (React.createElement("div", { id: _emptyChartId, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
451
+ });
452
+ ScatterChartBase.displayName = 'ScatterChart';
453
+ //# sourceMappingURL=ScatterChart.base.js.map