Hi
To display the checkboxes beside each series in the legend i do this;
theChart.Legend.CheckBoxes = true;
If the user selects a checkbox how do I detect this??
Note. I need to be able to detect whether the checkbox is selected or deselected
Note. I copied this questionto the activeX thread by mistake and Ive had a reply but this does not show how to detect the status of the box.
http://www.teechart.net/support/viewtop ... =1&t=15184
How detect when series checkbox is selected in the legend?
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: How detect when series checkbox is selected in the legend?
Hello!
You could try something like this:
You could try something like this:
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
for (int i = 0; i < 5; i++)
{
tChart1.Series.Add(typeof(Bar)).FillSampleValues();
}
tChart1.Legend.CheckBoxes = true;
}
private void button1_Click(object sender, EventArgs e)
{
int[] states = CheckCheckBoxStates();
string s = "These CheckBoxes active: index(es) = ";
for (int i = 0; i < states.Length; i++)
{
if (states[i] > 0)
s += i.ToString() + " ";
}
MessageBox.Show(s);
}
private int[] CheckCheckBoxStates()
{
List<int> result = new List<int>();
foreach (Series s in tChart1.Series)
{
result.Add(Convert.ToInt32(s.Active));
}
return result.ToArray();
}
Best Regards,
Christopher Ireland / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Re: How detect when series checkbox is selected in the legend?
Sensational! That works. Thanks Christopher