Page 1 of 1

Bug on map series

Posted: Tue May 26, 2009 11:47 am
by 13051613
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

Posted: Wed May 27, 2009 11:31 am
by yeray
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 = "";
}

Posted: Thu May 28, 2009 9:58 am
by 13051613
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.

Posted: Thu May 28, 2009 10:18 am
by 10050769
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,

Posted: Thu May 28, 2009 10:35 am
by 13051613
it works fine.

Thanks Sandra :wink:

Re: Bug on map series

Posted: Thu Jun 25, 2009 9:35 am
by yeray
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, "");
     }
   }

Re: Bug on map series

Posted: Thu Jun 25, 2009 10:37 am
by 13051613
Thanks for the info.