@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,10 +1,18 @@
1
- define(["require", "exports", "tslib"], function (require, exports, tslib_1) {
1
+ define(["require", "exports", "tslib", "@fluentui/react/lib/Styling"], function (require, exports, tslib_1, Styling_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.getStyles = void 0;
5
5
  var getStyles = function (props) {
6
+ var _a;
6
7
  return {
7
8
  tooltip: tslib_1.__assign(tslib_1.__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 }),
9
+ markerLabel: {
10
+ selectors: (_a = {},
11
+ _a[Styling_1.HighContrastSelector] = {
12
+ fill: 'CanvasText',
13
+ },
14
+ _a),
15
+ },
8
16
  };
9
17
  };
10
18
  exports.getStyles = getStyles;
@@ -1 +1 @@
1
- {"version":3,"file":"LineChart.styles.js","sourceRoot":"../src/","sources":["components/LineChart/LineChart.styles.ts"],"names":[],"mappings":";;;;IAEO,IAAM,SAAS,GAAG,UAAC,KAA2B;QACnD,OAAO;YACL,OAAO,wCACF,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;SACF,CAAC;IACJ,CAAC,CAAC;IAhBW,QAAA,SAAS,aAgBpB","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":";;;;IAGO,IAAM,SAAS,GAAG,UAAC,KAA2B;;QACnD,OAAO;YACL,OAAO,wCACF,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;YACD,WAAW,EAAE;gBACX,SAAS;oBACP,GAAC,8BAAoB,IAAG;wBACtB,IAAI,EAAE,YAAY;qBACnB;uBACF;aACF;SACF,CAAC;IACJ,CAAC,CAAC;IAvBW,QAAA,SAAS,aAuBpB","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,447 @@
1
+ define(["require", "exports", "tslib", "react", "d3-selection", "../Legends/index", "d3-array", "../../utilities/index", "../../index", "../../utilities/index", "@fluentui/react", "../../utilities/image-export-utils", "@fluentui/chart-utilities"], function (require, exports, tslib_1, React, d3_selection_1, index_1, d3_array_1, index_2, index_3, index_4, react_1, image_export_utils_1, chart_utilities_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.ScatterChartBase = void 0;
5
+ var getClassNames = (0, react_1.classNamesFunction)();
6
+ // Create a ScatterChart variant which uses these default styles and this styled subcomponent.
7
+ /**
8
+ * ScatterChart component
9
+ * {@docCategory ScatterChart}
10
+ */
11
+ exports.ScatterChartBase = React.forwardRef(function (props, forwardedRef) {
12
+ var _circleId = React.useMemo(function () { return (0, react_1.getId)('circle'); }, []);
13
+ var _seriesId = React.useMemo(function () { return (0, react_1.getId)('seriesID'); }, []);
14
+ var _verticalLine = React.useMemo(function () { return (0, react_1.getId)('verticalLine'); }, []);
15
+ var _tooltipId = React.useMemo(function () { return (0, react_1.getId)('ScatterChartTooltipId_'); }, []);
16
+ var _firstRenderOptimization = true;
17
+ var _emptyChartId = React.useMemo(function () { return (0, react_1.getId)('_ScatterChart_empty'); }, []);
18
+ var _points = React.useRef(_injectIndexPropertyInScatterChartData(props.data.scatterChartData));
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ var _calloutPoints = React.useMemo(function () { return (0, index_4.calloutData)(_points.current) || []; }, [_points]);
21
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
22
+ var _xAxisScale = React.useRef('');
23
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
+ var _yAxisScale = React.useRef('');
25
+ var _uniqueCallOutID = React.useRef(null);
26
+ var _refArray = React.useMemo(function () { return []; }, []);
27
+ var margins = React.useRef(null);
28
+ var renderSeries = React.useRef([]);
29
+ var _xAxisLabels = [];
30
+ var _xAxisCalloutAccessibilityData = {};
31
+ var _xBandwidth = React.useRef(0);
32
+ var cartesianChartRef = React.useRef(null);
33
+ var legendsRef = React.useRef(null);
34
+ var _a = React.useState(''), hoverXValue = _a[0], setHoverXValue = _a[1];
35
+ var _b = React.useState(''), activeLegend = _b[0], setActiveLegend = _b[1];
36
+ var _c = React.useState([]), YValueHover = _c[0], setYValueHover = _c[1];
37
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
+ var _d = React.useState([]), selectedLegendPoints = _d[0], setSelectedLegendPoints = _d[1];
39
+ var _e = React.useState(false), isSelectedLegend = _e[0], setIsSelectedLegend = _e[1];
40
+ var _f = React.useState(''), activePoint = _f[0], setActivePoint = _f[1];
41
+ var _g = React.useState(), stackCalloutProps = _g[0], setStackCalloutProps = _g[1];
42
+ var _h = React.useState(false), isCalloutVisible = _h[0], setCalloutVisible = _h[1];
43
+ var _j = React.useState([]), selectedLegends = _j[0], setSelectedLegends = _j[1];
44
+ var _k = React.useState(''), refSelected = _k[0], setRefSelected = _k[1];
45
+ var prevPropsRef = React.useRef(null);
46
+ React.useEffect(function () {
47
+ var _a, _b, _c;
48
+ if (prevPropsRef.current) {
49
+ var prevProps = prevPropsRef.current;
50
+ if (!(0, index_2.areArraysEqual)((_a = prevProps.legendProps) === null || _a === void 0 ? void 0 : _a.selectedLegends, (_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.selectedLegends)) {
51
+ setSelectedLegends(((_c = props.legendProps) === null || _c === void 0 ? void 0 : _c.selectedLegends) || []);
52
+ }
53
+ }
54
+ prevPropsRef.current = props;
55
+ }, [props]);
56
+ React.useImperativeHandle(props.componentRef, function () {
57
+ var _a, _b;
58
+ return ({
59
+ chartContainer: (_b = (_a = cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer) !== null && _b !== void 0 ? _b : null,
60
+ toImage: function (opts) {
61
+ var _a, _b;
62
+ return (0, image_export_utils_1.toImage)((_a = cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer, (_b = legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, (0, react_1.getRTL)(), opts);
63
+ },
64
+ });
65
+ }, []);
66
+ var _xAxisType = props.data.scatterChartData &&
67
+ props.data.scatterChartData.length > 0 &&
68
+ props.data.scatterChartData[0].data &&
69
+ props.data.scatterChartData[0].data.length > 0
70
+ ? (0, index_4.getTypeOfAxis)(props.data.scatterChartData[0].data[0].x, true)
71
+ : index_4.XAxisTypes.StringAxis;
72
+ var pointsRef = React.useRef([]);
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ var calloutPointsRef = React.useRef([]);
75
+ React.useEffect(function () {
76
+ /** note that height and width are not used to resize or set as dimesions of the chart,
77
+ * fitParentContainer is responisble for setting the height and width or resizing of the svg/chart
78
+ */
79
+ if (_points.current !== _injectIndexPropertyInScatterChartData(props.data.scatterChartData) ||
80
+ props.data !== _points.current) {
81
+ pointsRef.current = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);
82
+ calloutPointsRef.current = (0, index_4.calloutData)(pointsRef.current);
83
+ }
84
+ }, [props.height, props.width, props.data, _points]);
85
+ function _injectIndexPropertyInScatterChartData(scatterChartData) {
86
+ return scatterChartData
87
+ ? scatterChartData.map(function (item, index) {
88
+ var color;
89
+ if (typeof item.color === 'undefined') {
90
+ color = (0, index_4.getNextColor)(index, 0);
91
+ }
92
+ else {
93
+ color = (0, index_4.getColorFromToken)(item.color);
94
+ }
95
+ return tslib_1.__assign(tslib_1.__assign({}, item), { index: -1, color: color });
96
+ })
97
+ : [];
98
+ }
99
+ var _getMargins = React.useCallback(function (_margins) {
100
+ margins.current = _margins;
101
+ }, []);
102
+ function _onHoverCardHide() {
103
+ setSelectedLegendPoints([]);
104
+ setIsSelectedLegend(false);
105
+ }
106
+ function _createLegends(data) {
107
+ var legendProps = props.legendProps;
108
+ var isLegendMultiSelectEnabled = !!(legendProps && !!legendProps.canSelectMultipleLegends);
109
+ var legendDataItems = data.map(function (point) {
110
+ var color = point.color;
111
+ // mapping data to the format Legends component needs
112
+ var legend = tslib_1.__assign({ title: point.legend, color: color, onMouseOutAction: function () {
113
+ setActiveLegend('');
114
+ }, hoverAction: function () {
115
+ _handleChartMouseLeave();
116
+ setActiveLegend(point.legend);
117
+ } }, (point.legendShape && {
118
+ shape: point.legendShape,
119
+ }));
120
+ return legend;
121
+ });
122
+ return (React.createElement(index_1.Legends, tslib_1.__assign({ legends: tslib_1.__spreadArray([], legendDataItems, true), enabledWrapLines: props.enabledLegendsWrapLines, overflowProps: props.legendsOverflowProps, focusZonePropsInHoverCard: props.focusZonePropsForLegendsInHoverCard, overflowText: props.legendsOverflowText }, (isLegendMultiSelectEnabled && { onLegendHoverCardLeave: _onHoverCardHide }), { onChange: _onLegendSelectionChange }, props.legendProps)));
123
+ }
124
+ function _onLegendSelectionChange(legendsSelected, event, currentLegend) {
125
+ var _a, _b;
126
+ if ((_a = props.legendProps) === null || _a === void 0 ? void 0 : _a.canSelectMultipleLegends) {
127
+ setSelectedLegends(legendsSelected);
128
+ }
129
+ else {
130
+ setSelectedLegends(legendsSelected.slice(-1));
131
+ }
132
+ if ((_b = props.legendProps) === null || _b === void 0 ? void 0 : _b.onChange) {
133
+ props.legendProps.onChange(legendsSelected, event, currentLegend);
134
+ }
135
+ }
136
+ var _getPointFill = React.useCallback(function (lineColor, pointId) {
137
+ var theme = props.theme;
138
+ if (activePoint === pointId) {
139
+ return theme.semanticColors.bodyBackground;
140
+ }
141
+ else {
142
+ return lineColor;
143
+ }
144
+ }, [activePoint, props]);
145
+ var getDomainNRangeValuesScatterChart = React.useCallback(function (
146
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
147
+ points, domainMargins, width, _chartType, isRTL, xAxisType, _barWidth, tickValues) {
148
+ if (xAxisType === index_4.XAxisTypes.NumericAxis) {
149
+ return (0, index_2.domainRangeOfNumericForScatterChart)(points, domainMargins, width, isRTL);
150
+ }
151
+ else if (xAxisType === index_4.XAxisTypes.DateAxis) {
152
+ return (0, index_2.domainRangeOfDateForScatterChart)(points, domainMargins, width, isRTL, tickValues);
153
+ }
154
+ // String Axis type
155
+ return (0, index_2.domainRangeOfXStringAxis)(domainMargins, width, isRTL);
156
+ }, []);
157
+ var _handleFocus = React.useCallback(function (seriesId, x, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData) {
158
+ _uniqueCallOutID.current = circleId;
159
+ var formattedData = x instanceof Date ? (0, chart_utilities_1.formatDateToLocaleString)(x, props.culture, props.useUTC) : x;
160
+ var xVal = x instanceof Date ? x.getTime() : x;
161
+ var found = (0, react_1.find)(_calloutPoints, function (element) { return element.x === xVal; });
162
+ // if no points need to be called out then don't show vertical line and callout card
163
+ if (found) {
164
+ (0, d3_selection_1.select)("#".concat(_verticalLine))
165
+ .attr('transform', function () { var _a; return "translate(".concat(((_a = _xAxisScale.current) === null || _a === void 0 ? void 0 : _a.call(_xAxisScale, x)) + _xBandwidth.current, ", 0)"); })
166
+ .attr('visibility', 'visibility');
167
+ _refArray.forEach(function (obj) {
168
+ if (obj.index === seriesId) {
169
+ setCalloutVisible(true);
170
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
171
+ setRefSelected("#".concat(circleId));
172
+ setYValueHover(found.values);
173
+ setActivePoint(circleId);
174
+ }
175
+ });
176
+ }
177
+ else {
178
+ setActivePoint(circleId);
179
+ }
180
+ }, [_verticalLine, _xAxisScale, _xBandwidth, _calloutPoints, _refArray, props.culture, props.useUTC]);
181
+ var _handleHover = React.useCallback(function (x, y, lineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, mouseEvent) {
182
+ var _a;
183
+ mouseEvent === null || mouseEvent === void 0 ? void 0 : mouseEvent.persist();
184
+ var formattedData = x instanceof Date ? (0, chart_utilities_1.formatDateToLocaleString)(x, props.culture, props.useUTC) : x;
185
+ var xVal = x instanceof Date ? x.getTime() : x;
186
+ var found = (0, react_1.find)(_calloutPoints, function (element) { return element.x === xVal; });
187
+ // if no points need to be called out then don't show vertical line and callout card
188
+ if (found) {
189
+ (0, d3_selection_1.select)("#".concat(_verticalLine))
190
+ .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), ")"); })
191
+ .attr('visibility', 'visibility')
192
+ .attr('y2', "".concat(lineHeight - ((_a = _yAxisScale.current) === null || _a === void 0 ? void 0 : _a.call(_yAxisScale, y))));
193
+ if (_uniqueCallOutID.current !== circleId) {
194
+ _uniqueCallOutID.current = circleId;
195
+ setCalloutVisible(true);
196
+ xAxisCalloutData ? setHoverXValue(xAxisCalloutData) : setHoverXValue('' + formattedData);
197
+ setRefSelected("#".concat(circleId));
198
+ setYValueHover(found.values);
199
+ setStackCalloutProps(found);
200
+ setActivePoint(circleId);
201
+ }
202
+ }
203
+ else {
204
+ setActivePoint(circleId);
205
+ }
206
+ }, [_verticalLine, _xAxisScale, _xBandwidth, _calloutPoints, props.culture, props.useUTC]);
207
+ var _handleMouseOut = React.useCallback(function () {
208
+ (0, d3_selection_1.select)("#".concat(_verticalLine)).attr('visibility', 'hidden');
209
+ }, [_verticalLine]);
210
+ var _handleChartMouseLeave = React.useCallback(function () {
211
+ _uniqueCallOutID.current = null;
212
+ setActivePoint('');
213
+ if (isCalloutVisible) {
214
+ setCalloutVisible(false);
215
+ }
216
+ }, [_uniqueCallOutID, isCalloutVisible, setActivePoint, setCalloutVisible]);
217
+ /**
218
+ * This function checks if none of the legends is selected or hovered.*/
219
+ var _noLegendHighlighted = React.useCallback(function () {
220
+ return selectedLegends.length === 0;
221
+ }, [selectedLegends]);
222
+ var _getHighlightedLegend = React.useCallback(function () {
223
+ return selectedLegends.length > 0 ? selectedLegends : activeLegend ? [activeLegend] : [];
224
+ }, [selectedLegends, activeLegend]);
225
+ /**
226
+ * This function checks if the given legend is highlighted or not.
227
+ * A legend can be highlighted in 2 ways:
228
+ * 1. selection: if the user clicks on it
229
+ * 2. hovering: if there is no selected legend and the user hovers over it*/
230
+ var _legendHighlighted = React.useCallback(function (legend) {
231
+ return _getHighlightedLegend().includes(legend);
232
+ }, [_getHighlightedLegend]);
233
+ var _getAriaLabel = React.useCallback(function (seriesIndex, pointIndex) {
234
+ var _a, _b;
235
+ var series = (_a = _points.current) === null || _a === void 0 ? void 0 : _a[seriesIndex];
236
+ var point = series.data[pointIndex];
237
+ var formattedDate = point.x instanceof Date ? (0, chart_utilities_1.formatDateToLocaleString)(point.x, props.culture, props.useUTC) : point.x;
238
+ var xValue = point.xAxisCalloutData || formattedDate;
239
+ var legend = series.legend;
240
+ var yValue = point.yAxisCalloutData || point.y;
241
+ return ((_b = point.callOutAccessibilityData) === null || _b === void 0 ? void 0 : _b.ariaLabel) || "".concat(xValue, ". ").concat(legend, ", ").concat(yValue, ".");
242
+ }, [_points, props.culture, props.useUTC]);
243
+ var _createPlot = React.useCallback(function (xElement, containerHeight) {
244
+ 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;
245
+ var series = [];
246
+ if (isSelectedLegend) {
247
+ _points.current = selectedLegendPoints;
248
+ }
249
+ else {
250
+ _points.current = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);
251
+ }
252
+ var yMax = (0, d3_array_1.max)(_points.current, function (point) {
253
+ return (0, d3_array_1.max)(point.data, function (item) { return item.y; });
254
+ });
255
+ var yMin = (0, d3_array_1.min)(_points.current, function (point) {
256
+ return (0, d3_array_1.min)(point.data, function (item) { return item.y; });
257
+ });
258
+ var yPadding = (yMax - yMin) * 0.1;
259
+ 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)));
260
+ var maxMarkerRange = 40;
261
+ var xPaddingRange = 0;
262
+ if (_xAxisType === index_4.XAxisTypes.StringAxis) {
263
+ _xBandwidth.current = ((_c = _xAxisScale.current) === null || _c === void 0 ? void 0 : _c.bandwidth()) / 2;
264
+ xPaddingRange = _xBandwidth.current;
265
+ }
266
+ else if (_xAxisType === index_4.XAxisTypes.DateAxis) {
267
+ var xMin = (0, d3_array_1.min)(_points.current, function (point) {
268
+ return (0, d3_array_1.min)(point.data, function (item) { return item.x; });
269
+ });
270
+ var xMax = (0, d3_array_1.max)(_points.current, function (point) {
271
+ return (0, d3_array_1.max)(point.data, function (item) {
272
+ return item.x;
273
+ });
274
+ });
275
+ var xPadding = (xMax.getTime() - xMin.getTime()) * 0.1;
276
+ 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)));
277
+ }
278
+ else {
279
+ var xMin = (0, d3_array_1.min)(_points.current, function (point) {
280
+ return (0, d3_array_1.min)(point.data, function (item) { return item.x; });
281
+ });
282
+ var xMax = (0, d3_array_1.max)(_points.current, function (point) {
283
+ return (0, d3_array_1.max)(point.data, function (item) {
284
+ return item.x;
285
+ });
286
+ });
287
+ var xPadding = (xMax - xMin) * 0.1;
288
+ 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)));
289
+ }
290
+ maxMarkerRange = Math.min(maxMarkerRange, Math.min(xPaddingRange, yPaddingRange));
291
+ var maxMarkerSize = (0, d3_array_1.max)(_points.current, function (point) {
292
+ return (0, d3_array_1.max)(point.data, function (item) {
293
+ return item.markerSize;
294
+ });
295
+ });
296
+ var _loop_1 = function (i) {
297
+ var pointsForSeries = [];
298
+ var legendVal = (_k = (_j = _points.current) === null || _j === void 0 ? void 0 : _j[i]) === null || _k === void 0 ? void 0 : _k.legend;
299
+ var seriesColor = (_m = (_l = _points.current) === null || _l === void 0 ? void 0 : _l[i]) === null || _m === void 0 ? void 0 : _m.color;
300
+ var verticaLineHeight = containerHeight - ((_p = (_o = margins.current) === null || _o === void 0 ? void 0 : _o.bottom) !== null && _p !== void 0 ? _p : 0) + 6;
301
+ var _loop_2 = function (j) {
302
+ var seriesId = "".concat(_seriesId, "_").concat(i, "_").concat(j);
303
+ var circleId = "".concat(_circleId, "_").concat(i, "_").concat(j);
304
+ 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;
305
+ var circleRadius = 3.5;
306
+ var pointMarkerSize = ((_w = (_v = _points.current) === null || _v === void 0 ? void 0 : _v[i]) === null || _w === void 0 ? void 0 : _w.data[j]).markerSize;
307
+ if (pointMarkerSize !== undefined) {
308
+ circleRadius = Math.min((pointMarkerSize * maxMarkerRange) / maxMarkerSize, pointMarkerSize);
309
+ }
310
+ var isLegendSelected = _legendHighlighted(legendVal) || _noLegendHighlighted() || isSelectedLegend;
311
+ var currentPointHidden = ((_y = (_x = _points.current) === null || _x === void 0 ? void 0 : _x[i]) === null || _y === void 0 ? void 0 : _y.hideNonActiveDots) && activePoint !== circleId;
312
+ pointsForSeries.push(React.createElement("circle", tslib_1.__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) {
313
+ return _handleHover(x, y, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event);
314
+ }, onMouseMove: function (event) {
315
+ return _handleHover(x, y, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData, event);
316
+ }, 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 })));
317
+ };
318
+ 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++) {
319
+ _loop_2(j);
320
+ }
321
+ 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));
322
+ };
323
+ for (var i = ((_h = _points.current) === null || _h === void 0 ? void 0 : _h.length) - 1; i >= 0; i--) {
324
+ _loop_1(i);
325
+ }
326
+ var classNames = getClassNames(props.styles, {
327
+ theme: props.theme,
328
+ });
329
+ // Removing un wanted tooltip div from DOM, when prop not provided.
330
+ if (!props.showXAxisLablesTooltip) {
331
+ try {
332
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
333
+ // eslint-disable-next-line no-empty
334
+ }
335
+ catch (e) { }
336
+ }
337
+ // Used to display tooltip at x axis labels.
338
+ if (!props.wrapXAxisLables && props.showXAxisLablesTooltip) {
339
+ var xAxisElement = (0, d3_selection_1.select)(xElement).call(_xAxisScale.current);
340
+ try {
341
+ document.getElementById(_tooltipId) && document.getElementById(_tooltipId).remove();
342
+ // eslint-disable-next-line no-empty
343
+ }
344
+ catch (e) { }
345
+ var tooltipProps = {
346
+ tooltipCls: classNames.tooltip,
347
+ id: _tooltipId,
348
+ xAxis: xAxisElement,
349
+ };
350
+ xAxisElement && (0, index_4.tooltipOfAxislabels)(tooltipProps);
351
+ }
352
+ return series;
353
+ }, [
354
+ _xAxisScale,
355
+ _yAxisScale,
356
+ props.data.scatterChartData,
357
+ props.theme,
358
+ props.styles,
359
+ props.showXAxisLablesTooltip,
360
+ props.wrapXAxisLables,
361
+ _circleId,
362
+ _getAriaLabel,
363
+ _getPointFill,
364
+ _handleFocus,
365
+ _handleHover,
366
+ _handleMouseOut,
367
+ _legendHighlighted,
368
+ _noLegendHighlighted,
369
+ _seriesId,
370
+ _tooltipId,
371
+ _xAxisType,
372
+ activePoint,
373
+ isSelectedLegend,
374
+ selectedLegendPoints,
375
+ ]);
376
+ var _initializeScatterChartData = React.useCallback(function (xScale, yScale, containerHeight, containerWidth, xElement) {
377
+ _xAxisScale.current = xScale;
378
+ _yAxisScale.current = yScale;
379
+ renderSeries.current = _createPlot(xElement, containerHeight);
380
+ }, [renderSeries, _xAxisScale, _yAxisScale, _createPlot]);
381
+ /**
382
+ * Screen readers announce an element as clickable if the onClick attribute is set.
383
+ * This function sets the attribute only when a click event handler is provided.*/
384
+ function _getClickHandler(func) {
385
+ if (func) {
386
+ return {
387
+ onClick: func,
388
+ };
389
+ }
390
+ return {};
391
+ }
392
+ function _isChartEmpty() {
393
+ return !(props.data &&
394
+ props.data.scatterChartData &&
395
+ props.data.scatterChartData.length > 0 &&
396
+ props.data.scatterChartData.filter(function (item) { return item.data.length; }).length > 0);
397
+ }
398
+ function _closeCallout() {
399
+ setCalloutVisible(false);
400
+ }
401
+ var _createStringYAxis = React.useCallback(function () {
402
+ var createStringAxisprops = [];
403
+ for (var _i = 0; _i < arguments.length; _i++) {
404
+ createStringAxisprops[_i] = arguments[_i];
405
+ }
406
+ return index_2.createStringYAxis.apply(void 0, createStringAxisprops);
407
+ }, []);
408
+ var legendProps = props.legendProps, tickValues = props.tickValues, tickFormat = props.tickFormat;
409
+ _points.current = _injectIndexPropertyInScatterChartData(props.data.scatterChartData);
410
+ var points = _points.current;
411
+ if (legendProps && !!legendProps.canSelectMultipleLegends) {
412
+ points = selectedLegendPoints.length >= 1 ? selectedLegendPoints : _points.current;
413
+ _calloutPoints = (0, index_4.calloutData)(points);
414
+ }
415
+ var legendBars = null;
416
+ // reduce computation cost by only creating legendBars
417
+ // if when hideLegend is false.
418
+ // NOTE: they are rendered only when hideLegend is false in CartesianChart.
419
+ if (!props.hideLegend) {
420
+ legendBars = _createLegends(_points.current); // ToDo: Memoize legends to improve performance.
421
+ }
422
+ var calloutProps = tslib_1.__assign({ isCalloutVisible: isCalloutVisible, directionalHint: react_1.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
423
+ ? props.getCalloutDescriptionMessage(stackCalloutProps)
424
+ : undefined, 'data-is-focusable': true, xAxisCalloutAccessibilityData: _xAxisCalloutAccessibilityData }, props.calloutProps);
425
+ var tickParams = {
426
+ tickValues: tickValues,
427
+ tickFormat: tickFormat,
428
+ };
429
+ var xAxisLabels = _points.current
430
+ .map(function (point) { return point.data.map(function (dp) { return dp.x; }); })
431
+ .flat();
432
+ _xAxisLabels = Array.from(new Set(xAxisLabels));
433
+ return !_isChartEmpty() ? (React.createElement(index_3.CartesianChart, tslib_1.__assign({}, props, { ref: cartesianChartRef, chartTitle: props.data.chartTitle, isCalloutForStack: true, points: points, chartType: index_4.ChartTypes.ScatterChart, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, getmargins: _getMargins, getMinMaxOfYAxis: index_2.findNumericMinMaxOfY, getDomainNRangeValues: getDomainNRangeValuesScatterChart, createYAxis: index_2.createYAxisForScatterChart, createStringYAxis: _createStringYAxis, getGraphData: _initializeScatterChartData, xAxisType: _xAxisType, onChartMouseLeave: _handleChartMouseLeave, enableFirstRenderOptimization: _firstRenderOptimization, datasetForXAxisDomain: _xAxisLabels, componentRef: cartesianChartRef,
434
+ /* eslint-disable react/jsx-no-bind */
435
+ // eslint-disable-next-line react/no-children-prop
436
+ children: function (childProps) {
437
+ _xAxisScale.current = childProps.xScale;
438
+ _yAxisScale.current = childProps.yScalePrimary;
439
+ return (React.createElement(React.Fragment, null,
440
+ React.createElement("g", null,
441
+ React.createElement("line", { x1: 0, y1: 0, x2: 0, y2: childProps.containerHeight, stroke: '#323130', id: _verticalLine, visibility: 'hidden', strokeDasharray: '5,5' }),
442
+ React.createElement("g", null, renderSeries.current))));
443
+ } }))) : (React.createElement("div", { id: _emptyChartId, role: 'alert', style: { opacity: '0' }, "aria-label": 'Graph has no data to display' }));
444
+ });
445
+ exports.ScatterChartBase.displayName = 'ScatterChart';
446
+ });
447
+ //# sourceMappingURL=ScatterChart.base.js.map