@fluentui/react-charts 0.0.0-nightly-20251114-0406.1 → 0.0.0-nightly-20251117-0407.1

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 (25) hide show
  1. package/CHANGELOG.md +13 -13
  2. package/dist/index.d.ts +1 -0
  3. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js +4 -2
  4. package/lib/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  5. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -2
  6. package/lib/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  7. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +9 -4
  8. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  9. package/lib/components/DonutChart/Pie/Pie.js +4 -2
  10. package/lib/components/DonutChart/Pie/Pie.js.map +1 -1
  11. package/lib/components/SankeyChart/SankeyChart.js +1 -1
  12. package/lib/components/SankeyChart/SankeyChart.js.map +1 -1
  13. package/lib/types/DataPoint.js.map +1 -1
  14. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js +4 -2
  15. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.js.map +1 -1
  16. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js +4 -2
  17. package/lib-commonjs/components/CommonComponents/useCartesianChartStyles.styles.raw.js.map +1 -1
  18. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +9 -4
  19. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  20. package/lib-commonjs/components/DonutChart/Pie/Pie.js +4 -2
  21. package/lib-commonjs/components/DonutChart/Pie/Pie.js.map +1 -1
  22. package/lib-commonjs/components/SankeyChart/SankeyChart.js +1 -1
  23. package/lib-commonjs/components/SankeyChart/SankeyChart.js.map +1 -1
  24. package/lib-commonjs/types/DataPoint.js.map +1 -1
  25. package/package.json +12 -12
@@ -63,9 +63,11 @@ const Pie = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
63
63
  });
64
64
  }
65
65
  const { data } = props;
66
- const focusData = pieForFocusRing(data.map((d)=>d.data));
66
+ // Filter out data points with value 0 to avoid gaps in the donut chart
67
+ const filteredData = data.filter((d)=>d.data !== 0);
68
+ const focusData = pieForFocusRing(filteredData.map((d)=>d.data));
67
69
  const piechart = (0, _d3shape.pie)().sort(null) // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
- .value((d)=>d.data).padAngle(0.02)(data);
70
+ .value((d)=>d.data).padAngle(0.02)(filteredData);
69
71
  const translate = `translate(${props.width / 2}, ${props.height / 2})`;
70
72
  _totalValue = _computeTotalValue();
71
73
  return /*#__PURE__*/ _react.createElement("g", {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/DonutChart/Pie/Pie.tsx"],"sourcesContent":["'use client';\n\n/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable react/jsx-no-bind */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { pie as d3Pie } from 'd3-shape';\nimport { PieProps } from './index';\nimport { Arc } from '../Arc/index';\nimport { ChartDataPoint } from '../index';\nimport { usePieStyles } from './usePieStyles.styles';\nimport { wrapTextInsideDonut } from '../../../utilities/index';\nconst TEXT_PADDING: number = 5;\n\n// Create a Pie within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Pie component within Donut Chart.\n * {@docCategory PieDonutChart}\n */\nexport const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivElement, PieProps>(\n (props, forwardedRef) => {\n React.useEffect(() => {\n wrapTextInsideDonut(classes.insideDonutString, props.innerRadius! * 2 - TEXT_PADDING);\n }, []);\n\n let _totalValue: number;\n const classes = usePieStyles(props);\n const pieForFocusRing = d3Pie()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0);\n\n function _focusCallback(\n data: ChartDataPoint,\n id: string,\n e: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n props.onFocusCallback!(data, id, e, targetElement);\n }\n\n function _hoverCallback(\n data: ChartDataPoint,\n e: React.MouseEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n props.hoverOnCallback!(data, e, targetElement);\n }\n\n function _computeTotalValue() {\n let totalValue = 0;\n props.data.forEach((arc: ChartDataPoint) => {\n totalValue += arc.data!;\n });\n return totalValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function arcGenerator(\n d: any,\n i: number,\n focusData: any,\n href?: string,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement {\n const color = d && d.data && d.data.color;\n return (\n <Arc\n key={i}\n data={d}\n focusData={focusData}\n innerRadius={props.innerRadius}\n outerRadius={props.outerRadius}\n color={color!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n onBlurCallback={props.onBlurCallback}\n hoverLeaveCallback={props.hoverLeaveCallback}\n uniqText={props.uniqText}\n activeArc={props.activeArc}\n href={href}\n calloutId={props.calloutId}\n valueInsideDonut={props.valueInsideDonut}\n focusedArcId={props.focusedArcId}\n showLabelsInPercent={props.showLabelsInPercent}\n totalValue={_totalValue}\n hideLabels={props.hideLabels}\n />\n );\n }\n\n const { data } = props;\n const focusData = pieForFocusRing(data.map(d => d.data!));\n\n const piechart = d3Pie<ChartDataPoint>()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0.02)(data);\n const translate = `translate(${props.width / 2}, ${props.height / 2})`;\n\n _totalValue = _computeTotalValue();\n\n return (\n <g transform={translate}>\n {piechart.map((d: any, i: number) => arcGenerator(d, i, focusData[i], props.href))}\n {props.valueInsideDonut && (\n <text y={5} textAnchor=\"middle\" dominantBaseline=\"middle\" className={classes.insideDonutString}>\n {props.valueInsideDonut}\n </text>\n )}\n </g>\n );\n },\n);\nPie.displayName = 'Pie';\n"],"names":["React","pie","d3Pie","Arc","usePieStyles","wrapTextInsideDonut","TEXT_PADDING","Pie","forwardRef","props","forwardedRef","useEffect","classes","insideDonutString","innerRadius","_totalValue","pieForFocusRing","sort","value","d","data","padAngle","_focusCallback","id","e","targetElement","onFocusCallback","_hoverCallback","hoverOnCallback","_computeTotalValue","totalValue","forEach","arc","arcGenerator","i","focusData","href","color","key","outerRadius","onBlurCallback","hoverLeaveCallback","uniqText","activeArc","calloutId","valueInsideDonut","focusedArcId","showLabelsInPercent","hideLabels","map","piechart","translate","width","height","g","transform","text","y","textAnchor","dominantBaseline","className","displayName"],"mappings":"AAAA;;;;;+BAoBaO;;;;;;;iEAfU,QAAQ;yBAEF,WAAW;uBAEpB,eAAe;oCAEN,wBAAwB;wBACjB,2BAA2B;AAC/D,MAAMD,eAAuB;AAOtB,YAAMC,WAAAA,GAAyCP,OAAMQ,UAAU,CACpE,CAACC,OAAOC;IACNV,OAAMW,SAAS,CAAC;YACdN,2BAAAA,EAAoBO,QAAQC,iBAAiB,EAAEJ,MAAMK,WAAW,GAAI,IAAIR;IAC1E,GAAG,EAAE;IAEL,IAAIS;IACJ,MAAMH,cAAUR,gCAAAA,EAAaK;IAC7B,MAAMO,sBAAkBd,YAAAA,IACrBe,IAAI,CAAC,MACN,8DAA8D;KAC7DC,KAAK,CAAC,CAACC,IAAWA,EAAEC,IAAI,EACxBC,QAAQ,CAAC;IAEZ,SAASC,eACPF,IAAoB,EACpBG,EAAU,EACVC,CAAmC,EACnCC,aAAkC;QAElChB,MAAMiB,eAAe,CAAEN,MAAMG,IAAIC,GAAGC;IACtC;IAEA,SAASE,eACPP,IAAoB,EACpBI,CAAmC,EACnCC,aAAkC;QAElChB,MAAMmB,eAAe,CAAER,MAAMI,GAAGC;IAClC;IAEA,SAASI;QACP,IAAIC,aAAa;QACjBrB,MAAMW,IAAI,CAACW,OAAO,CAAC,CAACC;YAClBF,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AQe,IAAcD,aAAad,GAAGe,GAAGC,SAAS,CAACD,EAAE,EAAEzB,MAAM2B,IAAI,IAC/E3B,MAAMoC,gBAAgB,IAAA,WAAA,GACrB,OAAA,aAAA,CAACW,QAAAA;QAAKC,GAAG;QAAGC,YAAW;QAASC,kBAAiB;QAASC,WAAWhD,QAAQC,iBAAiB;OAC3FJ,MAAMoC,gBAAgB;AAKjC,GACA;AACFtC,IAAIsD,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/DonutChart/Pie/Pie.tsx"],"sourcesContent":["'use client';\n\n/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable react/jsx-no-bind */\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport * as React from 'react';\nimport type { JSXElement } from '@fluentui/react-utilities';\nimport { pie as d3Pie } from 'd3-shape';\nimport { PieProps } from './index';\nimport { Arc } from '../Arc/index';\nimport { ChartDataPoint } from '../index';\nimport { usePieStyles } from './usePieStyles.styles';\nimport { wrapTextInsideDonut } from '../../../utilities/index';\nconst TEXT_PADDING: number = 5;\n\n// Create a Pie within Donut Chart variant which uses these default styles and this styled subcomponent.\n/**\n * Pie component within Donut Chart.\n * {@docCategory PieDonutChart}\n */\nexport const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivElement, PieProps>(\n (props, forwardedRef) => {\n React.useEffect(() => {\n wrapTextInsideDonut(classes.insideDonutString, props.innerRadius! * 2 - TEXT_PADDING);\n }, []);\n\n let _totalValue: number;\n const classes = usePieStyles(props);\n const pieForFocusRing = d3Pie()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0);\n\n function _focusCallback(\n data: ChartDataPoint,\n id: string,\n e: React.FocusEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n props.onFocusCallback!(data, id, e, targetElement);\n }\n\n function _hoverCallback(\n data: ChartDataPoint,\n e: React.MouseEvent<SVGPathElement>,\n targetElement?: HTMLElement | null,\n ): void {\n props.hoverOnCallback!(data, e, targetElement);\n }\n\n function _computeTotalValue() {\n let totalValue = 0;\n props.data.forEach((arc: ChartDataPoint) => {\n totalValue += arc.data!;\n });\n return totalValue;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n function arcGenerator(\n d: any,\n i: number,\n focusData: any,\n href?: string,\n ): // eslint-disable-next-line @typescript-eslint/no-deprecated\n JSXElement {\n const color = d && d.data && d.data.color;\n return (\n <Arc\n key={i}\n data={d}\n focusData={focusData}\n innerRadius={props.innerRadius}\n outerRadius={props.outerRadius}\n color={color!}\n onFocusCallback={_focusCallback}\n hoverOnCallback={_hoverCallback}\n onBlurCallback={props.onBlurCallback}\n hoverLeaveCallback={props.hoverLeaveCallback}\n uniqText={props.uniqText}\n activeArc={props.activeArc}\n href={href}\n calloutId={props.calloutId}\n valueInsideDonut={props.valueInsideDonut}\n focusedArcId={props.focusedArcId}\n showLabelsInPercent={props.showLabelsInPercent}\n totalValue={_totalValue}\n hideLabels={props.hideLabels}\n />\n );\n }\n\n const { data } = props;\n\n // Filter out data points with value 0 to avoid gaps in the donut chart\n const filteredData = data.filter((d: ChartDataPoint) => d.data !== 0);\n\n const focusData = pieForFocusRing(filteredData.map(d => d.data!));\n\n const piechart = d3Pie<ChartDataPoint>()\n .sort(null)\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n .value((d: any) => d.data)\n .padAngle(0.02)(filteredData);\n const translate = `translate(${props.width / 2}, ${props.height / 2})`;\n\n _totalValue = _computeTotalValue();\n\n return (\n <g transform={translate}>\n {piechart.map((d: any, i: number) => arcGenerator(d, i, focusData[i], props.href))}\n {props.valueInsideDonut && (\n <text y={5} textAnchor=\"middle\" dominantBaseline=\"middle\" className={classes.insideDonutString}>\n {props.valueInsideDonut}\n </text>\n )}\n </g>\n );\n },\n);\nPie.displayName = 'Pie';\n"],"names":["React","pie","d3Pie","Arc","usePieStyles","wrapTextInsideDonut","TEXT_PADDING","Pie","forwardRef","props","forwardedRef","useEffect","classes","insideDonutString","innerRadius","_totalValue","pieForFocusRing","sort","value","d","data","padAngle","_focusCallback","id","e","targetElement","onFocusCallback","_hoverCallback","hoverOnCallback","_computeTotalValue","totalValue","forEach","arc","arcGenerator","i","focusData","href","color","key","outerRadius","onBlurCallback","hoverLeaveCallback","uniqText","activeArc","calloutId","valueInsideDonut","focusedArcId","showLabelsInPercent","hideLabels","filteredData","filter","map","piechart","translate","width","height","g","transform","text","y","textAnchor","dominantBaseline","className","displayName"],"mappings":"AAAA;;;;;+BAoBaO;;;;;;;iEAfU,QAAQ;yBAEF,WAAW;uBAEpB,eAAe;oCAEN,wBAAwB;wBACjB,2BAA2B;AAC/D,MAAMD,eAAuB;AAOtB,YAAMC,WAAAA,GAAyCP,OAAMQ,UAAU,CACpE,CAACC,OAAOC;IACNV,OAAMW,SAAS,CAAC;YACdN,2BAAAA,EAAoBO,QAAQC,iBAAiB,EAAEJ,MAAMK,WAAW,GAAI,IAAIR;IAC1E,GAAG,EAAE;IAEL,IAAIS;IACJ,MAAMH,cAAUR,gCAAAA,EAAaK;IAC7B,MAAMO,sBAAkBd,YAAAA,IACrBe,IAAI,CAAC,MACN,8DAA8D;KAC7DC,KAAK,CAAC,CAACC,IAAWA,EAAEC,IAAI,EACxBC,QAAQ,CAAC;IAEZ,SAASC,eACPF,IAAoB,EACpBG,EAAU,EACVC,CAAmC,EACnCC,aAAkC;QAElChB,MAAMiB,eAAe,CAAEN,MAAMG,IAAIC,GAAGC;IACtC;IAEA,SAASE,eACPP,IAAoB,EACpBI,CAAmC,EACnCC,aAAkC;QAElChB,MAAMmB,eAAe,CAAER,MAAMI,GAAGC;IAClC;IAEA,SAASI;QACP,IAAIC,aAAa;QACjBrB,MAAMW,IAAI,CAACW,OAAO,CAAC,CAACC;YAClBF,cAAcE,IAAIZ,IAAI;QACxB;QACA,OAAOU;IACT;IAEA,8DAA8D;IAC9D,SAASG,aACPd,CAAM,EACNe,CAAS,EACTC,SAAc,EACdC,IAAa;QAGb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SAAS,CAACD,EAAE,EAAEzB,MAAM2B,IAAI,IAC/E3B,MAAMoC,gBAAgB,IAAA,WAAA,GACrB,OAAA,aAAA,CAACa,QAAAA;QAAKC,GAAG;QAAGC,YAAW;QAASC,kBAAiB;QAASC,WAAWlD,QAAQC,iBAAiB;OAC3FJ,MAAMoC,gBAAgB;AAKjC,GACA;AACFtC,IAAIwD,WAAW,GAAG"}
@@ -811,7 +811,7 @@ const SankeyChart = /*#__PURE__*/ _react.forwardRef((props, forwardedRef)=>{
811
811
  };
812
812
  const _fillStreamColors = (singleLink, gradientUrl)=>{
813
813
  if (selectedState && selectedLinks.has(singleLink.index)) {
814
- return selectedNode ? selectedNode.color : gradientUrl;
814
+ return singleLink ? singleLink.color : selectedNode ? selectedNode.color : gradientUrl;
815
815
  }
816
816
  };
817
817
  const _fillStreamBorder = (singleLink, gradientUrl)=>{
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/SankeyChart/SankeyChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { tokens } from '@fluentui/react-theme';\nimport { useId } from '@fluentui/react-utilities';\nimport { sum as d3Sum } from 'd3-array';\nimport { SankeyGraph, SankeyLayout, sankey as d3Sankey, sankeyJustify, sankeyRight } from 'd3-sankey';\nimport { Selection as D3Selection, select, selectAll } from 'd3-selection';\nimport { area as d3Area, curveBumpX as d3CurveBasis } from 'd3-shape';\nimport { Margins, SLink, SNode } from '../../types/DataPoint';\nimport { SankeyChartData, SankeyChartProps } from './SankeyChart.types';\nimport { useSankeyChartStyles } from './useSankeyChartStyles.styles';\nimport { ChartPopover, ChartPopoverProps } from '../CommonComponents/index';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { format } from '../../utilities/string';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst PADDING_PERCENTAGE = 0.3;\n\ntype NodeId = number | string;\ntype ItemValues<T> = { [key: NodeId]: T };\ntype NodeValues = ItemValues<number>;\ntype LinkItemValues<T> = { [key: NodeId]: ItemValues<T> };\ntype LinkValues = LinkItemValues<number>;\n\ntype NodesInColumns = { [key: number]: SNode[] };\ntype NormalizedData = SankeyChartData & {\n width: number;\n height: number;\n};\n\ntype NodeColors = { fillColor: string; borderColor: string };\ntype SankeyLayoutGenerator = SankeyLayout<SankeyGraph<{}, {}>, {}, {}>;\n\nconst NON_SELECTED_NODE_AND_STREAM_COLOR: string = '#757575';\nconst DEFAULT_NODE_COLORS: NodeColors[] = [\n { fillColor: '#00758F', borderColor: '#002E39' },\n { fillColor: '#77004D', borderColor: '#43002C' },\n { fillColor: '#4F6BED', borderColor: '#3B52B4' },\n { fillColor: '#937600', borderColor: '#6D5700' },\n { fillColor: '#286EA8', borderColor: '#00457E' },\n { fillColor: '#A43FB1', borderColor: '#7C158A' },\n { fillColor: '#CC3595', borderColor: '#7F215D' },\n { fillColor: '#0E7878', borderColor: '#004E4E' },\n { fillColor: '#8764B8', borderColor: '#4B3867' },\n { fillColor: '#9C663F', borderColor: '#6D4123' },\n];\n\nconst MIN_HEIGHT_FOR_DOUBLINE_TYPE = 36;\nconst MIN_HEIGHT_FOR_TYPE = 24;\nconst REST_STREAM_OPACITY: number = 1;\nconst NON_SELECTED_OPACITY: number = 1;\nconst SELECTED_STREAM_OPACITY: number = 0.3;\nconst NON_SELECTED_STREAM_BORDER_OPACITY: number = 0.5;\nconst DEFAULT_TEXT_COLOR: string = '#323130';\nconst NON_SELECTED_TEXT_COLOR: string = '#FFFFFF';\nconst NODE_WIDTH = 124;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getSelectedNodes(selectedLinks: Set<SLink>): any[] {\n const nodes: SNode[] = [];\n selectedLinks.forEach(link => {\n nodes.push(link.target as SNode);\n\n if (nodes.indexOf(link.source as SNode) === -1) {\n nodes.push(link.source as SNode);\n }\n });\n return nodes;\n}\n\nfunction getSelectedLinks(singleNode: SNode): Set<SLink> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, no-array-constructor\n const q: any = new Array<any>();\n const finalLinks: Set<SLink> = new Set<SLink>();\n\n singleNode.sourceLinks!.forEach((link: SLink) => {\n q.push(link);\n finalLinks.add(link);\n });\n\n while (q.length > 0) {\n const poppedLink: SLink = q.shift();\n const node: SNode = poppedLink.target as SNode;\n if (node && node.sourceLinks) {\n node.sourceLinks.forEach((link: SLink) => {\n finalLinks.add(link);\n q.push(link);\n });\n }\n }\n\n if (singleNode.targetLinks) {\n singleNode.targetLinks.forEach((link: SLink) => {\n q.push(link);\n finalLinks.add(link);\n });\n }\n\n while (q.length > 0) {\n const poppedLink: SLink = q.shift();\n const node: SNode = poppedLink.source as SNode;\n if (node && node.targetLinks) {\n node.targetLinks.forEach((link: SLink) => {\n finalLinks.add(link);\n q.push(link);\n });\n }\n }\n\n return finalLinks;\n}\n\nfunction getSelectedLinksforStreamHover(singleLink: SLink): {\n selectedLinks: Set<SLink>;\n selectedNodes: Set<SNode>;\n} {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, no-array-constructor\n const q: any = new Array<any>();\n const finalLinks: Set<SLink> = new Set<SLink>();\n const finalNodes: Set<SNode> = new Set<SNode>();\n\n q.push(singleLink.source);\n finalLinks.add(singleLink);\n while (q.length > 0) {\n const poppedNode: SNode = q.shift();\n finalNodes.add(poppedNode);\n if (poppedNode.targetLinks && poppedNode.targetLinks.length > 0) {\n poppedNode.targetLinks.forEach((link: SLink) => {\n q.push(link.source);\n finalLinks.add(link);\n });\n }\n }\n\n q.push(singleLink.target);\n\n while (q.length > 0) {\n const poppedNode: SNode = q.shift();\n finalNodes.add(poppedNode);\n if (poppedNode.sourceLinks && poppedNode.sourceLinks.length > 0) {\n poppedNode.sourceLinks.forEach((link: SLink) => {\n q.push(link.target);\n finalLinks.add(link);\n });\n }\n }\n\n return {\n selectedLinks: finalLinks,\n selectedNodes: finalNodes,\n };\n}\n\n/**\n * This is used to group nodes by column index.\n */\n// This is exported for unit tests.\nexport function groupNodesByColumn(graph: SankeyChartData): NodesInColumns {\n const nodesInColumn: NodesInColumns = {};\n graph.nodes.forEach((node: SNode) => {\n const columnId = node.layer!;\n if (nodesInColumn[columnId]) {\n nodesInColumn[columnId].push(node);\n } else {\n nodesInColumn[columnId] = [node];\n }\n });\n return nodesInColumn;\n}\n\n/**\n * This is used to normalize the nodes value whose value is less than 1% of the total column value.\n */\nfunction adjustOnePercentHeightNodes(\n nodesInColumn: NodesInColumns,\n computedNodes: NodeValues,\n originalLinks: LinkValues,\n): void {\n const totalColumnValue = Object.values(nodesInColumn).map((column: SNode[]) => {\n return d3Sum(column, (node: SNode) => node.value);\n });\n totalColumnValue.forEach((columnValue: number, index: number) => {\n let totalPercentage = 0;\n const onePercent = 0.01 * columnValue;\n const columnNodes = nodesInColumn[index];\n columnNodes.forEach((node: SNode) => {\n const value = computedNodes[node.nodeId];\n const nodePercentage = (value / columnValue) * 100;\n node.actualValue = value;\n //if the value is less than 1% then we are making it as 1% of total .\n if (nodePercentage < 1) {\n node.value = onePercent;\n totalPercentage = totalPercentage + 1;\n } else {\n totalPercentage = totalPercentage + nodePercentage;\n }\n });\n //since we have adjusted the value to be 1% but we need to keep the sum of the percentage value under 100.\n const scalingRatio = totalPercentage !== 0 ? totalPercentage / 100 : 1;\n if (scalingRatio > 1) {\n // Loop through each node in that column and scale that node--and its incoming and outgoing links--by the\n // scaling ratio. We need the sankey diagram to re-layout the nodes and links after we do this.\n columnNodes.forEach((node: SNode) => {\n const normalized = (node.value = node.value! / scalingRatio);\n // Which Original Value? and Which Normalized Value is needed, here? The Node? The Link? Both?\n changeColumnValue(node, computedNodes[node.nodeId], normalized, originalLinks);\n });\n }\n });\n}\n\n/**\n * This is used for normalizing each link's value to reflect the normalized node value.\n */\nfunction changeColumnValue(\n node: SNode,\n originalNodeValue: number,\n normalizedNodeValue: number,\n linkValues: LinkValues,\n) {\n // For each link in the source and target, compute the proportion that this link contributes to the total\n // then adjust the link's value to reflect its proportion of the normalized node value.\n const updateLinkValue = (link: SLink) => {\n const value = linkValue(linkValues, link);\n link.unnormalizedValue = value;\n const linkRatio = value / originalNodeValue;\n link.value = Math.max(normalizedNodeValue * linkRatio, link.value);\n };\n node.sourceLinks!.forEach(updateLinkValue);\n node.targetLinks!.forEach(updateLinkValue);\n}\n\n/**\n * This is used for calculating the node non normalized value based on link non normalized value.\n * The links have the original weights. Computed nodes have the total weight of all incoming and outgoing links.\n */\nfunction populateNodeActualValue(data: SankeyChartData, computedNodes: NodeValues, originalLinks: LinkValues) {\n data.links.forEach((link: SLink) => {\n if (!link.unnormalizedValue) {\n link.unnormalizedValue = linkValue(originalLinks, link);\n }\n });\n data.nodes.forEach((node: SNode) => {\n node.actualValue = computedNodes[node.nodeId as NodeId];\n });\n}\n\n/**\n * This is used to introduce dynamic padding for cases where the number of nodes in a column is huge\n * so that we maintain a node to space ratio for such columns as if we fail to do so the\n * chart is devoid of nodes and only shows links.\n */\n// This is exported for unit tests\nexport function adjustPadding(sankey: SankeyLayoutGenerator, height: number, nodesInColumn: NodesInColumns): void {\n let padding = sankey.nodePadding();\n const minPadding = PADDING_PERCENTAGE * height;\n Object.values(nodesInColumn).forEach((column: SNode[]) => {\n const totalPaddingInColumn = height - d3Sum(column, (node: SNode) => node.y1! - node.y0!);\n if (minPadding < totalPaddingInColumn) {\n // Here we are calculating the min of default and calculated padding, we will not increase the padding\n // in any scenario.\n padding = Math.min(padding, minPadding / (column.length - 1));\n }\n });\n sankey.nodePadding(padding);\n}\n\nfunction idFromNumberOrSNode(node: SNode | number): NodeId {\n if (typeof node === 'number') {\n return node;\n }\n return node.nodeId as NodeId;\n}\n\n/**\n * Duplicates the supplied chart data so that we do not alter the original.\n * @param data The data to duplicate.\n * @returns The duplicated data.\n */\nfunction duplicateData(data: SankeyChartData): SankeyChartData {\n return {\n nodes: data.nodes.map(\n (node: SNode): SNode => ({\n ...node,\n }),\n ),\n links: data.links.map(\n (link: SLink): SLink => ({\n ...link,\n }),\n ),\n };\n}\n\nfunction valuesOfNodes(nodes: SNode[]): NodeValues {\n const result: NodeValues = {};\n nodes.forEach((node: SNode) => {\n result[node.nodeId as NodeId] = node.value!;\n });\n return result;\n}\n\nfunction valuesOfLinks(links: SLink[]): LinkValues {\n const result: LinkValues = {};\n links.forEach((link: SLink) => {\n const sourceId = idFromNumberOrSNode(link.source);\n let sourceToTarget = result[sourceId];\n if (!sourceToTarget) {\n sourceToTarget = {};\n result[sourceId] = sourceToTarget;\n }\n sourceToTarget[idFromNumberOrSNode(link.target)] = link.value;\n });\n return result;\n}\n\nfunction linkValue<T>(originalLinks: LinkItemValues<T>, link: SLink): T {\n return originalLinks[idFromNumberOrSNode(link.source)][idFromNumberOrSNode(link.target)];\n}\n\n// This is exported for unit tests.\nexport function preRenderLayout(\n margins: Margins,\n containerWidth: number,\n containerHeight: number,\n isRtl: boolean,\n): { sankey: SankeyLayoutGenerator; height: number; width: number } {\n const { left, right, top, bottom } = margins;\n\n const sankey = d3Sankey()\n .nodeWidth(NODE_WIDTH)\n .extent([\n [left!, top!],\n [containerWidth - right!, containerHeight - bottom!],\n ])\n .nodeAlign(isRtl ? sankeyRight : sankeyJustify);\n\n return { sankey, height: containerHeight, width: containerWidth };\n}\n\nconst elipsis = '...';\n\n/**\n * This is used to assign node fillcolors and borderColor cyclically when the user doesnt\n * provide color to individual node.\n */\nfunction assignNodeColors(\n nodes: SNode[],\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n) {\n let colors: string[];\n let borders: string[];\n if (colorsForNodes && borderColorsForNodes) {\n colors = colorsForNodes;\n borders = borderColorsForNodes;\n } else {\n colors = DEFAULT_NODE_COLORS.map(color => color.fillColor);\n borders = DEFAULT_NODE_COLORS.map(color => color.borderColor);\n }\n let currentIndex = 0;\n nodes.forEach((node: SNode) => {\n if (!node.color && !node.borderColor) {\n node.color = colors[currentIndex];\n node.borderColor = borders[currentIndex];\n } else if (node.color && !node.borderColor) {\n node.borderColor = '#757575';\n } else if (node.borderColor && !node.color) {\n node.color = '#F5F5F5';\n }\n currentIndex = (currentIndex + 1) % colors.length;\n });\n}\n\n/**\n * Takes in the display name for the node and potentially returns a trimmed version of the name.\n * @param tspan the `tspan` element to use for text visual length measurement\n * @param text is the text which we will potentially truncate\n * @param rectangleWidth is the width of the rectangle which will contain the text\n * @param padding is the space we need to leave between the rect lines and other text\n * @returns the name to show on the node which might be the truncated `text` if the `text` is too long\n */\nfunction truncateText(tspan: TSpanForTextMeasuring, text: string, rectangleWidth: number, padding: number) {\n // NOTE: This method is the most-expensive in terms of rerendering components.\n const textLengthForNodeName = rectangleWidth - padding; // This can likely be computed once and passed in.\n // The following `select` statement injects a `tempText` element into the DOM. This injection\n // (and subsequent removal) is causing a layout recalculation. This is a performance issue.\n // Note that this code will always inject a `tempText` element, but doesn't always remove it. This is a bug.\n if (fitsWithinNode(tspan, text, textLengthForNodeName)) {\n return text;\n }\n // Computing the size of elipsis is performed with each node. This should be computed once and used everywhere.\n // TODO: Compute the size of the elipsis once and use it everywhere.\n const elipsisLength = computeElipsisLength(tspan);\n let line: string = '';\n // Calculate how much of the original text to show.\n // TODO: The folllowing is O(n). We could use a binary search to make this faster: O(log(n)).\n for (let i = 0; i < text.length; i++) {\n line += text[i];\n tspan.text(line);\n const currentNode = tspan.node();\n if (currentNode !== null) {\n const w = currentNode!.getComputedTextLength();\n if (w >= textLengthForNodeName - elipsisLength) {\n line = line.slice(0, -1);\n line += elipsis;\n break;\n }\n }\n }\n tspan.text(null);\n return line;\n}\n\ntype RenderedNodeAttributes = {\n readonly reactId: string;\n readonly gElementId: string;\n readonly name: string;\n readonly aria: string;\n readonly trimmed: boolean;\n readonly height: number;\n readonly weightOffset: number;\n};\n\ntype RenderedLinkAttributes = {\n readonly reactId: string;\n readonly aria: string;\n readonly from: string;\n};\n\ntype TSpanForTextMeasuring = D3Selection<SVGTSpanElement, unknown, HTMLElement, unknown>;\n\nfunction fitsWithinNode(tspan: TSpanForTextMeasuring, text: string, textLengthForNodeName: number): boolean {\n const measurement = measureText(tspan, text);\n if (measurement === undefined) {\n return false;\n }\n return measurement <= textLengthForNodeName;\n}\n\nfunction measureText(tspan: TSpanForTextMeasuring, text: string | number): number | undefined {\n try {\n tspan.text(text);\n return tspan.node()?.getComputedTextLength();\n } finally {\n tspan.text(null);\n }\n}\n\nfunction computeElipsisLength(tspan: TSpanForTextMeasuring): number {\n const measurement = measureText(tspan, elipsis);\n return measurement === undefined ? 0 : measurement;\n}\n\nfunction computeLinkAttributes(\n links: SLink[],\n linkFrom: (node: SNode) => string,\n linkAriaLabel: (link: SLink) => string,\n linkId: string,\n): LinkItemValues<RenderedLinkAttributes> {\n const result: LinkItemValues<RenderedLinkAttributes> = {};\n links.forEach((link: SLink, index: number) => {\n const sourceId = idFromNumberOrSNode(link.source);\n let sourceToTarget = result[sourceId];\n if (!sourceToTarget) {\n sourceToTarget = {};\n result[sourceId] = sourceToTarget;\n }\n sourceToTarget[idFromNumberOrSNode(link.target)] = {\n reactId: `${linkId}-${index}`,\n from: linkFrom(link.source as SNode),\n aria: linkAriaLabel(link),\n };\n });\n\n return result;\n}\n\ntype ItemPositions = {\n readonly x0: number;\n readonly y0: number;\n readonly x1: number;\n readonly y1: number;\n};\n\ntype SankeyLinkWithPositions = ItemPositions & {\n readonly source: ItemPositions;\n readonly target: ItemPositions;\n readonly width: number;\n};\n\ntype AreaDataPoint = {\n readonly x: number;\n readonly y0: number;\n readonly y1: number;\n};\n\nconst linkToDataPoints = (d: SankeyLinkWithPositions): [AreaDataPoint, AreaDataPoint] => {\n const halfWidth = d.width * 0.5;\n const y0 = d.y0;\n const y1 = d.y1;\n return [\n { x: d.source.x1, y0: y0 + halfWidth, y1: y0 - halfWidth },\n { x: d.target.x0, y0: y1 + halfWidth, y1: y1 - halfWidth },\n ];\n};\n\nconst linkArea = d3Area<AreaDataPoint>()\n .x((p: AreaDataPoint) => p.x)\n .y0((p: AreaDataPoint) => p.y0)\n .y1((p: AreaDataPoint) => p.y1)\n .curve(d3CurveBasis);\n\nfunction nodeTextColor(\n state: { selectedState: boolean; selectedNodes: Set<number>; selectedNode: SNode | undefined },\n singleNode: SNode,\n): string {\n return !(\n !state.selectedState ||\n (state.selectedNodes.has(singleNode.index!) && state.selectedNode) ||\n !state.selectedNode\n )\n ? DEFAULT_TEXT_COLOR\n : NON_SELECTED_TEXT_COLOR;\n}\n\ntype StringRenderer = {\n linkFrom: (node: SNode) => string;\n};\n\ntype AccessibilityRenderer = {\n emptyAriaLabel: string;\n nodeAriaLabel: (node: SNode, weight: number) => string;\n linkAriaLabel: (link: SLink) => string;\n};\n\nexport const SankeyChart: React.FunctionComponent<SankeyChartProps> = React.forwardRef<\n HTMLDivElement,\n SankeyChartProps\n>((props, forwardedRef) => {\n const classes = useSankeyChartStyles(props);\n const { chartContainerRef: chartContainer } = useImageExport(props.componentRef, true, false);\n const _reqID = React.useRef<number | undefined>(undefined);\n const _linkId = useId('link');\n const _chartId = useId('sankeyChart');\n const _emptyChartId = useId('_SankeyChart_empty');\n const _labelTooltipId = useId('tooltip');\n const _margins = React.useRef<Margins>({ top: 36, right: 48, bottom: 32, left: 48 });\n const { targetDocument, dir } = useFluent();\n const _window = targetDocument?.defaultView;\n const _isRtl: boolean = dir === 'rtl';\n const _numColumns = React.useRef<number>(0);\n const _nodeBarId = useId('nodeBar');\n const _nodeGElementId = useId('nodeGElement');\n const _arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'vertical' });\n const _tooltip = React.useRef<HTMLDivElement>(null);\n\n const [containerHeight, setContainerHeight] = React.useState<number>(468);\n const [containerWidth, setContainerWidth] = React.useState<number>(912);\n const [selectedState, setSelectedState] = React.useState<boolean>(false);\n const [selectedLinks, setSelectedLinks] = React.useState(new Set<number>());\n const [selectedNodes, setSelectedNodes] = React.useState(new Set<number>());\n const [isCalloutVisible, setCalloutVisible] = React.useState<boolean>(false);\n const [selectedNode, setSelectedNode] = React.useState<SNode>();\n const [color, setColor] = React.useState<string>();\n const [xCalloutValue, setXCalloutValue] = React.useState<string>();\n const [yCalloutValue, setYCalloutValue] = React.useState<string>();\n const [descriptionMessage, setDescriptionMessage] = React.useState<string>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n\n const _fitParentContainer = React.useCallback((): void => {\n _reqID.current = _window?.requestAnimationFrame(() => {\n // NOTE: Calls to this method trigger a re-render.\n const container = props.parentRef ? props.parentRef : chartContainer.current;\n if (container) {\n const currentContainerWidth =\n props.reflowProps?.mode === 'min-width'\n ? Math.max(container.getBoundingClientRect().width, _calculateChartMinWidth())\n : container.getBoundingClientRect().width;\n const currentContainerHeight = container.getBoundingClientRect().height;\n setContainerWidth(currentContainerWidth);\n setContainerHeight(currentContainerHeight);\n }\n });\n }, [_window, props.reflowProps?.mode, props.parentRef]);\n\n React.useEffect(() => {\n _fitParentContainer();\n\n return () => {\n if (typeof _reqID.current === 'number') {\n _window?.cancelAnimationFrame(_reqID.current);\n }\n };\n }, [_fitParentContainer, _window, props.shouldResize]);\n\n const _formatNumber = React.useCallback(\n (value: number): string => {\n return props.formatNumberOptions\n ? value.toLocaleString(props.culture, props.formatNumberOptions)\n : value.toString();\n },\n [props.formatNumberOptions, props.culture],\n );\n\n const _computeNodeAttributes = React.useCallback(\n (nodes: SNode[], nodeAriaLabel: (node: SNode, weight: number) => string): ItemValues<RenderedNodeAttributes> => {\n const result: ItemValues<RenderedNodeAttributes> = {};\n const weightSpan = select('.nodeName').append('text').attr('class', 'tempText').append('tspan').text(null);\n const nameSpan = select('.nodeName')\n .append('text')\n .attr('class', 'tempText')\n .attr('font-size', '10')\n .append('tspan')\n .text(null);\n nodes.forEach((singleNode: SNode, index: number) => {\n const height = Math.max(singleNode.y1! - singleNode.y0!, 0);\n let padding = 8;\n let textLengthForNodeWeight = 0;\n\n const nodeValue = singleNode.actualValue!;\n // If the nodeWeight is in the same line as node description an extra padding\n // of 6 px is required between node description and node weight.\n if (height < MIN_HEIGHT_FOR_DOUBLINE_TYPE) {\n padding = padding + 6;\n // The following `select` statement injects a `tempText` element into the DOM. This injection\n // (and subsequent removal) is causing a layout recalculation. This is a performance issue.\n const measurement = measureText(weightSpan, _formatNumber(nodeValue));\n if (measurement !== undefined) {\n textLengthForNodeWeight = measurement;\n padding = padding + textLengthForNodeWeight;\n }\n }\n // Since the total width of the node is 124 and we are giving margin of 8px from the left .\n // So the actual value on which it will be truncated is 124-8=116.\n const truncatedname: string = truncateText(nameSpan, singleNode.name, NODE_WIDTH - 8, padding);\n const isTruncated: boolean = truncatedname.slice(-3) === elipsis;\n result[singleNode.nodeId] = {\n reactId: `${_nodeBarId}-${index}`,\n gElementId: `${_nodeGElementId}-${index}`,\n name: truncatedname,\n aria: nodeAriaLabel(singleNode, nodeValue),\n trimmed: isTruncated,\n height,\n weightOffset: textLengthForNodeWeight,\n };\n });\n selectAll('.tempText').remove();\n return result;\n },\n [_formatNumber, _nodeBarId, _nodeGElementId],\n );\n\n const _linkCalloutAttributes = (singleLink: SLink, from: string) => {\n setCalloutVisible(true);\n setColor((singleLink.source as SNode).color!);\n setXCalloutValue((singleLink.target as SNode).name);\n setYCalloutValue(_formatNumber(singleLink.unnormalizedValue!));\n setDescriptionMessage(from);\n };\n\n const _isChartEmpty = React.useCallback(() => {\n const sankeyChartData = props.data?.SankeyChartData;\n return !(sankeyChartData && sankeyChartData.nodes.length > 0 && sankeyChartData.links.length > 0);\n }, [props.data]);\n\n const _normalizeSankeyData = React.useCallback(\n (\n data: SankeyChartData,\n _containerWidth: number,\n _containerHeight: number,\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n ): NormalizedData => {\n if (_isChartEmpty()) {\n return { width: 0, height: 0, nodes: [], links: [] };\n }\n\n const { sankey, height, width } = preRenderLayout(_margins.current, _containerWidth, _containerHeight, _isRtl);\n // Clone the data before mutating it (via the SankeyLayoutGenerator) so that we don't mutate the original data.\n const transformed: SankeyChartData = duplicateData(data);\n sankey(transformed);\n // NOTE: After the prior line, `transformed` is now a more-complex object than the incoming `ISankeyChartData`.\n // `transformed` should be cast to a more-specific type. This is a breaking change because we would be eliminating\n // fields from `ISankeyChartData` and putting those fields on a now-local type. But doing so makes it clearer what\n // the caller needs to supply and why. For example, the `actualValue` and `layer` fields of `ISNodeExtra` should\n // both be moved. Similarly for `unnormalizedValue` in `ISLinkExtra`.\n // `SankeyNodeMinimal` and `SankeyLinkMinimal` are both the types after `sankey(transformed)`, but have almost no\n // bearing on the data before `sankey(transformed)` (which is basically nodes with ids and names along with links\n // with source index, target index, and value).\n const nodesInColumn = groupNodesByColumn(transformed);\n _numColumns.current = Object.keys(nodesInColumn).length;\n // Keep track of the original values of the links and their acccumulated values in the nodes\n // Setting these in external objects so they cannot be mutated by other code.\n // The IDs of nodes can be numbers or strings. But, the IDs of links are always the index into the \"nodes\" array.\n // After the sankey layout is computed, the each link's `source` and `target` will have the ID of the node in the\n // type originally specified in the Nodes array. Consequently, we get the values of those links after the sankey\n // transformation.\n const nodeValues = valuesOfNodes(transformed.nodes);\n const linkValues = valuesOfLinks(transformed.links);\n adjustOnePercentHeightNodes(nodesInColumn, nodeValues, linkValues);\n adjustPadding(sankey, containerHeight - _margins.current.top! - _margins.current.bottom!, nodesInColumn);\n // `sankey` is called a second time, probably to re-layout the nodes with the one-percent adjusted weights.\n // NOTE: The second call to `sankey` is required to allow links to be hoverable.\n // Without the second call, the links are not hoverable.\n sankey(transformed);\n populateNodeActualValue(transformed, nodeValues, linkValues);\n assignNodeColors(transformed.nodes, colorsForNodes, borderColorsForNodes);\n return {\n width,\n height,\n nodes: transformed.nodes,\n links: transformed.links,\n };\n },\n [_isChartEmpty, _isRtl],\n );\n\n const _createLinks = (\n dataLinks: SLink[],\n linkAttributes: LinkItemValues<RenderedLinkAttributes>,\n ): React.ReactNode[] | undefined => {\n if (dataLinks) {\n const linkId = _linkId;\n return dataLinks.map((singleLink: SLink, index: number): React.ReactNode => {\n const onMouseOut = () => {\n _onStreamLeave(singleLink);\n };\n const { reactId, from, aria } = linkValue(linkAttributes, singleLink);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const dataPoints: Array<any> = linkToDataPoints(singleLink as unknown as SankeyLinkWithPositions);\n const key = `${linkId}-${index}`;\n const gradientId = `gradient-${key}`;\n const gradientUrl = `url(#${gradientId})`;\n const source = singleLink.source as SNode;\n const target = singleLink.target as SNode;\n // TODO: localize the aria-label string\n return (\n <g key={key}>\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0\" stopColor={source.color} />\n <stop offset=\"100%\" stopColor={target.color} />\n </linearGradient>\n </defs>\n <path\n d={linkArea(dataPoints)!}\n id={reactId}\n fill={_fillStreamColors(singleLink, gradientUrl)}\n stroke={_fillStreamBorder(singleLink, gradientUrl)}\n strokeWidth=\"2\"\n strokeOpacity={_getOpacityStreamBorder(singleLink)}\n onMouseOver={event => _onStreamHover(event, singleLink, from)}\n onMouseOut={onMouseOut}\n onFocus={event => _onFocusLink(event, singleLink, from)}\n onBlur={_onBlur}\n fillOpacity={_getOpacityStream(singleLink)}\n tabIndex={0}\n aria-label={aria}\n role=\"img\"\n />\n </g>\n );\n });\n }\n return [];\n };\n\n const _createNodes = (\n dataNodes: SNode[],\n nodeAttributes: ItemValues<RenderedNodeAttributes>,\n ): React.ReactNode[] | undefined => {\n if (dataNodes) {\n const textAnchor = _isRtl ? 'end' : 'start';\n return dataNodes.map((singleNode: SNode, index: number): React.ReactNode => {\n const onMouseOut = () => {\n _onLeave(singleNode);\n };\n const {\n reactId: nodeId,\n gElementId,\n height,\n trimmed: isTruncated,\n name: truncatedName,\n weightOffset: textLengthForNodeWeight,\n aria,\n } = nodeAttributes[singleNode.nodeId];\n const tooTall = height > MIN_HEIGHT_FOR_DOUBLINE_TYPE;\n const { name, actualValue, x0, x1, y0 } = singleNode;\n const textColor = nodeTextColor({ selectedState, selectedNodes, selectedNode }, singleNode);\n return (\n <g key={index} id={gElementId}>\n <rect\n x={x0}\n y={y0}\n height={height}\n width={x1! - x0!}\n fill={_fillNodeColors(singleNode)}\n id={nodeId}\n onMouseOver={e => _onHover(singleNode, e)}\n onMouseOut={onMouseOut}\n onFocus={_onCloseCallout}\n stroke={_fillNodeBorder(singleNode)}\n strokeWidth=\"2\"\n opacity=\"1\"\n tabIndex={0}\n aria-label={aria}\n role=\"img\"\n />\n {height > MIN_HEIGHT_FOR_TYPE && (\n <g className={classes.nodeTextContainer}>\n <g className=\"nodeName\">\n <text\n id={`${nodeId}-name`}\n x={x0}\n y={y0}\n dy={'1.2em'}\n dx={'0.4em'}\n textAnchor={textAnchor}\n fontWeight=\"regular\"\n aria-hidden=\"true\"\n fill={textColor}\n fontSize={10}\n onMouseOver={e => _showTooltip(name, isTruncated, e)}\n onMouseOut={() => _hideTooltip()}\n >\n {truncatedName}\n </text>\n </g>\n\n <text\n x={tooTall ? x0 : x1! - textLengthForNodeWeight - 8}\n y={y0}\n dy={tooTall ? '2em' : '1em'}\n dx={tooTall ? '0.4em' : '0em'}\n textAnchor={textAnchor}\n fontWeight=\"bold\"\n aria-hidden=\"true\"\n fill={textColor}\n fontSize={14}\n >\n {actualValue ? _formatNumber(actualValue) : actualValue}\n </text>\n </g>\n )}\n </g>\n );\n });\n }\n };\n\n const _onLeave = (singleNode: SNode) => {\n if (selectedState) {\n setSelectedState(false);\n setSelectedNodes(new Set<number>());\n setSelectedLinks(new Set<number>());\n setSelectedNode(undefined);\n }\n };\n\n const _onHover = (singleNode: SNode, mouseEvent: React.MouseEvent<SVGElement>) => {\n mouseEvent.persist();\n _onCloseCallout();\n const _selectedLinks = getSelectedLinks(singleNode);\n const _selectedNodes = getSelectedNodes(_selectedLinks);\n _selectedNodes.push(singleNode);\n setSelectedState(true);\n setSelectedNodes(new Set<number>(Array.from(_selectedNodes).map(node => node.index!)));\n setSelectedLinks(new Set<number>(Array.from(_selectedLinks).map(link => link.index!)));\n setSelectedNode(singleNode);\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setCalloutVisible(singleNode.y1! - singleNode.y0! < MIN_HEIGHT_FOR_TYPE);\n setColor(singleNode.color);\n setXCalloutValue(singleNode.name);\n setYCalloutValue(_formatNumber(singleNode.actualValue!));\n };\n\n const _onStreamHover = (mouseEvent: React.MouseEvent<SVGElement>, singleLink: SLink, from: string) => {\n mouseEvent.persist();\n _onCloseCallout();\n const { selectedLinks: _selectedLinks, selectedNodes: _selectedNodes } = getSelectedLinksforStreamHover(singleLink);\n setSelectedState(true);\n setSelectedNodes(new Set<number>(Array.from(_selectedNodes).map(node => node.index!)));\n setSelectedLinks(new Set<number>(Array.from(_selectedLinks).map(link => link.index!)));\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n _linkCalloutAttributes(singleLink, from);\n };\n\n const _onStreamLeave = (singleLink: SLink) => {\n if (selectedState) {\n setSelectedState(false);\n setSelectedNodes(new Set<number>());\n setSelectedLinks(new Set<number>());\n }\n };\n\n const _onFocusLink = (focusEvent: React.FocusEvent<SVGElement>, singleLink: SLink, from: string): void => {\n // There is a big difference in how \"Tab\" and the \"Arrow keys\" are handled in this diagram.\n // In particular, I would expect the \"Down\" key to be like \"Tab\", but it jumps a little wildly. I'm not sure\n // if this behavior is an accessiblity violation, but it we might want to investigate it.\n focusEvent.persist();\n _onCloseCallout();\n const boundingRect = focusEvent.currentTarget.getBoundingClientRect();\n const clientX = boundingRect.left + boundingRect.width / 2;\n const clientY = boundingRect.top + boundingRect.height / 2;\n updatePosition(clientX, clientY);\n _linkCalloutAttributes(singleLink, from);\n };\n\n const _onCloseCallout = () => {\n setCalloutVisible(false);\n updatePosition(0, 0);\n setDescriptionMessage('');\n };\n\n const _onBlur = (): void => {\n /**/\n };\n\n const _fillNodeColors = (singleNode: SNode): string | undefined => {\n if (!selectedState) {\n return singleNode.color;\n } else {\n if (selectedNode && selectedNodes.has(singleNode.index!)) {\n return selectedNode.color;\n } else if (!selectedNode) {\n return singleNode.color;\n }\n }\n };\n\n const _fillStreamColors = (singleLink: SLink, gradientUrl: string): string | undefined => {\n if (selectedState && selectedLinks.has(singleLink.index!)) {\n return selectedNode ? selectedNode.color : gradientUrl;\n }\n };\n\n const _fillStreamBorder = (singleLink: SLink, gradientUrl: string): string => {\n if (!selectedState) {\n return NON_SELECTED_NODE_AND_STREAM_COLOR;\n } else {\n if (selectedLinks.has(singleLink.index!)) {\n return selectedNode ? selectedNode.borderColor! : gradientUrl;\n }\n return NON_SELECTED_NODE_AND_STREAM_COLOR;\n }\n };\n\n const _fillNodeBorder = (singleNode: SNode): string => {\n if (!selectedState) {\n return singleNode.borderColor!;\n } else {\n if (selectedNodes.has(singleNode.index!)) {\n return selectedNode ? selectedNode.borderColor! : singleNode.borderColor!;\n }\n return singleNode.borderColor!;\n }\n };\n\n const _getOpacityStream = (singleLink: SLink): number => {\n if (selectedState) {\n if (!selectedLinks.has(singleLink.index!)) {\n return NON_SELECTED_OPACITY;\n } else if (!selectedNode) {\n return SELECTED_STREAM_OPACITY;\n }\n }\n return REST_STREAM_OPACITY;\n };\n\n const _getOpacityStreamBorder = (singleLink: SLink): number => {\n if (selectedState && !selectedLinks.has(singleLink.index!) && !selectedNode) {\n return NON_SELECTED_STREAM_BORDER_OPACITY;\n }\n\n return NON_SELECTED_OPACITY;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _showTooltip = (text: string, checkTrcuncated: boolean, evt: any) => {\n if (_tooltip.current && checkTrcuncated) {\n //Fixing tooltip position by attaching it to the element rather than page\n select(_tooltip.current)\n .style('opacity', 0.9)\n .style('color', tokens.colorNeutralForeground1)\n .style('left', evt.pageX + 'px')\n .style('top', evt.pageY - 28 + 'px')\n .html(text);\n }\n };\n\n const _hideTooltip = () => {\n if (_tooltip.current) {\n select(_tooltip.current).style('opacity', 0);\n }\n };\n\n const _calculateChartMinWidth = (): number => {\n return (\n _margins.current.left! +\n _margins.current.right! +\n // total width of all node columns\n _numColumns.current * NODE_WIDTH +\n // minimum total width of all column gaps\n (_numColumns.current - 1) * (NODE_WIDTH / 2)\n );\n };\n\n const updatePosition = (newX: number, newY: number) => {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n }\n };\n\n // Prepare the localization utilities\n const _strings: StringRenderer = React.useMemo(() => {\n const fromString = props.strings?.linkFrom || 'From {0}';\n // NOTE: The `node` parameter is the sankey-generated node on the link, and not the original `node` supplied\n // by the caller.\n return {\n linkFrom: (node: SNode) => format(fromString, node.name),\n };\n }, [props.strings]);\n const _accessibility: AccessibilityRenderer = React.useMemo(() => {\n const linkString = props.accessibility?.linkAriaLabel || 'link from {0} to {1} with weight {2}';\n const nodeString = props.accessibility?.nodeAriaLabel || 'node {0} with weight {1}';\n return {\n emptyAriaLabel: props.accessibility?.emptyAriaLabel || 'Graph has no data to display',\n linkAriaLabel: (link: SLink) =>\n format(\n linkString,\n (link.source as SNode).name,\n (link.target as SNode).name,\n link.unnormalizedValue ? _formatNumber(link.unnormalizedValue) : link.unnormalizedValue,\n ),\n nodeAriaLabel: (node: SNode, weight: number) => format(nodeString, node.name, _formatNumber(weight)),\n };\n }, [_formatNumber, props.accessibility]);\n\n // Compute the position of each node and link\n const { nodes, links, width, height } = React.useMemo(\n () =>\n _normalizeSankeyData(\n props.data.SankeyChartData!,\n containerWidth,\n containerHeight,\n props.colorsForNodes,\n props.borderColorsForNodes,\n ),\n [\n _normalizeSankeyData,\n containerHeight,\n containerWidth,\n props.borderColorsForNodes,\n props.colorsForNodes,\n props.data,\n ],\n );\n // Pre-compute some important attributes about nodes, specifically text\n const nodeAttributes = React.useMemo(\n () => _computeNodeAttributes(nodes, _accessibility.nodeAriaLabel),\n [_accessibility, _computeNodeAttributes, nodes],\n );\n const linkAttributes = React.useMemo(\n () => computeLinkAttributes(links, _strings.linkFrom, _accessibility.linkAriaLabel, _linkId),\n [_accessibility, _linkId, _strings, links],\n );\n\n if (!_isChartEmpty()) {\n // In FocusZone, the focus order is determined by the rendering order of the elements. We need to find\n // a rendering order such that the focus moves through the nodes and links in a logical sequence.\n // Rendering the nodes and links layer by layer in a vertical order seems to be the most effective solution\n // with FocusZone. Although this focus order may not be entirely logical, it ensures that the focus moves\n // sequentially and prevents links (especially skip layer links) from being rendered over the nodes.\n const nodeLinkDomOrderArray: { layer: number; type: string; index: number }[] = [];\n nodes.sort((a: SNode, b: SNode) => {\n if (a.x0 !== b.x0) {\n return a.x0! - b.x0!;\n }\n return a.y0! - b.y0!;\n });\n nodes.forEach((item: SNode, index) => {\n nodeLinkDomOrderArray.push({ layer: item.layer!, type: 'node', index });\n });\n links.sort((a: SLink, b: SLink) => {\n const asx0 = (a.source as SNode).x0;\n const bsx0 = (b.source as SNode).x0;\n if (asx0 !== bsx0) {\n return asx0! - bsx0!;\n }\n return a.y0! - b.y0!;\n });\n links.forEach((item: SLink, index) => {\n nodeLinkDomOrderArray.push({ layer: (item.source as SNode).layer!, type: 'link', index });\n });\n nodeLinkDomOrderArray.sort((a, b) => {\n if (a.layer !== b.layer) {\n return a.layer - b.layer;\n }\n\n if (a.type > b.type) {\n return -1;\n }\n if (a.type < b.type) {\n return 1;\n }\n return 0;\n });\n\n // Build the nodes and links as rendered in the UX.\n const nodeData = _createNodes(nodes, nodeAttributes);\n const linkData = _createLinks(links, linkAttributes);\n\n const calloutProps: ChartPopoverProps = {\n isPopoverOpen: isCalloutVisible,\n clickPosition,\n color,\n XValue: xCalloutValue,\n YValue: yCalloutValue,\n descriptionMessage,\n ...props.calloutProps!,\n };\n return (\n <div className={classes.root} ref={chartContainer} onMouseLeave={_onCloseCallout}>\n {/*\n - Horizontal navigation has been disabled because the nodes and links are rendered vertically,\n causing the left/right arrow keys to move focus up or down to the previous or next sibling element.\n - Bidirectional navigation has been disabled because it causes the up/down arrow keys to move the focus\n in a non-sequential and erratic manner within a 2D grid.\n */}\n <div className={classes.chartWrapper} {..._arrowNavigationAttributes}>\n <svg width={width} height={height} id={_chartId} className={classes.chart}>\n {nodeLinkDomOrderArray.map(item => {\n if (item.type === 'node') {\n return (\n <g key={nodes[item.index].nodeId} className={classes.nodes}>\n {nodeData![item.index]}\n </g>\n );\n } else {\n return (\n <g\n key={`${(links[item.index].source as SNode).nodeId}-${(links[item.index].target as SNode).nodeId}`}\n className={classes.links}\n stroke={props.pathColor ? props.pathColor : tokens.colorStrokeFocus2}\n strokeOpacity={1}\n >\n {linkData![item.index]}\n </g>\n );\n }\n })}\n </svg>\n </div>\n {calloutProps.isPopoverOpen && <ChartPopover {...calloutProps} />}\n <div id={_labelTooltipId} className={classes.toolTip} style={{ opacity: 0 }} ref={_tooltip} />\n </div>\n );\n }\n return <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={_accessibility.emptyAriaLabel} />;\n});\n\nSankeyChart.displayName = 'SankeyChart';\n"],"names":["React","useFluent_unstable","useFluent","tokens","useId","sum","d3Sum","sankey","d3Sankey","sankeyJustify","sankeyRight","select","selectAll","area","d3Area","curveBumpX","d3CurveBasis","useSankeyChartStyles","ChartPopover","useArrowNavigationGroup","format","useImageExport","PADDING_PERCENTAGE","NON_SELECTED_NODE_AND_STREAM_COLOR","DEFAULT_NODE_COLORS","fillColor","borderColor","MIN_HEIGHT_FOR_DOUBLINE_TYPE","MIN_HEIGHT_FOR_TYPE","REST_STREAM_OPACITY","NON_SELECTED_OPACITY","SELECTED_STREAM_OPACITY","NON_SELECTED_STREAM_BORDER_OPACITY","DEFAULT_TEXT_COLOR","NON_SELECTED_TEXT_COLOR","NODE_WIDTH","getSelectedNodes","selectedLinks","nodes","forEach","link","push","target","indexOf","source","getSelectedLinks","singleNode","q","Array","finalLinks","Set","sourceLinks","add","length","poppedLink","shift","node","targetLinks","getSelectedLinksforStreamHover","singleLink","finalNodes","poppedNode","selectedNodes","groupNodesByColumn","graph","nodesInColumn","columnId","layer","adjustOnePercentHeightNodes","computedNodes","originalLinks","totalColumnValue","Object","values","map","column","value","columnValue","index","totalPercentage","onePercent","columnNodes","nodeId","nodePercentage","actualValue","scalingRatio","normalized","changeColumnValue","originalNodeValue","normalizedNodeValue","linkValues","updateLinkValue","linkValue","unnormalizedValue","linkRatio","Math","max","populateNodeActualValue","data","links","adjustPadding","height","padding","nodePadding","minPadding","totalPaddingInColumn","y1","y0","min","idFromNumberOrSNode","duplicateData","valuesOfNodes","result","valuesOfLinks","sourceId","sourceToTarget","preRenderLayout","margins","containerWidth","containerHeight","isRtl","left","right","top","bottom","nodeWidth","extent","nodeAlign","width","elipsis","assignNodeColors","colorsForNodes","borderColorsForNodes","colors","borders","color","currentIndex","truncateText","tspan","text","rectangleWidth","textLengthForNodeName","fitsWithinNode","elipsisLength","computeElipsisLength","line","i","currentNode","w","getComputedTextLength","slice","measurement","measureText","undefined","computeLinkAttributes","linkFrom","linkAriaLabel","linkId","reactId","from","aria","linkToDataPoints","d","halfWidth","x","x1","x0","linkArea","p","curve","nodeTextColor","state","selectedState","has","selectedNode","SankeyChart","forwardRef","props","forwardedRef","classes","chartContainerRef","chartContainer","componentRef","_reqID","useRef","_linkId","_chartId","_emptyChartId","_labelTooltipId","_margins","targetDocument","dir","_window","defaultView","_isRtl","_numColumns","_nodeBarId","_nodeGElementId","_arrowNavigationAttributes","axis","_tooltip","setContainerHeight","useState","setContainerWidth","setSelectedState","setSelectedLinks","setSelectedNodes","isCalloutVisible","setCalloutVisible","setSelectedNode","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","descriptionMessage","setDescriptionMessage","clickPosition","setClickPosition","y","_fitParentContainer","useCallback","current","requestAnimationFrame","container","parentRef","currentContainerWidth","reflowProps","mode","getBoundingClientRect","_calculateChartMinWidth","currentContainerHeight","useEffect","cancelAnimationFrame","shouldResize","_formatNumber","formatNumberOptions","toLocaleString","culture","toString","_computeNodeAttributes","nodeAriaLabel","weightSpan","append","attr","nameSpan","textLengthForNodeWeight","nodeValue","truncatedname","name","isTruncated","gElementId","trimmed","weightOffset","remove","_linkCalloutAttributes","_isChartEmpty","sankeyChartData","SankeyChartData","_normalizeSankeyData","_containerWidth","_containerHeight","transformed","keys","nodeValues","_createLinks","dataLinks","linkAttributes","onMouseOut","_onStreamLeave","dataPoints","key","gradientId","gradientUrl","g","defs","linearGradient","id","x2","y2","stop","offset","stopColor","path","fill","_fillStreamColors","stroke","_fillStreamBorder","strokeWidth","strokeOpacity","_getOpacityStreamBorder","onMouseOver","event","_onStreamHover","onFocus","_onFocusLink","onBlur","_onBlur","fillOpacity","_getOpacityStream","tabIndex","aria-label","role","_createNodes","dataNodes","nodeAttributes","textAnchor","_onLeave","truncatedName","tooTall","textColor","rect","_fillNodeColors","e","_onHover","_onCloseCallout","_fillNodeBorder","opacity","className","nodeTextContainer","dy","dx","fontWeight","aria-hidden","fontSize","_showTooltip","_hideTooltip","mouseEvent","persist","_selectedLinks","_selectedNodes","updatePosition","clientX","clientY","focusEvent","boundingRect","currentTarget","checkTrcuncated","evt","style","colorNeutralForeground1","pageX","pageY","html","newX","newY","threshold","distance","sqrt","pow","_strings","useMemo","fromString","strings","_accessibility","linkString","accessibility","nodeString","emptyAriaLabel","weight","nodeLinkDomOrderArray","sort","a","b","item","type","asx0","bsx0","nodeData","linkData","calloutProps","isPopoverOpen","XValue","YValue","div","root","ref","onMouseLeave","chartWrapper","svg","chart","pathColor","colorStrokeFocus2","toolTip","displayName"],"mappings":"AAAA;;;;;;;;;;;;eA0hBa+K;eAAAA;;IA3RG3E,aAAAA;;;sBAhGArC;eAAAA;;mBAoKAqD;eAAAA;;;;iEAjUO,QAAQ;qCACiB,kCAAkC;4BAC3D,wBAAwB;gCACzB,4BAA4B;yBACrB,WAAW;0BACkD,YAAY;6BAC1C,eAAe;yBAChB,WAAW;4CAGjC,gCAAgC;uBACrB,4BAA4B;8BACpC,0BAA0B;wBAC3C,yBAAyB;uBACjB,wBAAwB;AAEvD,MAAM9F,qBAAqB;AAiB3B,MAAMC,qCAA6C;AACnD,MAAMC,sBAAoC;IACxC;Q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,YAAYiN,WAAW,GAAG"}
1
+ {"version":3,"sources":["../src/components/SankeyChart/SankeyChart.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { tokens } from '@fluentui/react-theme';\nimport { useId } from '@fluentui/react-utilities';\nimport { sum as d3Sum } from 'd3-array';\nimport { SankeyGraph, SankeyLayout, sankey as d3Sankey, sankeyJustify, sankeyRight } from 'd3-sankey';\nimport { Selection as D3Selection, select, selectAll } from 'd3-selection';\nimport { area as d3Area, curveBumpX as d3CurveBasis } from 'd3-shape';\nimport { Margins, SLink, SNode } from '../../types/DataPoint';\nimport { SankeyChartData, SankeyChartProps } from './SankeyChart.types';\nimport { useSankeyChartStyles } from './useSankeyChartStyles.styles';\nimport { ChartPopover, ChartPopoverProps } from '../CommonComponents/index';\nimport { useArrowNavigationGroup } from '@fluentui/react-tabster';\nimport { format } from '../../utilities/string';\nimport { useImageExport } from '../../utilities/hooks';\n\nconst PADDING_PERCENTAGE = 0.3;\n\ntype NodeId = number | string;\ntype ItemValues<T> = { [key: NodeId]: T };\ntype NodeValues = ItemValues<number>;\ntype LinkItemValues<T> = { [key: NodeId]: ItemValues<T> };\ntype LinkValues = LinkItemValues<number>;\n\ntype NodesInColumns = { [key: number]: SNode[] };\ntype NormalizedData = SankeyChartData & {\n width: number;\n height: number;\n};\n\ntype NodeColors = { fillColor: string; borderColor: string };\ntype SankeyLayoutGenerator = SankeyLayout<SankeyGraph<{}, {}>, {}, {}>;\n\nconst NON_SELECTED_NODE_AND_STREAM_COLOR: string = '#757575';\nconst DEFAULT_NODE_COLORS: NodeColors[] = [\n { fillColor: '#00758F', borderColor: '#002E39' },\n { fillColor: '#77004D', borderColor: '#43002C' },\n { fillColor: '#4F6BED', borderColor: '#3B52B4' },\n { fillColor: '#937600', borderColor: '#6D5700' },\n { fillColor: '#286EA8', borderColor: '#00457E' },\n { fillColor: '#A43FB1', borderColor: '#7C158A' },\n { fillColor: '#CC3595', borderColor: '#7F215D' },\n { fillColor: '#0E7878', borderColor: '#004E4E' },\n { fillColor: '#8764B8', borderColor: '#4B3867' },\n { fillColor: '#9C663F', borderColor: '#6D4123' },\n];\n\nconst MIN_HEIGHT_FOR_DOUBLINE_TYPE = 36;\nconst MIN_HEIGHT_FOR_TYPE = 24;\nconst REST_STREAM_OPACITY: number = 1;\nconst NON_SELECTED_OPACITY: number = 1;\nconst SELECTED_STREAM_OPACITY: number = 0.3;\nconst NON_SELECTED_STREAM_BORDER_OPACITY: number = 0.5;\nconst DEFAULT_TEXT_COLOR: string = '#323130';\nconst NON_SELECTED_TEXT_COLOR: string = '#FFFFFF';\nconst NODE_WIDTH = 124;\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction getSelectedNodes(selectedLinks: Set<SLink>): any[] {\n const nodes: SNode[] = [];\n selectedLinks.forEach(link => {\n nodes.push(link.target as SNode);\n\n if (nodes.indexOf(link.source as SNode) === -1) {\n nodes.push(link.source as SNode);\n }\n });\n return nodes;\n}\n\nfunction getSelectedLinks(singleNode: SNode): Set<SLink> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, no-array-constructor\n const q: any = new Array<any>();\n const finalLinks: Set<SLink> = new Set<SLink>();\n\n singleNode.sourceLinks!.forEach((link: SLink) => {\n q.push(link);\n finalLinks.add(link);\n });\n\n while (q.length > 0) {\n const poppedLink: SLink = q.shift();\n const node: SNode = poppedLink.target as SNode;\n if (node && node.sourceLinks) {\n node.sourceLinks.forEach((link: SLink) => {\n finalLinks.add(link);\n q.push(link);\n });\n }\n }\n\n if (singleNode.targetLinks) {\n singleNode.targetLinks.forEach((link: SLink) => {\n q.push(link);\n finalLinks.add(link);\n });\n }\n\n while (q.length > 0) {\n const poppedLink: SLink = q.shift();\n const node: SNode = poppedLink.source as SNode;\n if (node && node.targetLinks) {\n node.targetLinks.forEach((link: SLink) => {\n finalLinks.add(link);\n q.push(link);\n });\n }\n }\n\n return finalLinks;\n}\n\nfunction getSelectedLinksforStreamHover(singleLink: SLink): {\n selectedLinks: Set<SLink>;\n selectedNodes: Set<SNode>;\n} {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any, no-array-constructor\n const q: any = new Array<any>();\n const finalLinks: Set<SLink> = new Set<SLink>();\n const finalNodes: Set<SNode> = new Set<SNode>();\n\n q.push(singleLink.source);\n finalLinks.add(singleLink);\n while (q.length > 0) {\n const poppedNode: SNode = q.shift();\n finalNodes.add(poppedNode);\n if (poppedNode.targetLinks && poppedNode.targetLinks.length > 0) {\n poppedNode.targetLinks.forEach((link: SLink) => {\n q.push(link.source);\n finalLinks.add(link);\n });\n }\n }\n\n q.push(singleLink.target);\n\n while (q.length > 0) {\n const poppedNode: SNode = q.shift();\n finalNodes.add(poppedNode);\n if (poppedNode.sourceLinks && poppedNode.sourceLinks.length > 0) {\n poppedNode.sourceLinks.forEach((link: SLink) => {\n q.push(link.target);\n finalLinks.add(link);\n });\n }\n }\n\n return {\n selectedLinks: finalLinks,\n selectedNodes: finalNodes,\n };\n}\n\n/**\n * This is used to group nodes by column index.\n */\n// This is exported for unit tests.\nexport function groupNodesByColumn(graph: SankeyChartData): NodesInColumns {\n const nodesInColumn: NodesInColumns = {};\n graph.nodes.forEach((node: SNode) => {\n const columnId = node.layer!;\n if (nodesInColumn[columnId]) {\n nodesInColumn[columnId].push(node);\n } else {\n nodesInColumn[columnId] = [node];\n }\n });\n return nodesInColumn;\n}\n\n/**\n * This is used to normalize the nodes value whose value is less than 1% of the total column value.\n */\nfunction adjustOnePercentHeightNodes(\n nodesInColumn: NodesInColumns,\n computedNodes: NodeValues,\n originalLinks: LinkValues,\n): void {\n const totalColumnValue = Object.values(nodesInColumn).map((column: SNode[]) => {\n return d3Sum(column, (node: SNode) => node.value);\n });\n totalColumnValue.forEach((columnValue: number, index: number) => {\n let totalPercentage = 0;\n const onePercent = 0.01 * columnValue;\n const columnNodes = nodesInColumn[index];\n columnNodes.forEach((node: SNode) => {\n const value = computedNodes[node.nodeId];\n const nodePercentage = (value / columnValue) * 100;\n node.actualValue = value;\n //if the value is less than 1% then we are making it as 1% of total .\n if (nodePercentage < 1) {\n node.value = onePercent;\n totalPercentage = totalPercentage + 1;\n } else {\n totalPercentage = totalPercentage + nodePercentage;\n }\n });\n //since we have adjusted the value to be 1% but we need to keep the sum of the percentage value under 100.\n const scalingRatio = totalPercentage !== 0 ? totalPercentage / 100 : 1;\n if (scalingRatio > 1) {\n // Loop through each node in that column and scale that node--and its incoming and outgoing links--by the\n // scaling ratio. We need the sankey diagram to re-layout the nodes and links after we do this.\n columnNodes.forEach((node: SNode) => {\n const normalized = (node.value = node.value! / scalingRatio);\n // Which Original Value? and Which Normalized Value is needed, here? The Node? The Link? Both?\n changeColumnValue(node, computedNodes[node.nodeId], normalized, originalLinks);\n });\n }\n });\n}\n\n/**\n * This is used for normalizing each link's value to reflect the normalized node value.\n */\nfunction changeColumnValue(\n node: SNode,\n originalNodeValue: number,\n normalizedNodeValue: number,\n linkValues: LinkValues,\n) {\n // For each link in the source and target, compute the proportion that this link contributes to the total\n // then adjust the link's value to reflect its proportion of the normalized node value.\n const updateLinkValue = (link: SLink) => {\n const value = linkValue(linkValues, link);\n link.unnormalizedValue = value;\n const linkRatio = value / originalNodeValue;\n link.value = Math.max(normalizedNodeValue * linkRatio, link.value);\n };\n node.sourceLinks!.forEach(updateLinkValue);\n node.targetLinks!.forEach(updateLinkValue);\n}\n\n/**\n * This is used for calculating the node non normalized value based on link non normalized value.\n * The links have the original weights. Computed nodes have the total weight of all incoming and outgoing links.\n */\nfunction populateNodeActualValue(data: SankeyChartData, computedNodes: NodeValues, originalLinks: LinkValues) {\n data.links.forEach((link: SLink) => {\n if (!link.unnormalizedValue) {\n link.unnormalizedValue = linkValue(originalLinks, link);\n }\n });\n data.nodes.forEach((node: SNode) => {\n node.actualValue = computedNodes[node.nodeId as NodeId];\n });\n}\n\n/**\n * This is used to introduce dynamic padding for cases where the number of nodes in a column is huge\n * so that we maintain a node to space ratio for such columns as if we fail to do so the\n * chart is devoid of nodes and only shows links.\n */\n// This is exported for unit tests\nexport function adjustPadding(sankey: SankeyLayoutGenerator, height: number, nodesInColumn: NodesInColumns): void {\n let padding = sankey.nodePadding();\n const minPadding = PADDING_PERCENTAGE * height;\n Object.values(nodesInColumn).forEach((column: SNode[]) => {\n const totalPaddingInColumn = height - d3Sum(column, (node: SNode) => node.y1! - node.y0!);\n if (minPadding < totalPaddingInColumn) {\n // Here we are calculating the min of default and calculated padding, we will not increase the padding\n // in any scenario.\n padding = Math.min(padding, minPadding / (column.length - 1));\n }\n });\n sankey.nodePadding(padding);\n}\n\nfunction idFromNumberOrSNode(node: SNode | number): NodeId {\n if (typeof node === 'number') {\n return node;\n }\n return node.nodeId as NodeId;\n}\n\n/**\n * Duplicates the supplied chart data so that we do not alter the original.\n * @param data The data to duplicate.\n * @returns The duplicated data.\n */\nfunction duplicateData(data: SankeyChartData): SankeyChartData {\n return {\n nodes: data.nodes.map(\n (node: SNode): SNode => ({\n ...node,\n }),\n ),\n links: data.links.map(\n (link: SLink): SLink => ({\n ...link,\n }),\n ),\n };\n}\n\nfunction valuesOfNodes(nodes: SNode[]): NodeValues {\n const result: NodeValues = {};\n nodes.forEach((node: SNode) => {\n result[node.nodeId as NodeId] = node.value!;\n });\n return result;\n}\n\nfunction valuesOfLinks(links: SLink[]): LinkValues {\n const result: LinkValues = {};\n links.forEach((link: SLink) => {\n const sourceId = idFromNumberOrSNode(link.source);\n let sourceToTarget = result[sourceId];\n if (!sourceToTarget) {\n sourceToTarget = {};\n result[sourceId] = sourceToTarget;\n }\n sourceToTarget[idFromNumberOrSNode(link.target)] = link.value;\n });\n return result;\n}\n\nfunction linkValue<T>(originalLinks: LinkItemValues<T>, link: SLink): T {\n return originalLinks[idFromNumberOrSNode(link.source)][idFromNumberOrSNode(link.target)];\n}\n\n// This is exported for unit tests.\nexport function preRenderLayout(\n margins: Margins,\n containerWidth: number,\n containerHeight: number,\n isRtl: boolean,\n): { sankey: SankeyLayoutGenerator; height: number; width: number } {\n const { left, right, top, bottom } = margins;\n\n const sankey = d3Sankey()\n .nodeWidth(NODE_WIDTH)\n .extent([\n [left!, top!],\n [containerWidth - right!, containerHeight - bottom!],\n ])\n .nodeAlign(isRtl ? sankeyRight : sankeyJustify);\n\n return { sankey, height: containerHeight, width: containerWidth };\n}\n\nconst elipsis = '...';\n\n/**\n * This is used to assign node fillcolors and borderColor cyclically when the user doesnt\n * provide color to individual node.\n */\nfunction assignNodeColors(\n nodes: SNode[],\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n) {\n let colors: string[];\n let borders: string[];\n if (colorsForNodes && borderColorsForNodes) {\n colors = colorsForNodes;\n borders = borderColorsForNodes;\n } else {\n colors = DEFAULT_NODE_COLORS.map(color => color.fillColor);\n borders = DEFAULT_NODE_COLORS.map(color => color.borderColor);\n }\n let currentIndex = 0;\n nodes.forEach((node: SNode) => {\n if (!node.color && !node.borderColor) {\n node.color = colors[currentIndex];\n node.borderColor = borders[currentIndex];\n } else if (node.color && !node.borderColor) {\n node.borderColor = '#757575';\n } else if (node.borderColor && !node.color) {\n node.color = '#F5F5F5';\n }\n currentIndex = (currentIndex + 1) % colors.length;\n });\n}\n\n/**\n * Takes in the display name for the node and potentially returns a trimmed version of the name.\n * @param tspan the `tspan` element to use for text visual length measurement\n * @param text is the text which we will potentially truncate\n * @param rectangleWidth is the width of the rectangle which will contain the text\n * @param padding is the space we need to leave between the rect lines and other text\n * @returns the name to show on the node which might be the truncated `text` if the `text` is too long\n */\nfunction truncateText(tspan: TSpanForTextMeasuring, text: string, rectangleWidth: number, padding: number) {\n // NOTE: This method is the most-expensive in terms of rerendering components.\n const textLengthForNodeName = rectangleWidth - padding; // This can likely be computed once and passed in.\n // The following `select` statement injects a `tempText` element into the DOM. This injection\n // (and subsequent removal) is causing a layout recalculation. This is a performance issue.\n // Note that this code will always inject a `tempText` element, but doesn't always remove it. This is a bug.\n if (fitsWithinNode(tspan, text, textLengthForNodeName)) {\n return text;\n }\n // Computing the size of elipsis is performed with each node. This should be computed once and used everywhere.\n // TODO: Compute the size of the elipsis once and use it everywhere.\n const elipsisLength = computeElipsisLength(tspan);\n let line: string = '';\n // Calculate how much of the original text to show.\n // TODO: The folllowing is O(n). We could use a binary search to make this faster: O(log(n)).\n for (let i = 0; i < text.length; i++) {\n line += text[i];\n tspan.text(line);\n const currentNode = tspan.node();\n if (currentNode !== null) {\n const w = currentNode!.getComputedTextLength();\n if (w >= textLengthForNodeName - elipsisLength) {\n line = line.slice(0, -1);\n line += elipsis;\n break;\n }\n }\n }\n tspan.text(null);\n return line;\n}\n\ntype RenderedNodeAttributes = {\n readonly reactId: string;\n readonly gElementId: string;\n readonly name: string;\n readonly aria: string;\n readonly trimmed: boolean;\n readonly height: number;\n readonly weightOffset: number;\n};\n\ntype RenderedLinkAttributes = {\n readonly reactId: string;\n readonly aria: string;\n readonly from: string;\n};\n\ntype TSpanForTextMeasuring = D3Selection<SVGTSpanElement, unknown, HTMLElement, unknown>;\n\nfunction fitsWithinNode(tspan: TSpanForTextMeasuring, text: string, textLengthForNodeName: number): boolean {\n const measurement = measureText(tspan, text);\n if (measurement === undefined) {\n return false;\n }\n return measurement <= textLengthForNodeName;\n}\n\nfunction measureText(tspan: TSpanForTextMeasuring, text: string | number): number | undefined {\n try {\n tspan.text(text);\n return tspan.node()?.getComputedTextLength();\n } finally {\n tspan.text(null);\n }\n}\n\nfunction computeElipsisLength(tspan: TSpanForTextMeasuring): number {\n const measurement = measureText(tspan, elipsis);\n return measurement === undefined ? 0 : measurement;\n}\n\nfunction computeLinkAttributes(\n links: SLink[],\n linkFrom: (node: SNode) => string,\n linkAriaLabel: (link: SLink) => string,\n linkId: string,\n): LinkItemValues<RenderedLinkAttributes> {\n const result: LinkItemValues<RenderedLinkAttributes> = {};\n links.forEach((link: SLink, index: number) => {\n const sourceId = idFromNumberOrSNode(link.source);\n let sourceToTarget = result[sourceId];\n if (!sourceToTarget) {\n sourceToTarget = {};\n result[sourceId] = sourceToTarget;\n }\n sourceToTarget[idFromNumberOrSNode(link.target)] = {\n reactId: `${linkId}-${index}`,\n from: linkFrom(link.source as SNode),\n aria: linkAriaLabel(link),\n };\n });\n\n return result;\n}\n\ntype ItemPositions = {\n readonly x0: number;\n readonly y0: number;\n readonly x1: number;\n readonly y1: number;\n};\n\ntype SankeyLinkWithPositions = ItemPositions & {\n readonly source: ItemPositions;\n readonly target: ItemPositions;\n readonly width: number;\n};\n\ntype AreaDataPoint = {\n readonly x: number;\n readonly y0: number;\n readonly y1: number;\n};\n\nconst linkToDataPoints = (d: SankeyLinkWithPositions): [AreaDataPoint, AreaDataPoint] => {\n const halfWidth = d.width * 0.5;\n const y0 = d.y0;\n const y1 = d.y1;\n return [\n { x: d.source.x1, y0: y0 + halfWidth, y1: y0 - halfWidth },\n { x: d.target.x0, y0: y1 + halfWidth, y1: y1 - halfWidth },\n ];\n};\n\nconst linkArea = d3Area<AreaDataPoint>()\n .x((p: AreaDataPoint) => p.x)\n .y0((p: AreaDataPoint) => p.y0)\n .y1((p: AreaDataPoint) => p.y1)\n .curve(d3CurveBasis);\n\nfunction nodeTextColor(\n state: { selectedState: boolean; selectedNodes: Set<number>; selectedNode: SNode | undefined },\n singleNode: SNode,\n): string {\n return !(\n !state.selectedState ||\n (state.selectedNodes.has(singleNode.index!) && state.selectedNode) ||\n !state.selectedNode\n )\n ? DEFAULT_TEXT_COLOR\n : NON_SELECTED_TEXT_COLOR;\n}\n\ntype StringRenderer = {\n linkFrom: (node: SNode) => string;\n};\n\ntype AccessibilityRenderer = {\n emptyAriaLabel: string;\n nodeAriaLabel: (node: SNode, weight: number) => string;\n linkAriaLabel: (link: SLink) => string;\n};\n\nexport const SankeyChart: React.FunctionComponent<SankeyChartProps> = React.forwardRef<\n HTMLDivElement,\n SankeyChartProps\n>((props, forwardedRef) => {\n const classes = useSankeyChartStyles(props);\n const { chartContainerRef: chartContainer } = useImageExport(props.componentRef, true, false);\n const _reqID = React.useRef<number | undefined>(undefined);\n const _linkId = useId('link');\n const _chartId = useId('sankeyChart');\n const _emptyChartId = useId('_SankeyChart_empty');\n const _labelTooltipId = useId('tooltip');\n const _margins = React.useRef<Margins>({ top: 36, right: 48, bottom: 32, left: 48 });\n const { targetDocument, dir } = useFluent();\n const _window = targetDocument?.defaultView;\n const _isRtl: boolean = dir === 'rtl';\n const _numColumns = React.useRef<number>(0);\n const _nodeBarId = useId('nodeBar');\n const _nodeGElementId = useId('nodeGElement');\n const _arrowNavigationAttributes = useArrowNavigationGroup({ axis: 'vertical' });\n const _tooltip = React.useRef<HTMLDivElement>(null);\n\n const [containerHeight, setContainerHeight] = React.useState<number>(468);\n const [containerWidth, setContainerWidth] = React.useState<number>(912);\n const [selectedState, setSelectedState] = React.useState<boolean>(false);\n const [selectedLinks, setSelectedLinks] = React.useState(new Set<number>());\n const [selectedNodes, setSelectedNodes] = React.useState(new Set<number>());\n const [isCalloutVisible, setCalloutVisible] = React.useState<boolean>(false);\n const [selectedNode, setSelectedNode] = React.useState<SNode>();\n const [color, setColor] = React.useState<string>();\n const [xCalloutValue, setXCalloutValue] = React.useState<string>();\n const [yCalloutValue, setYCalloutValue] = React.useState<string>();\n const [descriptionMessage, setDescriptionMessage] = React.useState<string>();\n const [clickPosition, setClickPosition] = React.useState({ x: 0, y: 0 });\n\n const _fitParentContainer = React.useCallback((): void => {\n _reqID.current = _window?.requestAnimationFrame(() => {\n // NOTE: Calls to this method trigger a re-render.\n const container = props.parentRef ? props.parentRef : chartContainer.current;\n if (container) {\n const currentContainerWidth =\n props.reflowProps?.mode === 'min-width'\n ? Math.max(container.getBoundingClientRect().width, _calculateChartMinWidth())\n : container.getBoundingClientRect().width;\n const currentContainerHeight = container.getBoundingClientRect().height;\n setContainerWidth(currentContainerWidth);\n setContainerHeight(currentContainerHeight);\n }\n });\n }, [_window, props.reflowProps?.mode, props.parentRef]);\n\n React.useEffect(() => {\n _fitParentContainer();\n\n return () => {\n if (typeof _reqID.current === 'number') {\n _window?.cancelAnimationFrame(_reqID.current);\n }\n };\n }, [_fitParentContainer, _window, props.shouldResize]);\n\n const _formatNumber = React.useCallback(\n (value: number): string => {\n return props.formatNumberOptions\n ? value.toLocaleString(props.culture, props.formatNumberOptions)\n : value.toString();\n },\n [props.formatNumberOptions, props.culture],\n );\n\n const _computeNodeAttributes = React.useCallback(\n (nodes: SNode[], nodeAriaLabel: (node: SNode, weight: number) => string): ItemValues<RenderedNodeAttributes> => {\n const result: ItemValues<RenderedNodeAttributes> = {};\n const weightSpan = select('.nodeName').append('text').attr('class', 'tempText').append('tspan').text(null);\n const nameSpan = select('.nodeName')\n .append('text')\n .attr('class', 'tempText')\n .attr('font-size', '10')\n .append('tspan')\n .text(null);\n nodes.forEach((singleNode: SNode, index: number) => {\n const height = Math.max(singleNode.y1! - singleNode.y0!, 0);\n let padding = 8;\n let textLengthForNodeWeight = 0;\n\n const nodeValue = singleNode.actualValue!;\n // If the nodeWeight is in the same line as node description an extra padding\n // of 6 px is required between node description and node weight.\n if (height < MIN_HEIGHT_FOR_DOUBLINE_TYPE) {\n padding = padding + 6;\n // The following `select` statement injects a `tempText` element into the DOM. This injection\n // (and subsequent removal) is causing a layout recalculation. This is a performance issue.\n const measurement = measureText(weightSpan, _formatNumber(nodeValue));\n if (measurement !== undefined) {\n textLengthForNodeWeight = measurement;\n padding = padding + textLengthForNodeWeight;\n }\n }\n // Since the total width of the node is 124 and we are giving margin of 8px from the left .\n // So the actual value on which it will be truncated is 124-8=116.\n const truncatedname: string = truncateText(nameSpan, singleNode.name, NODE_WIDTH - 8, padding);\n const isTruncated: boolean = truncatedname.slice(-3) === elipsis;\n result[singleNode.nodeId] = {\n reactId: `${_nodeBarId}-${index}`,\n gElementId: `${_nodeGElementId}-${index}`,\n name: truncatedname,\n aria: nodeAriaLabel(singleNode, nodeValue),\n trimmed: isTruncated,\n height,\n weightOffset: textLengthForNodeWeight,\n };\n });\n selectAll('.tempText').remove();\n return result;\n },\n [_formatNumber, _nodeBarId, _nodeGElementId],\n );\n\n const _linkCalloutAttributes = (singleLink: SLink, from: string) => {\n setCalloutVisible(true);\n setColor((singleLink.source as SNode).color!);\n setXCalloutValue((singleLink.target as SNode).name);\n setYCalloutValue(_formatNumber(singleLink.unnormalizedValue!));\n setDescriptionMessage(from);\n };\n\n const _isChartEmpty = React.useCallback(() => {\n const sankeyChartData = props.data?.SankeyChartData;\n return !(sankeyChartData && sankeyChartData.nodes.length > 0 && sankeyChartData.links.length > 0);\n }, [props.data]);\n\n const _normalizeSankeyData = React.useCallback(\n (\n data: SankeyChartData,\n _containerWidth: number,\n _containerHeight: number,\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n ): NormalizedData => {\n if (_isChartEmpty()) {\n return { width: 0, height: 0, nodes: [], links: [] };\n }\n\n const { sankey, height, width } = preRenderLayout(_margins.current, _containerWidth, _containerHeight, _isRtl);\n // Clone the data before mutating it (via the SankeyLayoutGenerator) so that we don't mutate the original data.\n const transformed: SankeyChartData = duplicateData(data);\n sankey(transformed);\n // NOTE: After the prior line, `transformed` is now a more-complex object than the incoming `ISankeyChartData`.\n // `transformed` should be cast to a more-specific type. This is a breaking change because we would be eliminating\n // fields from `ISankeyChartData` and putting those fields on a now-local type. But doing so makes it clearer what\n // the caller needs to supply and why. For example, the `actualValue` and `layer` fields of `ISNodeExtra` should\n // both be moved. Similarly for `unnormalizedValue` in `ISLinkExtra`.\n // `SankeyNodeMinimal` and `SankeyLinkMinimal` are both the types after `sankey(transformed)`, but have almost no\n // bearing on the data before `sankey(transformed)` (which is basically nodes with ids and names along with links\n // with source index, target index, and value).\n const nodesInColumn = groupNodesByColumn(transformed);\n _numColumns.current = Object.keys(nodesInColumn).length;\n // Keep track of the original values of the links and their acccumulated values in the nodes\n // Setting these in external objects so they cannot be mutated by other code.\n // The IDs of nodes can be numbers or strings. But, the IDs of links are always the index into the \"nodes\" array.\n // After the sankey layout is computed, the each link's `source` and `target` will have the ID of the node in the\n // type originally specified in the Nodes array. Consequently, we get the values of those links after the sankey\n // transformation.\n const nodeValues = valuesOfNodes(transformed.nodes);\n const linkValues = valuesOfLinks(transformed.links);\n adjustOnePercentHeightNodes(nodesInColumn, nodeValues, linkValues);\n adjustPadding(sankey, containerHeight - _margins.current.top! - _margins.current.bottom!, nodesInColumn);\n // `sankey` is called a second time, probably to re-layout the nodes with the one-percent adjusted weights.\n // NOTE: The second call to `sankey` is required to allow links to be hoverable.\n // Without the second call, the links are not hoverable.\n sankey(transformed);\n populateNodeActualValue(transformed, nodeValues, linkValues);\n assignNodeColors(transformed.nodes, colorsForNodes, borderColorsForNodes);\n return {\n width,\n height,\n nodes: transformed.nodes,\n links: transformed.links,\n };\n },\n [_isChartEmpty, _isRtl],\n );\n\n const _createLinks = (\n dataLinks: SLink[],\n linkAttributes: LinkItemValues<RenderedLinkAttributes>,\n ): React.ReactNode[] | undefined => {\n if (dataLinks) {\n const linkId = _linkId;\n return dataLinks.map((singleLink: SLink, index: number): React.ReactNode => {\n const onMouseOut = () => {\n _onStreamLeave(singleLink);\n };\n const { reactId, from, aria } = linkValue(linkAttributes, singleLink);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const dataPoints: Array<any> = linkToDataPoints(singleLink as unknown as SankeyLinkWithPositions);\n const key = `${linkId}-${index}`;\n const gradientId = `gradient-${key}`;\n const gradientUrl = `url(#${gradientId})`;\n const source = singleLink.source as SNode;\n const target = singleLink.target as SNode;\n // TODO: localize the aria-label string\n return (\n <g key={key}>\n <defs>\n <linearGradient id={gradientId} x1=\"0%\" y1=\"0%\" x2=\"100%\" y2=\"0%\">\n <stop offset=\"0\" stopColor={source.color} />\n <stop offset=\"100%\" stopColor={target.color} />\n </linearGradient>\n </defs>\n <path\n d={linkArea(dataPoints)!}\n id={reactId}\n fill={_fillStreamColors(singleLink, gradientUrl)}\n stroke={_fillStreamBorder(singleLink, gradientUrl)}\n strokeWidth=\"2\"\n strokeOpacity={_getOpacityStreamBorder(singleLink)}\n onMouseOver={event => _onStreamHover(event, singleLink, from)}\n onMouseOut={onMouseOut}\n onFocus={event => _onFocusLink(event, singleLink, from)}\n onBlur={_onBlur}\n fillOpacity={_getOpacityStream(singleLink)}\n tabIndex={0}\n aria-label={aria}\n role=\"img\"\n />\n </g>\n );\n });\n }\n return [];\n };\n\n const _createNodes = (\n dataNodes: SNode[],\n nodeAttributes: ItemValues<RenderedNodeAttributes>,\n ): React.ReactNode[] | undefined => {\n if (dataNodes) {\n const textAnchor = _isRtl ? 'end' : 'start';\n return dataNodes.map((singleNode: SNode, index: number): React.ReactNode => {\n const onMouseOut = () => {\n _onLeave(singleNode);\n };\n const {\n reactId: nodeId,\n gElementId,\n height,\n trimmed: isTruncated,\n name: truncatedName,\n weightOffset: textLengthForNodeWeight,\n aria,\n } = nodeAttributes[singleNode.nodeId];\n const tooTall = height > MIN_HEIGHT_FOR_DOUBLINE_TYPE;\n const { name, actualValue, x0, x1, y0 } = singleNode;\n const textColor = nodeTextColor({ selectedState, selectedNodes, selectedNode }, singleNode);\n return (\n <g key={index} id={gElementId}>\n <rect\n x={x0}\n y={y0}\n height={height}\n width={x1! - x0!}\n fill={_fillNodeColors(singleNode)}\n id={nodeId}\n onMouseOver={e => _onHover(singleNode, e)}\n onMouseOut={onMouseOut}\n onFocus={_onCloseCallout}\n stroke={_fillNodeBorder(singleNode)}\n strokeWidth=\"2\"\n opacity=\"1\"\n tabIndex={0}\n aria-label={aria}\n role=\"img\"\n />\n {height > MIN_HEIGHT_FOR_TYPE && (\n <g className={classes.nodeTextContainer}>\n <g className=\"nodeName\">\n <text\n id={`${nodeId}-name`}\n x={x0}\n y={y0}\n dy={'1.2em'}\n dx={'0.4em'}\n textAnchor={textAnchor}\n fontWeight=\"regular\"\n aria-hidden=\"true\"\n fill={textColor}\n fontSize={10}\n onMouseOver={e => _showTooltip(name, isTruncated, e)}\n onMouseOut={() => _hideTooltip()}\n >\n {truncatedName}\n </text>\n </g>\n\n <text\n x={tooTall ? x0 : x1! - textLengthForNodeWeight - 8}\n y={y0}\n dy={tooTall ? '2em' : '1em'}\n dx={tooTall ? '0.4em' : '0em'}\n textAnchor={textAnchor}\n fontWeight=\"bold\"\n aria-hidden=\"true\"\n fill={textColor}\n fontSize={14}\n >\n {actualValue ? _formatNumber(actualValue) : actualValue}\n </text>\n </g>\n )}\n </g>\n );\n });\n }\n };\n\n const _onLeave = (singleNode: SNode) => {\n if (selectedState) {\n setSelectedState(false);\n setSelectedNodes(new Set<number>());\n setSelectedLinks(new Set<number>());\n setSelectedNode(undefined);\n }\n };\n\n const _onHover = (singleNode: SNode, mouseEvent: React.MouseEvent<SVGElement>) => {\n mouseEvent.persist();\n _onCloseCallout();\n const _selectedLinks = getSelectedLinks(singleNode);\n const _selectedNodes = getSelectedNodes(_selectedLinks);\n _selectedNodes.push(singleNode);\n setSelectedState(true);\n setSelectedNodes(new Set<number>(Array.from(_selectedNodes).map(node => node.index!)));\n setSelectedLinks(new Set<number>(Array.from(_selectedLinks).map(link => link.index!)));\n setSelectedNode(singleNode);\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n setCalloutVisible(singleNode.y1! - singleNode.y0! < MIN_HEIGHT_FOR_TYPE);\n setColor(singleNode.color);\n setXCalloutValue(singleNode.name);\n setYCalloutValue(_formatNumber(singleNode.actualValue!));\n };\n\n const _onStreamHover = (mouseEvent: React.MouseEvent<SVGElement>, singleLink: SLink, from: string) => {\n mouseEvent.persist();\n _onCloseCallout();\n const { selectedLinks: _selectedLinks, selectedNodes: _selectedNodes } = getSelectedLinksforStreamHover(singleLink);\n setSelectedState(true);\n setSelectedNodes(new Set<number>(Array.from(_selectedNodes).map(node => node.index!)));\n setSelectedLinks(new Set<number>(Array.from(_selectedLinks).map(link => link.index!)));\n updatePosition(mouseEvent.clientX, mouseEvent.clientY);\n _linkCalloutAttributes(singleLink, from);\n };\n\n const _onStreamLeave = (singleLink: SLink) => {\n if (selectedState) {\n setSelectedState(false);\n setSelectedNodes(new Set<number>());\n setSelectedLinks(new Set<number>());\n }\n };\n\n const _onFocusLink = (focusEvent: React.FocusEvent<SVGElement>, singleLink: SLink, from: string): void => {\n // There is a big difference in how \"Tab\" and the \"Arrow keys\" are handled in this diagram.\n // In particular, I would expect the \"Down\" key to be like \"Tab\", but it jumps a little wildly. I'm not sure\n // if this behavior is an accessiblity violation, but it we might want to investigate it.\n focusEvent.persist();\n _onCloseCallout();\n const boundingRect = focusEvent.currentTarget.getBoundingClientRect();\n const clientX = boundingRect.left + boundingRect.width / 2;\n const clientY = boundingRect.top + boundingRect.height / 2;\n updatePosition(clientX, clientY);\n _linkCalloutAttributes(singleLink, from);\n };\n\n const _onCloseCallout = () => {\n setCalloutVisible(false);\n updatePosition(0, 0);\n setDescriptionMessage('');\n };\n\n const _onBlur = (): void => {\n /**/\n };\n\n const _fillNodeColors = (singleNode: SNode): string | undefined => {\n if (!selectedState) {\n return singleNode.color;\n } else {\n if (selectedNode && selectedNodes.has(singleNode.index!)) {\n return selectedNode.color;\n } else if (!selectedNode) {\n return singleNode.color;\n }\n }\n };\n\n const _fillStreamColors = (singleLink: SLink, gradientUrl: string): string | undefined => {\n if (selectedState && selectedLinks.has(singleLink.index!)) {\n return singleLink ? singleLink.color : selectedNode ? selectedNode.color : gradientUrl;\n }\n };\n\n const _fillStreamBorder = (singleLink: SLink, gradientUrl: string): string => {\n if (!selectedState) {\n return NON_SELECTED_NODE_AND_STREAM_COLOR;\n } else {\n if (selectedLinks.has(singleLink.index!)) {\n return selectedNode ? selectedNode.borderColor! : gradientUrl;\n }\n return NON_SELECTED_NODE_AND_STREAM_COLOR;\n }\n };\n\n const _fillNodeBorder = (singleNode: SNode): string => {\n if (!selectedState) {\n return singleNode.borderColor!;\n } else {\n if (selectedNodes.has(singleNode.index!)) {\n return selectedNode ? selectedNode.borderColor! : singleNode.borderColor!;\n }\n return singleNode.borderColor!;\n }\n };\n\n const _getOpacityStream = (singleLink: SLink): number => {\n if (selectedState) {\n if (!selectedLinks.has(singleLink.index!)) {\n return NON_SELECTED_OPACITY;\n } else if (!selectedNode) {\n return SELECTED_STREAM_OPACITY;\n }\n }\n return REST_STREAM_OPACITY;\n };\n\n const _getOpacityStreamBorder = (singleLink: SLink): number => {\n if (selectedState && !selectedLinks.has(singleLink.index!) && !selectedNode) {\n return NON_SELECTED_STREAM_BORDER_OPACITY;\n }\n\n return NON_SELECTED_OPACITY;\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const _showTooltip = (text: string, checkTrcuncated: boolean, evt: any) => {\n if (_tooltip.current && checkTrcuncated) {\n //Fixing tooltip position by attaching it to the element rather than page\n select(_tooltip.current)\n .style('opacity', 0.9)\n .style('color', tokens.colorNeutralForeground1)\n .style('left', evt.pageX + 'px')\n .style('top', evt.pageY - 28 + 'px')\n .html(text);\n }\n };\n\n const _hideTooltip = () => {\n if (_tooltip.current) {\n select(_tooltip.current).style('opacity', 0);\n }\n };\n\n const _calculateChartMinWidth = (): number => {\n return (\n _margins.current.left! +\n _margins.current.right! +\n // total width of all node columns\n _numColumns.current * NODE_WIDTH +\n // minimum total width of all column gaps\n (_numColumns.current - 1) * (NODE_WIDTH / 2)\n );\n };\n\n const updatePosition = (newX: number, newY: number) => {\n const threshold = 1; // Set a threshold for movement\n const { x, y } = clickPosition;\n // Calculate the distance moved\n const distance = Math.sqrt(Math.pow(newX - x, 2) + Math.pow(newY - y, 2));\n // Update the position only if the distance moved is greater than the threshold\n if (distance > threshold) {\n setClickPosition({ x: newX, y: newY });\n }\n };\n\n // Prepare the localization utilities\n const _strings: StringRenderer = React.useMemo(() => {\n const fromString = props.strings?.linkFrom || 'From {0}';\n // NOTE: The `node` parameter is the sankey-generated node on the link, and not the original `node` supplied\n // by the caller.\n return {\n linkFrom: (node: SNode) => format(fromString, node.name),\n };\n }, [props.strings]);\n const _accessibility: AccessibilityRenderer = React.useMemo(() => {\n const linkString = props.accessibility?.linkAriaLabel || 'link from {0} to {1} with weight {2}';\n const nodeString = props.accessibility?.nodeAriaLabel || 'node {0} with weight {1}';\n return {\n emptyAriaLabel: props.accessibility?.emptyAriaLabel || 'Graph has no data to display',\n linkAriaLabel: (link: SLink) =>\n format(\n linkString,\n (link.source as SNode).name,\n (link.target as SNode).name,\n link.unnormalizedValue ? _formatNumber(link.unnormalizedValue) : link.unnormalizedValue,\n ),\n nodeAriaLabel: (node: SNode, weight: number) => format(nodeString, node.name, _formatNumber(weight)),\n };\n }, [_formatNumber, props.accessibility]);\n\n // Compute the position of each node and link\n const { nodes, links, width, height } = React.useMemo(\n () =>\n _normalizeSankeyData(\n props.data.SankeyChartData!,\n containerWidth,\n containerHeight,\n props.colorsForNodes,\n props.borderColorsForNodes,\n ),\n [\n _normalizeSankeyData,\n containerHeight,\n containerWidth,\n props.borderColorsForNodes,\n props.colorsForNodes,\n props.data,\n ],\n );\n // Pre-compute some important attributes about nodes, specifically text\n const nodeAttributes = React.useMemo(\n () => _computeNodeAttributes(nodes, _accessibility.nodeAriaLabel),\n [_accessibility, _computeNodeAttributes, nodes],\n );\n const linkAttributes = React.useMemo(\n () => computeLinkAttributes(links, _strings.linkFrom, _accessibility.linkAriaLabel, _linkId),\n [_accessibility, _linkId, _strings, links],\n );\n\n if (!_isChartEmpty()) {\n // In FocusZone, the focus order is determined by the rendering order of the elements. We need to find\n // a rendering order such that the focus moves through the nodes and links in a logical sequence.\n // Rendering the nodes and links layer by layer in a vertical order seems to be the most effective solution\n // with FocusZone. Although this focus order may not be entirely logical, it ensures that the focus moves\n // sequentially and prevents links (especially skip layer links) from being rendered over the nodes.\n const nodeLinkDomOrderArray: { layer: number; type: string; index: number }[] = [];\n nodes.sort((a: SNode, b: SNode) => {\n if (a.x0 !== b.x0) {\n return a.x0! - b.x0!;\n }\n return a.y0! - b.y0!;\n });\n nodes.forEach((item: SNode, index) => {\n nodeLinkDomOrderArray.push({ layer: item.layer!, type: 'node', index });\n });\n links.sort((a: SLink, b: SLink) => {\n const asx0 = (a.source as SNode).x0;\n const bsx0 = (b.source as SNode).x0;\n if (asx0 !== bsx0) {\n return asx0! - bsx0!;\n }\n return a.y0! - b.y0!;\n });\n links.forEach((item: SLink, index) => {\n nodeLinkDomOrderArray.push({ layer: (item.source as SNode).layer!, type: 'link', index });\n });\n nodeLinkDomOrderArray.sort((a, b) => {\n if (a.layer !== b.layer) {\n return a.layer - b.layer;\n }\n\n if (a.type > b.type) {\n return -1;\n }\n if (a.type < b.type) {\n return 1;\n }\n return 0;\n });\n\n // Build the nodes and links as rendered in the UX.\n const nodeData = _createNodes(nodes, nodeAttributes);\n const linkData = _createLinks(links, linkAttributes);\n\n const calloutProps: ChartPopoverProps = {\n isPopoverOpen: isCalloutVisible,\n clickPosition,\n color,\n XValue: xCalloutValue,\n YValue: yCalloutValue,\n descriptionMessage,\n ...props.calloutProps!,\n };\n return (\n <div className={classes.root} ref={chartContainer} onMouseLeave={_onCloseCallout}>\n {/*\n - Horizontal navigation has been disabled because the nodes and links are rendered vertically,\n causing the left/right arrow keys to move focus up or down to the previous or next sibling element.\n - Bidirectional navigation has been disabled because it causes the up/down arrow keys to move the focus\n in a non-sequential and erratic manner within a 2D grid.\n */}\n <div className={classes.chartWrapper} {..._arrowNavigationAttributes}>\n <svg width={width} height={height} id={_chartId} className={classes.chart}>\n {nodeLinkDomOrderArray.map(item => {\n if (item.type === 'node') {\n return (\n <g key={nodes[item.index].nodeId} className={classes.nodes}>\n {nodeData![item.index]}\n </g>\n );\n } else {\n return (\n <g\n key={`${(links[item.index].source as SNode).nodeId}-${(links[item.index].target as SNode).nodeId}`}\n className={classes.links}\n stroke={props.pathColor ? props.pathColor : tokens.colorStrokeFocus2}\n strokeOpacity={1}\n >\n {linkData![item.index]}\n </g>\n );\n }\n })}\n </svg>\n </div>\n {calloutProps.isPopoverOpen && <ChartPopover {...calloutProps} />}\n <div id={_labelTooltipId} className={classes.toolTip} style={{ opacity: 0 }} ref={_tooltip} />\n </div>\n );\n }\n return <div id={_emptyChartId} role={'alert'} style={{ opacity: '0' }} aria-label={_accessibility.emptyAriaLabel} />;\n});\n\nSankeyChart.displayName = 'SankeyChart';\n"],"names":["React","useFluent_unstable","useFluent","tokens","useId","sum","d3Sum","sankey","d3Sankey","sankeyJustify","sankeyRight","select","selectAll","area","d3Area","curveBumpX","d3CurveBasis","useSankeyChartStyles","ChartPopover","useArrowNavigationGroup","format","useImageExport","PADDING_PERCENTAGE","NON_SELECTED_NODE_AND_STREAM_COLOR","DEFAULT_NODE_COLORS","fillColor","borderColor","MIN_HEIGHT_FOR_DOUBLINE_TYPE","MIN_HEIGHT_FOR_TYPE","REST_STREAM_OPACITY","NON_SELECTED_OPACITY","SELECTED_STREAM_OPACITY","NON_SELECTED_STREAM_BORDER_OPACITY","DEFAULT_TEXT_COLOR","NON_SELECTED_TEXT_COLOR","NODE_WIDTH","getSelectedNodes","selectedLinks","nodes","forEach","link","push","target","indexOf","source","getSelectedLinks","singleNode","q","Array","finalLinks","Set","sourceLinks","add","length","poppedLink","shift","node","targetLinks","getSelectedLinksforStreamHover","singleLink","finalNodes","poppedNode","selectedNodes","groupNodesByColumn","graph","nodesInColumn","columnId","layer","adjustOnePercentHeightNodes","computedNodes","originalLinks","totalColumnValue","Object","values","map","column","value","columnValue","index","totalPercentage","onePercent","columnNodes","nodeId","nodePercentage","actualValue","scalingRatio","normalized","changeColumnValue","originalNodeValue","normalizedNodeValue","linkValues","updateLinkValue","linkValue","unnormalizedValue","linkRatio","Math","max","populateNodeActualValue","data","links","adjustPadding","height","padding","nodePadding","minPadding","totalPaddingInColumn","y1","y0","min","idFromNumberOrSNode","duplicateData","valuesOfNodes","result","valuesOfLinks","sourceId","sourceToTarget","preRenderLayout","margins","containerWidth","containerHeight","isRtl","left","right","top","bottom","nodeWidth","extent","nodeAlign","width","elipsis","assignNodeColors","colorsForNodes","borderColorsForNodes","colors","borders","color","currentIndex","truncateText","tspan","text","rectangleWidth","textLengthForNodeName","fitsWithinNode","elipsisLength","computeElipsisLength","line","i","currentNode","w","getComputedTextLength","slice","measurement","measureText","undefined","computeLinkAttributes","linkFrom","linkAriaLabel","linkId","reactId","from","aria","linkToDataPoints","d","halfWidth","x","x1","x0","linkArea","p","curve","nodeTextColor","state","selectedState","has","selectedNode","SankeyChart","forwardRef","props","forwardedRef","classes","chartContainerRef","chartContainer","componentRef","_reqID","useRef","_linkId","_chartId","_emptyChartId","_labelTooltipId","_margins","targetDocument","dir","_window","defaultView","_isRtl","_numColumns","_nodeBarId","_nodeGElementId","_arrowNavigationAttributes","axis","_tooltip","setContainerHeight","useState","setContainerWidth","setSelectedState","setSelectedLinks","setSelectedNodes","isCalloutVisible","setCalloutVisible","setSelectedNode","setColor","xCalloutValue","setXCalloutValue","yCalloutValue","setYCalloutValue","descriptionMessage","setDescriptionMessage","clickPosition","setClickPosition","y","_fitParentContainer","useCallback","current","requestAnimationFrame","container","parentRef","currentContainerWidth","reflowProps","mode","getBoundingClientRect","_calculateChartMinWidth","currentContainerHeight","useEffect","cancelAnimationFrame","shouldResize","_formatNumber","formatNumberOptions","toLocaleString","culture","toString","_computeNodeAttributes","nodeAriaLabel","weightSpan","append","attr","nameSpan","textLengthForNodeWeight","nodeValue","truncatedname","name","isTruncated","gElementId","trimmed","weightOffset","remove","_linkCalloutAttributes","_isChartEmpty","sankeyChartData","SankeyChartData","_normalizeSankeyData","_containerWidth","_containerHeight","transformed","keys","nodeValues","_createLinks","dataLinks","linkAttributes","onMouseOut","_onStreamLeave","dataPoints","key","gradientId","gradientUrl","g","defs","linearGradient","id","x2","y2","stop","offset","stopColor","path","fill","_fillStreamColors","stroke","_fillStreamBorder","strokeWidth","strokeOpacity","_getOpacityStreamBorder","onMouseOver","event","_onStreamHover","onFocus","_onFocusLink","onBlur","_onBlur","fillOpacity","_getOpacityStream","tabIndex","aria-label","role","_createNodes","dataNodes","nodeAttributes","textAnchor","_onLeave","truncatedName","tooTall","textColor","rect","_fillNodeColors","e","_onHover","_onCloseCallout","_fillNodeBorder","opacity","className","nodeTextContainer","dy","dx","fontWeight","aria-hidden","fontSize","_showTooltip","_hideTooltip","mouseEvent","persist","_selectedLinks","_selectedNodes","updatePosition","clientX","clientY","focusEvent","boundingRect","currentTarget","checkTrcuncated","evt","style","colorNeutralForeground1","pageX","pageY","html","newX","newY","threshold","distance","sqrt","pow","_strings","useMemo","fromString","strings","_accessibility","linkString","accessibility","nodeString","emptyAriaLabel","weight","nodeLinkDomOrderArray","sort","a","b","item","type","asx0","bsx0","nodeData","linkData","calloutProps","isPopoverOpen","XValue","YValue","div","root","ref","onMouseLeave","chartWrapper","svg","chart","pathColor","colorStrokeFocus2","toolTip","displayName"],"mappings":"AAAA;;;;;;;;;;;;eA0hBa+K;eAAAA;;IA3RG3E,aAAAA;;;sBAhGArC;eAAAA;;mBAoKAqD;eAAAA;;;;iEAjUO,QAAQ;qCACiB,kCAAkC;4BAC3D,wBAAwB;gCACzB,4BAA4B;yBACrB,WAAW;0BACkD,YAAY;6BAC1C,eAAe;yBAChB,WAAW;4CAGjC,gCAAgC;uBACrB,4BAA4B;8BACpC,0BAA0B;wBAC3C,yBAAyB;uBACjB,wBAAwB;AAEvD,MAAM9F,qBAAqB;AAiB3B,MAAMC,qCAA6C;AACnD,MAAMC,sBAAoC;IACxC;QAAEC,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;IAC/C;QAAED,WAAW;QAAWC,aAAa;IAAU;CAChD;AAED,MAAMC,+BAA+B;AACrC,MAAMC,sBAAsB;AAC5B,MAAMC,sBAA8B;AACpC,MAAMC,uBAA+B;AACrC,MAAMC,0BAAkC;AACxC,MAAMC,qCAA6C;A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5K,KAAK,CAACyQ,KAAK9R,KAAK,CAAC,CAAClC,MAAM,CAAWsC,MAAM,CAAC,CAAC,EAAGiB,KAAK,CAACyQ,KAAK9R,KAAK,CAAC,CAACpC,MAAM,CAAWwC,MAAM,EAAE;oBAClG4O,WAAW3I,QAAQhF,KAAK;oBACxB2L,QAAQ7G,MAAM4M,SAAS,GAAG5M,MAAM4M,SAAS,GAAG1X,kBAAAA,CAAO2X,iBAAiB;oBACpE7F,eAAe;mBAEdgF,QAAS,CAACL,KAAK9R,KAAK,CAAC;YAG5B;QACF,MAGHoS,aAAaC,aAAa,IAAA,WAAA,GAAI,OAAA,aAAA,CAACjW,mBAAAA,EAAiBgW,eAAAA,WAAAA,GACjD,OAAA,aAAA,CAACI,OAAAA;YAAIjG,IAAIzF;YAAiBkI,WAAW3I,QAAQ4M,OAAO;YAAE5C,OAAO;gBAAEtB,SAAS;YAAE;YAAG2D,KAAKhL;;IAGxF;IACA,OAAA,WAAA,GAAO,OAAA,aAAA,CAAC8K,OAAAA;QAAIjG,IAAI1F;QAAemH,MAAM;QAASqC,OAAO;YAAEtB,SAAS;QAAI;QAAGhB,cAAYqD,eAAeI,cAAc;;AAClH,GAAG;AAEHvL,YAAYiN,WAAW,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/DataPoint.ts"],"sourcesContent":["import { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\nimport { CurveFactory } from 'd3-shape';\nimport { SankeyLink, SankeyNode } from 'd3-sankey';\n\nexport interface Basestate {\n _width?: number;\n _height?: number;\n activeLegend?: string;\n color?: string;\n dataForHoverCard?: number | string;\n isCalloutVisible: boolean;\n isLegendSelected?: boolean;\n isLegendHovered?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n refSelected?: any;\n YValueHover?: { legend?: string; y?: number | string; color?: string }[];\n hoverYValue?: string | number | null;\n hoverXValue?: string | number | null;\n xCalloutValue?: string;\n yCalloutValue?: string;\n lineColor?: string;\n hoveredLineColor?: string;\n selectedLegend?: string;\n containerWidth?: number;\n containerHeight?: number;\n}\n\nexport interface RefArrayData {\n index?: string;\n refElement?: SVGGElement;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface Margins {\n /**\n * left margin for the chart.\n */\n left?: number;\n /**\n * Right margin for the chart.\n */\n right?: number;\n /**\n * Top margin for the chart.\n */\n top?: number;\n /**\n * Bottom margin for the chart.\n */\n bottom?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface DataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n // NOTE: VerticalStackedBarChart, PieChart\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalStackedBarDataPoint extends Omit<DataPoint, 'x'> {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n * If data type on x is Date, then the data is spaced evenly by d3-scale.\n */\n x: number | string | Date;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number;\n\n /**\n * Total value of a single point bar chart.\n */\n total?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface ChartDataPoint {\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * data the datapoint in the chart\n */\n data?: number;\n\n /**\n * data the datapoint in the chart\n */\n horizontalBarChartdata?: HorizontalDataPoint;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Color for the legend in the chart. If not provided, it will fallback on the default color palette.\n */\n color?: string;\n\n /**\n * placeholder data point\n */\n placeHolder?: boolean;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalBarChartDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * data to render the line along with bars\n */\n lineData?: LineDataInVerticalBarChart;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalBarChartWithAxisDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: number;\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalBarChart {\n y: VerticalBarChartDataPoint['y'];\n yAxisCalloutData?: string | undefined;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartData}\n */\ninterface BaseDataPoint {\n /**\n * Defines the function that is executed on clicking line\n */\n onDataPointClick?: () => void;\n\n /**\n * Callout data for x axis\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n */\n yAxisCalloutData?: string | { [id: string]: number };\n\n /**\n * Whether to hide callout data for the point.\n */\n hideCallout?: boolean;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * X axis Accessibility data for callout\n */\n xAxisCalloutAccessibilityData?: AccessibilityProps;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * text labels of marker points\n */\n text?: string;\n\n /**\n * Per-point marker color (overrides series color when present)\n */\n markerColor?: string;\n}\n\n/**\n * {@docCategory ChartData}\n * ScatterChartDataPoint interface.\n */\nexport interface ScatterChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n\n /**\n * text labels of marker points\n */\n text?: string;\n\n /**\n * Per-point marker color (overrides series color when present)\n */\n markerColor?: string;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartGap {\n /**\n * Starting index of the gap.\n */\n startIndex: number;\n\n /**\n * Ending index of the gap.\n */\n endIndex: number;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface LineChartLineOptions extends SVGProps<SVGPathElement> {\n /**\n * Width of the line/stroke.\n * Overrides the strokeWidth set on ICartesianChartProps level.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width\n */\n strokeWidth?: number | string;\n\n /**\n * Pattern of dashes and gaps.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray\n */\n strokeDasharray?: string | number;\n\n /**\n * Offset on rendering of stroke dash array.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset\n */\n strokeDashoffset?: string | number;\n\n /**\n * Shape at the end of a subpath.\n * Default round.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap\n */\n strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';\n\n /**\n * Width of border around the line. Default no border.\n */\n lineBorderWidth?: string | number;\n\n /**\n * Color of border around the line. Default white.\n */\n lineBorderColor?: string;\n\n /**\n * Defines the type of interpolation used to render the line.\n * @default 'linear'\n */\n curve?: 'linear' | 'natural' | 'step' | 'stepAfter' | 'stepBefore' | CurveFactory;\n\n /**\n * Defines the mode of points to be rendered.\n */\n mode?:\n | 'lines'\n | 'markers'\n | 'text'\n | 'lines+markers'\n | 'text+markers'\n | 'text+lines'\n | 'text+lines+markers'\n | 'none'\n | 'gauge'\n | 'number'\n | 'delta'\n | 'number+delta'\n | 'gauge+number'\n | 'gauge+number+delta'\n | 'gauge+delta'\n | 'markers+text'\n | 'lines+text'\n | 'lines+markers+text';\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: LineChartDataPoint[] | ScatterChartDataPoint[];\n\n /**\n * gaps in the line chart where a line is not drawn\n */\n gaps?: LineChartGap[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Defines the function that is executed on clicking line\n */\n onLineClick?: () => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface ChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Accessibility data for chart title\n */\n chartTitleAccessibilityData?: AccessibilityProps;\n /**\n * data for the points in the chart\n */\n chartData?: ChartDataPoint[];\n\n /**\n * Accessibility data for chart data\n */\n chartDataAccessibilityData?: AccessibilityProps;\n\n /**\n * data for the points in the line chart\n */\n lineChartData?: LineChartPoints[];\n\n /**\n * data for the points in the scatter chart\n */\n scatterChartData?: ScatterChartPoints[];\n\n /**\n * data for the points in the line chart\n */\n SankeyChartData?: SankeyChartData;\n\n /**\n * data for the points in the line chart\n */\n pointOptions?: SVGProps<SVGCircleElement>;\n\n /**\n * data for the dotted line on hovering the point\n */\n pointLineOptions?: SVGProps<SVGLineElement>;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface AccessibilityProps {\n /**\n * Accessibility aria-label\n */\n ariaLabel?: string;\n\n /**\n * Accessibility aria-labelledBy\n */\n ariaLabelledBy?: string;\n\n /**\n * Accessibility aria-describedBy\n */\n ariaDescribedBy?: string;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VSChartDataPoint {\n /**\n * data the datapoint in the chart\n */\n data: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface VerticalStackedChartProps {\n /**\n * data for the points in the chart\n */\n chartData: VSChartDataPoint[];\n\n /**\n * Data for x axis label for multistacked Vertical bar chart\n */\n xAxisPoint: number | string | Date;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given, legend will take\n */\n xAxisCalloutData?: string;\n /**\n * line data to render lines on stacked bar chart\n */\n lineData?: LineDataInVerticalStackedBarChart[];\n /**\n * Accessibility data for Whole stack callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalStackedBarChart {\n y: number | string;\n color: string;\n legend: string;\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n /**\n * Data to show in callout\n */\n data?: number | string;\n yAxisCalloutData?: string;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GVBarChartSeriesPoint {\n /**\n * Text for // need to check use of this\n */\n key: string;\n\n /**\n * Data for bar height of Grouped vertical bar chart\n */\n data: number;\n\n /**\n * Color for the legend in the chart\n */\n color?: string;\n\n /**\n * Legend text in the chart\n */\n legend: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GroupedVerticalBarChartData {\n /**\n * Data for X axis label\n */\n name: string;\n\n /**\n * Data points for Grouped vertical bar chart\n */\n series: GVBarChartSeriesPoint[];\n\n /**\n * Accessibility data for Group Bars Stack Callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\nexport interface GVDataPoint {\n /**\n * This interface used for - While forming datapoints from given prop \"data\" in code\n * datapoints are used for to draw graph\n */\n [key: string]: number | string;\n}\n\nexport interface GVSingleDataPoint {\n /**\n * While forming datapoints from given prop \"data\" in code.\n * These datapoints are used for to draw graph easily.\n */\n [key: string]: GVDataPoint;\n}\n\nexport interface GVForBarChart {\n /**\n * While forming datapoints from given prop \"data\"\n * These datapoints are used for to draw graph.\n */\n [key: string]: GVBarChartSeriesPoint;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutDataPoint {\n legend: string;\n y: number;\n color: string;\n xAxisCalloutData?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n}\n\n/**\n * Used for custom callout data interface. As Area chart callout data will be prepared from given props.data,\n * Those required data passing to onRenderCalloutPerDataPoint and onRenderCalloutPerStack.\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutData {\n x: number | string | Date;\n values: CustomizedCalloutDataPoint[];\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface Chart {\n chartContainer: HTMLElement | null;\n toImage?: (opts?: ImageExportOptions) => Promise<string>;\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface ImageExportOptions {\n width?: number;\n height?: number;\n scale?: number;\n background?: string;\n}\n\nexport interface HeatMapChartDataPoint {\n x: string | Date | number;\n y: string | Date | number;\n value: number;\n /**\n * The value/ text to be rendered in the rectange\n */\n rectText?: string | number;\n /**\n * denomination to show in the callout\n */\n ratio?: [number, number];\n /**\n * description message to the callout\n */\n descriptionMessage?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HeatMapChartData {\n /**\n * name of the legend\n */\n legend: string;\n data: HeatMapChartDataPoint[];\n /**\n * This number will be used to get the color for the legend\n */\n value: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface SankeyChartData {\n nodes: SNode[];\n links: SLink[];\n}\n\ninterface SNodeExtra {\n /**\n * A unique identifier for this node.\n */\n nodeId: number | string;\n /**\n * The display name for this node in the UX.\n */\n name: string;\n color?: string;\n borderColor?: string;\n actualValue?: number;\n layer?: number;\n}\n\ninterface SLinkExtra {\n /**\n * The index within `ISankeyChartData.nodes` of the source node.\n */\n source: number;\n /**\n * The index within `ISankeyChartData.nodes` of the target node.\n */\n target: number;\n /**\n * The weight of this link between the two nodes.\n */\n value: number;\n unnormalizedValue?: number;\n}\n\nexport type SNode = SankeyNode<SNodeExtra, SLinkExtra>;\nexport type SLink = SankeyLink<SNodeExtra, SLinkExtra>;\n\n/**\n * Specifies the ordering options for axis categories in Cartesian charts.\n *\n * - `'default'`: Uses the original order before custom ordering was supported.\n * In some charts, this behaves the same as `'data'`.\n * - `'data'`: Preserves the order of categories as provided in the input data.\n * - `string[]`: Explicitly defines the custom order of categories as an array of category names.\n * - `'category ascending' | 'category descending'`: Orders categories alphanumerically.\n * - `'total ascending' | 'total descending'`: Orders categories by the total of their associated values.\n * - `'min ascending' | 'min descending'`: Orders by the minimum value within each category.\n * - `'max ascending' | 'max descending'`: Orders by the maximum value within each category.\n * - `'sum ascending' | 'sum descending'`: Orders by the sum of values for each category (same as 'total').\n * - `'mean ascending' | 'mean descending'`: Orders by the average of values in each category.\n * - `'median ascending' | 'median descending'`: Orders by the median value of each category.\n *\n * {@docCategory CartesianChart}\n */\nexport type AxisCategoryOrder =\n | 'default'\n | 'data'\n | string[]\n | 'category ascending'\n | 'category descending'\n | 'total ascending'\n | 'total descending'\n | 'min ascending'\n | 'min descending'\n | 'max ascending'\n | 'max descending'\n | 'sum ascending'\n | 'sum descending'\n | 'mean ascending'\n | 'mean descending'\n | 'median ascending'\n | 'median descending';\n\n/**\n * {@docCategory IChartData}\n */\nexport interface GanttChartDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: {\n start: Date | number;\n end: Date | number;\n };\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ScatterChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: ScatterChartDataPoint[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * Available scale types for axes.\n *\n * - `'default'`: Uses an automatic scale (linear, band, or time) based on axis data type.\n * - `'log'`: Uses a logarithmic scale. Only supported for numeric axes in LineChart and ScatterChart.\n *\n * {@docCategory CartesianChart}\n */\nexport type AxisScaleType = 'default' | 'log';\n\n/**\n * Configuration options for an axis.\n *\n * {@docCategory CartesianChart}\n */\nexport type AxisProps = {\n /**\n * Defines the step between tick marks on the axis.\n * Works in combination with `tick0`.\n * Must be a positive number.\n *\n * - **Log scale**:\n * - Ticks are placed at `10^(n * tickStep)` where `n` is the tick index.\n * - Example: `tickStep = 2` → ticks at 1, 100, 10,000...\n * - Example: `tickStep = log10(5)` → ticks at 1, 5, 25, 125...\n * - Special format `\"L<f>\"`: Creates ticks that are linearly spaced in value (not position).\n * - Example: `tick0 = 0.1`, `tickStep = \"L0.5\"` → ticks at 0.1, 0.6, 1.1, 1.6...\n *\n * - **Date axis**:\n * - Must be in milliseconds.\n * - Example: one day = `tickStep = 86400000`.\n * - Special format `\"M<n>\"`: Places ticks every `n` months.\n * - Example: `tick0 = \"2000-01-15\"`, `tickStep = \"M3\"` → ticks on the 15th every third month.\n * - Example: `tickStep = \"M48\"` → ticks every 4 years.\n */\n tickStep?: number | string;\n\n /**\n * Sets the reference value for axis ticks.\n * Works in combination with `tickStep`.\n *\n * - **Log scale**:\n * - `tick0` must be given as the logarithm of the reference tick.\n * - Example: to align ticks with 100, use `tick0 = 2`.\n * - Exception: when `tickStep` uses `\"L<f>\"`, you can specify the raw value directly.\n */\n tick0?: number | Date;\n\n /**\n * Sets the text displayed at each tick position specified by `tickValues`. Used with `tickValues`.\n */\n tickText?: string[];\n};\n\n/**\n * Represents a single data point in a series.\n */\nexport interface DataPointV2<X extends string | number | Date, Y extends string | number | Date> {\n /**\n * X-axis value of the data point.\n */\n x: X;\n\n /**\n * Y-axis value of the data point.\n */\n y: Y;\n\n /**\n * Optional click handler for the data point.\n */\n onClick?: () => void;\n\n /**\n * Custom text to show in the callout in place of the x-axis value.\n */\n xAxisCalloutData?: string;\n\n /**\n * Custom text to show in the callout in place of the y-axis value.\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility properties for the data point.\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * Custom marker size for the data point.\n */\n markerSize?: number;\n\n /**\n * Optional text to annotate or label the data point.\n */\n text?: string;\n\n /**\n * Color of the data point. If not provided, it will inherit the series color.\n */\n color?: string;\n}\n\n/**\n * Base interface for a series.\n */\nexport interface DataSeries {\n /**\n * Name of the series to be displayed in the legend.\n */\n legend: string;\n\n /**\n * Shape used in the legend (e.g., circle, square).\n */\n legendShape?: LegendShape;\n\n /**\n * Color of the series.\n */\n color?: string;\n\n /**\n * Opacity of the series.\n */\n opacity?: number;\n\n /**\n * Gradient fill for the series (start and end colors).\n */\n gradient?: [string, string];\n\n /**\n * Whether this series should be plotted against a secondary Y-axis.\n */\n useSecondaryYScale?: boolean;\n\n /**\n * Callback invoked when the legend item is clicked.\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n}\n\n/**\n * Represents a bar series.\n */\nexport interface BarSeries<X extends string | number | Date, Y extends string | number | Date> extends DataSeries {\n /**\n * Type discriminator: always 'bar' for this series.\n */\n type: 'bar';\n\n /**\n * Array of data points for the series.\n */\n data: DataPointV2<X, Y>[];\n\n /**\n * Optional group identifier for the series.\n */\n key?: string;\n}\n\n/**\n * Represents a line series.\n */\nexport interface LineSeries<X extends string | number | Date, Y extends string | number | Date> extends DataSeries {\n /**\n * Type discriminator: always 'line' for this series.\n */\n type: 'line';\n\n /**\n * Array of data points for the series.\n */\n data: DataPointV2<X, Y>[];\n\n /**\n * Optional gaps to render in the line.\n */\n gaps?: LineChartGap[];\n\n /**\n * Additional line rendering options (e.g., stroke width, curve type).\n */\n lineOptions?: LineChartLineOptions;\n\n /**\n * If true, hides dots for inactive (unfocused/unhovered) data points.\n */\n hideInactiveDots?: boolean;\n\n /**\n * Callback invoked when the line itself is clicked.\n */\n onLineClick?: () => void;\n}\n"],"names":[],"mappings":"AAisCA;;CAEC,GACD,WA8BC"}
1
+ {"version":3,"sources":["../src/types/DataPoint.ts"],"sourcesContent":["import { SVGProps } from 'react';\nimport { LegendShape } from '../components/Legends/Legends.types';\nimport { CurveFactory } from 'd3-shape';\nimport { SankeyLink, SankeyNode } from 'd3-sankey';\n\nexport interface Basestate {\n _width?: number;\n _height?: number;\n activeLegend?: string;\n color?: string;\n dataForHoverCard?: number | string;\n isCalloutVisible: boolean;\n isLegendSelected?: boolean;\n isLegendHovered?: boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n refSelected?: any;\n YValueHover?: { legend?: string; y?: number | string; color?: string }[];\n hoverYValue?: string | number | null;\n hoverXValue?: string | number | null;\n xCalloutValue?: string;\n yCalloutValue?: string;\n lineColor?: string;\n hoveredLineColor?: string;\n selectedLegend?: string;\n containerWidth?: number;\n containerHeight?: number;\n}\n\nexport interface RefArrayData {\n index?: string;\n refElement?: SVGGElement;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface Margins {\n /**\n * left margin for the chart.\n */\n left?: number;\n /**\n * Right margin for the chart.\n */\n right?: number;\n /**\n * Top margin for the chart.\n */\n top?: number;\n /**\n * Bottom margin for the chart.\n */\n bottom?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface DataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n // NOTE: VerticalStackedBarChart, PieChart\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalStackedBarDataPoint extends Omit<DataPoint, 'x'> {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n * If data type on x is Date, then the data is spaced evenly by d3-scale.\n */\n x: number | string | Date;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number;\n\n /**\n * Total value of a single point bar chart.\n */\n total?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface ChartDataPoint {\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * data the datapoint in the chart\n */\n data?: number;\n\n /**\n * data the datapoint in the chart\n */\n horizontalBarChartdata?: HorizontalDataPoint;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Color for the legend in the chart. If not provided, it will fallback on the default color palette.\n */\n color?: string;\n\n /**\n * placeholder data point\n */\n placeHolder?: boolean;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VerticalBarChartDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n * If x is a number, then each y-coordinate is plotted at its x-coordinate.\n * If x is a string, then the data is evenly spaced along the x-axis.\n */\n x: number | string | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * data to render the line along with bars\n */\n lineData?: LineDataInVerticalBarChart;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HorizontalBarChartWithAxisDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: number;\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalBarChart {\n y: VerticalBarChartDataPoint['y'];\n yAxisCalloutData?: string | undefined;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartData}\n */\ninterface BaseDataPoint {\n /**\n * Defines the function that is executed on clicking line\n */\n onDataPointClick?: () => void;\n\n /**\n * Callout data for x axis\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n */\n yAxisCalloutData?: string | { [id: string]: number };\n\n /**\n * Whether to hide callout data for the point.\n */\n hideCallout?: boolean;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * X axis Accessibility data for callout\n */\n xAxisCalloutAccessibilityData?: AccessibilityProps;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * text labels of marker points\n */\n text?: string;\n\n /**\n * Per-point marker color (overrides series color when present)\n */\n markerColor?: string;\n}\n\n/**\n * {@docCategory ChartData}\n * ScatterChartDataPoint interface.\n */\nexport interface ScatterChartDataPoint extends BaseDataPoint {\n /**\n * Independent value of the data point, rendered along the x-axis.\n */\n x: number | Date | string;\n\n /**\n * Dependent value of the data point, rendered along the y-axis.\n */\n y: number;\n\n /**\n * Marker size of the points\n */\n markerSize?: number;\n\n /**\n * text labels of marker points\n */\n text?: string;\n\n /**\n * Per-point marker color (overrides series color when present)\n */\n markerColor?: string;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartGap {\n /**\n * Starting index of the gap.\n */\n startIndex: number;\n\n /**\n * Ending index of the gap.\n */\n endIndex: number;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface LineChartLineOptions extends SVGProps<SVGPathElement> {\n /**\n * Width of the line/stroke.\n * Overrides the strokeWidth set on ICartesianChartProps level.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-width\n */\n strokeWidth?: number | string;\n\n /**\n * Pattern of dashes and gaps.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray\n */\n strokeDasharray?: string | number;\n\n /**\n * Offset on rendering of stroke dash array.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dashoffset\n */\n strokeDashoffset?: string | number;\n\n /**\n * Shape at the end of a subpath.\n * Default round.\n * @see https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap\n */\n strokeLinecap?: 'butt' | 'round' | 'square' | 'inherit';\n\n /**\n * Width of border around the line. Default no border.\n */\n lineBorderWidth?: string | number;\n\n /**\n * Color of border around the line. Default white.\n */\n lineBorderColor?: string;\n\n /**\n * Defines the type of interpolation used to render the line.\n * @default 'linear'\n */\n curve?: 'linear' | 'natural' | 'step' | 'stepAfter' | 'stepBefore' | CurveFactory;\n\n /**\n * Defines the mode of points to be rendered.\n */\n mode?:\n | 'lines'\n | 'markers'\n | 'text'\n | 'lines+markers'\n | 'text+markers'\n | 'text+lines'\n | 'text+lines+markers'\n | 'none'\n | 'gauge'\n | 'number'\n | 'delta'\n | 'number+delta'\n | 'gauge+number'\n | 'gauge+number+delta'\n | 'gauge+delta'\n | 'markers+text'\n | 'lines+text'\n | 'lines+markers+text';\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: LineChartDataPoint[] | ScatterChartDataPoint[];\n\n /**\n * gaps in the line chart where a line is not drawn\n */\n gaps?: LineChartGap[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Defines the function that is executed on clicking line\n */\n onLineClick?: () => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface ChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n\n /**\n * Accessibility data for chart title\n */\n chartTitleAccessibilityData?: AccessibilityProps;\n /**\n * data for the points in the chart\n */\n chartData?: ChartDataPoint[];\n\n /**\n * Accessibility data for chart data\n */\n chartDataAccessibilityData?: AccessibilityProps;\n\n /**\n * data for the points in the line chart\n */\n lineChartData?: LineChartPoints[];\n\n /**\n * data for the points in the scatter chart\n */\n scatterChartData?: ScatterChartPoints[];\n\n /**\n * data for the points in the line chart\n */\n SankeyChartData?: SankeyChartData;\n\n /**\n * data for the points in the line chart\n */\n pointOptions?: SVGProps<SVGCircleElement>;\n\n /**\n * data for the dotted line on hovering the point\n */\n pointLineOptions?: SVGProps<SVGLineElement>;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface AccessibilityProps {\n /**\n * Accessibility aria-label\n */\n ariaLabel?: string;\n\n /**\n * Accessibility aria-labelledBy\n */\n ariaLabelledBy?: string;\n\n /**\n * Accessibility aria-describedBy\n */\n ariaDescribedBy?: string;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface VSChartDataPoint {\n /**\n * data the datapoint in the chart\n */\n data: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n}\n\n/**\n * {@docCategory ChartProps}\n */\nexport interface VerticalStackedChartProps {\n /**\n * data for the points in the chart\n */\n chartData: VSChartDataPoint[];\n\n /**\n * Data for x axis label for multistacked Vertical bar chart\n */\n xAxisPoint: number | string | Date;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given, legend will take\n */\n xAxisCalloutData?: string;\n /**\n * line data to render lines on stacked bar chart\n */\n lineData?: LineDataInVerticalStackedBarChart[];\n /**\n * Accessibility data for Whole stack callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface LineDataInVerticalStackedBarChart {\n y: number | string;\n color: string;\n legend: string;\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n /**\n * Data to show in callout\n */\n data?: number | string;\n yAxisCalloutData?: string;\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n /**\n * options for the line drawn\n */\n lineOptions?: LineChartLineOptions;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GVBarChartSeriesPoint {\n /**\n * Text for // need to check use of this\n */\n key: string;\n\n /**\n * Data for bar height of Grouped vertical bar chart\n */\n data: number;\n\n /**\n * Color for the legend in the chart\n */\n color?: string;\n\n /**\n * Legend text in the chart\n */\n legend: string;\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface GroupedVerticalBarChartData {\n /**\n * Data for X axis label\n */\n name: string;\n\n /**\n * Data points for Grouped vertical bar chart\n */\n series: GVBarChartSeriesPoint[];\n\n /**\n * Accessibility data for Group Bars Stack Callout\n */\n stackCallOutAccessibilityData?: AccessibilityProps;\n}\n\nexport interface GVDataPoint {\n /**\n * This interface used for - While forming datapoints from given prop \"data\" in code\n * datapoints are used for to draw graph\n */\n [key: string]: number | string;\n}\n\nexport interface GVSingleDataPoint {\n /**\n * While forming datapoints from given prop \"data\" in code.\n * These datapoints are used for to draw graph easily.\n */\n [key: string]: GVDataPoint;\n}\n\nexport interface GVForBarChart {\n /**\n * While forming datapoints from given prop \"data\"\n * These datapoints are used for to draw graph.\n */\n [key: string]: GVBarChartSeriesPoint;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutDataPoint {\n legend: string;\n y: number;\n color: string;\n xAxisCalloutData?: string;\n yAxisCalloutData?: string | { [id: string]: number };\n}\n\n/**\n * Used for custom callout data interface. As Area chart callout data will be prepared from given props.data,\n * Those required data passing to onRenderCalloutPerDataPoint and onRenderCalloutPerStack.\n * {@docCategory ChartData}\n */\nexport interface CustomizedCalloutData {\n x: number | string | Date;\n values: CustomizedCalloutDataPoint[];\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface Chart {\n chartContainer: HTMLElement | null;\n toImage?: (opts?: ImageExportOptions) => Promise<string>;\n}\n\n/**\n * {@docCategory Chart}\n */\nexport interface ImageExportOptions {\n width?: number;\n height?: number;\n scale?: number;\n background?: string;\n}\n\nexport interface HeatMapChartDataPoint {\n x: string | Date | number;\n y: string | Date | number;\n value: number;\n /**\n * The value/ text to be rendered in the rectange\n */\n rectText?: string | number;\n /**\n * denomination to show in the callout\n */\n ratio?: [number, number];\n /**\n * description message to the callout\n */\n descriptionMessage?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface HeatMapChartData {\n /**\n * name of the legend\n */\n legend: string;\n data: HeatMapChartDataPoint[];\n /**\n * This number will be used to get the color for the legend\n */\n value: number;\n}\n\n/**\n * {@docCategory ChartData}\n */\nexport interface SankeyChartData {\n nodes: SNode[];\n links: SLink[];\n}\n\ninterface SNodeExtra {\n /**\n * A unique identifier for this node.\n */\n nodeId: number | string;\n /**\n * The display name for this node in the UX.\n */\n name: string;\n color?: string;\n borderColor?: string;\n actualValue?: number;\n layer?: number;\n}\n\ninterface SLinkExtra {\n /**\n * The index within `ISankeyChartData.nodes` of the source node.\n */\n source: number;\n /**\n * The index within `ISankeyChartData.nodes` of the target node.\n */\n target: number;\n /**\n * The weight of this link between the two nodes.\n */\n value: number;\n unnormalizedValue?: number;\n color?: string;\n}\n\nexport type SNode = SankeyNode<SNodeExtra, SLinkExtra>;\nexport type SLink = SankeyLink<SNodeExtra, SLinkExtra>;\n\n/**\n * Specifies the ordering options for axis categories in Cartesian charts.\n *\n * - `'default'`: Uses the original order before custom ordering was supported.\n * In some charts, this behaves the same as `'data'`.\n * - `'data'`: Preserves the order of categories as provided in the input data.\n * - `string[]`: Explicitly defines the custom order of categories as an array of category names.\n * - `'category ascending' | 'category descending'`: Orders categories alphanumerically.\n * - `'total ascending' | 'total descending'`: Orders categories by the total of their associated values.\n * - `'min ascending' | 'min descending'`: Orders by the minimum value within each category.\n * - `'max ascending' | 'max descending'`: Orders by the maximum value within each category.\n * - `'sum ascending' | 'sum descending'`: Orders by the sum of values for each category (same as 'total').\n * - `'mean ascending' | 'mean descending'`: Orders by the average of values in each category.\n * - `'median ascending' | 'median descending'`: Orders by the median value of each category.\n *\n * {@docCategory CartesianChart}\n */\nexport type AxisCategoryOrder =\n | 'default'\n | 'data'\n | string[]\n | 'category ascending'\n | 'category descending'\n | 'total ascending'\n | 'total descending'\n | 'min ascending'\n | 'min descending'\n | 'max ascending'\n | 'max descending'\n | 'sum ascending'\n | 'sum descending'\n | 'mean ascending'\n | 'mean descending'\n | 'median ascending'\n | 'median descending';\n\n/**\n * {@docCategory IChartData}\n */\nexport interface GanttChartDataPoint {\n /**\n * Dependent value of the data point, rendered along the x-axis.\n */\n x: {\n start: Date | number;\n end: Date | number;\n };\n\n /**\n * Independent value of the data point, rendered along the y-axis.\n * If y is a number, then each y-coordinate is plotted at its y-coordinate.\n * If y is a string, then the data is evenly spaced along the y-axis.\n */\n y: number | string;\n\n /**\n * Legend text for the datapoint in the chart\n */\n legend?: string;\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * Gradient for the legend in the chart. If not provided, it will fallback on the default color palette.\n * If provided, it will override the color prop. granted `enableGradient` is set to true for the chart.\n */\n gradient?: [string, string];\n\n /**\n * Callout data for x axis\n * This is an optional prop, If haven't given legend will take\n */\n xAxisCalloutData?: string;\n\n /**\n * Callout data for y axis\n * This is an optional prop, If haven't given data will take\n */\n yAxisCalloutData?: string;\n\n /**\n * onClick action for each datapoint in the chart\n */\n onClick?: VoidFunction;\n\n /**\n * Accessibility data for callout\n */\n callOutAccessibilityData?: AccessibilityProps;\n}\n\n/**\n * {@docCategory IChartData}\n */\nexport interface ScatterChartPoints {\n /**\n * Legend text for the datapoint in the chart\n */\n legend: string;\n\n /**\n * The shape for the legend\n * default: show the rect legend\n */\n legendShape?: LegendShape;\n\n /**\n * dataPoints for the line chart\n */\n data: ScatterChartDataPoint[];\n\n /**\n * color for the legend in the chart\n */\n color?: string;\n\n /**\n * opacity for chart fill color\n */\n opacity?: number;\n\n /**\n * hide dots for points that are not active\n */\n hideNonActiveDots?: boolean;\n\n /**\n * Defines the function that is executed on clicking this legend\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n\n /**\n * Whether to use the secondary y scale or not\n * False by default.\n */\n useSecondaryYScale?: boolean;\n}\n\n/**\n * Available scale types for axes.\n *\n * - `'default'`: Uses an automatic scale (linear, band, or time) based on axis data type.\n * - `'log'`: Uses a logarithmic scale. Only supported for numeric axes in LineChart and ScatterChart.\n *\n * {@docCategory CartesianChart}\n */\nexport type AxisScaleType = 'default' | 'log';\n\n/**\n * Configuration options for an axis.\n *\n * {@docCategory CartesianChart}\n */\nexport type AxisProps = {\n /**\n * Defines the step between tick marks on the axis.\n * Works in combination with `tick0`.\n * Must be a positive number.\n *\n * - **Log scale**:\n * - Ticks are placed at `10^(n * tickStep)` where `n` is the tick index.\n * - Example: `tickStep = 2` → ticks at 1, 100, 10,000...\n * - Example: `tickStep = log10(5)` → ticks at 1, 5, 25, 125...\n * - Special format `\"L<f>\"`: Creates ticks that are linearly spaced in value (not position).\n * - Example: `tick0 = 0.1`, `tickStep = \"L0.5\"` → ticks at 0.1, 0.6, 1.1, 1.6...\n *\n * - **Date axis**:\n * - Must be in milliseconds.\n * - Example: one day = `tickStep = 86400000`.\n * - Special format `\"M<n>\"`: Places ticks every `n` months.\n * - Example: `tick0 = \"2000-01-15\"`, `tickStep = \"M3\"` → ticks on the 15th every third month.\n * - Example: `tickStep = \"M48\"` → ticks every 4 years.\n */\n tickStep?: number | string;\n\n /**\n * Sets the reference value for axis ticks.\n * Works in combination with `tickStep`.\n *\n * - **Log scale**:\n * - `tick0` must be given as the logarithm of the reference tick.\n * - Example: to align ticks with 100, use `tick0 = 2`.\n * - Exception: when `tickStep` uses `\"L<f>\"`, you can specify the raw value directly.\n */\n tick0?: number | Date;\n\n /**\n * Sets the text displayed at each tick position specified by `tickValues`. Used with `tickValues`.\n */\n tickText?: string[];\n};\n\n/**\n * Represents a single data point in a series.\n */\nexport interface DataPointV2<X extends string | number | Date, Y extends string | number | Date> {\n /**\n * X-axis value of the data point.\n */\n x: X;\n\n /**\n * Y-axis value of the data point.\n */\n y: Y;\n\n /**\n * Optional click handler for the data point.\n */\n onClick?: () => void;\n\n /**\n * Custom text to show in the callout in place of the x-axis value.\n */\n xAxisCalloutData?: string;\n\n /**\n * Custom text to show in the callout in place of the y-axis value.\n */\n yAxisCalloutData?: string;\n\n /**\n * Accessibility properties for the data point.\n */\n callOutAccessibilityData?: AccessibilityProps;\n\n /**\n * Custom marker size for the data point.\n */\n markerSize?: number;\n\n /**\n * Optional text to annotate or label the data point.\n */\n text?: string;\n\n /**\n * Color of the data point. If not provided, it will inherit the series color.\n */\n color?: string;\n}\n\n/**\n * Base interface for a series.\n */\nexport interface DataSeries {\n /**\n * Name of the series to be displayed in the legend.\n */\n legend: string;\n\n /**\n * Shape used in the legend (e.g., circle, square).\n */\n legendShape?: LegendShape;\n\n /**\n * Color of the series.\n */\n color?: string;\n\n /**\n * Opacity of the series.\n */\n opacity?: number;\n\n /**\n * Gradient fill for the series (start and end colors).\n */\n gradient?: [string, string];\n\n /**\n * Whether this series should be plotted against a secondary Y-axis.\n */\n useSecondaryYScale?: boolean;\n\n /**\n * Callback invoked when the legend item is clicked.\n */\n onLegendClick?: (selectedLegend: string | null | string[]) => void;\n}\n\n/**\n * Represents a bar series.\n */\nexport interface BarSeries<X extends string | number | Date, Y extends string | number | Date> extends DataSeries {\n /**\n * Type discriminator: always 'bar' for this series.\n */\n type: 'bar';\n\n /**\n * Array of data points for the series.\n */\n data: DataPointV2<X, Y>[];\n\n /**\n * Optional group identifier for the series.\n */\n key?: string;\n}\n\n/**\n * Represents a line series.\n */\nexport interface LineSeries<X extends string | number | Date, Y extends string | number | Date> extends DataSeries {\n /**\n * Type discriminator: always 'line' for this series.\n */\n type: 'line';\n\n /**\n * Array of data points for the series.\n */\n data: DataPointV2<X, Y>[];\n\n /**\n * Optional gaps to render in the line.\n */\n gaps?: LineChartGap[];\n\n /**\n * Additional line rendering options (e.g., stroke width, curve type).\n */\n lineOptions?: LineChartLineOptions;\n\n /**\n * If true, hides dots for inactive (unfocused/unhovered) data points.\n */\n hideInactiveDots?: boolean;\n\n /**\n * Callback invoked when the line itself is clicked.\n */\n onLineClick?: () => void;\n}\n"],"names":[],"mappings":"AAksCA;;CAEC,GACD,WA8BC"}