Series.ChangeType fails when second time triggering...

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
glikoz
Newbie
Newbie
Posts: 50
Joined: Fri Oct 07, 2005 4:00 am

Series.ChangeType fails when second time triggering...

Post by glikoz » Thu Feb 16, 2006 9:14 am

Hi Narcis and all Steema Family ..

Very simple trying :

ChangeType any series ...
Then Re-ChangeType same series..

It seems problem is related with a bug in ChangeType Method of Series..
When you run ChangeType method ,the Chart reference of series flies..
The ChangeType method runs like that :

1- All reference of Series move to new fresh series...
2- Calling of Dispose method of Old series..
3- When u dispose old series ,Chart reference flies with old series ...
4- U have got one changed type new series without Chart reference ..

Could you advice us a trick for solve out this problem temprorarly...
Thx for delicious aids..

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 16, 2006 11:32 am

Hi glikoz,

The code below works fine for me here. Can you please test if it work at your end and modify it so that we can reproduce the problem here?

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			Steema.TeeChart.Styles.Series s0=tChart1.Series.Add(typeof(Steema.TeeChart.Styles.Points)); 
			s0.FillSampleValues();
			
			Steema.TeeChart.Styles.Series.ChangeType(ref s0, typeof(Steema.TeeChart.Styles.Line));
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			Steema.TeeChart.Styles.Series s0=tChart1[0];

			Steema.TeeChart.Styles.Series.ChangeType(ref s0, typeof(Steema.TeeChart.Styles.Bar));
		}
Thanks in advance.
Best Regards,
Narcís Calvet / 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

glikoz
Newbie
Newbie
Posts: 50
Joined: Fri Oct 07, 2005 4:00 am

Post by glikoz » Thu Feb 16, 2006 1:04 pm

Hi Narcis ..U can Try this one ..

Code: Select all

 
public partial class Form1 : Form
    {
        //public List<CustomPoint> listCustom = new List<CustomPoint>();
        public CustomPoint CP;
             public Form1()
        {
            InitializeComponent();
            tChart1.Aspect.View3D = false;
        }

        private void Form1_Load(object sender, System.EventArgs e)
        {
            Line l = new Line();
            //listCustom.Add(l);
            CP = l;
            Steema.TeeChart.Styles.Series s0 = tChart1.Series.Add(l);
            s0.FillSampleValues();

            ChangeType(typeof(Steema.TeeChart.Styles.Points));
        }

        private void button1_Click(object sender, System.EventArgs e)
        {
            Steema.TeeChart.Styles.Series s0 = tChart1[0];

            ChangeType(typeof(Steema.TeeChart.Styles.Area));
            ChangeType(typeof(Steema.TeeChart.Styles.Volume));
        }
        public void ChangeType(Type type)
        {
            Series s = CP;//listCustom[0] as Series;
            Series.ChangeType(ref s, type);

        }
    }

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Thu Feb 16, 2006 3:23 pm

Hi glikoz,

The working for what you are trying to do is:

Code: Select all

		private void Form1_Load(object sender, System.EventArgs e)
		{
			Line l = new Line(); 
	
			CustomPoint s0 = tChart1.Series.Add(l) as CustomPoint; 
			s0.FillSampleValues();

			CP = s0; 

			ChangeType(typeof(Points));
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			CustomPoint s0 = tChart1[0] as CustomPoint; 
			CP = s0;
			ChangeType(typeof(Area)); 
			
			s0 = tChart1[0] as CustomPoint; 
			CP = s0;
			ChangeType(typeof(Volume));
		}

		public void ChangeType(Type type) 
		{ 
			Series s = CP;
			Series.ChangeType(ref s, type); 
		}
Best Regards,
Narcís Calvet / 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

glikoz
Newbie
Newbie
Posts: 50
Joined: Fri Oct 07, 2005 4:00 am

Thx

Post by glikoz » Thu Feb 16, 2006 4:05 pm

Thx for delicious aids Narcis..
I made small changes in your code ...
And it works as consistent..

Post Reply