Hi Joseph Cellucci,
Greetings from Syncfusion.
We have achieved your requirement “Change the style of the Selected axis label using LabelClicked event” by workaround with the help of RangeStyle property of ChartAxis in LabelCreated event. Please find the code example below.
CodeSnippet:
|
<chart:SfChart.PrimaryAxis>
<chart:CategoryAxis LabelClicked="CategoryAxis_LabelClicked">
</chart:CategoryAxis >
</chart:SfChart.PrimaryAxis> |
|
private void CategoryAxis_LabelClicked(object sender, LabelClickedEventArgs e)
{
var index = (sender as CategoryAxis).VisibleLabels.FindIndex(b => b.LabelContent == e.LabelContent);
ChartAxisRangeStyleCollection rangeStyleCollection = new ChartAxisRangeStyleCollection();
ChartAxisRangeStyle rangeStyle = new ChartAxisRangeStyle()
{
Start = index, End = index,
LabelStyle = new ChartAxisLabelStyle() { TextColor = Color.Blue, FontAttributes = FontAttributes.Bold}
};
rangeStyleCollection.Add(rangeStyle);
(sender as CategoryAxis).RangeStyles = rangeStyleCollection;
} |
Also, we have attached the sample for your reference, please find the sample from the below link.
Output:
For more details, please refer the below link.
Regards,
Yuvaraj.