I'm having problem with the legend title being cropped when I resize my WinForms.
I've already set TeeChart to Fill. When resize, the legend title will move to 2nd line when most of the title is being cropped.
please refer to attachment.
Legend title cropped
Legend title cropped
- Attachments
-
- TeeChartLegend-TitleCropped.png (29.55 KiB) Viewed 8021 times
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Legend title cropped
Hello,
You can modify the column widths of the Legend using code such as the following:
which here gives me:
You can modify the column widths of the Legend using code such as the following:
Code: Select all
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
for (int i = 0; i < 4; i++)
{
tChart1.Series.Add(typeof(Line));
tChart1[i].FillSampleValues();
tChart1[i].Title = "Se title of seventy characters " + i.ToString();
}
tChart1.Legend.Alignment = LegendAlignments.Bottom;
tChart1.Legend.ColumnWidthAuto = false;
tChart1.Legend.ColumnWidths[0] = 10;
tChart1.Legend.ColumnWidths[1] = 300;
}
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 |
Re: Legend title cropped
Hi Christopher, thanks for your reply. Is there another way besides hard code the column width. Because my legend display title is dynamic not a fixed characters.
-
- Guru
- Posts: 1603
- Joined: Fri Nov 15, 2002 12:00 am
Re: Legend title cropped
As you can see in the code, the options are either to have ColumnWidthAuto set to true or to false.user2016 wrote:Hi Christopher, thanks for your reply. Is there another way besides hard code the column width. Because my legend display title is dynamic not a fixed characters.
What you could consider is measuring the length of your dynamic legend display title and then turning ColumnWidthAuto on or off as required - the limit for turning on or off will depend on the height and width of the chart, a few empirical tests should be able to determine for you what it will be.
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 |