Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
Comment thread
Anush2303 marked this conversation as resolved.
"type": "patch",
"comment": "fix incomplete donut and VSBC bug",
"packageName": "@fluentui/react-charts",
"email": "anushgupta@microsoft.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -1485,6 +1485,7 @@ export const transformPlotlyJsonToVSBCProps = (
showYAxisLables: true,
noOfCharsToTruncate: 20,
showYAxisLablesTooltip: true,
roundedTicks: true,
...getTitles(input.layout),
...getXAxisTickFormat(input.data[0], input.layout),
...yAxisTickFormat,
Expand Down Expand Up @@ -2458,6 +2459,14 @@ export const transformPlotlyJsonToSankeyProps = (
colorMap,
isDarkTheme,
);
const extractedLinkColors = extractColor(
input.layout?.template?.layout?.colorway,
colorwayType,
link?.color,
colorMap,
isDarkTheme,
);

const sankeyChartData = {
nodes: node.label?.map((label: string, index: number) => {
const color = resolveColor(
Expand All @@ -2477,8 +2486,17 @@ export const transformPlotlyJsonToSankeyProps = (
}),
// eslint-disable-next-line @typescript-eslint/no-explicit-any
links: validLinks.map((validLink: any, index: number) => {
const color = resolveColor(
extractedLinkColors,
index,
validLink.target,
colorMap,
input.layout?.template?.layout?.colorway,
isDarkTheme,
);
return {
...validLink,
color,
};
}),
} as SankeyChartData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4639,76 +4639,91 @@ Object {
"SankeyChartData": Object {
"links": Array [
Object {
"color": "#fde3d4",
"source": 0,
"target": 5,
"value": 20,
},
Object {
"color": "#f27420",
"source": 0,
"target": 6,
"value": 3,
},
Object {
"color": "#fde3d4",
"source": 0,
"target": 7,
"value": 5,
},
Object {
"color": "#dbe9f6",
"source": 1,
"target": 5,
"value": 14,
},
Object {
"color": "#4994ce",
"source": 1,
"target": 6,
"value": 1,
},
Object {
"color": "#dbe9f6",
"source": 1,
"target": 7,
"value": 1,
},
Object {
"color": "#fabc13",
"source": 2,
"target": 5,
"value": 3,
},
Object {
"color": "#fabc13",
"source": 2,
"target": 6,
"value": 17,
},
Object {
"color": "#fabc13",
"source": 2,
"target": 7,
"value": 2,
},
Object {
"color": "#7fc241",
"source": 3,
"target": 5,
"value": 3,
},
Object {
"color": "#7fc241",
"source": 3,
"target": 6,
"value": 9,
},
Object {
"color": "#7fc241",
"source": 3,
"target": 7,
"value": 2,
},
Object {
"color": "#d3d3d3",
"source": 4,
"target": 5,
"value": 5,
},
Object {
"color": "#d3d3d3",
"source": 4,
"target": 6,
"value": 9,
},
Object {
"color": "#d3d3d3",
"source": 4,
"target": 7,
"value": 8,
Expand Down Expand Up @@ -5578,6 +5593,7 @@ Object {
"mode": "plotly",
"noOfCharsToTruncate": 20,
"roundCorners": true,
"roundedTicks": true,
"showYAxisLables": true,
"showYAxisLablesTooltip": true,
"width": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,17 @@ export const Pie: React.FunctionComponent<PieProps> = React.forwardRef<HTMLDivEl
}

const { data } = props;
const focusData = pieForFocusRing(data.map(d => d.data!));

// Filter out data points with value 0 to avoid gaps in the donut chart
const filteredData = data.filter((d: ChartDataPoint) => d.data !== 0);

const focusData = pieForFocusRing(filteredData.map(d => d.data!));

const piechart = d3Pie<ChartDataPoint>()
.sort(null)
// eslint-disable-next-line @typescript-eslint/no-explicit-any
.value((d: any) => d.data)
.padAngle(0.02)(data);
.padAngle(0.02)(filteredData);
const translate = `translate(${props.width / 2}, ${props.height / 2})`;

_totalValue = _computeTotalValue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ export const SankeyChart: React.FunctionComponent<SankeyChartProps> = React.forw

const _fillStreamColors = (singleLink: SLink, gradientUrl: string): string | undefined => {
Comment thread
Anush2303 marked this conversation as resolved.
if (selectedState && selectedLinks.has(singleLink.index!)) {
return selectedNode ? selectedNode.color : gradientUrl;
return singleLink ? singleLink.color : selectedNode ? selectedNode.color : gradientUrl;
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10405,7 +10405,6 @@ exports[`SankeyChart - mouse events Should render callout correctly on mouseover
<path
aria-label="link from 124.360.55.1 to Junk Folder with weight 14"
d="M172,311.726C283,311.726,283,320.523,394,320.523L394,343.537C283,343.537,283,334.74,172,334.74Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_33_-3"
role="img"
Expand Down Expand Up @@ -10834,7 +10833,6 @@ exports[`SankeyChart - mouse events Should render callout correctly on mouseover
<path
aria-label="link from Junk Folder to No further action required with weight 60"
d="M518,274.496C629,274.496,629,275.194,740,275.194L740,373.825C629,373.825,629,373.126,518,373.126Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_33_-10"
role="img"
Expand Down Expand Up @@ -11422,7 +11420,6 @@ Object {
<path
aria-label="link from 172.152.48.13 to inbox with weight 50"
d="M172,175.507C283,175.507,283,169.194,394,169.194L394,251.386C283,251.386,283,257.699,172,257.699Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-1"
role="img"
Expand Down Expand Up @@ -11460,7 +11457,6 @@ Object {
<path
aria-label="link from 172.152.48.13 to Junk Folder with weight 28"
d="M172,257.699C283,257.699,283,274.496,394,274.496L394,320.523C283,320.523,283,303.726,172,303.726Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-2"
role="img"
Expand Down Expand Up @@ -11853,7 +11849,6 @@ Object {
<path
aria-label="link from inbox to Clicked with weight 30"
d="M518,37.687C629,37.687,629,36,740,36L740,85.315C629,85.315,629,87.002,518,87.002Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-8"
role="img"
Expand Down Expand Up @@ -11891,7 +11886,6 @@ Object {
<path
aria-label="link from inbox to Opened with weight 55"
d="M518,87.002C629,87.002,629,93.315,740,93.315L740,183.726C629,183.726,629,177.413,518,177.413Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-9"
role="img"
Expand Down Expand Up @@ -11929,7 +11923,6 @@ Object {
<path
aria-label="link from Junk Folder to No further action required with weight 60"
d="M518,274.496C629,274.496,629,275.194,740,275.194L740,373.825C629,373.825,629,373.126,518,373.126Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-10"
role="img"
Expand Down Expand Up @@ -12468,7 +12461,6 @@ Object {
<path
aria-label="link from 172.152.48.13 to inbox with weight 50"
d="M172,175.507C283,175.507,283,169.194,394,169.194L394,251.386C283,251.386,283,257.699,172,257.699Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-1"
role="img"
Expand Down Expand Up @@ -12506,7 +12498,6 @@ Object {
<path
aria-label="link from 172.152.48.13 to Junk Folder with weight 28"
d="M172,257.699C283,257.699,283,274.496,394,274.496L394,320.523C283,320.523,283,303.726,172,303.726Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-2"
role="img"
Expand Down Expand Up @@ -12899,7 +12890,6 @@ Object {
<path
aria-label="link from inbox to Clicked with weight 30"
d="M518,37.687C629,37.687,629,36,740,36L740,85.315C629,85.315,629,87.002,518,87.002Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-8"
role="img"
Expand Down Expand Up @@ -12937,7 +12927,6 @@ Object {
<path
aria-label="link from inbox to Opened with weight 55"
d="M518,87.002C629,87.002,629,93.315,740,93.315L740,183.726C629,183.726,629,177.413,518,177.413Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-9"
role="img"
Expand Down Expand Up @@ -12975,7 +12964,6 @@ Object {
<path
aria-label="link from Junk Folder to No further action required with weight 60"
d="M518,274.496C629,274.496,629,275.194,740,275.194L740,373.825C629,373.825,629,373.126,518,373.126Z"
fill="#8764B8"
fill-opacity="1"
id="link_r_2t_-10"
role="img"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,7 @@ interface SLinkExtra {
*/
value: number;
unnormalizedValue?: number;
color?: string;
}

export type SNode = SankeyNode<SNodeExtra, SLinkExtra>;
Expand Down