@fluentui/react-charting 5.23.58 → 5.23.60

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 (186) hide show
  1. package/CHANGELOG.json +55 -1
  2. package/CHANGELOG.md +24 -2
  3. package/dist/react-charting.d.ts +26 -1
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +6 -0
  7. package/lib/components/AreaChart/AreaChart.base.d.ts +3 -1
  8. package/lib/components/AreaChart/AreaChart.base.js +8 -2
  9. package/lib/components/AreaChart/AreaChart.base.js.map +1 -1
  10. package/lib/components/DeclarativeChart/DeclarativeChart.d.ts +1 -1
  11. package/lib/components/DeclarativeChart/DeclarativeChart.js +35 -12
  12. package/lib/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  13. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +8 -4
  14. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  15. package/lib/components/DeclarativeChart/index.d.ts +0 -1
  16. package/lib/components/DeclarativeChart/index.js.map +1 -1
  17. package/lib/components/DonutChart/DonutChart.base.d.ts +3 -1
  18. package/lib/components/DonutChart/DonutChart.base.js +8 -2
  19. package/lib/components/DonutChart/DonutChart.base.js.map +1 -1
  20. package/lib/components/GaugeChart/GaugeChart.base.d.ts +3 -1
  21. package/lib/components/GaugeChart/GaugeChart.base.js +7 -1
  22. package/lib/components/GaugeChart/GaugeChart.base.js.map +1 -1
  23. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +3 -1
  24. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +7 -1
  25. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  26. package/lib/components/HeatMapChart/HeatMapChart.base.d.ts +3 -1
  27. package/lib/components/HeatMapChart/HeatMapChart.base.js +8 -2
  28. package/lib/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  29. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
  30. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +7 -1
  31. package/lib/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  32. package/lib/components/Legends/Legends.base.d.ts +8 -2
  33. package/lib/components/Legends/Legends.base.js +12 -1
  34. package/lib/components/Legends/Legends.base.js.map +1 -1
  35. package/lib/components/Legends/Legends.styles.d.ts +8 -0
  36. package/lib/components/Legends/Legends.styles.js +21 -8
  37. package/lib/components/Legends/Legends.styles.js.map +1 -1
  38. package/lib/components/Legends/Legends.types.d.ts +15 -1
  39. package/lib/components/Legends/Legends.types.js.map +1 -1
  40. package/lib/components/LineChart/LineChart.base.d.ts +11 -1
  41. package/lib/components/LineChart/LineChart.base.js +101 -23
  42. package/lib/components/LineChart/LineChart.base.js.map +1 -1
  43. package/lib/components/LineChart/LineChart.types.d.ts +5 -0
  44. package/lib/components/LineChart/LineChart.types.js.map +1 -1
  45. package/lib/components/SankeyChart/SankeyChart.base.d.ts +2 -1
  46. package/lib/components/SankeyChart/SankeyChart.base.js +4 -0
  47. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  48. package/lib/components/VerticalBarChart/VerticalBarChart.base.d.ts +3 -1
  49. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +7 -1
  50. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  51. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -1
  52. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +7 -1
  53. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  54. package/lib/index.d.ts +2 -2
  55. package/lib/index.js.map +1 -1
  56. package/lib/types/IDataPoint.d.ts +14 -0
  57. package/lib/types/IDataPoint.js.map +1 -1
  58. package/lib/utilities/image-export-utils.d.ts +13 -0
  59. package/lib/{components/DeclarativeChart/imageExporter.js → utilities/image-export-utils.js} +65 -63
  60. package/lib/utilities/image-export-utils.js.map +1 -0
  61. package/lib/utilities/utilities.d.ts +2 -0
  62. package/lib/utilities/utilities.js +44 -0
  63. package/lib/utilities/utilities.js.map +1 -1
  64. package/lib-amd/components/AreaChart/AreaChart.base.d.ts +3 -1
  65. package/lib-amd/components/AreaChart/AreaChart.base.js +7 -2
  66. package/lib-amd/components/AreaChart/AreaChart.base.js.map +1 -1
  67. package/lib-amd/components/DeclarativeChart/DeclarativeChart.d.ts +1 -1
  68. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js +36 -12
  69. package/lib-amd/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  70. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +8 -4
  71. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  72. package/lib-amd/components/DeclarativeChart/index.d.ts +0 -1
  73. package/lib-amd/components/DeclarativeChart/index.js.map +1 -1
  74. package/lib-amd/components/DonutChart/DonutChart.base.d.ts +3 -1
  75. package/lib-amd/components/DonutChart/DonutChart.base.js +7 -2
  76. package/lib-amd/components/DonutChart/DonutChart.base.js.map +1 -1
  77. package/lib-amd/components/GaugeChart/GaugeChart.base.d.ts +3 -1
  78. package/lib-amd/components/GaugeChart/GaugeChart.base.js +7 -2
  79. package/lib-amd/components/GaugeChart/GaugeChart.base.js.map +1 -1
  80. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +3 -1
  81. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +7 -2
  82. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  83. package/lib-amd/components/HeatMapChart/HeatMapChart.base.d.ts +3 -1
  84. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js +7 -2
  85. package/lib-amd/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  86. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
  87. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +7 -2
  88. package/lib-amd/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  89. package/lib-amd/components/Legends/Legends.base.d.ts +8 -2
  90. package/lib-amd/components/Legends/Legends.base.js +12 -2
  91. package/lib-amd/components/Legends/Legends.base.js.map +1 -1
  92. package/lib-amd/components/Legends/Legends.styles.d.ts +8 -0
  93. package/lib-amd/components/Legends/Legends.styles.js +22 -9
  94. package/lib-amd/components/Legends/Legends.styles.js.map +1 -1
  95. package/lib-amd/components/Legends/Legends.types.d.ts +15 -1
  96. package/lib-amd/components/Legends/Legends.types.js.map +1 -1
  97. package/lib-amd/components/LineChart/LineChart.base.d.ts +11 -1
  98. package/lib-amd/components/LineChart/LineChart.base.js +100 -24
  99. package/lib-amd/components/LineChart/LineChart.base.js.map +1 -1
  100. package/lib-amd/components/LineChart/LineChart.types.d.ts +5 -0
  101. package/lib-amd/components/LineChart/LineChart.types.js.map +1 -1
  102. package/lib-amd/components/SankeyChart/SankeyChart.base.d.ts +2 -1
  103. package/lib-amd/components/SankeyChart/SankeyChart.base.js +4 -1
  104. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  105. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.d.ts +3 -1
  106. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +7 -2
  107. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  108. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -1
  109. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +7 -2
  110. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  111. package/lib-amd/index.d.ts +2 -2
  112. package/lib-amd/index.js.map +1 -1
  113. package/lib-amd/types/IDataPoint.d.ts +14 -0
  114. package/lib-amd/types/IDataPoint.js.map +1 -1
  115. package/lib-amd/utilities/image-export-utils.d.ts +13 -0
  116. package/lib-amd/{components/DeclarativeChart/imageExporter.js → utilities/image-export-utils.js} +69 -67
  117. package/lib-amd/utilities/image-export-utils.js.map +1 -0
  118. package/lib-amd/utilities/utilities.d.ts +2 -0
  119. package/lib-amd/utilities/utilities.js +47 -2
  120. package/lib-amd/utilities/utilities.js.map +1 -1
  121. package/lib-commonjs/components/AreaChart/AreaChart.base.d.ts +3 -1
  122. package/lib-commonjs/components/AreaChart/AreaChart.base.js +7 -1
  123. package/lib-commonjs/components/AreaChart/AreaChart.base.js.map +1 -1
  124. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.d.ts +1 -1
  125. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js +35 -12
  126. package/lib-commonjs/components/DeclarativeChart/DeclarativeChart.js.map +1 -1
  127. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +8 -4
  128. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  129. package/lib-commonjs/components/DeclarativeChart/index.d.ts +0 -1
  130. package/lib-commonjs/components/DeclarativeChart/index.js.map +1 -1
  131. package/lib-commonjs/components/DonutChart/DonutChart.base.d.ts +3 -1
  132. package/lib-commonjs/components/DonutChart/DonutChart.base.js +7 -1
  133. package/lib-commonjs/components/DonutChart/DonutChart.base.js.map +1 -1
  134. package/lib-commonjs/components/GaugeChart/GaugeChart.base.d.ts +3 -1
  135. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js +7 -1
  136. package/lib-commonjs/components/GaugeChart/GaugeChart.base.js.map +1 -1
  137. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.d.ts +3 -1
  138. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +7 -1
  139. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  140. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.d.ts +3 -1
  141. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js +7 -1
  142. package/lib-commonjs/components/HeatMapChart/HeatMapChart.base.js.map +1 -1
  143. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.d.ts +3 -1
  144. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js +7 -1
  145. package/lib-commonjs/components/HorizontalBarChartWithAxis/HorizontalBarChartWithAxis.base.js.map +1 -1
  146. package/lib-commonjs/components/Legends/Legends.base.d.ts +8 -2
  147. package/lib-commonjs/components/Legends/Legends.base.js +12 -1
  148. package/lib-commonjs/components/Legends/Legends.base.js.map +1 -1
  149. package/lib-commonjs/components/Legends/Legends.styles.d.ts +8 -0
  150. package/lib-commonjs/components/Legends/Legends.styles.js +22 -9
  151. package/lib-commonjs/components/Legends/Legends.styles.js.map +1 -1
  152. package/lib-commonjs/components/Legends/Legends.types.d.ts +15 -1
  153. package/lib-commonjs/components/Legends/Legends.types.js.map +1 -1
  154. package/lib-commonjs/components/LineChart/LineChart.base.d.ts +11 -1
  155. package/lib-commonjs/components/LineChart/LineChart.base.js +101 -23
  156. package/lib-commonjs/components/LineChart/LineChart.base.js.map +1 -1
  157. package/lib-commonjs/components/LineChart/LineChart.types.d.ts +5 -0
  158. package/lib-commonjs/components/LineChart/LineChart.types.js.map +1 -1
  159. package/lib-commonjs/components/SankeyChart/SankeyChart.base.d.ts +2 -1
  160. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +4 -0
  161. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  162. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.d.ts +3 -1
  163. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +7 -1
  164. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  165. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.d.ts +3 -1
  166. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +7 -1
  167. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  168. package/lib-commonjs/index.d.ts +2 -2
  169. package/lib-commonjs/index.js.map +1 -1
  170. package/lib-commonjs/types/IDataPoint.d.ts +14 -0
  171. package/lib-commonjs/types/IDataPoint.js.map +1 -1
  172. package/lib-commonjs/utilities/image-export-utils.d.ts +13 -0
  173. package/lib-commonjs/{components/DeclarativeChart/imageExporter.js → utilities/image-export-utils.js} +70 -67
  174. package/lib-commonjs/utilities/image-export-utils.js.map +1 -0
  175. package/lib-commonjs/utilities/utilities.d.ts +2 -0
  176. package/lib-commonjs/utilities/utilities.js +47 -1
  177. package/lib-commonjs/utilities/utilities.js.map +1 -1
  178. package/package.json +4 -4
  179. package/src/components/Legends/Legends.types.ts +20 -1
  180. package/src/components/LineChart/LineChart.types.ts +6 -0
  181. package/lib/components/DeclarativeChart/imageExporter.d.ts +0 -10
  182. package/lib/components/DeclarativeChart/imageExporter.js.map +0 -1
  183. package/lib-amd/components/DeclarativeChart/imageExporter.d.ts +0 -10
  184. package/lib-amd/components/DeclarativeChart/imageExporter.js.map +0 -1
  185. package/lib-commonjs/components/DeclarativeChart/imageExporter.d.ts +0 -10
  186. package/lib-commonjs/components/DeclarativeChart/imageExporter.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Legends.styles.js","sourceRoot":"../src/","sources":["components/Legends/Legends.styles.ts"],"names":[],"mappings":";;;;AACA,uDAAkH;AAE3G,IAAM,SAAS,GAAG,UAAC,KAAwB;;IACxC,IAAA,SAAS,GAA4C,KAAK,UAAjD,EAAE,KAAK,GAAqC,KAAK,MAA1C,EAAE,KAAmC,KAAK,uBAAV,EAA9B,sBAAsB,mBAAG,KAAK,KAAA,CAAW;IAC7D,IAAA,KAAqB,KAAM,EAAzB,OAAO,aAAA,EAAE,KAAK,W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,MAAM;YACb,MAAM,EAAE,MAAM;YACd,eAAe,EAAE,KAAM,CAAC,cAAc,CAAC,gBAAgB;YACvD,WAAW,EAAE,KAAK;YAClB,MAAM,EAAE,WAAW;YACnB,WAAW,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK;SACnE;QACD,2BAA2B,EAAE;YAC3B,IAAA,uBAAa,EAAC,KAAM,EAAE,OAAO,CAAC;gDAE5B,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc,CAAC,QAAQ,IAClC,KAAK,CAAC,KAAK,KACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,KAAK;SAEjB;QACD,aAAa,EAAE;YACb,OAAO,EAAE,KAAK;SACf;QACD,kBAAkB,EAAE;YAClB,eAAe,EAAE;gBACf,IAAI,EAAE,CAAC,IAAA,uBAAa,EAAC,KAAM,EAAE,OAAO,CAAC,CAAC;aACvC;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAlHW,QAAA,SAAS,aAkHpB","sourcesContent":["import { ILegendsStyles, ILegendStyleProps } from './Legends.types';\nimport { HighContrastSelector, getFocusStyle, IGetFocusStylesOptions, IStyle } from '@fluentui/react/lib/Styling';\n\nexport const getStyles = (props: ILegendStyleProps): ILegendsStyles => {\n const { className, theme, isLineLegendInBarChart = false } = props;\n const { palette, fonts } = theme!;\n const options: IGetFocusStylesOptions = {\n inset: undefined,\n position: undefined,\n highContrastStyle: {\n outlineColor: theme!.semanticColors.focusBorder,\n },\n borderColor: 'transparent',\n outlineColor: undefined,\n };\n return {\n root: [\n {\n whiteSpace: 'nowrap',\n width: '100%',\n alignItems: 'center',\n margin: '-8px 0 0 -8px',\n },\n className,\n ],\n legend: [\n getFocusStyle(theme!, options),\n {\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n border: 'none',\n padding: '8px',\n background: 'none',\n textTransform: 'capitalize',\n },\n ],\n rect: {\n selectors: {\n [HighContrastSelector]: {\n content: `linear-gradient(to right, ${props.colorOnSelectedState}, ${props.colorOnSelectedState})`,\n opacity: props.colorOnSelectedState === theme!.semanticColors.buttonBackground ? '0.6' : '',\n },\n },\n width: '12px',\n height: isLineLegendInBarChart ? '4px' : '12px',\n backgroundColor: props.stripePattern ? '' : props.colorOnSelectedState,\n marginRight: '8px',\n border: '1px solid',\n borderColor: props.borderColor ? props.borderColor : theme?.semanticColors.buttonBorder,\n content: props.stripePattern\n ? // eslint-disable-next-line @fluentui/max-len\n `repeating-linear-gradient(135deg, transparent, transparent 3px, ${props.colorOnSelectedState} 1px, ${props.colorOnSelectedState} 4px)`\n : '',\n },\n shape: [\n {\n marginRight: '8px',\n },\n ],\n triangle: {\n width: '0',\n height: '0',\n borderLeft: '6px solid transparent',\n borderRight: '6px solid transparent',\n borderTop: '10.4px solid',\n borderTopColor: props.colorOnSelectedState,\n marginRight: '8px',\n opacity:\n props.colorOnSelectedState === theme!.semanticColors.buttonBackground\n ? '0.6'\n : props.opacity\n ? props.opacity\n : '',\n selectors: {\n [HighContrastSelector]: {\n border: '0px',\n height: '10.4px',\n width: '10.4px',\n clipPath: 'polygon(50% 100%, 0 0, 100% 0)',\n backgroundImage: `linear-gradient(to right, ${props.colorOnSelectedState}, ${props.colorOnSelectedState})`,\n } as IStyle,\n },\n },\n text: {\n ...fonts.small,\n lineHeight: '16px',\n color: theme?.semanticColors.bodyText,\n opacity: props.colorOnSelectedState === theme!.semanticColors.buttonBackground ? '0.67' : '',\n },\n hoverChange: {\n width: '12px',\n height: '12px',\n backgroundColor: theme!.semanticColors.buttonBackground,\n marginRight: '8px',\n border: '1px solid',\n borderColor: props.borderColor ? props.borderColor : palette.black,\n },\n overflowIndicationTextStyle: [\n getFocusStyle(theme!, options),\n {\n cursor: 'pointer',\n color: theme?.semanticColors.bodyText,\n ...fonts.small,\n lineHeight: '16px',\n padding: '8px',\n },\n ],\n hoverCardRoot: {\n padding: '8px',\n },\n subComponentStyles: {\n hoverCardStyles: {\n host: [getFocusStyle(theme!, options)],\n },\n },\n };\n};\n"]}
1
+ {"version":3,"file":"Legends.styles.js","sourceRoot":"../src/","sources":["components/Legends/Legends.styles.ts"],"names":[],"mappings":";;;;AACA,uDAAkH;AAElH,gEAAgE;AACnD,QAAA,2BAA2B,GAAG,CAAC,CAAC;AAChC,QAAA,6BAA6B,GAAG,EAAE,CAAC;AACnC,QAAA,cAAc,GAAG,CAAC,CAAC;AACnB,QAAA,aAAa,GAAG,EAAE,CAAC;AACnB,QAAA,mBAAmB,GAAG,CAAC,CAAC;AACrC,IAAM,gCAAgC,GAAG,EAAE,CAAC;AAC5C,iGAAiG;AACjG,uGAAuG;AACvG,gCAAgC;AACnB,QAAA,iBAAiB,GAAG,gCAAgC,GAAG,2BAAmB,CAAC;AAC3E,QAAA,uBAAuB,GAAG,CAAC,CAAC;AAC5B,QAAA,4BAA4B,GAAG,IAAI,CAAC;AAE1C,IAAM,SAAS,GAAG,UAAC,KAAwB;;IACxC,IAAA,SAAS,GAA4C,KAAK,UAAjD,EAAE,KAAK,GAAqC,KAAK,MAA1C,EAAE,KAAmC,KAAK,uBAAV,EAA9B,sBAAsB,mBAAG,KAAK,KAAA,CAAW;IAC7D,IAAA,KAAqB,KAAM,EAAzB,OAAO,aAAA,EAAE,KAAK,WAAW,CAAC;IAClC,IAAM,OAAO,GAA2B;QACtC,KAAK,EAAE,SAAS;QAChB,QAAQ,EAAE,SAAS;QACnB,iBAAiB,EAAE;YACjB,YAAY,EAAE,KAAM,CAAC,cAAc,CAAC,WAAW;SAChD;QACD,WAAW,EAAE,aAAa;QAC1B,YAAY,EAAE,SAAS;KACxB,CAAC;IACF,OAAO;QACL,IAAI,EAAE;YACJ;gBACE,UAAU,EAAE,QAAQ;gBACpB,KAAK,EAAE,MAAM;gBACb,UAAU,EAAE,QAAQ;gBACpB,MAAM,EAAE,eAAe;aACxB;YACD,SAAS;SACV;QACD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AAa,EAAC,KAAM,EAAE,OAAO,CAAC;gDAE5B,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,cAAc,CAAC,QAAQ,IAClC,KAAK,CAAC,KAAK,KACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,UAAG,sBAAc,OAAI;SAEjC;QACD,aAAa,EAAE;YACb,OAAO,EAAE,KAAK;SACf;QACD,kBAAkB,EAAE;YAClB,eAAe,EAAE;gBACf,IAAI,EAAE,CAAC,IAAA,uBAAa,EAAC,KAAM,EAAE,OAAO,CAAC,CAAC;aACvC;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAnHW,QAAA,SAAS,aAmHpB","sourcesContent":["import { ILegendsStyles, ILegendStyleProps } from './Legends.types';\nimport { HighContrastSelector, getFocusStyle, IGetFocusStylesOptions, IStyle } from '@fluentui/react/lib/Styling';\n\n// Constants needed to create legends using SVG for image export\nexport const LEGEND_CONTAINER_MARGIN_TOP = 8;\nexport const LEGEND_CONTAINER_MARGIN_START = 12;\nexport const LEGEND_PADDING = 8;\nexport const LEGEND_HEIGHT = 32;\nexport const LEGEND_SHAPE_BORDER = 1;\nconst LEGEND_SHAPE_SIZE_WITHOUT_BORDER = 12;\n// SVG strokes are drawn centered around the path, with half of the stroke width extending inward\n// (overlapping the fill area) and half outward. To ensure the filled area maintains its intended size,\n// expand the shape accordingly.\nexport const LEGEND_SHAPE_SIZE = LEGEND_SHAPE_SIZE_WITHOUT_BORDER + LEGEND_SHAPE_BORDER;\nexport const LEGEND_SHAPE_MARGIN_END = 8;\nexport const INACTIVE_LEGEND_TEXT_OPACITY = 0.67;\n\nexport const getStyles = (props: ILegendStyleProps): ILegendsStyles => {\n const { className, theme, isLineLegendInBarChart = false } = props;\n const { palette, fonts } = theme!;\n const options: IGetFocusStylesOptions = {\n inset: undefined,\n position: undefined,\n highContrastStyle: {\n outlineColor: theme!.semanticColors.focusBorder,\n },\n borderColor: 'transparent',\n outlineColor: undefined,\n };\n return {\n root: [\n {\n whiteSpace: 'nowrap',\n width: '100%',\n alignItems: 'center',\n margin: '-8px 0 0 -8px',\n },\n className,\n ],\n legend: [\n getFocusStyle(theme!, options),\n {\n display: 'flex',\n alignItems: 'center',\n cursor: 'pointer',\n border: 'none',\n padding: `${LEGEND_PADDING}px`,\n background: 'none',\n textTransform: 'capitalize',\n },\n ],\n rect: {\n selectors: {\n [HighContrastSelector]: {\n content: `linear-gradient(to right, ${props.colorOnSelectedState}, ${props.colorOnSelectedState})`,\n opacity: props.colorOnSelectedState === theme!.semanticColors.buttonBackground ? '0.6' : '',\n },\n },\n width: `${LEGEND_SHAPE_SIZE_WITHOUT_BORDER}px`,\n height: isLineLegendInBarChart ? '4px' : `${LEGEND_SHAPE_SIZE_WITHOUT_BORDER}px`,\n backgroundColor: props.stripePattern ? '' : props.colorOnSelectedState,\n marginRight: `${LEGEND_SHAPE_MARGIN_END}px`,\n border: `${LEGEND_SHAPE_BORDER}px solid`,\n borderColor: props.borderColor ? props.borderColor : theme?.semanticColors.buttonBorder,\n content: props.stripePattern\n ? // eslint-disable-next-line @fluentui/max-len\n `repeating-linear-gradient(135deg, transparent, transparent 3px, ${props.colorOnSelectedState} 1px, ${props.colorOnSelectedState} 4px)`\n : '',\n },\n shape: [\n {\n marginRight: `${LEGEND_SHAPE_MARGIN_END}px`,\n },\n ],\n triangle: {\n width: '0',\n height: '0',\n borderLeft: '6px solid transparent',\n borderRight: '6px solid transparent',\n borderTop: '10.4px solid',\n borderTopColor: props.colorOnSelectedState,\n marginRight: '8px',\n opacity:\n props.colorOnSelectedState === theme!.semanticColors.buttonBackground\n ? '0.6'\n : props.opacity\n ? props.opacity\n : '',\n selectors: {\n [HighContrastSelector]: {\n border: '0px',\n height: '10.4px',\n width: '10.4px',\n clipPath: 'polygon(50% 100%, 0 0, 100% 0)',\n backgroundImage: `linear-gradient(to right, ${props.colorOnSelectedState}, ${props.colorOnSelectedState})`,\n } as IStyle,\n },\n },\n text: {\n ...fonts.small,\n lineHeight: '16px',\n color: theme?.semanticColors.bodyText,\n opacity:\n props.colorOnSelectedState === theme!.semanticColors.buttonBackground ? `${INACTIVE_LEGEND_TEXT_OPACITY}` : '',\n },\n hoverChange: {\n width: '12px',\n height: '12px',\n backgroundColor: theme!.semanticColors.buttonBackground,\n marginRight: '8px',\n border: '1px solid',\n borderColor: props.borderColor ? props.borderColor : palette.black,\n },\n overflowIndicationTextStyle: [\n getFocusStyle(theme!, options),\n {\n cursor: 'pointer',\n color: theme?.semanticColors.bodyText,\n ...fonts.small,\n lineHeight: '16px',\n padding: `${LEGEND_PADDING}px`,\n },\n ],\n hoverCardRoot: {\n padding: '8px',\n },\n subComponentStyles: {\n hoverCardStyles: {\n host: [getFocusStyle(theme!, options)],\n },\n },\n };\n};\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { ITheme, IStyle } from '@fluentui/react/lib/Styling';
3
- import { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';
3
+ import { IRefObject, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';
4
4
  import { IHoverCardStyleProps, IHoverCardStyles } from '@fluentui/react/lib/HoverCard';
5
5
  import { IOverflowSetProps } from '@fluentui/react/lib/OverflowSet';
6
6
  import { IFocusZoneProps } from '@fluentui/react-focus';
@@ -234,6 +234,10 @@ export interface ILegendsProps {
234
234
  * The shape for the legend.
235
235
  */
236
236
  shape?: LegendShape;
237
+ /**
238
+ * Callback to access the public methods and properties of the component.
239
+ */
240
+ ref?: IRefObject<ILegendContainer>;
237
241
  }
238
242
  /**
239
243
  * @public
@@ -243,3 +247,13 @@ export interface ILegendsProps {
243
247
  * {@docCategory Legends}
244
248
  */
245
249
  export type LegendShape = 'default' | 'triangle' | keyof typeof Points | keyof typeof CustomPoints;
250
+ /**
251
+ * {@docCategory Legends}
252
+ */
253
+ export interface ILegendContainer {
254
+ toSVG: (svgWidth: number, isRTL?: boolean) => {
255
+ node: SVGGElement | null;
256
+ width: number;
257
+ height: number;
258
+ };
259
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"Legends.types.js","sourceRoot":"../src/","sources":["components/Legends/Legends.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ITheme, IStyle } from '@fluentui/react/lib/Styling';\nimport { IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { IHoverCardStyleProps, IHoverCardStyles } from '@fluentui/react/lib/HoverCard';\nimport { IOverflowSetProps } from '@fluentui/react/lib/OverflowSet';\nimport { IFocusZoneProps } from '@fluentui/react-focus';\nimport { CustomPoints, Points } from '../../utilities/utilities';\n\nexport interface ILegendOverflowData {\n primary: ILegend[];\n\n overflow?: ILegend[];\n}\n\n/**\n * @public\n * {@docCategory Legends}\n */\nexport interface ILegendSubComponentStyles {\n hoverCardStyles: IStyleFunctionOrObject<IHoverCardStyleProps, IHoverCardStyles>;\n}\n\n/**\n * @public\n * Legends styles\n * {@docCategory Legends}\n */\nexport interface ILegendsStyles {\n /**\n * Style set for the root of the legend component\n */\n root: IStyle;\n\n /**\n * Style set for Legend. This is a wrapping class for text of legend and the rectange box that represents a legend\n */\n legend: IStyle;\n\n /**\n * Style set for the rectangle that represents a legend\n */\n rect: IStyle;\n\n /**\n * styles set for the shape that represents a legend\n */\n shape: IStyle;\n\n /**\n * Style set for the triangle that represents a legend\n */\n triangle: IStyle;\n\n /**\n * Style for the legend text\n */\n text: IStyle;\n\n /**\n * Style for the legend text\n */\n hoverChange: IStyle;\n\n /**\n * Style for the text that indicates the no.of legends that are in hovercard due to lack of space\n */\n overflowIndicationTextStyle: IStyle;\n\n /**\n * Style for the overflow container\n */\n hoverCardRoot: IStyle;\n\n /**\n * sub component styles\n */\n subComponentStyles: ILegendSubComponentStyles;\n}\n\n/**\n * @public\n * ILegend interface\n * {@docCategory Legends}\n */\nexport interface ILegend {\n /**\n * Defines the title of the legend\n */\n title: string;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n action?: VoidFunction;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverAction?: VoidFunction;\n\n /**\n * Defines the function that is executed upon moving the mouse away from the legend\n */\n onMouseOutAction?: (isLegendFocused?: boolean) => void;\n\n /**\n * The color for the legend\n */\n color: string;\n\n /**\n * The opacity of the legend color\n */\n opacity?: number;\n\n /**\n * The shape for the legend\n */\n shape?: LegendShape;\n\n /**\n * Indicated whether or not to apply stripe pattern\n */\n stripePattern?: boolean;\n\n /**\n * Indicates if the legend belongs to a line in the Bar Chart\n */\n isLineLegendInBarChart?: boolean;\n\n /*\n * native button props for the legend button\n */\n nativeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n}\n\n/**\n * @public\n * Legend style properties\n * {@docCategory Legends}\n */\nexport interface ILegendStyleProps {\n theme?: ITheme;\n className?: string;\n colorOnSelectedState?: string;\n borderColor?: string;\n opacity?: number;\n overflow?: boolean;\n stripePattern?: boolean;\n isLineLegendInBarChart?: boolean;\n}\n\n/**\n * @public\n * Legend properties\n * {@docCategory Legends}\n */\nexport interface ILegendsProps {\n /**\n * Prop that takes list of legends\n */\n legends: ILegend[];\n\n /**\n * Additional CSS class(es) to apply to the legneds component.\n */\n className?: string;\n\n /**\n * Theme (provided through customization.)\n */\n theme?: ITheme;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<ILegendStyleProps, ILegendsStyles>;\n\n /**\n * This prop makes the legends component align itself to the center in the container it is sitting in\n */\n centerLegends?: boolean;\n\n /**\n * Enable the legends to wrap lines if there is not enough space to show all legends on a single line\n */\n enabledWrapLines?: boolean;\n\n /**\n * props for the overflow set component\n */\n overflowProps?: Partial<IOverflowSetProps>;\n\n /**\n * focus zone props in hover card\n */\n focusZonePropsInHoverCard?: IFocusZoneProps;\n\n /**\n * text for overflow legends string\n */\n overflowText?: string;\n\n /**\n * prop that decides if legends are focusable\n * @default true\n */\n allowFocusOnLegends?: boolean;\n\n /**\n * prop that decide if we can select multiple legends or single legend at a time\n * @default false\n */\n canSelectMultipleLegends?: boolean;\n\n /**\n * Defines the function that is executed upon hiding of hover card\n * make sure to send prop when the prop is canSelectMultipleLegends is set to true\n * and empty the selected state legends\n */\n onLegendHoverCardLeave?: VoidFunction;\n\n /**\n * Callback issued when the selected option changes.\n */\n onChange?: (selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: ILegend) => void;\n\n /**\n * Keys (title) that will be initially used to set selected items. This prop is used for multi-select scenarios when\n * canSelectMultipleLegends is true; for single-select, use defaultSelectedLegend.\n *\n * Updating this prop does not change the selection after the component has been initialized. For controlled\n * selections, use selectedLegends instead.\n *\n * @see selectedLegends for setting the selected legends in controlled mode.\n * @see defaultSelectedLegend for setting the initially selected legend when canSelectMultipleLegends is false.\n */\n defaultSelectedLegends?: string[];\n\n /**\n * Key that will be initially used to set selected item. This prop is used for single-select scenarios when\n * canSelectMultipleLegends is false or unspecified; for multi-select, use defaultSelectedLegends.\n *\n * Updating this prop does not change the selection after the component has been initialized. For controlled\n * selections, use selectedLegend instead.\n *\n * @see selectedLegend for setting the selected legend in controlled mode.\n * @see defaultSelectedLegends for setting the initially selected legends when canSelectMultipleLegends is true.\n */\n defaultSelectedLegend?: string;\n\n /**\n * Keys (title) that will be used to set selected items in multi-select scenarios when canSelectMultipleLegends is\n * true. For single-select, use selectedLegend.\n *\n * When this prop is provided, the component is controlled and does not automatically update the selection based on\n * user interactions; the parent component must update the value passed to this property by handling the onChange\n * event.\n *\n * @see defaultSelectedLegends for setting the initially-selected legends in uncontrolled mode.\n * @see selectedLegends for setting the selected legends when `canSelectMultipleLegends` is `true`.\n */\n selectedLegends?: string[];\n\n /**\n * Key (title) that will be used to set the selected item in single-select scenarios when canSelectMultipleLegends is\n * false or unspecified. For multi-select, use selectedLegends.\n *\n * When this prop is provided, the component is controlled and does not automatically update the selection based on\n * user interactions; the parent component must update the value passed to this property by handling the onChange\n * event.\n *\n * @see defaultSelectedLegend for setting the initially-selected legend in uncontrolled mode.\n * @see selectedLegend for setting the selected legend when `canSelectMultipleLegends` is `false`.\n */\n selectedLegend?: string;\n\n /**\n * The shape for the legend.\n */\n shape?: LegendShape;\n}\n\n/**\n * @public\n * The shape for the legend\n * default: show the rect legend\n * triangle: show the triangle legend\n * {@docCategory Legends}\n */\nexport type LegendShape = 'default' | 'triangle' | keyof typeof Points | keyof typeof CustomPoints;\n"]}
1
+ {"version":3,"file":"Legends.types.js","sourceRoot":"../src/","sources":["components/Legends/Legends.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ITheme, IStyle } from '@fluentui/react/lib/Styling';\nimport { IRefObject, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport { IHoverCardStyleProps, IHoverCardStyles } from '@fluentui/react/lib/HoverCard';\nimport { IOverflowSetProps } from '@fluentui/react/lib/OverflowSet';\nimport { IFocusZoneProps } from '@fluentui/react-focus';\nimport { CustomPoints, Points } from '../../utilities/utilities';\n\nexport interface ILegendOverflowData {\n primary: ILegend[];\n\n overflow?: ILegend[];\n}\n\n/**\n * @public\n * {@docCategory Legends}\n */\nexport interface ILegendSubComponentStyles {\n hoverCardStyles: IStyleFunctionOrObject<IHoverCardStyleProps, IHoverCardStyles>;\n}\n\n/**\n * @public\n * Legends styles\n * {@docCategory Legends}\n */\nexport interface ILegendsStyles {\n /**\n * Style set for the root of the legend component\n */\n root: IStyle;\n\n /**\n * Style set for Legend. This is a wrapping class for text of legend and the rectange box that represents a legend\n */\n legend: IStyle;\n\n /**\n * Style set for the rectangle that represents a legend\n */\n rect: IStyle;\n\n /**\n * styles set for the shape that represents a legend\n */\n shape: IStyle;\n\n /**\n * Style set for the triangle that represents a legend\n */\n triangle: IStyle;\n\n /**\n * Style for the legend text\n */\n text: IStyle;\n\n /**\n * Style for the legend text\n */\n hoverChange: IStyle;\n\n /**\n * Style for the text that indicates the no.of legends that are in hovercard due to lack of space\n */\n overflowIndicationTextStyle: IStyle;\n\n /**\n * Style for the overflow container\n */\n hoverCardRoot: IStyle;\n\n /**\n * sub component styles\n */\n subComponentStyles: ILegendSubComponentStyles;\n}\n\n/**\n * @public\n * ILegend interface\n * {@docCategory Legends}\n */\nexport interface ILegend {\n /**\n * Defines the title of the legend\n */\n title: string;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n action?: VoidFunction;\n\n /**\n * Defines the function that is executed upon hovering over the legend\n */\n hoverAction?: VoidFunction;\n\n /**\n * Defines the function that is executed upon moving the mouse away from the legend\n */\n onMouseOutAction?: (isLegendFocused?: boolean) => void;\n\n /**\n * The color for the legend\n */\n color: string;\n\n /**\n * The opacity of the legend color\n */\n opacity?: number;\n\n /**\n * The shape for the legend\n */\n shape?: LegendShape;\n\n /**\n * Indicated whether or not to apply stripe pattern\n */\n stripePattern?: boolean;\n\n /**\n * Indicates if the legend belongs to a line in the Bar Chart\n */\n isLineLegendInBarChart?: boolean;\n\n /*\n * native button props for the legend button\n */\n nativeButtonProps?: React.ButtonHTMLAttributes<HTMLButtonElement>;\n}\n\n/**\n * @public\n * Legend style properties\n * {@docCategory Legends}\n */\nexport interface ILegendStyleProps {\n theme?: ITheme;\n className?: string;\n colorOnSelectedState?: string;\n borderColor?: string;\n opacity?: number;\n overflow?: boolean;\n stripePattern?: boolean;\n isLineLegendInBarChart?: boolean;\n}\n\n/**\n * @public\n * Legend properties\n * {@docCategory Legends}\n */\nexport interface ILegendsProps {\n /**\n * Prop that takes list of legends\n */\n legends: ILegend[];\n\n /**\n * Additional CSS class(es) to apply to the legneds component.\n */\n className?: string;\n\n /**\n * Theme (provided through customization.)\n */\n theme?: ITheme;\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<ILegendStyleProps, ILegendsStyles>;\n\n /**\n * This prop makes the legends component align itself to the center in the container it is sitting in\n */\n centerLegends?: boolean;\n\n /**\n * Enable the legends to wrap lines if there is not enough space to show all legends on a single line\n */\n enabledWrapLines?: boolean;\n\n /**\n * props for the overflow set component\n */\n overflowProps?: Partial<IOverflowSetProps>;\n\n /**\n * focus zone props in hover card\n */\n focusZonePropsInHoverCard?: IFocusZoneProps;\n\n /**\n * text for overflow legends string\n */\n overflowText?: string;\n\n /**\n * prop that decides if legends are focusable\n * @default true\n */\n allowFocusOnLegends?: boolean;\n\n /**\n * prop that decide if we can select multiple legends or single legend at a time\n * @default false\n */\n canSelectMultipleLegends?: boolean;\n\n /**\n * Defines the function that is executed upon hiding of hover card\n * make sure to send prop when the prop is canSelectMultipleLegends is set to true\n * and empty the selected state legends\n */\n onLegendHoverCardLeave?: VoidFunction;\n\n /**\n * Callback issued when the selected option changes.\n */\n onChange?: (selectedLegends: string[], event: React.MouseEvent<HTMLButtonElement>, currentLegend?: ILegend) => void;\n\n /**\n * Keys (title) that will be initially used to set selected items. This prop is used for multi-select scenarios when\n * canSelectMultipleLegends is true; for single-select, use defaultSelectedLegend.\n *\n * Updating this prop does not change the selection after the component has been initialized. For controlled\n * selections, use selectedLegends instead.\n *\n * @see selectedLegends for setting the selected legends in controlled mode.\n * @see defaultSelectedLegend for setting the initially selected legend when canSelectMultipleLegends is false.\n */\n defaultSelectedLegends?: string[];\n\n /**\n * Key that will be initially used to set selected item. This prop is used for single-select scenarios when\n * canSelectMultipleLegends is false or unspecified; for multi-select, use defaultSelectedLegends.\n *\n * Updating this prop does not change the selection after the component has been initialized. For controlled\n * selections, use selectedLegend instead.\n *\n * @see selectedLegend for setting the selected legend in controlled mode.\n * @see defaultSelectedLegends for setting the initially selected legends when canSelectMultipleLegends is true.\n */\n defaultSelectedLegend?: string;\n\n /**\n * Keys (title) that will be used to set selected items in multi-select scenarios when canSelectMultipleLegends is\n * true. For single-select, use selectedLegend.\n *\n * When this prop is provided, the component is controlled and does not automatically update the selection based on\n * user interactions; the parent component must update the value passed to this property by handling the onChange\n * event.\n *\n * @see defaultSelectedLegends for setting the initially-selected legends in uncontrolled mode.\n * @see selectedLegends for setting the selected legends when `canSelectMultipleLegends` is `true`.\n */\n selectedLegends?: string[];\n\n /**\n * Key (title) that will be used to set the selected item in single-select scenarios when canSelectMultipleLegends is\n * false or unspecified. For multi-select, use selectedLegends.\n *\n * When this prop is provided, the component is controlled and does not automatically update the selection based on\n * user interactions; the parent component must update the value passed to this property by handling the onChange\n * event.\n *\n * @see defaultSelectedLegend for setting the initially-selected legend in uncontrolled mode.\n * @see selectedLegend for setting the selected legend when `canSelectMultipleLegends` is `false`.\n */\n selectedLegend?: string;\n\n /**\n * The shape for the legend.\n */\n shape?: LegendShape;\n\n /**\n * Callback to access the public methods and properties of the component.\n */\n ref?: IRefObject<ILegendContainer>;\n}\n\n/**\n * @public\n * The shape for the legend\n * default: show the rect legend\n * triangle: show the triangle legend\n * {@docCategory Legends}\n */\nexport type LegendShape = 'default' | 'triangle' | keyof typeof Points | keyof typeof CustomPoints;\n\n/**\n * {@docCategory Legends}\n */\nexport interface ILegendContainer {\n toSVG: (\n svgWidth: number,\n isRTL?: boolean,\n ) => {\n node: SVGGElement | null;\n width: number;\n height: number;\n };\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { IAccessibilityProps, IBasestate, ILineChartProps, ILineChartPoints, ICustomizedCalloutData, IColorFillBarsProps, ILineChartDataPoint } from '../../index';
3
- import { IChart } from '../../types/index';
3
+ import { IChart, IImageExportOptions } from '../../types/index';
4
4
  type LineChartDataWithIndex = ILineChartPoints & {
5
5
  index: number;
6
6
  };
@@ -41,13 +41,21 @@ export declare class LineChartBase extends React.Component<ILineChartProps, ILin
41
41
  private _emptyChartId;
42
42
  private _isRTL;
43
43
  private _cartesianChartRef;
44
+ private _legendsRef;
45
+ private _xMin;
46
+ private _yMin;
47
+ private _xMax;
48
+ private _xPadding;
49
+ private _yPadding;
44
50
  constructor(props: ILineChartProps);
45
51
  componentDidUpdate(prevProps: ILineChartProps): void;
46
52
  render(): JSX.Element;
47
53
  get chartContainer(): HTMLElement | null;
54
+ toImage: (opts?: IImageExportOptions) => Promise<string>;
48
55
  private _getDomainNRangeValues;
49
56
  private _injectIndexPropertyInLineChartData;
50
57
  private _getCustomizedCallout;
58
+ private _getNumericMinMaxOfY;
51
59
  private _getMargins;
52
60
  private _initializeLineChartData;
53
61
  private _handleSingleLegendSelectionAction;
@@ -57,6 +65,7 @@ export declare class LineChartBase extends React.Component<ILineChartProps, ILin
57
65
  private _getBoxWidthOfShape;
58
66
  private _getPath;
59
67
  private _getPointFill;
68
+ private _getRangeForScatterMarkerSize;
60
69
  private _createLines;
61
70
  private _createColorFillBars;
62
71
  private _getStripePattern;
@@ -89,6 +98,7 @@ export declare class LineChartBase extends React.Component<ILineChartProps, ILin
89
98
  private _noLegendHighlighted;
90
99
  private _getColorFillBarOpacity;
91
100
  private _getAriaLabel;
101
+ private _getDomainNRangeValuesWithPadding;
92
102
  private _isChartEmpty;
93
103
  private _getChartTitle;
94
104
  }
@@ -7,11 +7,13 @@ var d3_selection_1 = require("d3-selection");
7
7
  var d3_array_1 = require("d3-array");
8
8
  var index_1 = require("../Legends/index");
9
9
  var d3_shape_1 = require("d3-shape");
10
+ var d3_array_2 = require("d3-array");
10
11
  var Utilities_1 = require("@fluentui/react/lib/Utilities");
11
12
  var index_2 = require("../../index");
12
13
  var Callout_1 = require("@fluentui/react/lib/Callout");
13
14
  var EventAnnotation_1 = require("./eventAnnotation/EventAnnotation");
14
15
  var index_3 = require("../../utilities/index");
16
+ var image_export_utils_1 = require("../../utilities/image-export-utils");
15
17
  var getClassNames = (0, Utilities_1.classNamesFunction)();
16
18
  var PointSize;
17
19
  (function (PointSize) {
@@ -62,9 +64,21 @@ var LineChartBase = /** @class */ (function (_super) {
62
64
  _this_1._yAxisScale = '';
63
65
  _this_1.eventLabelHeight = 36;
64
66
  _this_1._isRTL = (0, Utilities_1.getRTL)();
67
+ _this_1._xMin = Number.NEGATIVE_INFINITY;
68
+ _this_1._yMin = Number.NEGATIVE_INFINITY;
69
+ _this_1._xMax = Number.POSITIVE_INFINITY;
70
+ _this_1._xPadding = 0;
71
+ _this_1._yPadding = 0;
72
+ _this_1.toImage = function (opts) {
73
+ var _a, _b;
74
+ return (0, image_export_utils_1.toImage)((_a = _this_1._cartesianChartRef.current) === null || _a === void 0 ? void 0 : _a.chartContainer, (_b = _this_1._legendsRef.current) === null || _b === void 0 ? void 0 : _b.toSVG, _this_1._isRTL, opts);
75
+ };
65
76
  _this_1._getDomainNRangeValues = function (points, margins, width, chartType, isRTL, xAxisType, barWidth, tickValues, shiftX) {
66
77
  var domainNRangeValue;
67
- if (xAxisType === index_3.XAxisTypes.NumericAxis) {
78
+ if (_this_1.props.lineMode === 'scatter' && xAxisType === index_3.XAxisTypes.NumericAxis) {
79
+ domainNRangeValue = _this_1._getDomainNRangeValuesWithPadding(points, margins, width, isRTL);
80
+ }
81
+ else if (xAxisType === index_3.XAxisTypes.NumericAxis) {
68
82
  domainNRangeValue = (0, index_3.domainRangeOfNumericForAreaChart)(points, margins, width, isRTL);
69
83
  }
70
84
  else if (xAxisType === index_3.XAxisTypes.DateAxis) {
@@ -108,6 +122,18 @@ var LineChartBase = /** @class */ (function (_super) {
108
122
  ? _this_1.props.onRenderCalloutPerDataPoint(_this_1.state.dataPointCalloutProps)
109
123
  : null;
110
124
  };
125
+ _this_1._getNumericMinMaxOfY = function (points) {
126
+ // eslint-disable-next-line @typescript-eslint/no-shadow
127
+ var _a = (0, index_3.findNumericMinMaxOfY)(points), startValue = _a.startValue, endValue = _a.endValue;
128
+ _this_1._yMin = startValue;
129
+ if (_this_1.props.lineMode === 'scatter') {
130
+ _this_1._yPadding = (endValue - startValue) * 0.1;
131
+ }
132
+ return {
133
+ startValue: startValue - _this_1._yPadding,
134
+ endValue: endValue + _this_1._yPadding,
135
+ };
136
+ };
111
137
  _this_1._getMargins = function (margins) {
112
138
  _this_1.margins = margins;
113
139
  };
@@ -551,6 +577,34 @@ var LineChartBase = /** @class */ (function (_super) {
551
577
  var yValue = point.yAxisCalloutData || point.y;
552
578
  return ((_a = point.callOutAccessibilityData) === null || _a === void 0 ? void 0 : _a.ariaLabel) || "".concat(xValue, ". ").concat(legend, ", ").concat(yValue, ".");
553
579
  };
580
+ _this_1._getDomainNRangeValuesWithPadding = function (points, margins, width, isRTL) {
581
+ _this_1._xMin = (0, d3_array_2.min)(points, function (point) {
582
+ return (0, d3_array_2.min)(point.data, function (item) { return item.x; });
583
+ });
584
+ _this_1._xMax = (0, d3_array_2.max)(points, function (point) {
585
+ return (0, d3_array_2.max)(point.data, function (item) {
586
+ return item.x;
587
+ });
588
+ });
589
+ if (_this_1.props.lineMode === 'scatter') {
590
+ _this_1._xPadding = (_this_1._xMax - _this_1._xMin) * 0.1;
591
+ }
592
+ var rStartValue = margins.left;
593
+ var rEndValue = width - margins.right;
594
+ return isRTL
595
+ ? {
596
+ dStartValue: _this_1._xMax + _this_1._xPadding,
597
+ dEndValue: _this_1._xMin - _this_1._xPadding,
598
+ rStartValue: rStartValue,
599
+ rEndValue: rEndValue,
600
+ }
601
+ : {
602
+ dStartValue: _this_1._xMin - _this_1._xPadding,
603
+ dEndValue: _this_1._xMax + _this_1._xPadding,
604
+ rStartValue: rStartValue,
605
+ rEndValue: rEndValue,
606
+ };
607
+ };
554
608
  _this_1._getChartTitle = function () {
555
609
  var _a = _this_1.props.data, chartTitle = _a.chartTitle, lineChartData = _a.lineChartData;
556
610
  return (chartTitle ? "".concat(chartTitle, ". ") : '') + "Line chart with ".concat((lineChartData === null || lineChartData === void 0 ? void 0 : lineChartData.length) || 0, " lines. ");
@@ -586,6 +640,7 @@ var LineChartBase = /** @class */ (function (_super) {
586
640
  _this_1._firstRenderOptimization = true;
587
641
  _this_1._emptyChartId = (0, Utilities_1.getId)('_LineChart_empty');
588
642
  _this_1._cartesianChartRef = React.createRef();
643
+ _this_1._legendsRef = React.createRef();
589
644
  props.eventAnnotationProps &&
590
645
  props.eventAnnotationProps.labelHeight &&
591
646
  (_this_1.eventLabelHeight = props.eventAnnotationProps.labelHeight);
@@ -635,7 +690,7 @@ var LineChartBase = /** @class */ (function (_super) {
635
690
  tickValues: tickValues,
636
691
  tickFormat: tickFormat,
637
692
  };
638
- return !this._isChartEmpty() ? (React.createElement(index_2.CartesianChart, tslib_1.__assign({}, this.props, { chartTitle: this._getChartTitle(), points: points, chartType: index_3.ChartTypes.LineChart, isCalloutForStack: true, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, createYAxis: index_3.createNumericYAxis, getmargins: this._getMargins, getMinMaxOfYAxis: index_3.findNumericMinMaxOfY, getGraphData: this._initializeLineChartData, xAxisType: isXAxisDateType ? index_3.XAxisTypes.DateAxis : index_3.XAxisTypes.NumericAxis, customizedCallout: this._getCustomizedCallout(), getDomainNRangeValues: this._getDomainNRangeValues, createStringYAxis: index_3.createStringYAxis, onChartMouseLeave: this._handleChartMouseLeave, enableFirstRenderOptimization: this.props.enablePerfOptimization && this._firstRenderOptimization, ref: this._cartesianChartRef,
693
+ return !this._isChartEmpty() ? (React.createElement(index_2.CartesianChart, tslib_1.__assign({}, this.props, { chartTitle: this._getChartTitle(), points: points, chartType: index_3.ChartTypes.LineChart, isCalloutForStack: true, calloutProps: calloutProps, tickParams: tickParams, legendBars: legendBars, createYAxis: index_3.createNumericYAxis, getmargins: this._getMargins, getMinMaxOfYAxis: this._getNumericMinMaxOfY, getGraphData: this._initializeLineChartData, xAxisType: isXAxisDateType ? index_3.XAxisTypes.DateAxis : index_3.XAxisTypes.NumericAxis, customizedCallout: this._getCustomizedCallout(), getDomainNRangeValues: this._getDomainNRangeValues, createStringYAxis: index_3.createStringYAxis, onChartMouseLeave: this._handleChartMouseLeave, enableFirstRenderOptimization: this.props.enablePerfOptimization && this._firstRenderOptimization, ref: this._cartesianChartRef,
639
694
  /* eslint-disable react/jsx-no-bind */
640
695
  // eslint-disable-next-line react/no-children-prop
641
696
  children: function (props) {
@@ -715,7 +770,14 @@ var LineChartBase = /** @class */ (function (_super) {
715
770
  return legend;
716
771
  })
717
772
  : [];
718
- return (React.createElement(index_1.Legends, tslib_1.__assign({ legends: tslib_1.__spreadArray(tslib_1.__spreadArray([], legendDataItems, true), colorFillBarsLegendDataItems, true), enabledWrapLines: this.props.enabledLegendsWrapLines, overflowProps: this.props.legendsOverflowProps, focusZonePropsInHoverCard: this.props.focusZonePropsForLegendsInHoverCard, overflowText: this.props.legendsOverflowText }, (isLegendMultiSelectEnabled && { onLegendHoverCardLeave: this._onHoverCardHide }), this.props.legendProps)));
773
+ return (React.createElement(index_1.Legends, tslib_1.__assign({ legends: tslib_1.__spreadArray(tslib_1.__spreadArray([], legendDataItems, true), colorFillBarsLegendDataItems, true), enabledWrapLines: this.props.enabledLegendsWrapLines, overflowProps: this.props.legendsOverflowProps, focusZonePropsInHoverCard: this.props.focusZonePropsForLegendsInHoverCard, overflowText: this.props.legendsOverflowText }, (isLegendMultiSelectEnabled && { onLegendHoverCardLeave: this._onHoverCardHide }), this.props.legendProps, { ref: this._legendsRef })));
774
+ };
775
+ LineChartBase.prototype._getRangeForScatterMarkerSize = function () {
776
+ var extraXPixels = this._isRTL
777
+ ? this._xAxisScale(this._xMax - this._xPadding) - this._xAxisScale(this._xMax)
778
+ : this._xAxisScale(this._xMin + this._xPadding) - this._xAxisScale(this._xMin);
779
+ var extraYPixels = this._yAxisScale(this._yMin) - this._yAxisScale(this._yMin + this._yPadding);
780
+ return Math.min(extraXPixels, extraYPixels);
719
781
  };
720
782
  LineChartBase.prototype._createLines = function (xElement, containerHeight) {
721
783
  var _this_1 = this;
@@ -727,6 +789,12 @@ var LineChartBase = /** @class */ (function (_super) {
727
789
  else {
728
790
  this._points = this._injectIndexPropertyInLineChartData(this.props.data.lineChartData);
729
791
  }
792
+ var extraMaxPixels = this.props.lineMode === 'scatter' ? this._getRangeForScatterMarkerSize() : 0;
793
+ var maxMarkerSize = (0, d3_array_2.max)(this._points, function (point) {
794
+ return (0, d3_array_2.max)(point.data, function (item) {
795
+ return item.markerSize;
796
+ });
797
+ });
730
798
  var _loop_1 = function (i) {
731
799
  var linesForLine = [];
732
800
  var bordersForLine = [];
@@ -740,7 +808,12 @@ var LineChartBase = /** @class */ (function (_super) {
740
808
  var _2 = this_1._points[i].data[0], x1_1 = _2.x, y1 = _2.y, xAxisCalloutData_1 = _2.xAxisCalloutData, xAxisCalloutAccessibilityData_1 = _2.xAxisCalloutAccessibilityData;
741
809
  var circleId_1 = "".concat(this_1._circleId, "_").concat(i);
742
810
  var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
743
- pointsForLine.push(React.createElement("circle", tslib_1.__assign({ id: circleId_1, key: circleId_1, r: activePoint === circleId_1 ? 5.5 : 3.5, cx: this_1._xAxisScale(x1_1), cy: this_1._yAxisScale(y1), fill: activePoint === circleId_1 ? theme.semanticColors.bodyBackground : lineColor, opacity: isLegendSelected ? 1 : 0.1, onMouseOver: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1), onMouseMove: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1), onMouseOut: this_1._handleMouseOut, strokeWidth: activePoint === circleId_1 ? DEFAULT_LINE_STROKE_SIZE : 0, stroke: activePoint === circleId_1 ? lineColor : '', role: "img", "aria-label": this_1._getAriaLabel(i, 0), "data-is-focusable": isLegendSelected, ref: function (e) {
811
+ var currentMarkerSize = this_1._points[i].data[0].markerSize;
812
+ pointsForLine.push(React.createElement("circle", tslib_1.__assign({ id: circleId_1, key: circleId_1, r: currentMarkerSize
813
+ ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize
814
+ : activePoint === circleId_1
815
+ ? 5.5
816
+ : 3.5, cx: this_1._xAxisScale(x1_1), cy: this_1._yAxisScale(y1), fill: activePoint === circleId_1 ? theme.semanticColors.bodyBackground : lineColor, opacity: isLegendSelected ? 1 : 0.1, onMouseOver: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1), onMouseMove: this_1._handleHover.bind(this_1, x1_1, y1, verticaLineHeight, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1), onMouseOut: this_1._handleMouseOut, strokeWidth: activePoint === circleId_1 ? DEFAULT_LINE_STROKE_SIZE : 0, stroke: activePoint === circleId_1 ? lineColor : '', role: "img", "aria-label": this_1._getAriaLabel(i, 0), "data-is-focusable": isLegendSelected, ref: function (e) {
744
817
  _this_1._refCallback(e, circleId_1);
745
818
  }, onFocus: function () { return _this_1._handleFocus(circleId_1, x1_1, xAxisCalloutData_1, circleId_1, xAxisCalloutAccessibilityData_1); }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[0].onDataPointClick))));
746
819
  }
@@ -796,7 +869,8 @@ var LineChartBase = /** @class */ (function (_super) {
796
869
  var strokeWidth = ((_p = this_1._points[i].lineOptions) === null || _p === void 0 ? void 0 : _p.strokeWidth) || this_1.props.strokeWidth || DEFAULT_LINE_STROKE_SIZE;
797
870
  var isLegendSelected = this_1._legendHighlighted(legendVal) || this_1._noLegendHighlighted() || this_1.state.isSelectedLegend;
798
871
  var currentPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== circleId;
799
- pointsForLine.push(React.createElement("path", tslib_1.__assign({ id: circleId, key: circleId, d: path, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseOut: this_1._handleMouseOut, onFocus: function () { return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData); }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, circleId, j, false), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j - 1) })));
872
+ var currentMarkerSize = this_1._points[i].data[j - 1].markerSize;
873
+ pointsForLine.push(this_1.props.lineMode === 'scatter' ? (React.createElement("circle", tslib_1.__assign({ id: circleId, key: circleId, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: this_1._xAxisScale(x1), cy: this_1._yAxisScale(y1), "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseOut: this_1._handleMouseOut, onFocus: function () { return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData); }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, circleId, j, false), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j - 1) }))) : (React.createElement("path", tslib_1.__assign({ id: circleId, key: circleId, d: path, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseOut: this_1._handleMouseOut, onFocus: function () { return _this_1._handleFocus(lineId, x1, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData); }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j - 1].onDataPointClick), { opacity: isLegendSelected && !currentPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, circleId, j, false), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j - 1) }))));
800
874
  if (j + 1 === this_1._points[i].data.length) {
801
875
  // If this is last point of the line segment.
802
876
  var lastCircleId_1 = "".concat(circleId).concat(j, "L");
@@ -804,30 +878,34 @@ var LineChartBase = /** @class */ (function (_super) {
804
878
  var lastPointHidden = this_1._points[i].hideNonActiveDots && activePoint !== lastCircleId_1;
805
879
  path = this_1._getPath(this_1._xAxisScale(x2), this_1._yAxisScale(y2), lastCircleId_1, j, true, this_1._points[i].index);
806
880
  var _5 = this_1._points[i].data[j], lastCirlceXCallout_1 = _5.xAxisCalloutData, lastCirlceXCalloutAccessibilityData_1 = _5.xAxisCalloutAccessibilityData;
881
+ currentMarkerSize = this_1._points[i].data[j].markerSize;
807
882
  pointsForLine.push(React.createElement(React.Fragment, { key: "".concat(lastCircleId_1, "_container") },
808
- React.createElement("path", tslib_1.__assign({ id: lastCircleId_1, key: lastCircleId_1, d: path, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseOut: this_1._handleMouseOut, onFocus: function () {
883
+ this_1.props.lineMode === 'scatter' ? (React.createElement("circle", tslib_1.__assign({ id: lastCircleId_1, key: lastCircleId_1, r: currentMarkerSize ? (currentMarkerSize * extraMaxPixels) / maxMarkerSize : 4, cx: this_1._xAxisScale(x2), cy: this_1._yAxisScale(y2), "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseOut: this_1._handleMouseOut, onFocus: function () {
884
+ return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
885
+ }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, lastCircleId_1, j, true), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j) }))) : (React.createElement("path", tslib_1.__assign({ id: lastCircleId_1, key: lastCircleId_1, d: path, "data-is-focusable": isLegendSelected, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseOut: this_1._handleMouseOut, onFocus: function () {
809
886
  return _this_1._handleFocus(lineId, x2, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1);
810
- }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, lastCircleId_1, j, true), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j) })),
887
+ }, onBlur: this_1._handleMouseOut }, this_1._getClickHandler(this_1._points[i].data[j].onDataPointClick), { opacity: isLegendSelected && !lastPointHidden ? 1 : 0.01, fill: this_1._getPointFill(lineColor, lastCircleId_1, j, true), stroke: lineColor, strokeWidth: strokeWidth, role: "img", "aria-label": this_1._getAriaLabel(i, j) }))),
811
888
  React.createElement("circle", { id: hiddenHoverCircleId, key: hiddenHoverCircleId, r: 8, cx: this_1._xAxisScale(x2), cy: this_1._yAxisScale(y2), opacity: 0, width: 0, onMouseOver: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseMove: this_1._handleHover.bind(this_1, x2, y2, verticaLineHeight, lastCirlceXCallout_1, lastCircleId_1, lastCirlceXCalloutAccessibilityData_1), onMouseOut: this_1._handleMouseOut, strokeWidth: 0, focusable: false, onBlur: this_1._handleMouseOut })));
812
- /* eslint-enable react/jsx-no-bind */
813
889
  }
814
- if (isLegendSelected) {
815
- // don't draw line if it is in a gap
816
- if (!isInGap) {
817
- var lineBorderWidth = ((_q = this_1._points[i].lineOptions) === null || _q === void 0 ? void 0 : _q.lineBorderWidth)
818
- ? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
819
- : 0;
820
- if (lineBorderWidth > 0) {
821
- bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeLinecap: (_s = (_r = this_1._points[i].lineOptions) === null || _r === void 0 ? void 0 : _r.strokeLinecap) !== null && _s !== void 0 ? _s : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_t = this_1._points[i].lineOptions) === null || _t === void 0 ? void 0 : _t.lineBorderColor) || theme.semanticColors.bodyBackground, opacity: 1 }));
890
+ if (this_1.props.lineMode !== 'scatter') {
891
+ if (isLegendSelected) {
892
+ // don't draw line if it is in a gap
893
+ if (!isInGap) {
894
+ var lineBorderWidth = ((_q = this_1._points[i].lineOptions) === null || _q === void 0 ? void 0 : _q.lineBorderWidth)
895
+ ? Number.parseFloat(this_1._points[i].lineOptions.lineBorderWidth.toString())
896
+ : 0;
897
+ if (lineBorderWidth > 0) {
898
+ bordersForLine.push(React.createElement("line", { id: borderId, key: borderId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeLinecap: (_s = (_r = this_1._points[i].lineOptions) === null || _r === void 0 ? void 0 : _r.strokeLinecap) !== null && _s !== void 0 ? _s : 'round', strokeWidth: Number.parseFloat(strokeWidth.toString()) + lineBorderWidth, stroke: ((_t = this_1._points[i].lineOptions) === null || _t === void 0 ? void 0 : _t.lineBorderColor) || theme.semanticColors.bodyBackground, opacity: 1 }));
899
+ }
900
+ linesForLine.push(React.createElement("line", tslib_1.__assign({ id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeWidth: strokeWidth, ref: function (e) {
901
+ _this_1._refCallback(e, lineId);
902
+ }, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseOut: this_1._handleMouseOut, stroke: lineColor, strokeLinecap: (_v = (_u = this_1._points[i].lineOptions) === null || _u === void 0 ? void 0 : _u.strokeLinecap) !== null && _v !== void 0 ? _v : 'round', strokeDasharray: (_w = this_1._points[i].lineOptions) === null || _w === void 0 ? void 0 : _w.strokeDasharray, strokeDashoffset: (_x = this_1._points[i].lineOptions) === null || _x === void 0 ? void 0 : _x.strokeDashoffset, opacity: 1 }, this_1._getClickHandler(this_1._points[i].onLineClick))));
822
903
  }
823
- linesForLine.push(React.createElement("line", tslib_1.__assign({ id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeWidth: strokeWidth, ref: function (e) {
824
- _this_1._refCallback(e, lineId);
825
- }, onMouseOver: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseMove: this_1._handleHover.bind(this_1, x1, y1, verticaLineHeight, xAxisCalloutData, circleId, xAxisCalloutAccessibilityData), onMouseOut: this_1._handleMouseOut, stroke: lineColor, strokeLinecap: (_v = (_u = this_1._points[i].lineOptions) === null || _u === void 0 ? void 0 : _u.strokeLinecap) !== null && _v !== void 0 ? _v : 'round', strokeDasharray: (_w = this_1._points[i].lineOptions) === null || _w === void 0 ? void 0 : _w.strokeDasharray, strokeDashoffset: (_x = this_1._points[i].lineOptions) === null || _x === void 0 ? void 0 : _x.strokeDashoffset, opacity: 1 }, this_1._getClickHandler(this_1._points[i].onLineClick))));
826
904
  }
827
- }
828
- else {
829
- if (!isInGap) {
830
- linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeWidth: strokeWidth, stroke: lineColor, strokeLinecap: (_z = (_y = this_1._points[i].lineOptions) === null || _y === void 0 ? void 0 : _y.strokeLinecap) !== null && _z !== void 0 ? _z : 'round', strokeDasharray: (_0 = this_1._points[i].lineOptions) === null || _0 === void 0 ? void 0 : _0.strokeDasharray, strokeDashoffset: (_1 = this_1._points[i].lineOptions) === null || _1 === void 0 ? void 0 : _1.strokeDashoffset, opacity: 0.1 }));
905
+ else {
906
+ if (!isInGap) {
907
+ linesForLine.push(React.createElement("line", { id: lineId, key: lineId, x1: this_1._xAxisScale(x1), y1: this_1._yAxisScale(y1), x2: this_1._xAxisScale(x2), y2: this_1._yAxisScale(y2), strokeWidth: strokeWidth, stroke: lineColor, strokeLinecap: (_z = (_y = this_1._points[i].lineOptions) === null || _y === void 0 ? void 0 : _y.strokeLinecap) !== null && _z !== void 0 ? _z : 'round', strokeDasharray: (_0 = this_1._points[i].lineOptions) === null || _0 === void 0 ? void 0 : _0.strokeDasharray, strokeDashoffset: (_1 = this_1._points[i].lineOptions) === null || _1 === void 0 ? void 0 : _1.strokeDashoffset, opacity: 0.1 }));
908
+ }
831
909
  }
832
910
  }
833
911
  };