Hi Davy,
Greetings from Syncfusion.
We have validated your reported scenario. As of now, we don’t have direct property to display the stacking group name as legend name. We suggest you to use OnLegendItemRender event to customize the legend text. This event will be triggered for each legend item rendering. In the sample, we have changed 1st and 3rd legend names based on provided stacking group name and cancelled 2nd and 4th legends.
|
<SfChart>
<ChartEvents OnLegendItemRender="LegendRender"></ChartEvents>
</SfChart>
@code{
public int count = 0;
public void LegendRender(LegendRenderEventArgs args)
{
if (count == 1 || count == 3)
{
args.Cancel = true;
}
args.Text = count == 0 ? "A" : (count == 2 ? "B" : "");
count = count + 1;
}
} |
Kindly revert us if you have any concerns.
Regards,
Durga G