Not all series visible in legend when form is small

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Adrian
Newbie
Newbie
Posts: 34
Joined: Thu Oct 25, 2007 12:00 am

Not all series visible in legend when form is small

Post by Adrian » Sun Aug 23, 2009 2:48 am

I've noticed that if the form containing TC is quite small and I have a largish number of series in the TC then not all series are shown in the legend. If I resize the form making it bigger the missing series appear in the legend, reducing the size and the series dissapear again. This is dependant upon the font size used for the legend items, smaller font, more items.

I understand that there is a scroll bar option but this wont work for me as I use an export of the image in documents, the export also doesn't show all legend items.

is there some way to determine that not all series are visible in the legend? alternativle is there some way to automatically change the font size for legend items to ensure that all items are visible.

Adrian.

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

Re: Not all series visible in legend when form is small

Post by Narcís » Mon Aug 24, 2009 11:38 am

Hi Adrian,

Yes, you can do something like this:

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private void InitializeChart()
		{
			tChart1.Dock = DockStyle.Fill;

			for (int i = 0; i < 10; i++)
			{
				tChart1.Series.Add(new Steema.TeeChart.Styles.Bar());
				tChart1[i].FillSampleValues();
			}

			tChart1.GetLegendRect += new Steema.TeeChart.GetLegendRectEventHandler(tChart1_GetLegendRect);
		}

		void tChart1_GetLegendRect(object sender, Steema.TeeChart.GetLegendRectEventArgs e)
		{
			for (int i = 0; i < tChart1.Legend.Items.Count; i++)
			{
				Point p = new Point(tChart1.Legend.Items[i].Left, tChart1.Legend.Items[i].Top);
				if ((!e.Rectangle.Contains(p)) && (tChart1.Legend.Font.Size>1))
				{
					tChart1.Legend.Font.Size--;
				}
			}
		}
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