map series clear method

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:

map series clear method

Post by Pujol1986 » Thu Jun 04, 2009 11:00 am

I'm trying to clear my map series.

I've tested all this methods but noone works fine:

Code: Select all

        Map2.Dispose()
        TChart1.Series(1).Dispose()
        Map2.SeriesData.Remove(0, 1)
        TChart1.Series(1).Clear()
        Map2.Shapes.Clear()
       
the map series seems to be clear when you take a look to the TChart1 properties. But when you add new polygons the old series on Map2 will appear again.

I've read this topic but it doesn't works

http://www.teechart.net/support/viewtop ... ries+clear

Here an simple example about what is happening in my application:

I have this Map1 series witch I represents a warehouse:

Image

then I click on the first polygon and I can see this:

Image

I've added only one polygon to the Map2 series, its color is yellow like you can see in the picture.

well, I go back to the first screen by using this code:

Code: Select all

map1.visible = true
map2.visible = false
' here I use the methods that I wrote at the begining of this topic
I do click on the second polygon and I see this:

Image

How I can delete this old polygon?

Thanks in advance.

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

Post by Yeray » Thu Jun 04, 2009 1:45 pm

Hi Pujol,
Pujol1986 wrote:the map series seems to be clear when you take a look to the TChart1 properties. But when you add new polygons the old series on Map2 will appear again.
The following code adds 20 polygons, deletes them and finally adds 5 new polygons. The result is 5 polygons. Is that your problem?

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 = 0;
                map1.Shapes[i].Text = "";
            }

            map1.Clear();

            for (int i = 0; i < 5; 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 = 0;
                map1.Shapes[i].Text = "";
            }
Probably we'll need a simple example we can run as-is here to reproduce the problem here to see the problem well.
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 » Fri Jun 05, 2009 8:05 am

I can't reproduce the error with this code but I've solved it using a mdi form and this code:

Code: Select all

        Form1.Close()
        Form1.MdiParent = Me
        Form1.Show()
        Form1.WindowState = FormWindowState.Maximized

Post Reply