@fluentui/react-charting 5.23.39 → 5.23.41

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 (57) hide show
  1. package/CHANGELOG.json +55 -1
  2. package/CHANGELOG.md +24 -2
  3. package/dist/react-charting.d.ts +15 -0
  4. package/dist/react-charting.js +1 -1
  5. package/dist/react-charting.min.js +1 -1
  6. package/etc/react-charting.api.md +3 -0
  7. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js +3 -0
  8. package/lib/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  9. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +19 -5
  10. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  11. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +5 -0
  12. package/lib/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  13. package/lib/components/SankeyChart/SankeyChart.base.js +1 -1
  14. package/lib/components/SankeyChart/SankeyChart.base.js.map +1 -1
  15. package/lib/components/VerticalBarChart/VerticalBarChart.base.js +15 -3
  16. package/lib/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  17. package/lib/components/VerticalBarChart/VerticalBarChart.types.d.ts +5 -0
  18. package/lib/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  19. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +15 -3
  20. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  21. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +5 -0
  22. package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  23. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js +3 -0
  24. package/lib-amd/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  25. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +18 -4
  26. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  27. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +5 -0
  28. package/lib-amd/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  29. package/lib-amd/components/SankeyChart/SankeyChart.base.js +1 -1
  30. package/lib-amd/components/SankeyChart/SankeyChart.base.js.map +1 -1
  31. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js +14 -2
  32. package/lib-amd/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  33. package/lib-amd/components/VerticalBarChart/VerticalBarChart.types.d.ts +5 -0
  34. package/lib-amd/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  35. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +14 -2
  36. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  37. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +5 -0
  38. package/lib-amd/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  39. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js +3 -0
  40. package/lib-commonjs/components/DeclarativeChart/PlotlySchemaAdapter.js.map +1 -1
  41. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js +18 -4
  42. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.base.js.map +1 -1
  43. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.d.ts +5 -0
  44. package/lib-commonjs/components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.js.map +1 -1
  45. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js +1 -1
  46. package/lib-commonjs/components/SankeyChart/SankeyChart.base.js.map +1 -1
  47. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js +14 -2
  48. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.base.js.map +1 -1
  49. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.d.ts +5 -0
  50. package/lib-commonjs/components/VerticalBarChart/VerticalBarChart.types.js.map +1 -1
  51. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js +14 -2
  52. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.base.js.map +1 -1
  53. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.d.ts +5 -0
  54. package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.types.js.map +1 -1
  55. package/package.json +3 -3
  56. package/src/components/VerticalBarChart/VerticalBarChart.types.ts +6 -0
  57. package/src/components/VerticalStackedBarChart/VerticalStackedBarChart.types.ts +6 -0
@@ -1 +1 @@
1
- {"version":3,"file":"GroupedVerticalBarChart.types.js","sourceRoot":"../src/","sources":["components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.tsx"],"names":[],"mappings":"","sourcesContent":["import { IStyle } from '@fluentui/react/lib/Styling';\nimport { IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport {\n ICartesianChartStyles,\n ICartesianChartStyleProps,\n ICartesianChartProps,\n IGroupedVerticalBarChartData,\n IGVBarChartSeriesPoint,\n} from '../../index';\n\n/**\n * Grouped Vertical Bar Chart properties\n * {@docCategory GroupedVerticalBarChart}\n */\nexport interface IGroupedVerticalBarChartProps extends ICartesianChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n /**\n * Data to render in the chart.\n */\n data: IGroupedVerticalBarChartData[];\n\n /**\n * Width of each bar in the chart. When set to `undefined` or `'default'`, the bar width defaults to 16px,\n * which may decrease to prevent overlap. When set to `'auto'`, the bar width is calculated from padding values.\n * @default 16\n */\n barwidth?: number | 'default' | 'auto';\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IGroupedVerticalBarChartStyleProps, IGroupedVerticalBarChartStyles>;\n\n /**\n * color of the datapoint legend\n * @deprecated Dont use this property. colour will pick from given data\n */\n legendColor?: string;\n\n /**\n * This prop used to draw X axis grid line on tha chart. Default value will be false\n * @deprecated Dont use this property. Handling with default value.\n */\n showXAxisGridLines?: boolean;\n\n /**\n * This prop used to draw Y axis grid lines on the chart. Default value will be true\n * @deprecated Dont use this property. Lines are drawn by default\n */\n showYAxisGridLines?: boolean;\n\n /**\n * This prop takes the boolean value and used for to display x-axis path or transparent.\n * This is a optional prop and default value is false. It dont show X-Axis path as tranparent.\n * @deprecated Dont use this property. Axis line are removed by default\n */\n showXAxisPath?: boolean;\n\n /**\n * This prop takes the boolean value and used for to display y-axis path or transparent.\n * This is a optional prop and default value is false. It dont show Y-Axis path as tranparent.\n * @deprecated Dont use this property. No need to display Y axis path. Handling default\n */\n showYAxisPath?: boolean;\n\n /**\n * Define a custom callout renderer for a stack\n */\n onRenderCalloutPerDataPoint?: IRenderFunction<IGVBarChartSeriesPoint>;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * To display multi stack callout or single callout\n * @default false\n */\n isCalloutForStack?: boolean;\n\n /**\n * Prop to hide the bar labels\n * @default false\n */\n hideLabels?: boolean;\n\n /**\n * Maximum width of a bar, in pixels.\n * @default 24\n */\n maxBarWidth?: number;\n\n /**\n * Padding between groups as a fraction of the [step](https://d3js.org/d3-scale/band#band_step).\n * Takes a number in the range [0, 1]. Only applicable to string x-axis.\n * Note: groupWidthInTermsOfBarWidth is calculated at runtime based on\n * the number of bars in a group and the gap between the bars.\n * @default 2 / (2 + groupWidthInTermsOfBarWidth)\n */\n xAxisInnerPadding?: number;\n\n /**\n * Padding before the first group and after the last group as a fraction of\n * the [step](https://d3js.org/d3-scale/band#band_step). Takes a number in the range [0, 1].\n * Only applicable to string x-axis.\n */\n xAxisOuterPadding?: number;\n\n /**\n * @default false\n * The prop used to enable gradient fill color for the chart.\n */\n enableGradient?: boolean;\n\n /**\n * @default false\n * The prop used to enable rounded corners for the chart.\n */\n roundCorners?: boolean;\n}\n\n/**\n * Grouped Vertical Bar Chart style properties\n * {@docCategory GroupedVerticalBarChart}\n */\nexport interface IGroupedVerticalBarChartStyleProps extends ICartesianChartStyleProps {}\n\n/**\n * Grouped Vertical Bar Chart styles\n * {@docCategory GroupedVerticalBarChart}\n */\nexport interface IGroupedVerticalBarChartStyles extends ICartesianChartStyles {\n /**\n * Style to change the opacity of bars in dataviz when we hover on a single bar or legends\n */\n opacityChangeOnHover: IStyle;\n\n /**\n * Style for the bar labels\n */\n barLabel: IStyle;\n}\n"]}
1
+ {"version":3,"file":"GroupedVerticalBarChart.types.js","sourceRoot":"../src/","sources":["components/GroupedVerticalBarChart/GroupedVerticalBarChart.types.tsx"],"names":[],"mappings":"","sourcesContent":["import { IStyle } from '@fluentui/react/lib/Styling';\nimport { IRenderFunction, IStyleFunctionOrObject } from '@fluentui/react/lib/Utilities';\nimport {\n ICartesianChartStyles,\n ICartesianChartStyleProps,\n ICartesianChartProps,\n IGroupedVerticalBarChartData,\n IGVBarChartSeriesPoint,\n} from '../../index';\n\n/**\n * Grouped Vertical Bar Chart properties\n * {@docCategory GroupedVerticalBarChart}\n */\nexport interface IGroupedVerticalBarChartProps extends ICartesianChartProps {\n /**\n * chart title for the chart\n */\n chartTitle?: string;\n /**\n * Data to render in the chart.\n */\n data: IGroupedVerticalBarChartData[];\n\n /**\n * Width of each bar in the chart. When set to `undefined` or `'default'`, the bar width defaults to 16px,\n * which may decrease to prevent overlap. When set to `'auto'`, the bar width is calculated from padding values.\n * @default 16\n */\n barwidth?: number | 'default' | 'auto';\n\n /**\n * Call to provide customized styling that will layer on top of the variant rules.\n */\n styles?: IStyleFunctionOrObject<IGroupedVerticalBarChartStyleProps, IGroupedVerticalBarChartStyles>;\n\n /**\n * color of the datapoint legend\n * @deprecated Dont use this property. colour will pick from given data\n */\n legendColor?: string;\n\n /**\n * This prop used to draw X axis grid line on tha chart. Default value will be false\n * @deprecated Dont use this property. Handling with default value.\n */\n showXAxisGridLines?: boolean;\n\n /**\n * This prop used to draw Y axis grid lines on the chart. Default value will be true\n * @deprecated Dont use this property. Lines are drawn by default\n */\n showYAxisGridLines?: boolean;\n\n /**\n * This prop takes the boolean value and used for to display x-axis path or transparent.\n * This is a optional prop and default value is false. It dont show X-Axis path as tranparent.\n * @deprecated Dont use this property. Axis line are removed by default\n */\n showXAxisPath?: boolean;\n\n /**\n * This prop takes the boolean value and used for to display y-axis path or transparent.\n * This is a optional prop and default value is false. It dont show Y-Axis path as tranparent.\n * @deprecated Dont use this property. No need to display Y axis path. Handling default\n */\n showYAxisPath?: boolean;\n\n /**\n * Define a custom callout renderer for a stack\n */\n onRenderCalloutPerDataPoint?: IRenderFunction<IGVBarChartSeriesPoint>;\n\n /**\n * The prop used to define the culture to localized the numbers\n */\n culture?: string;\n\n /**\n * To display multi stack callout or single callout\n * @default false\n */\n isCalloutForStack?: boolean;\n\n /**\n * Prop to hide the bar labels\n * @default false\n */\n hideLabels?: boolean;\n\n /**\n * Maximum width of a bar, in pixels.\n * @default 24\n */\n maxBarWidth?: number;\n\n /**\n * Padding between groups as a fraction of the [step](https://d3js.org/d3-scale/band#band_step).\n * Takes a number in the range [0, 1]. Only applicable to string x-axis.\n * Note: groupWidthInTermsOfBarWidth is calculated at runtime based on\n * the number of bars in a group and the gap between the bars.\n * @default 2 / (2 + groupWidthInTermsOfBarWidth)\n */\n xAxisInnerPadding?: number;\n\n /**\n * Padding before the first group and after the last group as a fraction of\n * the [step](https://d3js.org/d3-scale/band#band_step). Takes a number in the range [0, 1].\n * Only applicable to string x-axis.\n */\n xAxisOuterPadding?: number;\n\n /**\n * @default false\n * The prop used to enable gradient fill color for the chart.\n */\n enableGradient?: boolean;\n\n /**\n * @default false\n * The prop used to enable rounded corners for the chart.\n */\n roundCorners?: boolean;\n\n /**\n * Specifies the mode of the chart.\n * @default 'default'\n */\n mode?: 'default' | 'plotly';\n}\n\n/**\n * Grouped Vertical Bar Chart style properties\n * {@docCategory GroupedVerticalBarChart}\n */\nexport interface IGroupedVerticalBarChartStyleProps extends ICartesianChartStyleProps {}\n\n/**\n * Grouped Vertical Bar Chart styles\n * {@docCategory GroupedVerticalBarChart}\n */\nexport interface IGroupedVerticalBarChartStyles extends ICartesianChartStyles {\n /**\n * Style to change the opacity of bars in dataviz when we hover on a single bar or legends\n */\n opacityChangeOnHover: IStyle;\n\n /**\n * Style for the bar labels\n */\n barLabel: IStyle;\n}\n"]}
@@ -889,7 +889,7 @@ var SankeyChartBase = /** @class */ (function (_super) {
889
889
  SankeyChartBase.prototype._showTooltip = function (text, checkTrcuncated, div, evt) {
890
890
  if (checkTrcuncated) {
891
891
  //Fixing tooltip position by attaching it to the element rather than page
892
- div.style('opacity', 0.9);
892
+ div.style('opacity', 0.9).style('color', this.props.theme.palette.neutralPrimary);
893
893
  div
894
894
  .html(text)
895
895
  .style('left', evt.pageX + 'px')
@@ -1 +1 @@
1
- {"version":3,"file":"SankeyChart.base.js","sourceRoot":"../src/","sources":["components/SankeyChart/SankeyChart.base.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAEL,kBAAkB,EAClB,MAAM,EACN,KAAK,EACL,MAAM,EACN,sBAAsB,EACtB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,GAAG,IAAI,KAAK,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAA6B,MAAM,IAAI,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtG,OAAO,EAAsC,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,UAAU,CAAC;AACtE,OAAO,KAAK,KAA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AAC;IAhxBa,4BAAY,GAA+B;QACvD,YAAY,EAAE,IAAI;KACnB,AAFyB,CAExB;IA0xBJ,sBAAC;CAAA,AA7xBD,CAAqC,KAAK,CAAC,SAAS,GA6xBnD;SA7xBY,eAAe","sourcesContent":["import { FocusZone, FocusZoneDirection } from '@fluentui/react-focus';\nimport { Callout, DirectionalHint } from '@fluentui/react/lib/Callout';\nimport { IProcessedStyleSet, ITheme } from '@fluentui/react/lib/Styling';\nimport {\n IStyleFunctionOrObject,\n classNamesFunction,\n format,\n getId,\n getRTL,\n initializeComponentRef,\n memoizeFunction,\n} from '@fluentui/react/lib/Utilities';\nimport { sum as d3Sum } from 'd3-array';\nimport { SankeyGraph, SankeyLayout, sankey as d3Sankey, sankeyJustify, sankeyRight } from 'd3-sankey';\nimport { BaseType, Selection as D3Selection, select, selectAll } from 'd3-selection';\nimport { area as d3Area, curveBumpX as d3CurveBasis } from 'd3-shape';\nimport * as React from 'react';\nimport { IBasestate, IChart, SLink, SNode } from '../../types/IDataPoint';\nimport { ChartHoverCard } from '../../utilities/ChartHoverCard/ChartHoverCard';\nimport { IChartHoverCardProps } from '../../utilities/ChartHoverCard/ChartHoverCard.types';\nimport { IMargins } from '../../utilities/utilities';\nimport {\n ISankeyChartAccessibilityProps,\n ISankeyChartData,\n ISankeyChartProps,\n ISankeyChartStrings,\n ISankeyChartStyleProps,\n ISankeyChartStyles,\n} from './SankeyChart.types';\n\nconst getClassNames = classNamesFunction<ISankeyChartStyleProps, ISankeyChartStyles>();\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 = ISankeyChartData & {\n width: number;\n height: number;\n};\n\ntype NormalizeDiagramFunction = (\n data: ISankeyChartData,\n containerWidth: number,\n containerHeight: number,\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n) => NormalizedData;\n\ntype NodeColors = { fillColor: string; borderColor: string };\ntype SankeyLayoutGenerator = SankeyLayout<SankeyGraph<{}, {}>, {}, {}>;\n\nexport interface ISankeyChartState extends IBasestate, IChartHoverCardProps {\n containerWidth: number;\n containerHeight: number;\n selectedState: boolean;\n selectedLinks: Set<Number>;\n selectedNodes: Set<Number>;\n selectedNode?: SNode;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n refSelected?: any;\n selectedLink?: SLink;\n shouldOverflow: boolean;\n}\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: ISankeyChartData) {\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: ISankeyChartData, 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: ISankeyChartData): ISankeyChartData {\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: IMargins,\n containerWidth: number,\n containerHeight: number,\n isRtl: boolean,\n): { sankey: SankeyLayoutGenerator; height: number; width: number } {\n const { left, right, top, bottom } = margins;\n const width = containerWidth - right!;\n const height = containerHeight - bottom! > 0 ? containerHeight - bottom! : 0;\n\n const sankey = d3Sankey()\n .nodeWidth(NODE_WIDTH)\n .extent([\n [left!, top!],\n [width - 1, height - 6],\n ])\n .nodeAlign(isRtl ? sankeyRight : sankeyJustify);\n\n return { sankey, height, width };\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): LinkItemValues<RenderedLinkAttributes> {\n const result: LinkItemValues<RenderedLinkAttributes> = {};\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)] = {\n reactId: getId('link'),\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\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TooltipDiv = D3Selection<BaseType, unknown, HTMLElement, any>;\n\nfunction nodeTextColor(state: Readonly<ISankeyChartState>, singleNode: SNode): 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\n// NOTE: To start employing React.useMemo properly, we need to convert this code from a React.Component\n// to a function component. This will require a significant refactor of the code in this file.\n// https://stackoverflow.com/questions/60223362/fast-way-to-convert-react-class-component-to-functional-component\n// I am concerned that doing so would break this contract, making it difficult for consuming code.\nexport class SankeyChartBase extends React.Component<ISankeyChartProps, ISankeyChartState> implements IChart {\n public static defaultProps: Partial<ISankeyChartProps> = {\n enableReflow: true,\n };\n\n public chartContainer: HTMLDivElement;\n private _reqID: number;\n private readonly _calloutId: string;\n private readonly _linkId: string;\n private readonly _chartId: string;\n private readonly _emptyChartId: string;\n private readonly _labelTooltipId: string;\n private readonly _margins: IMargins;\n private readonly _isRtl: boolean = getRTL();\n private _numColumns: number = 0;\n\n private readonly _computeClassNamesProps: (\n theme: ITheme,\n pathColor: string,\n className: string,\n containerWidth: number,\n containerHeight: number,\n ) => ISankeyChartStyleProps;\n private readonly _computeClassNames: (\n styles: IStyleFunctionOrObject<ISankeyChartStyleProps, ISankeyChartStyles>,\n classNamesProps: ISankeyChartStyleProps,\n ) => IProcessedStyleSet<ISankeyChartStyles>;\n private readonly _normalizeData: NormalizeDiagramFunction;\n private readonly _fetchTooltip: (classNames: IProcessedStyleSet<ISankeyChartStyles>) => TooltipDiv;\n private readonly _nodeAttributes: (\n nodes: SNode[],\n nodeAriaLabel: (node: SNode, weight: number) => string,\n ) => ItemValues<RenderedNodeAttributes>;\n private readonly _linkAttributes: (\n links: SLink[],\n linkFrom: (node: SNode) => string,\n linkAriaLabel: (link: SLink) => string,\n ) => LinkItemValues<RenderedLinkAttributes>;\n private readonly _fetchNodes: (\n classNames: IProcessedStyleSet<ISankeyChartStyles>,\n nodes: SNode[],\n nodeAttributes: ItemValues<RenderedNodeAttributes>,\n tooltipDiv: TooltipDiv,\n ) => React.ReactNode[] | undefined;\n private readonly _fetchLinks: (\n links: SLink[],\n linkAttributes: LinkItemValues<RenderedLinkAttributes>,\n ) => React.ReactNode[] | undefined;\n\n private readonly _strings: StringRenderer;\n private readonly _accessibility: AccessibilityRenderer;\n\n constructor(props: ISankeyChartProps) {\n super(props);\n\n initializeComponentRef(this);\n\n this.state = {\n containerHeight: 468,\n containerWidth: 912,\n selectedState: false,\n selectedLinks: new Set<number>(),\n selectedNodes: new Set<number>(),\n shouldOverflow: false,\n isCalloutVisible: false,\n };\n this._calloutId = getId('callout');\n this._linkId = getId('link');\n this._chartId = getId('sankeyChart');\n this._emptyChartId = getId('_SankeyChart_empty');\n this._labelTooltipId = getId('tooltip');\n this._margins = { top: 36, right: 48, bottom: 32, left: 48 };\n // We memo-ize creation so that we only create a new object when any of the fields change.\n this._computeClassNamesProps = memoizeFunction(\n (\n theme: ITheme,\n pathColor: string,\n className: string,\n containerWidth: number,\n containerHeight: number,\n ): ISankeyChartStyleProps => ({\n theme: theme!,\n width: containerWidth,\n height: containerHeight,\n pathColor,\n className,\n }),\n );\n // `getClassNames` is memoized underneath, so it only recomputes when the `styles` or `classNamesProps` change.\n // We memoize `classNamesProps` so that we only create new class names when absolutely necessary,\n // and so that we can memoize the `_createNodes` method.\n this._computeClassNames = memoizeFunction(\n (\n styles: IStyleFunctionOrObject<ISankeyChartStyleProps, ISankeyChartStyles>,\n classNamesProps: ISankeyChartStyleProps,\n ) => getClassNames(styles, classNamesProps),\n );\n this._normalizeData = memoizeFunction(\n (\n data: ISankeyChartData,\n containerWidth: number,\n containerHeight: number,\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n ) => this._normalizeSankeyData(data, containerWidth, containerHeight, colorsForNodes, borderColorsForNodes),\n );\n this._fetchTooltip = memoizeFunction((classNames: IProcessedStyleSet<ISankeyChartStyles>) =>\n this._labelTooltipDiv(classNames),\n );\n // Prepare the localization utilities\n this._strings = memoizeFunction((strings?: ISankeyChartStrings): StringRenderer => {\n const fromString = 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 this._accessibility = memoizeFunction((accessibility?: ISankeyChartAccessibilityProps): AccessibilityRenderer => {\n const linkString = accessibility?.linkAriaLabel || 'link from {0} to {1} with weight {2}';\n const nodeString = accessibility?.nodeAriaLabel || 'node {0} with weight {1}';\n return {\n emptyAriaLabel: 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 ? this._formatNumber(link.unnormalizedValue) : link.unnormalizedValue,\n ),\n nodeAriaLabel: (node: SNode, weight: number) => format(nodeString, node.name, this._formatNumber(weight)),\n };\n })(props.accessibility);\n // NOTE: Memoizing the `_createNodes` and `_createLinks` methods would break the hoverability of the chart\n // because the nodes are currently created differently based on the layout information. Hence why we do not\n // memoize these methods (but have stubs for memoizing as the `_fetchNodes` and `_fetchLinks` methods).\n this._nodeAttributes = memoizeFunction((nodes: SNode[], nodeAriaLabel: (node: SNode, weight: number) => string) =>\n this._computeNodeAttributes(nodes, nodeAriaLabel),\n );\n this._fetchNodes = (\n classNames: IProcessedStyleSet<ISankeyChartStyles>,\n nodes: SNode[],\n nodeAttributes: ItemValues<RenderedNodeAttributes>,\n tooltipDiv: TooltipDiv,\n ) => this._createNodes(classNames, nodes, nodeAttributes, tooltipDiv);\n this._linkAttributes = memoizeFunction(\n (links: SLink[], linkFrom: (node: SNode) => string, linkAriaLabel: (link: SLink) => string) =>\n computeLinkAttributes(links, linkFrom, linkAriaLabel),\n );\n this._fetchLinks = (links: SLink[], linkAttributes: LinkItemValues<RenderedLinkAttributes>) =>\n this._createLinks(links, linkAttributes);\n // Our shorter path to performance is to pre-compute the truncated labels of each node because\n // that should not change based on the position of the mouse. This is a shorter path becase the code which\n // computes the truncated labels creates and destroys a `tempText` element in the DOM. This is causing a\n // reflow and repaint of the entire chart. This is a performance issue, and so computing the truncated labels\n // once will help to mitigate this issue.\n }\n\n public componentDidMount(): void {\n this._fitParentContainer();\n }\n\n public componentDidUpdate(prevProps: ISankeyChartProps): void {\n if (prevProps.shouldResize !== this.props.shouldResize) {\n this._fitParentContainer();\n }\n }\n\n public componentWillUnmount(): void {\n cancelAnimationFrame(this._reqID);\n }\n\n public render(): React.ReactNode {\n if (!this._isChartEmpty()) {\n const { theme, className, styles, pathColor, colorsForNodes, borderColorsForNodes } = this.props;\n const state = this.state;\n const classNamesProps = this._computeClassNamesProps(\n theme!,\n pathColor!,\n className!,\n state.containerWidth,\n state.containerHeight,\n );\n const classNames: IProcessedStyleSet<ISankeyChartStyles> = this._computeClassNames(styles!, classNamesProps);\n\n // Compute the position of each node and link\n const { nodes, links, width, height } = this._normalizeData(\n this.props.data.SankeyChartData!,\n state.containerWidth,\n state.containerHeight,\n colorsForNodes,\n borderColorsForNodes,\n );\n\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 // NOTE: I don't love this approach to caching the \"select\" result. Is it still valid from render-to-render?\n // although local testing seems to indicate so, I do not trust that React will always support that instance.\n // It might be better to perform this `fetch` within the `_showTooltip` and `_hideTooltip` methods.\n const tooltipDiv = this._fetchTooltip(classNames);\n // Pre-compute some important attributes about nodes, specifically text\n const nodeAttributes = this._nodeAttributes(nodes, this._accessibility.nodeAriaLabel);\n // Build the nodes and links as rendered in the UX.\n const nodeData = this._fetchNodes(classNames, nodes, nodeAttributes, tooltipDiv);\n const linkAttributes = this._linkAttributes(links, this._strings.linkFrom, this._accessibility.linkAriaLabel);\n const linkData = this._fetchLinks(links, linkAttributes);\n\n const calloutProps = {\n isCalloutVisible: state.isCalloutVisible,\n directionalHint: DirectionalHint.topAutoEdge,\n id: `toolTip${this._calloutId}`,\n target: state.refSelected,\n color: state.color,\n XValue: state.xCalloutValue,\n YValue: state.yCalloutValue ? state.yCalloutValue : state.dataForHoverCard,\n descriptionMessage: state.descriptionMessage,\n isBeakVisible: false,\n gapSpace: 15,\n onDismiss: this._onCloseCallout,\n className: classNames.calloutContentRoot,\n preventDismissOnLostFocus: true,\n ...this.props.calloutProps!,\n };\n return (\n <div\n className={classNames.root}\n role={'presentation'}\n ref={(rootElem: HTMLDivElement) => (this.chartContainer = rootElem)}\n onMouseLeave={this._onCloseCallout}\n >\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 <FocusZone direction={FocusZoneDirection.vertical} className={classNames.chartWrapper}>\n <svg width={width} height={height} id={this._chartId}>\n {nodeLinkDomOrderArray.map(item => {\n if (item.type === 'node') {\n return (\n <g key={nodes[item.index].nodeId} className={classNames.nodes}>\n {nodeData![item.index]}\n </g>\n );\n } else {\n return (\n <g\n key={`${(links[item.index].source as SNode).nodeId}-${\n (links[item.index].target as SNode).nodeId\n }`}\n className={classNames.links}\n strokeOpacity={1}\n >\n {linkData![item.index]}\n </g>\n );\n }\n })}\n {calloutProps.isCalloutVisible && (\n <Callout {...calloutProps}>\n <ChartHoverCard\n XValue={calloutProps.XValue}\n YValue={calloutProps.YValue}\n color={calloutProps.color}\n descriptionMessage={calloutProps.descriptionMessage ? calloutProps.descriptionMessage : ''}\n />\n </Callout>\n )}\n </svg>\n </FocusZone>\n </div>\n );\n }\n return (\n <div\n id={this._emptyChartId}\n role={'alert'}\n style={{ opacity: '0' }}\n aria-label={this._accessibility.emptyAriaLabel}\n />\n );\n }\n\n private _computeNodeAttributes(\n nodes: SNode[],\n nodeAriaLabel: (node: SNode, weight: number) => string,\n ): 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) => {\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, this._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: getId('nodeBar'),\n gElementId: getId('nodeGElement'),\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\n private _linkCalloutAttributes(\n singleLink: SLink,\n from: string,\n ): IChartHoverCardProps & {\n selectedLink: SLink;\n isCalloutVisible: boolean;\n color: string;\n xCalloutValue: string;\n yCalloutValue: string;\n descriptionMessage: string;\n } {\n return {\n selectedLink: singleLink,\n isCalloutVisible: true,\n color: (singleLink.source as SNode).color!,\n xCalloutValue: (singleLink.target as SNode).name,\n yCalloutValue: this._formatNumber(singleLink.unnormalizedValue!),\n descriptionMessage: from,\n };\n }\n\n private _normalizeSankeyData(\n data: ISankeyChartData,\n containerWidth: number,\n containerHeight: number,\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n ): NormalizedData {\n const { sankey, height, width } = preRenderLayout(this._margins, containerWidth, containerHeight, this._isRtl);\n // Clone the data before mutating it (via the SankeyLayoutGenerator) so that we don't mutate the original data.\n const transformed: ISankeyChartData = 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 this._numColumns = 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, height - 6, 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\n private _labelTooltipDiv(classNames: IProcessedStyleSet<ISankeyChartStyles>): TooltipDiv {\n // find the tooltip div. If it doesn't exist, then create it.\n let tooltipDiv = select(`#${this._labelTooltipId}`);\n if (tooltipDiv.empty()) {\n tooltipDiv = select('body')\n .append('div')\n .attr('id', this._labelTooltipId)\n .attr('class', classNames.toolTip!)\n .style('opacity', 0);\n }\n // If the div exists, then `classNames` has changed; update the `class` on the `div`.\n tooltipDiv.attr('class', classNames.toolTip!);\n return tooltipDiv;\n }\n\n private _createLinks(\n dataLinks: SLink[],\n linkAttributes: LinkItemValues<RenderedLinkAttributes>,\n ): React.ReactNode[] | undefined {\n if (dataLinks) {\n const linkId = this._linkId;\n return dataLinks.map((singleLink: SLink, index: number): React.ReactNode => {\n const onMouseOut = () => {\n this._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={this._fillStreamColors(singleLink, gradientUrl)}\n stroke={this._fillStreamBorder(singleLink, gradientUrl)}\n strokeWidth=\"2\"\n strokeOpacity={this._getOpacityStreamBorder(singleLink)}\n onMouseOver={event => this._onStreamHover(event, singleLink, from)}\n onMouseOut={onMouseOut}\n onFocus={event => this._onFocusLink(event, singleLink, from)}\n onBlur={this._onBlur}\n fillOpacity={this._getOpacityStream(singleLink)}\n data-is-focusable={true}\n aria-label={aria}\n role=\"img\"\n />\n </g>\n );\n });\n }\n return [];\n }\n\n private _createNodes(\n classNames: IProcessedStyleSet<ISankeyChartStyles>,\n dataNodes: SNode[],\n nodeAttributes: ItemValues<RenderedNodeAttributes>,\n tooltipDiv: TooltipDiv,\n ): React.ReactNode[] | undefined {\n if (dataNodes) {\n const state = this.state;\n const textAnchor = this._isRtl ? 'end' : 'start';\n return dataNodes.map((singleNode: SNode, index: number): React.ReactNode => {\n const onMouseOut = () => {\n this._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(state, 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={this._fillNodeColors(singleNode)}\n id={nodeId}\n onMouseOver={this._onHover.bind(this, singleNode)}\n onMouseOut={onMouseOut}\n onFocus={this._onCloseCallout.bind(this)}\n stroke={this._fillNodeBorder(singleNode)}\n strokeWidth=\"2\"\n opacity=\"1\"\n data-is-focusable={true}\n aria-label={aria}\n role=\"img\"\n />\n {height > MIN_HEIGHT_FOR_TYPE && (\n <g className={classNames.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={this._showTooltip.bind(this, name, isTruncated, tooltipDiv)}\n onMouseOut={this._hideTooltip.bind(this, tooltipDiv)}\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 ? this._formatNumber(actualValue) : actualValue}\n </text>\n </g>\n )}\n </g>\n );\n });\n }\n }\n\n private _onLeave(singleNode: SNode) {\n if (this.state.selectedState) {\n this.setState({\n selectedState: false,\n selectedNodes: new Set<number>(),\n selectedLinks: new Set<number>(),\n selectedNode: undefined,\n });\n }\n }\n\n private _onHover(singleNode: SNode, mouseEvent: React.MouseEvent<SVGElement>) {\n mouseEvent.persist();\n this._onCloseCallout();\n if (!this.state.selectedState) {\n const selectedLinks = getSelectedLinks(singleNode);\n const selectedNodes = getSelectedNodes(selectedLinks);\n selectedNodes.push(singleNode);\n this.setState({\n selectedState: true,\n selectedNodes: new Set<number>(Array.from(selectedNodes).map(node => node.index)),\n selectedLinks: new Set<number>(Array.from(selectedLinks).map(link => link.index!)),\n selectedNode: singleNode,\n refSelected: mouseEvent, //this._refArray.get(index),\n isCalloutVisible: singleNode.y1! - singleNode.y0! < MIN_HEIGHT_FOR_TYPE,\n color: singleNode.color,\n xCalloutValue: singleNode.name,\n yCalloutValue: this._formatNumber(singleNode.actualValue!),\n });\n }\n }\n\n private _formatNumber(value: number): string {\n return this.props.formatNumberOptions\n ? value.toLocaleString(undefined, this.props.formatNumberOptions)\n : value.toString();\n }\n\n private _onStreamHover(mouseEvent: React.MouseEvent<SVGElement>, singleLink: SLink, from: string) {\n mouseEvent.persist();\n this._onCloseCallout();\n if (!this.state.selectedState) {\n const { selectedLinks, selectedNodes } = getSelectedLinksforStreamHover(singleLink);\n this.setState({\n selectedState: true,\n selectedNodes: new Set<number>(Array.from(selectedNodes).map(node => node.index!)),\n selectedLinks: new Set<number>(Array.from(selectedLinks).map(link => link.index!)),\n refSelected: mouseEvent,\n ...this._linkCalloutAttributes(singleLink, from),\n });\n }\n }\n\n private _onStreamLeave(singleLink: SLink) {\n if (this.state.selectedState) {\n this.setState({\n selectedState: false,\n selectedNodes: new Set<number>(),\n selectedLinks: new Set<number>(),\n selectedLink: undefined,\n });\n }\n }\n\n private _onFocusLink(element: 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 element.persist();\n this._onCloseCallout();\n this.setState({\n refSelected: element.currentTarget,\n ...this._linkCalloutAttributes(singleLink, from),\n });\n }\n\n private _onCloseCallout = () => {\n this.setState({\n isCalloutVisible: false,\n refSelected: undefined,\n descriptionMessage: '',\n });\n };\n\n private _onBlur = (): void => {\n /**/\n };\n\n private _fillNodeColors = (singleNode: SNode): string | undefined => {\n const state = this.state;\n if (!state.selectedState) {\n return singleNode.color;\n } else {\n const selectedNode = state.selectedNode;\n if (selectedNode && state.selectedNodes.has(singleNode.index!)) {\n return selectedNode.color;\n } else if (!selectedNode) {\n return singleNode.color;\n }\n }\n };\n\n private _fillStreamColors(singleLink: SLink, gradientUrl: string): string | undefined {\n const state = this.state;\n if (state.selectedState && state.selectedLinks.has(singleLink.index!)) {\n const selectedNode = state.selectedNode;\n return selectedNode ? selectedNode.color : gradientUrl;\n }\n }\n\n private _fillStreamBorder(singleLink: SLink, gradientUrl: string): string {\n const state = this.state;\n if (!state.selectedState) {\n return NON_SELECTED_NODE_AND_STREAM_COLOR;\n } else {\n if (state.selectedLinks.has(singleLink.index!)) {\n const selectedNode = state.selectedNode;\n return selectedNode ? selectedNode.borderColor! : gradientUrl;\n }\n return NON_SELECTED_NODE_AND_STREAM_COLOR;\n }\n }\n\n private _fillNodeBorder = (singleNode: SNode): string => {\n const state = this.state;\n if (!state.selectedState) {\n return singleNode.borderColor!;\n } else {\n if (state.selectedNodes.has(singleNode.index!)) {\n const selectedNode = state.selectedNode;\n return selectedNode ? selectedNode.borderColor! : singleNode.borderColor!;\n }\n return singleNode.borderColor!;\n }\n };\n\n private _getOpacityStream(singleLink: SLink): number {\n const state = this.state;\n if (state.selectedState) {\n if (!state.selectedLinks.has(singleLink.index!)) {\n return NON_SELECTED_OPACITY;\n } else if (!state.selectedNode) {\n return SELECTED_STREAM_OPACITY;\n }\n }\n return REST_STREAM_OPACITY;\n }\n\n private _getOpacityStreamBorder(singleLink: SLink): number {\n const state = this.state;\n if (state.selectedState && !state.selectedLinks.has(singleLink.index!) && !state.selectedNode) {\n return NON_SELECTED_STREAM_BORDER_OPACITY;\n }\n\n return NON_SELECTED_OPACITY;\n }\n\n private _fitParentContainer(): void {\n const { containerWidth, containerHeight } = this.state;\n this._reqID = requestAnimationFrame(() => {\n // NOTE: Calls to this method trigger a re-render.\n const container = this.props.parentRef ? this.props.parentRef : this.chartContainer;\n const currentContainerWidth =\n container &&\n (this.props.enableReflow\n ? Math.max(container.getBoundingClientRect().width, this._calculateChartMinWidth())\n : container.getBoundingClientRect().width);\n const currentContainerHeight = container && container.getBoundingClientRect().height;\n const shouldResize = containerWidth !== currentContainerWidth || containerHeight !== currentContainerHeight;\n if (shouldResize) {\n this.setState({\n containerWidth: currentContainerWidth,\n containerHeight: currentContainerHeight,\n });\n }\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _showTooltip(text: string, checkTrcuncated: boolean, div: any, evt: any) {\n if (checkTrcuncated) {\n //Fixing tooltip position by attaching it to the element rather than page\n div.style('opacity', 0.9);\n div\n .html(text)\n .style('left', evt.pageX + 'px')\n .style('top', evt.pageY - 28 + 'px');\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _hideTooltip(div: any) {\n div.style('opacity', 0);\n }\n\n private _isChartEmpty() {\n const sankeyChartData = this.props.data?.SankeyChartData;\n return !(sankeyChartData && sankeyChartData.nodes.length > 0 && sankeyChartData.links.length > 0);\n }\n\n private _calculateChartMinWidth = (): number => {\n return (\n this._margins.left! +\n this._margins.right! +\n // total width of all node columns\n this._numColumns * NODE_WIDTH +\n // minimum total width of all column gaps\n (this._numColumns - 1) * (NODE_WIDTH / 2)\n );\n };\n}\n"]}
1
+ {"version":3,"file":"SankeyChart.base.js","sourceRoot":"../src/","sources":["components/SankeyChart/SankeyChart.base.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,uBAAuB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C;YACnF,GAAG;iBACA,IAAI,CAAC,IAAI,CAAC;iBACV,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC;iBAC/B,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,KAAK,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,8DAA8D;IACtD,sCAAY,GAApB,UAAqB,GAAQ;QAC3B,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC1B,CAAC;IAEO,uCAAa,GAArB;;QACE,IAAM,eAAe,GAAG,MAAA,IAAI,CAAC,KAAK,CAAC,IAAI,0CAAE,eAAe,CAAC;QACzD,OAAO,CAAC,CAAC,eAAe,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpG,CAAC;IAhxBa,4BAAY,GAA+B;QACvD,YAAY,EAAE,IAAI;KACnB,AAFyB,CAExB;IA0xBJ,sBAAC;CAAA,AA7xBD,CAAqC,KAAK,CAAC,SAAS,GA6xBnD;SA7xBY,eAAe","sourcesContent":["import { FocusZone, FocusZoneDirection } from '@fluentui/react-focus';\nimport { Callout, DirectionalHint } from '@fluentui/react/lib/Callout';\nimport { IProcessedStyleSet, ITheme } from '@fluentui/react/lib/Styling';\nimport {\n IStyleFunctionOrObject,\n classNamesFunction,\n format,\n getId,\n getRTL,\n initializeComponentRef,\n memoizeFunction,\n} from '@fluentui/react/lib/Utilities';\nimport { sum as d3Sum } from 'd3-array';\nimport { SankeyGraph, SankeyLayout, sankey as d3Sankey, sankeyJustify, sankeyRight } from 'd3-sankey';\nimport { BaseType, Selection as D3Selection, select, selectAll } from 'd3-selection';\nimport { area as d3Area, curveBumpX as d3CurveBasis } from 'd3-shape';\nimport * as React from 'react';\nimport { IBasestate, IChart, SLink, SNode } from '../../types/IDataPoint';\nimport { ChartHoverCard } from '../../utilities/ChartHoverCard/ChartHoverCard';\nimport { IChartHoverCardProps } from '../../utilities/ChartHoverCard/ChartHoverCard.types';\nimport { IMargins } from '../../utilities/utilities';\nimport {\n ISankeyChartAccessibilityProps,\n ISankeyChartData,\n ISankeyChartProps,\n ISankeyChartStrings,\n ISankeyChartStyleProps,\n ISankeyChartStyles,\n} from './SankeyChart.types';\n\nconst getClassNames = classNamesFunction<ISankeyChartStyleProps, ISankeyChartStyles>();\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 = ISankeyChartData & {\n width: number;\n height: number;\n};\n\ntype NormalizeDiagramFunction = (\n data: ISankeyChartData,\n containerWidth: number,\n containerHeight: number,\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n) => NormalizedData;\n\ntype NodeColors = { fillColor: string; borderColor: string };\ntype SankeyLayoutGenerator = SankeyLayout<SankeyGraph<{}, {}>, {}, {}>;\n\nexport interface ISankeyChartState extends IBasestate, IChartHoverCardProps {\n containerWidth: number;\n containerHeight: number;\n selectedState: boolean;\n selectedLinks: Set<Number>;\n selectedNodes: Set<Number>;\n selectedNode?: SNode;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n refSelected?: any;\n selectedLink?: SLink;\n shouldOverflow: boolean;\n}\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: ISankeyChartData) {\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: ISankeyChartData, 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: ISankeyChartData): ISankeyChartData {\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: IMargins,\n containerWidth: number,\n containerHeight: number,\n isRtl: boolean,\n): { sankey: SankeyLayoutGenerator; height: number; width: number } {\n const { left, right, top, bottom } = margins;\n const width = containerWidth - right!;\n const height = containerHeight - bottom! > 0 ? containerHeight - bottom! : 0;\n\n const sankey = d3Sankey()\n .nodeWidth(NODE_WIDTH)\n .extent([\n [left!, top!],\n [width - 1, height - 6],\n ])\n .nodeAlign(isRtl ? sankeyRight : sankeyJustify);\n\n return { sankey, height, width };\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): LinkItemValues<RenderedLinkAttributes> {\n const result: LinkItemValues<RenderedLinkAttributes> = {};\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)] = {\n reactId: getId('link'),\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\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype TooltipDiv = D3Selection<BaseType, unknown, HTMLElement, any>;\n\nfunction nodeTextColor(state: Readonly<ISankeyChartState>, singleNode: SNode): 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\n// NOTE: To start employing React.useMemo properly, we need to convert this code from a React.Component\n// to a function component. This will require a significant refactor of the code in this file.\n// https://stackoverflow.com/questions/60223362/fast-way-to-convert-react-class-component-to-functional-component\n// I am concerned that doing so would break this contract, making it difficult for consuming code.\nexport class SankeyChartBase extends React.Component<ISankeyChartProps, ISankeyChartState> implements IChart {\n public static defaultProps: Partial<ISankeyChartProps> = {\n enableReflow: true,\n };\n\n public chartContainer: HTMLDivElement;\n private _reqID: number;\n private readonly _calloutId: string;\n private readonly _linkId: string;\n private readonly _chartId: string;\n private readonly _emptyChartId: string;\n private readonly _labelTooltipId: string;\n private readonly _margins: IMargins;\n private readonly _isRtl: boolean = getRTL();\n private _numColumns: number = 0;\n\n private readonly _computeClassNamesProps: (\n theme: ITheme,\n pathColor: string,\n className: string,\n containerWidth: number,\n containerHeight: number,\n ) => ISankeyChartStyleProps;\n private readonly _computeClassNames: (\n styles: IStyleFunctionOrObject<ISankeyChartStyleProps, ISankeyChartStyles>,\n classNamesProps: ISankeyChartStyleProps,\n ) => IProcessedStyleSet<ISankeyChartStyles>;\n private readonly _normalizeData: NormalizeDiagramFunction;\n private readonly _fetchTooltip: (classNames: IProcessedStyleSet<ISankeyChartStyles>) => TooltipDiv;\n private readonly _nodeAttributes: (\n nodes: SNode[],\n nodeAriaLabel: (node: SNode, weight: number) => string,\n ) => ItemValues<RenderedNodeAttributes>;\n private readonly _linkAttributes: (\n links: SLink[],\n linkFrom: (node: SNode) => string,\n linkAriaLabel: (link: SLink) => string,\n ) => LinkItemValues<RenderedLinkAttributes>;\n private readonly _fetchNodes: (\n classNames: IProcessedStyleSet<ISankeyChartStyles>,\n nodes: SNode[],\n nodeAttributes: ItemValues<RenderedNodeAttributes>,\n tooltipDiv: TooltipDiv,\n ) => React.ReactNode[] | undefined;\n private readonly _fetchLinks: (\n links: SLink[],\n linkAttributes: LinkItemValues<RenderedLinkAttributes>,\n ) => React.ReactNode[] | undefined;\n\n private readonly _strings: StringRenderer;\n private readonly _accessibility: AccessibilityRenderer;\n\n constructor(props: ISankeyChartProps) {\n super(props);\n\n initializeComponentRef(this);\n\n this.state = {\n containerHeight: 468,\n containerWidth: 912,\n selectedState: false,\n selectedLinks: new Set<number>(),\n selectedNodes: new Set<number>(),\n shouldOverflow: false,\n isCalloutVisible: false,\n };\n this._calloutId = getId('callout');\n this._linkId = getId('link');\n this._chartId = getId('sankeyChart');\n this._emptyChartId = getId('_SankeyChart_empty');\n this._labelTooltipId = getId('tooltip');\n this._margins = { top: 36, right: 48, bottom: 32, left: 48 };\n // We memo-ize creation so that we only create a new object when any of the fields change.\n this._computeClassNamesProps = memoizeFunction(\n (\n theme: ITheme,\n pathColor: string,\n className: string,\n containerWidth: number,\n containerHeight: number,\n ): ISankeyChartStyleProps => ({\n theme: theme!,\n width: containerWidth,\n height: containerHeight,\n pathColor,\n className,\n }),\n );\n // `getClassNames` is memoized underneath, so it only recomputes when the `styles` or `classNamesProps` change.\n // We memoize `classNamesProps` so that we only create new class names when absolutely necessary,\n // and so that we can memoize the `_createNodes` method.\n this._computeClassNames = memoizeFunction(\n (\n styles: IStyleFunctionOrObject<ISankeyChartStyleProps, ISankeyChartStyles>,\n classNamesProps: ISankeyChartStyleProps,\n ) => getClassNames(styles, classNamesProps),\n );\n this._normalizeData = memoizeFunction(\n (\n data: ISankeyChartData,\n containerWidth: number,\n containerHeight: number,\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n ) => this._normalizeSankeyData(data, containerWidth, containerHeight, colorsForNodes, borderColorsForNodes),\n );\n this._fetchTooltip = memoizeFunction((classNames: IProcessedStyleSet<ISankeyChartStyles>) =>\n this._labelTooltipDiv(classNames),\n );\n // Prepare the localization utilities\n this._strings = memoizeFunction((strings?: ISankeyChartStrings): StringRenderer => {\n const fromString = 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 this._accessibility = memoizeFunction((accessibility?: ISankeyChartAccessibilityProps): AccessibilityRenderer => {\n const linkString = accessibility?.linkAriaLabel || 'link from {0} to {1} with weight {2}';\n const nodeString = accessibility?.nodeAriaLabel || 'node {0} with weight {1}';\n return {\n emptyAriaLabel: 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 ? this._formatNumber(link.unnormalizedValue) : link.unnormalizedValue,\n ),\n nodeAriaLabel: (node: SNode, weight: number) => format(nodeString, node.name, this._formatNumber(weight)),\n };\n })(props.accessibility);\n // NOTE: Memoizing the `_createNodes` and `_createLinks` methods would break the hoverability of the chart\n // because the nodes are currently created differently based on the layout information. Hence why we do not\n // memoize these methods (but have stubs for memoizing as the `_fetchNodes` and `_fetchLinks` methods).\n this._nodeAttributes = memoizeFunction((nodes: SNode[], nodeAriaLabel: (node: SNode, weight: number) => string) =>\n this._computeNodeAttributes(nodes, nodeAriaLabel),\n );\n this._fetchNodes = (\n classNames: IProcessedStyleSet<ISankeyChartStyles>,\n nodes: SNode[],\n nodeAttributes: ItemValues<RenderedNodeAttributes>,\n tooltipDiv: TooltipDiv,\n ) => this._createNodes(classNames, nodes, nodeAttributes, tooltipDiv);\n this._linkAttributes = memoizeFunction(\n (links: SLink[], linkFrom: (node: SNode) => string, linkAriaLabel: (link: SLink) => string) =>\n computeLinkAttributes(links, linkFrom, linkAriaLabel),\n );\n this._fetchLinks = (links: SLink[], linkAttributes: LinkItemValues<RenderedLinkAttributes>) =>\n this._createLinks(links, linkAttributes);\n // Our shorter path to performance is to pre-compute the truncated labels of each node because\n // that should not change based on the position of the mouse. This is a shorter path becase the code which\n // computes the truncated labels creates and destroys a `tempText` element in the DOM. This is causing a\n // reflow and repaint of the entire chart. This is a performance issue, and so computing the truncated labels\n // once will help to mitigate this issue.\n }\n\n public componentDidMount(): void {\n this._fitParentContainer();\n }\n\n public componentDidUpdate(prevProps: ISankeyChartProps): void {\n if (prevProps.shouldResize !== this.props.shouldResize) {\n this._fitParentContainer();\n }\n }\n\n public componentWillUnmount(): void {\n cancelAnimationFrame(this._reqID);\n }\n\n public render(): React.ReactNode {\n if (!this._isChartEmpty()) {\n const { theme, className, styles, pathColor, colorsForNodes, borderColorsForNodes } = this.props;\n const state = this.state;\n const classNamesProps = this._computeClassNamesProps(\n theme!,\n pathColor!,\n className!,\n state.containerWidth,\n state.containerHeight,\n );\n const classNames: IProcessedStyleSet<ISankeyChartStyles> = this._computeClassNames(styles!, classNamesProps);\n\n // Compute the position of each node and link\n const { nodes, links, width, height } = this._normalizeData(\n this.props.data.SankeyChartData!,\n state.containerWidth,\n state.containerHeight,\n colorsForNodes,\n borderColorsForNodes,\n );\n\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 // NOTE: I don't love this approach to caching the \"select\" result. Is it still valid from render-to-render?\n // although local testing seems to indicate so, I do not trust that React will always support that instance.\n // It might be better to perform this `fetch` within the `_showTooltip` and `_hideTooltip` methods.\n const tooltipDiv = this._fetchTooltip(classNames);\n // Pre-compute some important attributes about nodes, specifically text\n const nodeAttributes = this._nodeAttributes(nodes, this._accessibility.nodeAriaLabel);\n // Build the nodes and links as rendered in the UX.\n const nodeData = this._fetchNodes(classNames, nodes, nodeAttributes, tooltipDiv);\n const linkAttributes = this._linkAttributes(links, this._strings.linkFrom, this._accessibility.linkAriaLabel);\n const linkData = this._fetchLinks(links, linkAttributes);\n\n const calloutProps = {\n isCalloutVisible: state.isCalloutVisible,\n directionalHint: DirectionalHint.topAutoEdge,\n id: `toolTip${this._calloutId}`,\n target: state.refSelected,\n color: state.color,\n XValue: state.xCalloutValue,\n YValue: state.yCalloutValue ? state.yCalloutValue : state.dataForHoverCard,\n descriptionMessage: state.descriptionMessage,\n isBeakVisible: false,\n gapSpace: 15,\n onDismiss: this._onCloseCallout,\n className: classNames.calloutContentRoot,\n preventDismissOnLostFocus: true,\n ...this.props.calloutProps!,\n };\n return (\n <div\n className={classNames.root}\n role={'presentation'}\n ref={(rootElem: HTMLDivElement) => (this.chartContainer = rootElem)}\n onMouseLeave={this._onCloseCallout}\n >\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 <FocusZone direction={FocusZoneDirection.vertical} className={classNames.chartWrapper}>\n <svg width={width} height={height} id={this._chartId}>\n {nodeLinkDomOrderArray.map(item => {\n if (item.type === 'node') {\n return (\n <g key={nodes[item.index].nodeId} className={classNames.nodes}>\n {nodeData![item.index]}\n </g>\n );\n } else {\n return (\n <g\n key={`${(links[item.index].source as SNode).nodeId}-${\n (links[item.index].target as SNode).nodeId\n }`}\n className={classNames.links}\n strokeOpacity={1}\n >\n {linkData![item.index]}\n </g>\n );\n }\n })}\n {calloutProps.isCalloutVisible && (\n <Callout {...calloutProps}>\n <ChartHoverCard\n XValue={calloutProps.XValue}\n YValue={calloutProps.YValue}\n color={calloutProps.color}\n descriptionMessage={calloutProps.descriptionMessage ? calloutProps.descriptionMessage : ''}\n />\n </Callout>\n )}\n </svg>\n </FocusZone>\n </div>\n );\n }\n return (\n <div\n id={this._emptyChartId}\n role={'alert'}\n style={{ opacity: '0' }}\n aria-label={this._accessibility.emptyAriaLabel}\n />\n );\n }\n\n private _computeNodeAttributes(\n nodes: SNode[],\n nodeAriaLabel: (node: SNode, weight: number) => string,\n ): 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) => {\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, this._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: getId('nodeBar'),\n gElementId: getId('nodeGElement'),\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\n private _linkCalloutAttributes(\n singleLink: SLink,\n from: string,\n ): IChartHoverCardProps & {\n selectedLink: SLink;\n isCalloutVisible: boolean;\n color: string;\n xCalloutValue: string;\n yCalloutValue: string;\n descriptionMessage: string;\n } {\n return {\n selectedLink: singleLink,\n isCalloutVisible: true,\n color: (singleLink.source as SNode).color!,\n xCalloutValue: (singleLink.target as SNode).name,\n yCalloutValue: this._formatNumber(singleLink.unnormalizedValue!),\n descriptionMessage: from,\n };\n }\n\n private _normalizeSankeyData(\n data: ISankeyChartData,\n containerWidth: number,\n containerHeight: number,\n colorsForNodes: string[] | undefined,\n borderColorsForNodes: string[] | undefined,\n ): NormalizedData {\n const { sankey, height, width } = preRenderLayout(this._margins, containerWidth, containerHeight, this._isRtl);\n // Clone the data before mutating it (via the SankeyLayoutGenerator) so that we don't mutate the original data.\n const transformed: ISankeyChartData = 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 this._numColumns = 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, height - 6, 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\n private _labelTooltipDiv(classNames: IProcessedStyleSet<ISankeyChartStyles>): TooltipDiv {\n // find the tooltip div. If it doesn't exist, then create it.\n let tooltipDiv = select(`#${this._labelTooltipId}`);\n if (tooltipDiv.empty()) {\n tooltipDiv = select('body')\n .append('div')\n .attr('id', this._labelTooltipId)\n .attr('class', classNames.toolTip!)\n .style('opacity', 0);\n }\n // If the div exists, then `classNames` has changed; update the `class` on the `div`.\n tooltipDiv.attr('class', classNames.toolTip!);\n return tooltipDiv;\n }\n\n private _createLinks(\n dataLinks: SLink[],\n linkAttributes: LinkItemValues<RenderedLinkAttributes>,\n ): React.ReactNode[] | undefined {\n if (dataLinks) {\n const linkId = this._linkId;\n return dataLinks.map((singleLink: SLink, index: number): React.ReactNode => {\n const onMouseOut = () => {\n this._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={this._fillStreamColors(singleLink, gradientUrl)}\n stroke={this._fillStreamBorder(singleLink, gradientUrl)}\n strokeWidth=\"2\"\n strokeOpacity={this._getOpacityStreamBorder(singleLink)}\n onMouseOver={event => this._onStreamHover(event, singleLink, from)}\n onMouseOut={onMouseOut}\n onFocus={event => this._onFocusLink(event, singleLink, from)}\n onBlur={this._onBlur}\n fillOpacity={this._getOpacityStream(singleLink)}\n data-is-focusable={true}\n aria-label={aria}\n role=\"img\"\n />\n </g>\n );\n });\n }\n return [];\n }\n\n private _createNodes(\n classNames: IProcessedStyleSet<ISankeyChartStyles>,\n dataNodes: SNode[],\n nodeAttributes: ItemValues<RenderedNodeAttributes>,\n tooltipDiv: TooltipDiv,\n ): React.ReactNode[] | undefined {\n if (dataNodes) {\n const state = this.state;\n const textAnchor = this._isRtl ? 'end' : 'start';\n return dataNodes.map((singleNode: SNode, index: number): React.ReactNode => {\n const onMouseOut = () => {\n this._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(state, 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={this._fillNodeColors(singleNode)}\n id={nodeId}\n onMouseOver={this._onHover.bind(this, singleNode)}\n onMouseOut={onMouseOut}\n onFocus={this._onCloseCallout.bind(this)}\n stroke={this._fillNodeBorder(singleNode)}\n strokeWidth=\"2\"\n opacity=\"1\"\n data-is-focusable={true}\n aria-label={aria}\n role=\"img\"\n />\n {height > MIN_HEIGHT_FOR_TYPE && (\n <g className={classNames.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={this._showTooltip.bind(this, name, isTruncated, tooltipDiv)}\n onMouseOut={this._hideTooltip.bind(this, tooltipDiv)}\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 ? this._formatNumber(actualValue) : actualValue}\n </text>\n </g>\n )}\n </g>\n );\n });\n }\n }\n\n private _onLeave(singleNode: SNode) {\n if (this.state.selectedState) {\n this.setState({\n selectedState: false,\n selectedNodes: new Set<number>(),\n selectedLinks: new Set<number>(),\n selectedNode: undefined,\n });\n }\n }\n\n private _onHover(singleNode: SNode, mouseEvent: React.MouseEvent<SVGElement>) {\n mouseEvent.persist();\n this._onCloseCallout();\n if (!this.state.selectedState) {\n const selectedLinks = getSelectedLinks(singleNode);\n const selectedNodes = getSelectedNodes(selectedLinks);\n selectedNodes.push(singleNode);\n this.setState({\n selectedState: true,\n selectedNodes: new Set<number>(Array.from(selectedNodes).map(node => node.index)),\n selectedLinks: new Set<number>(Array.from(selectedLinks).map(link => link.index!)),\n selectedNode: singleNode,\n refSelected: mouseEvent, //this._refArray.get(index),\n isCalloutVisible: singleNode.y1! - singleNode.y0! < MIN_HEIGHT_FOR_TYPE,\n color: singleNode.color,\n xCalloutValue: singleNode.name,\n yCalloutValue: this._formatNumber(singleNode.actualValue!),\n });\n }\n }\n\n private _formatNumber(value: number): string {\n return this.props.formatNumberOptions\n ? value.toLocaleString(undefined, this.props.formatNumberOptions)\n : value.toString();\n }\n\n private _onStreamHover(mouseEvent: React.MouseEvent<SVGElement>, singleLink: SLink, from: string) {\n mouseEvent.persist();\n this._onCloseCallout();\n if (!this.state.selectedState) {\n const { selectedLinks, selectedNodes } = getSelectedLinksforStreamHover(singleLink);\n this.setState({\n selectedState: true,\n selectedNodes: new Set<number>(Array.from(selectedNodes).map(node => node.index!)),\n selectedLinks: new Set<number>(Array.from(selectedLinks).map(link => link.index!)),\n refSelected: mouseEvent,\n ...this._linkCalloutAttributes(singleLink, from),\n });\n }\n }\n\n private _onStreamLeave(singleLink: SLink) {\n if (this.state.selectedState) {\n this.setState({\n selectedState: false,\n selectedNodes: new Set<number>(),\n selectedLinks: new Set<number>(),\n selectedLink: undefined,\n });\n }\n }\n\n private _onFocusLink(element: 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 element.persist();\n this._onCloseCallout();\n this.setState({\n refSelected: element.currentTarget,\n ...this._linkCalloutAttributes(singleLink, from),\n });\n }\n\n private _onCloseCallout = () => {\n this.setState({\n isCalloutVisible: false,\n refSelected: undefined,\n descriptionMessage: '',\n });\n };\n\n private _onBlur = (): void => {\n /**/\n };\n\n private _fillNodeColors = (singleNode: SNode): string | undefined => {\n const state = this.state;\n if (!state.selectedState) {\n return singleNode.color;\n } else {\n const selectedNode = state.selectedNode;\n if (selectedNode && state.selectedNodes.has(singleNode.index!)) {\n return selectedNode.color;\n } else if (!selectedNode) {\n return singleNode.color;\n }\n }\n };\n\n private _fillStreamColors(singleLink: SLink, gradientUrl: string): string | undefined {\n const state = this.state;\n if (state.selectedState && state.selectedLinks.has(singleLink.index!)) {\n const selectedNode = state.selectedNode;\n return selectedNode ? selectedNode.color : gradientUrl;\n }\n }\n\n private _fillStreamBorder(singleLink: SLink, gradientUrl: string): string {\n const state = this.state;\n if (!state.selectedState) {\n return NON_SELECTED_NODE_AND_STREAM_COLOR;\n } else {\n if (state.selectedLinks.has(singleLink.index!)) {\n const selectedNode = state.selectedNode;\n return selectedNode ? selectedNode.borderColor! : gradientUrl;\n }\n return NON_SELECTED_NODE_AND_STREAM_COLOR;\n }\n }\n\n private _fillNodeBorder = (singleNode: SNode): string => {\n const state = this.state;\n if (!state.selectedState) {\n return singleNode.borderColor!;\n } else {\n if (state.selectedNodes.has(singleNode.index!)) {\n const selectedNode = state.selectedNode;\n return selectedNode ? selectedNode.borderColor! : singleNode.borderColor!;\n }\n return singleNode.borderColor!;\n }\n };\n\n private _getOpacityStream(singleLink: SLink): number {\n const state = this.state;\n if (state.selectedState) {\n if (!state.selectedLinks.has(singleLink.index!)) {\n return NON_SELECTED_OPACITY;\n } else if (!state.selectedNode) {\n return SELECTED_STREAM_OPACITY;\n }\n }\n return REST_STREAM_OPACITY;\n }\n\n private _getOpacityStreamBorder(singleLink: SLink): number {\n const state = this.state;\n if (state.selectedState && !state.selectedLinks.has(singleLink.index!) && !state.selectedNode) {\n return NON_SELECTED_STREAM_BORDER_OPACITY;\n }\n\n return NON_SELECTED_OPACITY;\n }\n\n private _fitParentContainer(): void {\n const { containerWidth, containerHeight } = this.state;\n this._reqID = requestAnimationFrame(() => {\n // NOTE: Calls to this method trigger a re-render.\n const container = this.props.parentRef ? this.props.parentRef : this.chartContainer;\n const currentContainerWidth =\n container &&\n (this.props.enableReflow\n ? Math.max(container.getBoundingClientRect().width, this._calculateChartMinWidth())\n : container.getBoundingClientRect().width);\n const currentContainerHeight = container && container.getBoundingClientRect().height;\n const shouldResize = containerWidth !== currentContainerWidth || containerHeight !== currentContainerHeight;\n if (shouldResize) {\n this.setState({\n containerWidth: currentContainerWidth,\n containerHeight: currentContainerHeight,\n });\n }\n });\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _showTooltip(text: string, checkTrcuncated: boolean, div: any, evt: any) {\n if (checkTrcuncated) {\n //Fixing tooltip position by attaching it to the element rather than page\n div.style('opacity', 0.9).style('color', this.props.theme!.palette.neutralPrimary);\n div\n .html(text)\n .style('left', evt.pageX + 'px')\n .style('top', evt.pageY - 28 + 'px');\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private _hideTooltip(div: any) {\n div.style('opacity', 0);\n }\n\n private _isChartEmpty() {\n const sankeyChartData = this.props.data?.SankeyChartData;\n return !(sankeyChartData && sankeyChartData.nodes.length > 0 && sankeyChartData.links.length > 0);\n }\n\n private _calculateChartMinWidth = (): number => {\n return (\n this._margins.left! +\n this._margins.right! +\n // total width of all node columns\n this._numColumns * NODE_WIDTH +\n // minimum total width of all column gaps\n (this._numColumns - 1) * (NODE_WIDTH / 2)\n );\n };\n}\n"]}
@@ -8,7 +8,7 @@ import { classNamesFunction, getId, getRTL, initializeComponentRef } from '@flue
8
8
  import { DirectionalHint } from '@fluentui/react/lib/Callout';
9
9
  import { CartesianChart, ChartHoverCard, Legends, } from '../../index';
10
10
  import { FocusZoneDirection } from '@fluentui/react-focus';
11
- import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVerticalNumericMinMaxOfY, createNumericYAxis, domainRageOfVerticalNumeric, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfXStringAxis, createStringYAxis, formatDate, getNextGradient, areArraysEqual, } from '../../utilities/index';
11
+ import { ChartTypes, getAccessibleDataObject, XAxisTypes, getTypeOfAxis, tooltipOfXAxislabels, formatValueWithSIPrefix, getBarWidth, getScalePadding, isScalePaddingDefined, calculateAppropriateBarWidth, findVerticalNumericMinMaxOfY, createNumericYAxis, domainRageOfVerticalNumeric, domainRangeOfDateForAreaLineVerticalBarChart, domainRangeOfXStringAxis, createStringYAxis, formatDate, getNextGradient, areArraysEqual, calculateLongestLabelWidth, } from '../../utilities/index';
12
12
  var CircleVisbility;
13
13
  (function (CircleVisbility) {
14
14
  CircleVisbility["show"] = "visibility";
@@ -398,6 +398,8 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
398
398
  _this._domainMargin = MIN_DOMAIN_MARGIN;
399
399
  /** Total width available to render the bars */
400
400
  var totalWidth = containerWidth - (_this.margins.left + MIN_DOMAIN_MARGIN) - (_this.margins.right + MIN_DOMAIN_MARGIN);
401
+ /** Rate at which the space between the bars changes wrt the bar width */
402
+ var barGapRate = _this._xAxisInnerPadding / (1 - _this._xAxisInnerPadding);
401
403
  if (_this._xAxisType === XAxisTypes.StringAxis) {
402
404
  if (isScalePaddingDefined(_this.props.xAxisOuterPadding, _this.props.xAxisPadding)) {
403
405
  // Setting the domain margin for string x-axis to 0 because the xAxisOuterPadding prop is now available
@@ -405,8 +407,6 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
405
407
  _this._domainMargin = 0;
406
408
  }
407
409
  else if (_this.props.barWidth !== 'auto') {
408
- /** Rate at which the space between the bars changes wrt the bar width */
409
- var barGapRate = _this._xAxisInnerPadding / (1 - _this._xAxisInnerPadding);
410
410
  // Update the bar width so that when CartesianChart rerenders,
411
411
  // the following calculations don't use the previous bar width.
412
412
  _this._barWidth = getBarWidth(_this.props.barWidth, _this.props.maxBarWidth);
@@ -417,6 +417,18 @@ var VerticalBarChartBase = /** @class */ (function (_super) {
417
417
  _this._domainMargin = MIN_DOMAIN_MARGIN + (totalWidth - reqWidth) / 2;
418
418
  }
419
419
  }
420
+ else if (_this.props.mode === 'plotly' && _this._xAxisLabels.length > 1) {
421
+ // Calculate the remaining width after rendering bars at their maximum allowable width
422
+ var bandwidth = totalWidth / (_this._xAxisLabels.length + (_this._xAxisLabels.length - 1) * barGapRate);
423
+ var barWidth = getBarWidth(_this.props.barWidth, _this.props.maxBarWidth, bandwidth);
424
+ var reqWidth = (_this._xAxisLabels.length + (_this._xAxisLabels.length - 1) * barGapRate) * barWidth;
425
+ var margin1 = (totalWidth - reqWidth) / 2;
426
+ // Calculate the remaining width after accounting for the space required to render x-axis labels
427
+ var step = calculateLongestLabelWidth(_this._xAxisLabels) + 20;
428
+ reqWidth = (_this._xAxisLabels.length - _this._xAxisInnerPadding) * step;
429
+ var margin2 = (totalWidth - reqWidth) / 2;
430
+ _this._domainMargin = MIN_DOMAIN_MARGIN + Math.max(0, Math.min(margin1, margin2));
431
+ }
420
432
  }
421
433
  else {
422
434
  var data = ((_a = _this.props.data) === null || _a === void 0 ? void 0 : _a.map(function (point) { return point.x; })) || [];