How to highlight selected line when clicked item in legend box

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
goodsj
Newbie
Newbie
Posts: 18
Joined: Thu Jan 25, 2018 12:00 am

How to highlight selected line when clicked item in legend box

Post by goodsj » Mon Nov 26, 2018 8:46 am

Hola

Please explain how to highlight the one line among More than one series.

Is there an option like when I clicked a item in legend, the others become blurred at tee chart?
chart.png
chart.png (28.31 KiB) Viewed 8287 times
Thank you for tee-chart

Christopher
Guru
Posts: 1603
Joined: Fri Nov 15, 2002 12:00 am

Re: How to highlight selected line when clicked item in legend box

Post by Christopher » Tue Nov 27, 2018 8:10 am

Hello,

one option would be to highlight the series clicked in the legend by making the other series more transparent, e.g.

Code: Select all

		private void InitializeChart()
		{
			for (int i = 0; i < 4; i++)
			{
				tChart1.Series.Add(typeof(Line)).FillSampleValues();
			}

			tChart1.ClickLegend += TChart1_ClickLegend;
		}

		private void TChart1_ClickLegend(object sender, MouseEventArgs e)
		{
			int index = tChart1.Legend.Clicked(e.X, e.Y);

			if(index > -1)
			{
				for (int i = 0; i < tChart1.Series.Count; i++)
				{
					tChart1[i].Transparency = 0;

					if (i != index)
					{
						tChart1[i].Transparency = 70;
					}
				}
			}
		}
Thank you for tee-chart
You're very welcome :)
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

Post Reply