Legend.Width
Legend.Width
Hi,
I want my legend to be of a fixed size so I set AutoSize to false. But always when I try to set the Width property it resets itself back to its old value. What am I doing wrong?
I want my legend to be of a fixed size so I set AutoSize to false. But always when I try to set the Width property it resets itself back to its old value. What am I doing wrong?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi ctusch,
Could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
Could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
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,
Thanks for the example project. I could reproduce the issue here and it's probable they are related. I've added the bug (TF02013088) to our defect lst to be fixed for next releases. In the meantime you can set custom legend position:
Thanks for the example project. I could reproduce the issue here and it's probable they are related. I've added the bug (TF02013088) to our defect lst to be fixed for next releases. In the meantime you can set custom legend position:
Code: Select all
public Form1()
{
InitializeComponent();
Line line = new Line();
this.tChart1.Series.Add(line);
line.Add(1, 0);
line.Add(2, 2);
line.Add(3, 3);
line.Add(4, 3);
tChart1.Legend.AutoSize = false;
tChart1.Panel.MarginRight = 20;
tChart1.Legend.CustomPosition = true;
Bitmap bmp = tChart1.Bitmap;
Rectangle rect = tChart1.Chart.ChartRect;
tChart1.Legend.Left = rect.Right + 10;
tChart1.Legend.Top = rect.Top;
}
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,
Yes, in that case you'll need to use AfterDraw and Resize events like this:
Yes, in that case you'll need to use AfterDraw and Resize events like this:
Code: Select all
public Form1()
{
InitializeComponent();
Line line = new Line();
this.tChart1.Series.Add(line);
line.Add(1, 0);
line.Add(2, 2);
line.Add(3, 3);
line.Add(4, 3);
tChart1.Legend.AutoSize = false;
tChart1.Panel.MarginRight = 20;
tChart1.Legend.CustomPosition = true;
Bitmap bmp = tChart1.Bitmap;
}
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Rectangle rect = tChart1.Chart.ChartRect;
tChart1.Legend.Left = rect.Right + 10;
tChart1.Legend.Top = rect.Top;
}
private void tChart1_Resize(object sender, EventArgs e)
{
Bitmap bmp = tChart1.Bitmap;
}
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,
In that case you can implement AfterDraw event like this:
In that case you can implement AfterDraw event like this:
Code: Select all
private void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
{
Rectangle rect = tChart1.Chart.ChartRect;
//tChart1.Legend.Left = tChart1.Width - 100;
tChart1.Legend.Left = tChart1.Width - tChart1.Legend.Width;
tChart1.Legend.Top = rect.Top;
}
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, a TeeChart for .NET developers pointed me out that he doesn't think TF02013088 is a bug. When you set AutoSize to false, you have to set the width and height manually. The following code works as expected:
As an update, a TeeChart for .NET developers pointed me out that he doesn't think TF02013088 is a bug. When you set AutoSize to false, you have to set the width and height manually. The following code works as expected:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line();
this.tChart1.Series.Add(line);
line.Add(1, 0);
line.Add(2, 2);
line.Add(3, 3);
line.Add(4, 3);
tChart1.Legend.Width = 50;
tChart1.Legend.Height = 100;
tChart1.Legend.AutoSize = false;
}
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, a TeeChart for .NET developers pointed me out that he doesn't think TF02013088 is a bug. When you set AutoSize to false, you have to set the width and height manually. The following code works as expected:
As an update, a TeeChart for .NET developers pointed me out that he doesn't think TF02013088 is a bug. When you set AutoSize to false, you have to set the width and height manually. The following code works as expected:
Code: Select all
public Form1()
{
InitializeComponent();
InitializeChart();
}
private void InitializeChart()
{
Steema.TeeChart.Styles.Line line = new Steema.TeeChart.Styles.Line();
this.tChart1.Series.Add(line);
line.Add(1, 0);
line.Add(2, 2);
line.Add(3, 3);
line.Add(4, 3);
tChart1.Legend.Width = 50;
tChart1.Legend.Height = 100;
tChart1.Legend.AutoSize = false;
}
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 |