Page 1 of 1
Use legend's checkBox to control series display or not
Posted: Mon Oct 29, 2007 3:18 am
by 9637789
HI
I'm using TeeChart Pro v2 for Visual Studio .NET
could set CheckBoxes enables/disables the display of Legend check boxes. But,how can Use legend's checkBox to control series display or not;
Please response me ASAP!
Thanks
Posted: Tue Oct 30, 2007 9:05 am
by narcis
Hi swip,
I'm not sure about what you are looking for. You can try using this:
Code: Select all
tChart1[0].Active = !tChart1[0].Active;
If this doesn't help please give us some more details about what are you trying to achieve.
Thanks in advance.
similar issue
Posted: Wed Feb 20, 2008 10:39 pm
by 8739068
I would like to programatically click the check box of an item in the legend. My situation is such that I have several hundred series's in my chart. Most of which have their ShowInLegend property = false. I do have lets say 5 series's that do have the ShowInLegend property = true. How can I locate the series that is associated with Legend.Items[2] lets say?
I see that the Legend has a property called Series, but it is null. I don't see an easy way to find the series associated with a legend item.
I am using the latest version .NET version 3 of TeeChart
Posted: Thu Feb 21, 2008 9:21 am
by narcis
Hi Mike,
If you are displaying series names you can do something like this:
Code: Select all
public Form1()
{
InitializeComponent();
for (int i = 0; i < 5; i++)
{
tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
tChart1[i].FillSampleValues();
if (i%2==0)
{
tChart1[i].ShowInLegend = false;
}
}
tChart1.ClickLegend += new MouseEventHandler(tChart1_ClickLegend);
}
void tChart1_ClickLegend(object sender, MouseEventArgs e)
{
int index = tChart1.Legend.Clicked(e.X, e.Y);
if (index != -1)
{
for (int j = 0; j < tChart1.Series.Count; j++)
{
if ((tChart1[j].ShowInLegend) && (tChart1.Legend.Items[index].Text ==tChart1[j].Title))
{
tChart1.Header.Text = "Series selected: " + j.ToString();
}
}
}
}