Skip to content

Commit

Permalink
Showing total values when multiple legends are selected
Browse files Browse the repository at this point in the history
  • Loading branch information
srmukher committed Dec 12, 2024
1 parent 24ce6bf commit 434fc6d
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,18 @@ export class DonutChartBase extends React.Component<IDonutChartProps, IDonutChar
const highlightedLegends = this._getHighlightedLegend();
if (valueInsideDonut !== undefined && (highlightedLegends.length > 0 || this.state.showHover)) {
let legendValue = valueInsideDonut;
let totalValue = 0;
data!.map((point: IChartDataPoint, index: number) => {
if (
highlightedLegends.includes(point.legend!) ||
(this.state.showHover && point.legend === this.state.legend)
) {
legendValue = point.yAxisCalloutData ? point.yAxisCalloutData : point.data!;
totalValue += point.data!;
}
return;
});
legendValue = totalValue === 0 ? legendValue : totalValue;
return legendValue;
} else {
return valueInsideDonut;
Expand Down

0 comments on commit 434fc6d

Please sign in to comment.