Page 1 of 1

Resize Teechart

Posted: Mon Aug 29, 2011 6:15 am
by 15657351
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.

Re: Resize Teechart

Posted: Mon Aug 29, 2011 1:31 pm
by narcis
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?

Re: Resize Teechart

Posted: Tue Aug 30, 2011 10:02 am
by 15657351
Yes, it works if I declare a new opengl teechart.

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