Use legend's checkBox to control series display or not

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
swip
Newbie
Newbie
Posts: 8
Joined: Mon Jul 18, 2005 4:00 am

Use legend's checkBox to control series display or not

Post by swip » Mon Oct 29, 2007 3:18 am

HI
I'm using TeeChart Pro v2 for Visual Studio .NET

Code: Select all

chart.Legend.CheckBoxes = true;
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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Oct 30, 2007 9:05 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Mike Jones
Advanced
Posts: 192
Joined: Thu Feb 01, 2007 12:00 am
Contact:

similar issue

Post by Mike Jones » Wed Feb 20, 2008 10:39 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 21, 2008 9:21 am

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();			
					}
				}				
			}
		}
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply