Hello,
how can I set a fixed legend width? When I try so in the VS designer it always resets the Width value although I have set AutoSize to false.
Thanks in advance!
fixed legend width
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi ctusch,
As you can see on this thread there's a problem with that. As Pep suggests, using code below works fine.
As you can see on this thread there's a problem with that. As Pep suggests, using code below works fine.
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
void InitializeChart()
{
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.Legend.CustomPosition = true;
tChart1.Legend.Left = 10;
tChart1.Legend.Top = 10;
tChart1.Legend.CheckBoxes = true;
tChart1.Legend.Height = 50;
tChart1.Legend.Width = 50;
tChart1.Legend.AutoSize = false;
tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
}
void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
tChart1.Legend.Transparent = true;
tChart1.Graphics3D.Rectangle(10, 10, 250, 250);
tChart1.Legend.Paint();
}
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi ctusch,
As an update, we found that disabling checkboxes code below works fine without the need of the AfterDraw event.
As an update, we found that disabling checkboxes code below works fine without the need of the AfterDraw event.
Code: Select all
void InitializeChart()
{
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.Legend.CustomPosition = true;
tChart1.Legend.Left = 10;
tChart1.Legend.Top = 10;
tChart1.Legend.AutoSize = false;
tChart1.Legend.Height = 150;
tChart1.Legend.Width = 150;
}
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 |
Hello Narcis,
thanks for your answer. Finally I've found the reason (i.e. the checkboxes) why I couldn't reproduce the bug when I posted about my problem back in May. Disabling the checkboxes is okay for now but do you have an estimate when the bug will get fixed?
A further problem I have: I want the Height of the Legend to be the same as when autosized, i.e. so it fits its content. Is there a way to get the height of all the text in the legend so I can set it manually?
thanks for your answer. Finally I've found the reason (i.e. the checkboxes) why I couldn't reproduce the bug when I posted about my problem back in May. Disabling the checkboxes is okay for now but do you have an estimate when the bug will get fixed?
A further problem I have: I want the Height of the Legend to be the same as when autosized, i.e. so it fits its content. Is there a way to get the height of all the text in the legend so I can set it manually?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hello ctusch,
Yes, this issue (TF02013331) was fixed yesterday so you can expect this to be fixed for the next maintenance release due out in two weeks.thanks for your answer. Finally I've found the reason (i.e. the checkboxes) why I couldn't reproduce the bug when I posted about my problem back in May. Disabling the checkboxes is okay for now but do you have an estimate when the bug will get fixed?
Yes, you can do this:A further problem I have: I want the Height of the Legend to be the same as when autosized, i.e. so it fits its content. Is there a way to get the height of all the text in the legend so I can set it manually?
Code: Select all
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.Draw();
int tmp = tChart1.Legend.Height;
tChart1.Legend.CustomPosition = true;
tChart1.Legend.Left = 10;
tChart1.Legend.Top = 10;
tChart1.Legend.AutoSize = false;
tChart1.Legend.Height = 150;
tChart1.Legend.Width = tmp;
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 |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi ctusch,
Sorry, I assigned tmp to Width when I should have assigned it to Height. The idea is drawing the chart so that automatic legend is calculated then get its Height and use it for custom dimensions setting. This works fine here:
Sorry, I assigned tmp to Width when I should have assigned it to Height. The idea is drawing the chart so that automatic legend is calculated then get its Height and use it for custom dimensions setting. This works fine here:
Code: Select all
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
line1.FillSampleValues();
tChart1.Draw();
int tmp = tChart1.Legend.Height;
//tChart1.Legend.CustomPosition = true;
//tChart1.Legend.Left = 10;
//tChart1.Legend.Top = 10;
tChart1.Legend.AutoSize = false;
tChart1.Legend.Height = tmp;
tChart1.Legend.Width = 150;
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 |