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.
Not all series visible in legend when form is small
-
- 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
Hi Adrian,
Yes, you can do something like this:
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 |
Instructions - How to post in this forum |