Bug on map series

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Pujol1986
Newbie
Newbie
Posts: 58
Joined: Thu Jan 29, 2009 12:00 am
Location: Barcelona
Contact:

Bug on map series

Post by Pujol1986 » Tue May 26, 2009 11:47 am

Hello, I've found a bug while I was drawing polygons.

If I draw more than 13 polygons, the polygons don't draw on the position that I want.

there is an example image with 13 polygons on the screen:
Image

this map was created with this simple code:

Code: Select all

        For i As Integer = 1 To 13
            Dim X() As Integer = {i, i + 1, i + 1, i}
            Dim Y() As Integer = {1, 1, 2, 2}
            Map2.AddShape(X, Y, "")
        Next i
and this is how the map looks like when I change the 13 for a 14 in the For loop:

Image

there is the code:

Code: Select all

        For i As Integer = 1 To 14
            Dim X() As Integer = {i, i + 1, i + 1, i}
            Dim Y() As Integer = {1, 1, 2, 2}
            Map2.AddShape(X, Y, "")
        Next i
like you can see, I can't create more than 13 polygons because there is an error with the following polygons.

My release is:

Release Notes 12th February 2009
TeeChart.NET version 3
Build 3.5.3330.21114

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Post by Yeray » Wed May 27, 2009 11:31 am

Hi Pujol,

Yes, you are right. I've added it to the wish list to be fixed asap (TF02014189).
Note that in the meanwhile, you could add the polygons manually as in the following example that works fine for me here:

Code: Select all

Steema.TeeChart.Styles.Map map1 = new Steema.TeeChart.Styles.Map(tChart1.Chart);
Steema.TeeChart.Styles.PolygonList shapes = new Steema.TeeChart.Styles.PolygonList(map1);
Steema.TeeChart.Styles.Polygon P1;
Random rnd = new Random();
for (int i = 0; i < 20; i++)
            {
    P1 = new Steema.TeeChart.Styles.Polygon(shapes, tChart1.Chart);

    P1.Add(i, 1);
    P1.Add(i + 1, 1);
    P1.Add(i + 1, 2);
    P1.Add(i, 2);
    map1.Shapes.Add(P1);
    map1.Shapes[i].Z = rnd.Next();
    map1.Shapes[i].Text = "";
}
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Pujol1986
Newbie
Newbie
Posts: 58
Joined: Thu Jan 29, 2009 12:00 am
Location: Barcelona
Contact:

Post by Pujol1986 » Thu May 28, 2009 9:58 am

Hello Yeray,
I'm using this code in VB.net:

Code: Select all

        For i = 1 To 20

            Dim P1 = New Steema.TeeChart.Styles.Polygon(TChart1.Chart)

            P1.Add(i, 1)
            P1.Add(i + 1, 1)
            P1.Add(i + 1, 2)
            P1.Add(i, 2)
            Map1.Shapes.Add(P1)
            Map1.Shapes(i - 1).Z = 0.125
            Map1.Shapes(i - 1).Text = ""
        Next i
And I have the error NullReferenceException in line Map1.Shapes(i - 1).Z = 0.125
I think that this would be because the line Map1.Shapes.Add(P1) is not working well.

can you help me please? Is something wrong in the code?

Thanks in advance.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Post by Sandra » Thu May 28, 2009 10:18 am

Hello Pujol1986,

Please, check that next example works fine:

Form_Load:

Code: Select all

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        InitializeChart()
    End Sub

InitializeChart:

Code: Select all

   Private Sub InitializeChart()
        Dim map1 As Steema.TeeChart.Styles.Map = New Steema.TeeChart.Styles.Map(TChart1.Chart)
        Dim shapes As Steema.TeeChart.Styles.PolygonList = New Steema.TeeChart.Styles.PolygonList(map1)
        Dim P1 As Steema.TeeChart.Styles.Polygon
        Dim rnd As Random = New Random()
        Dim i As Integer
        For i = 0 To 20
            P1 = New Steema.TeeChart.Styles.Polygon(shapes, TChart1.Chart)
            P1.Add(i, 1)
            P1.Add(i + 1, 1)
            P1.Add(i + 1, 2)
            P1.Add(i, 2)
            map1.Shapes.Add(P1)
            map1.Shapes(i).Z = rnd.Next()
            map1.Shapes(i).Text = ""
        Next i
    End Sub

I hope that will helps.

Thanks,
Best Regards,
Sandra Pazos / 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

Pujol1986
Newbie
Newbie
Posts: 58
Joined: Thu Jan 29, 2009 12:00 am
Location: Barcelona
Contact:

Post by Pujol1986 » Thu May 28, 2009 10:35 am

it works fine.

Thanks Sandra :wink:

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Bug on map series

Post by Yeray » Thu Jun 25, 2009 9:35 am

Hi Pujol1986,

As an update, I'd like you to know that we've just closed the issue (TF02014189) for v2009 disabling the AddShape method by making it private and adding two new Add methods to the map series:

Code: Select all

public int Add(double[] X, double[] Y, double Z, string Text)
public int Add(int[] X, int[] Y, int Z, string Text)
So with the next v2009 maintenance release, this should work fine:

Code: Select all

   private void InitializeChart()
   {
     tChart1.Aspect.View3D = false;
     Map map1 = new Map(tChart1.Chart);
     for (int i = 0; i < 24; i++)
     {
       int[] X = { i, i + 1, i + 1, i };
       int[] Y = { 1, 1, 2, 2 };
       map1.Add(X, Y, i, "");
     }
   }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Pujol1986
Newbie
Newbie
Posts: 58
Joined: Thu Jan 29, 2009 12:00 am
Location: Barcelona
Contact:

Re: Bug on map series

Post by Pujol1986 » Thu Jun 25, 2009 10:37 am

Thanks for the info.

Post Reply