Resize Teechart

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
lilo
Newbie
Newbie
Posts: 29
Joined: Thu Sep 30, 2010 12:00 am

Resize Teechart

Post by lilo » Mon Aug 29, 2011 6:15 am

What is the best way to resize a teechart containing and opengl 3d canvas?

If I resize the 3d opengl teechart in the form_sizechanged event the teechart crashes.

Points1.Chart.Aspect.View3D = True
Points1.Chart.Walls.Visible = True
Points1.Chart.Aspect.Orthogonal = False
Points1.Chart.Aspect.Chart3DPercent = 100
Points1.Chart.Aspect.Zoom = 50
Points1.Chart.Aspect.View3D = True
Rotate1.Active = True
Steema.TeeChart.Drawing.TeeBase.TeeOpenGL.Active = True
TChart1.Dock = DockStyle.None
TChart1.Height = Me.ClientSize.Height - ToolStrip1.Height - MenuStrip1.Height
TChart1.Width = TChart1.Height
Points1.Chart.Aspect.Height3D = Me.ClientSize.Height - ToolStrip1.Height - MenuStrip1.Height
Points1.Chart.Aspect.Width3D = Points1.Chart.Height

If I disable 3D before resizing, the teechart draws correctly. However, when I enable opengl, the 3d opengl is not resized correctly.
Steema.TeeChart.Drawing.TeeBase.TeeOpenGL.Active = False
Points1.Chart.Aspect.View3D = False
Points1.Chart.Walls.Visible = False
Rotate1.Active = False

A windows native 3d teechart resizes correctly using similar code.

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

Re: Resize Teechart

Post by Narcís » Mon Aug 29, 2011 1:31 pm

Hi lilo,

An OpenGL 3D chart resizes fine for me doing something like this:

Code: Select all

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

    Steema.TeeChart.Styles.Points points1;

    private void InitializeChart()
    {
      points1 = new Steema.TeeChart.Styles.Points(tChart1.Chart);
      points1.FillSampleValues();

      points1.Chart.Aspect.View3D = true;
      points1.Chart.Walls.Visible = true;
      points1.Chart.Aspect.Orthogonal = false;
      points1.Chart.Aspect.Chart3DPercent = 100;
      points1.Chart.Aspect.Zoom = 50;
      points1.Chart.Aspect.View3D = true;
      points1.Active = true;

      Steema.TeeChart.Drawing.GL.TeeOpenGL teeOpenGL1 = new Steema.TeeChart.Drawing.GL.TeeOpenGL(tChart1.Chart);
      teeOpenGL1.Active = true;

      tChart1.Dock = DockStyle.None;
      ResizeChart();

      this.SizeChanged += new EventHandler(Form1_SizeChanged);
    }

    void Form1_SizeChanged(object sender, EventArgs e)
    {
      ResizeChart();
    }

    private void ResizeChart()
    {
      tChart1.Height = this.ClientSize.Height - chartController1.Height;
      tChart1.Width = tChart1.Height;
      tChart1.Chart.Aspect.Height3D = tChart1.ClientSize.Height - chartController1.Height;
      tChart1.Chart.Aspect.Width3D = points1.Chart.Height;
    }
Does this work fine for you?
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

lilo
Newbie
Newbie
Posts: 29
Joined: Thu Sep 30, 2010 12:00 am

Re: Resize Teechart

Post by lilo » Tue Aug 30, 2011 10:02 am

Yes, it works if I declare a new opengl teechart.

openglchart= new Steema.TeeChart.Drawing.GL.TeeOpenGL(tChart1.Chart)

Post Reply