Page 1 of 1
How to get axis on Click or double click on axis.
Posted: Fri Jul 15, 2016 5:26 am
by 9526439
Hi steema support,
We have one regarding how to get axis click or double click on Multiple Custom axis as shown in attached image.
In this i have four custom axis and i want to get that particular axis when i click or double click on axis.
- custom multiple axis.
- Custom multiple Axis.png (31.62 KiB) Viewed 6858 times
Kindly suggest any solution asap.
Thanks in advance.
Re: How to get axis on Click or double click on axis.
Posted: Fri Jul 15, 2016 8:51 am
by Christopher
Hello!
Yes, you should be able to use code such as this:
Code: Select all
private void InitializeChart()
{
Line line1 = new Line(tChart1.Chart);
Line line2 = new Line(tChart1.Chart);
Axis axis = tChart1.Axes.Custom.Add();
axis.RelativePosition = 20;
line2.CustomVertAxis = axis;
line1.FillSampleValues();
line2.FillSampleValues();
tChart1.ClickAxis += TChart1_ClickAxis;
}
private void TChart1_ClickAxis(object sender, MouseEventArgs e)
{
Axis axis = sender as Axis;
string message = "";
int custIndex = tChart1.Axes.Custom.IndexOf(axis);
if (custIndex > -1)
{
message = "Custom Axis " + custIndex.ToString();
}
else
{
if(tChart1.Axes.Left.Equals(axis))
{
message = "Left Axis";
}
else if(tChart1.Axes.Bottom.Equals(axis))
{
message = "Bottom Axis";
}
}
MessageBox.Show(message);
}