Page 1 of 2

Problem Graphic 3D

Posted: Thu Dec 17, 2009 1:42 pm
by 15654105
I have a problem when I use the tchart.aspect.elevation . My graphic do not goes from 0 to 360, it accepts this values but the image don't spin. I don't know if it's a limitation or there's something that I have to do.

Here is my code:

Code: Select all

Private Function plotarBoia(ByVal g As Steema.TeeChart.Drawing.Graphics3D) As Boolean
        Try
            '// center position
            Dim Xcentro As Integer = g.ChartXCenter + g.RotationCenter.X
            Dim Ycentro As Integer = g.ChartYCenter + g.RotationCenter.Y
            Dim Zcentro As Integer = (tChart.Aspect.Width3D / 2) + g.RotationCenter.Z

            g.Brush.Solid = True
            g.Brush.Visible = True

            g.Pen.Visible = True
            g.Pen.Width = 1
            g.Pen.Color = Color.Black

            Dim rect As System.Drawing.Rectangle

            'Parte de baixo
            g.Brush.Color = Color.Orange
            rect = New System.Drawing.Rectangle(Xcentro - 96, Ycentro + 22, 192, 43)
            g.Cone(True, rect, Zcentro - 96, Zcentro + 96, True, 100)

            ''Parte do meio
            g.Brush.Color = Color.Gray
            rect = New System.Drawing.Rectangle(Xcentro - 104, Ycentro + 10, 208, 12)
            g.Cone(True, rect, Zcentro - 104, Zcentro + 104, True, 100)

            'Parte de cima
            g.Brush.Color = Color.Orange
            rect = New System.Drawing.Rectangle(Xcentro - 96, Ycentro, 192, 10)
            g.Cone(True, rect, Zcentro - 96, Zcentro + 96, True, 100)


            Dim m(4) As Drawing.Point3D
            g.Brush.Color = Color.Yellow
            m(0) = New Steema.TeeChart.Drawing.Point3D(Xcentro - 50, Ycentro - 135, Zcentro) 'sup. dir.
            m(1) = New Steema.TeeChart.Drawing.Point3D(Xcentro - 50, Ycentro - 20, Zcentro) 'inf. dir.
            m(2) = New Steema.TeeChart.Drawing.Point3D(Xcentro - 100, Ycentro - 20, Zcentro) 'inf. esq.
            m(3) = New Steema.TeeChart.Drawing.Point3D(Xcentro - 100, Ycentro - 40, Zcentro) 'int. esq.
            m(4) = New Steema.TeeChart.Drawing.Point3D(Xcentro - 70, Ycentro - 135, Zcentro) 'sup. esq.
            g.Polygon(m)

            g.Pen.Width = 1
            'mastro
            g.Brush.Color = Color.Gainsboro
            rect = New System.Drawing.Rectangle(Xcentro - 50, Ycentro - 155, 8, 155)
            g.Cone(True, rect, Zcentro - 4, Zcentro + 4, True, 100)

            Dim p(3) As System.Drawing.Point
            p(0) = New System.Drawing.Point(Xcentro - 60, Ycentro - 155)
            p(1) = New System.Drawing.Point(Xcentro - 30, Ycentro - 155)
            p(2) = New System.Drawing.Point(Xcentro - 30, Ycentro - 155)
            p(3) = New System.Drawing.Point(Xcentro - 60, Ycentro - 155)
            g.Plane(Zcentro - 25, Zcentro + 25, p)

            g.Brush.Color = Color.White
            'est. met.
            rect = New System.Drawing.Rectangle(Xcentro - 55, Ycentro - 195, 4, 40)
            g.Cone(True, rect, Zcentro + 18, Zcentro + 22, True, 100)
            'gps
            rect = New System.Drawing.Rectangle(Xcentro - 39, Ycentro - 175, 4, 20)
            g.Cone(True, rect, Zcentro + 18, Zcentro + 22, True, 100)
            'sinalizador
            rect = New System.Drawing.Rectangle(Xcentro - 51, Ycentro - 190, 12, 35) '45
            g.Cone(True, rect, Zcentro - 6, Zcentro + 6, True, 100)
            '
            rect = New System.Drawing.Rectangle(Xcentro - 40, Ycentro - 165, 6, 10)
            g.Cone(True, rect, Zcentro - 23, Zcentro - 17, True, 100)
            'antena
            rect = New System.Drawing.Rectangle(Xcentro - 55, Ycentro - 200, 4, 45)
            g.Cone(True, rect, Zcentro - 22, Zcentro - 18, True, 100)

            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function
Thanks..! :)

Re: Problem Graphic 3D

Posted: Thu Dec 17, 2009 4:07 pm
by narcis
Hi Alias,

Try setting the chart to be non-orthogonal:

Code: Select all

TChart1.Aspect.Orthogonal = False

Re: Problem Graphic 3D

Posted: Thu Dec 17, 2009 4:29 pm
by 15654105
it is set to be non-orthogonal
my image is rotating, but not correctly, it do not complete a round.

here is the code where I set the tchart:

Code: Select all

Private Function criaGrafico() As Boolean
        Try
            tChart.Series.Clear()

            tChart.Visible = False

            tChart.Series.Add(points3D)
            tChart.Location = New System.Drawing.Point(8, 8)

            tChart.Size = New System.Drawing.Size(575, 450)

            alteraCorFundo(Color.Navy, Color.DeepSkyBlue, Color.Navy)

            '// tChart1
            '// 
            '// 
            '// tChart1.Axes
            '// 
            tChart.Axes.Visible = False
            '// 
            '// tChart1.Legend
            '// 
            'tChart1.Legend.Shadow.Visible = True
            tChart.Legend.Visible = True

            tChart.Walls.Visible = False
            tChart.Aspect.Orthogonal = False

            tChart.Aspect.View3D = True

            tChart.Visible = True

            tChart.Enabled = True

            plotarBoia(tChart.Graphics3D)

            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function
thanks!

Re: Problem Graphic 3D

Posted: Fri Dec 18, 2009 10:22 am
by 10050769
Hello "Alias",


I couldn't reproduce your problem here. I have checked 3 different ways:
- I add Rotate Tool Chart.
-Using ChartEditor/3D.
-Using CharController rotate.


Using first and second way chart rotate 360º. On the other hand, using ChartController you can only rotate of 270º to 360º, because it's limited.

Please, you could send us a simple project because we can reproduce problem here? You could attach your project directly in the post.

Thanks,

Re: Problem Graphic 3D

Posted: Fri Dec 18, 2009 12:48 pm
by 15654105
You can see the problem when you change the value of the Elevation (using the trackbar)
(I didn't attach my TeeChart.dll 4.0.2009.28593 because it's too big)

Thank you!

Re: Problem Graphic 3D

Posted: Mon Dec 21, 2009 12:06 pm
by 10050769
Hello "Alias",

I found that your problem is that you assigned Zcentro. I change your custom drawing cone for a series pie because it has more properties, elevation works correctly and you have not draw many times chart. You can use a similar code in your application if you want add pie:

Code: Select all

Dim pie1 As Steema.TeeChart.Styles.Pie

    
    Private Sub InitializeChart()
        pie1 = New Steema.TeeChart.Styles.Pie(tChart1.Chart)
        pie1.FillSampleValues(1)
        pie1.Marks.Visible = false
        pie1.ColorEach = false
        pie1.Color = Color.Orange
        chartController1.Chart = tChart1
        tChart1.Location = New Point(8, 8)
        tChart1.Size = New Size(575, 450)
        alteraCorFundo(Color.Navy, Color.DeepSkyBlue, Color.Navy)
        tChart1.Axes.Visible = false
        tChart1.Legend.Visible = true
        tChart1.Walls.Visible = false
        tChart1.Aspect.Orthogonal = false
        tChart1.Aspect.View3D = true
        tChart1.Visible = true
    End Sub
    
    Private Sub alteraCorFundo(ByVal startColor As Color, ByVal middleColor As Color, ByVal endColor As Color)
        tChart1.Panel.Brush.Gradient.EndColor = endColor
        tChart1.Panel.Brush.Gradient.MiddleColor = middleColor
        tChart1.Panel.Brush.Gradient.StartColor = startColor
    End Sub
    
    Private Sub trackBar1_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
        tChart1.Aspect.Elevation = trackBar1.Value
    End Sub
On the other hand, if you would use custom drawing and you would works correctly, you must change value of Z (Zcentro variable), because actually in your application Zcentor is static, if you don't change value will remain always the same position and will never be negative, therefore not work correctly.

I hope will helps.

Thanks,

Re: Problem Graphic 3D

Posted: Mon Dec 21, 2009 5:08 pm
by 15654105
series pie don't work for me ( or I don't know how to make it works in my case )
changing the value of Zcentro neither works. The elevation rotates the axis, so it wouldn't work. When you use the rotation and tilt the values of Xcentro and Ycentro doesn't change.
you have any other idea?

thanks..!

Re: Problem Graphic 3D

Posted: Wed Dec 23, 2009 10:21 am
by 10050769
Hello Alias,

I modify your code, simplifying in same project, elevation and drawing cone. There seems to behave correctly here.
Please, see next code check works fine.

Code: Select all

    Dim Zcentro As Integer
    Dim Xcentro As Integer
    Dim Ycentro As Integer
    Private Sub InitializeChart()
        chartController1.Chart = tChart1
        Dim Xcentro As Integer
        Dim Ycentro As Integer
        tChart1.Location = New Point(8, 8)
        tChart1.Size = New Size(575, 450)
        alteraCorFundo(Color.Navy, Color.DeepSkyBlue, Color.Navy)
        tChart1.Axes.Visible = false
        tChart1.Walls.Visible = false
        tChart1.Aspect.Orthogonal = false
        AddHandler tChart1.AfterDraw, AddressOf Me.tChart1_AfterDraw
        tChart1.Draw
    End Sub
    
    Private Sub tChart1_AfterDraw(ByVal sender As Object, ByVal g As Steema.TeeChart.Drawing.Graphics3D)
        drawCone(g)
    End Sub
    
    Private Sub drawCone(ByVal g As Steema.TeeChart.Drawing.Graphics3D)
        Xcentro = (g.ChartXCenter + g.RotationCenter.X)
        Ycentro = (g.ChartYCenter + g.RotationCenter.Y)
        Zcentro = ((tChart1.Aspect.Width3D / 2)  _
                    + g.RotationCenter.Z)
        Dim rect As Rectangle = New Rectangle((Xcentro - 96), (Ycentro + 22), 192, 43)
        g.Pen.Visible = true
        g.Pen.Width = 1
        g.Pen.Color = Color.Black
        g.Brush.Color = Color.Orange
        g.Cone(true, rect, (Zcentro + 96), (Zcentro - 96), true, 100)
    End Sub
    
    Private Sub alteraCorFundo(ByVal startColor As Color, ByVal middleColor As Color, ByVal endColor As Color)
        tChart1.Panel.Brush.Gradient.EndColor = endColor
        tChart1.Panel.Brush.Gradient.MiddleColor = middleColor
        tChart1.Panel.Brush.Gradient.StartColor = startColor
    End Sub
    
    Private Sub trackBar1_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)
        Text = tChart1.Aspect.Rotation.ToString
    End Sub 
On the other hand,I believe as I said before should try controlled Z because it is not default controlled when you use custom drawing, as isn't case of x and y, because they are controlled by default.

I hope will helps.

Thanks

Re: Problem Graphic 3D

Posted: Tue Jan 12, 2010 1:09 pm
by 15654105
I checked and the elevation still doesn't working and changing the tilt value causes sometimes a problem in the cone.

How can I make Z controlled? What I have to do? Which properties I have to change? Is there any tool I have to add?


Thanks Sandra!

Re: Problem Graphic 3D

Posted: Tue Jan 12, 2010 4:59 pm
by yeray
Hi Alias,

Could you please send us a simple example project we can run as-is to reproduce the problem here? Or, if the code that Sandra posted above reproduces the problem, could you please attach a picture of the result indicating where exactly is the problem you are seeing?

Thanks in advance.

Re: Problem Graphic 3D

Posted: Tue Jan 12, 2010 6:43 pm
by 15654105
I've already sent it.
Now I attached some pictures.

The trackbar values are going from -360 through 360.

The bottom of the object that I drew never appears.


Thanks!

Re: Problem Graphic 3D

Posted: Tue Jan 12, 2010 7:08 pm
by 15654105
Another image.

Re: Problem Graphic 3D

Posted: Thu Jan 14, 2010 7:20 pm
by 15654105
So, anyone knows how make the elevation works correctly? or not? this is a limitation of the teechart?

thanks !

Re: Problem Graphic 3D

Posted: Mon Jan 18, 2010 10:43 am
by 15654105
Anybody? ?


Thanks

Re: Problem Graphic 3D

Posted: Mon Jan 18, 2010 10:46 am
by yeray
Hi Alias,

Excuse us for the delay,

I've reproduced the problem you show in your pictures and added it to the wish list to be revised for future releases (TF02014642). It may be a problem in the InternalCylinder function that gives an unexpected result for determined pair of z0 and z1 values [InternalCylinder(bool vertical, Rectangle r, int z0, int z1, bool dark3D, int conePercent)].
The simplest code I've found that reproduces the problem is this:

Code: Select all

        private void InitializeChart()
        {
            tChart1.Axes.Visible = false;
            tChart1.Walls.Visible = false;
            tChart1.Aspect.Orthogonal = false;

            tChart1.Aspect.Elevation = 350;            
            tChart1.Aspect.Tilt = 270;

            tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
        }

        void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
        {
            int Xcentro = (g.ChartXCenter + g.RotationCenter.X);
            int Ycentro = (g.ChartYCenter + g.RotationCenter.Y);
            int Zcentro = ((tChart1.Aspect.Width3D / 2) + g.RotationCenter.Z);
            Rectangle rect = new Rectangle((Xcentro - 96), (Ycentro + 22), 192, 43);
            g.Pen.Visible = true;
            g.Brush.Color = Color.Orange;
            g.Cone(true, rect, (Zcentro + 96), (Zcentro - 96), true, 100);
        }