Hi Mathew,
Thanks for contacting Syncfusion support. We have analyzed your query and find the response for your query below.
Currently we provide axis index value in Axes region and not in AxesLabel region, so you can’t able to get axis index value when you clicked in axis label region. We have created improvement task and for better follow up, we have created branch incident under your account.
Since we don’t provide axis index values in AxesLabel region, we have created work around sample in which we have compared the axis line bounds with the mouse position X and Y values obtained in the ChartRegionClick event. Find the code snippet below,
Code Snippet:
void chart_ChartRegionClick(object sender, ChartRegionMouseEventArgs e)
{
var axis = this.chart.Axes;
int x =e.Point.X;
int y = e.Point.Y;
for (int i = 0; i < axis.Count; i++)
{
if (x >= axis[i].Rect.X && x <= axis[i].Rect.X + axis[i].Rect.Width && y >= axis[i].Rect.Y && y <= axis[i].Rect.Y + axis[i].Rect.Height)
{
MessageBox.Show("Axis Index: " + i);
}
}
}
|
Screenshot:
In the screenshot we have highlighted the place where we have clicked in red color.
For your reference we have attached the sample, kindly find the sample from the below link,
Thanks,
Dharani.