Adding points from another thread

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Frances
Newbie
Newbie
Posts: 14
Joined: Thu Mar 10, 2005 5:00 am
Location: The Netherlands

Adding points from another thread

Post by Frances » Tue Dec 04, 2007 12:25 pm

Hi all,

I have a problem with my application. In it, I add points to my chart from another thread. This doesn't cause a problem in itself, only that the chart doesn't repaint itself automatically. You can only see the added points when you resize the window, or when you move the focus from the window and back again (causing it to repaint).

One method I have found out of this problem is to call tChart.Refresh() on the GUI thread every time a point is added, but since I have six charts, this takes up quite a lot of CPU (20% on a 2.00Ghz processor).

Does anyone know how I can make the charts repaint themselves? Settings AutoRepaint = true doesn't work either.

There's a small app on the upload page which demonstrates my problem, called TestHorizLine.zip.

Thanks in advance for any response,
Frances

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

Post by Narcís » Tue Dec 04, 2007 2:15 pm

Hi Frances,

Thanks for the example, using RefreshSeries instead of AutoRepaint works fine here:

Code: Select all

		private void StartTimer()
		{
			while (true)
			{
				y += random.NextDouble();

				horizLine1.Add(random.Next(20), y);
				//tChart1.AutoRepaint = true;
				horizLine1.RefreshSeries();

				Thread.Sleep(1000);
			}
		}
Hope this helps!
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

Frances
Newbie
Newbie
Posts: 14
Joined: Thu Mar 10, 2005 5:00 am
Location: The Netherlands

Post by Frances » Tue Dec 04, 2007 2:29 pm

Hi Narcís,

thanks for the quick reply, but unfortunately your example code doesn't work for me. When I use this code:

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace TestHorizLine
{
	public partial class Form1 : Form
	{
		private double y = 2;
		private Random random = new Random();
		private Thread thread;

		public Form1()
		{
			InitializeComponent();

			horizLine1.Add(0, 0);
			horizLine1.Add(1, 1);
			horizLine1.Add(2, 2);
		}

		private void Form1_Load(object sender, EventArgs e)
		{
			thread = new Thread(new ThreadStart(StartTimer));	
			thread.Start();
		}

		protected override void OnClosing(CancelEventArgs e)
		{
			base.OnClosing(e);

			thread.Abort();
		}

		private void StartTimer()
		{
			while (true)
			{
				y += random.NextDouble();

				horizLine1.Add(random.Next(20), y);
				horizLine1.RefreshSeries();

				Thread.Sleep(1000);
			}
		}
	}
}

My chart doesn't show it's added points until I resize / refocus the window :(

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

Post by Narcís » Tue Dec 04, 2007 2:31 pm

Hi Frances,

It works fine for me here using latest TeeChart for .NET v3 release available at the client area.

Which TeeChart version are you using?

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

Frances
Newbie
Newbie
Posts: 14
Joined: Thu Mar 10, 2005 5:00 am
Location: The Netherlands

Post by Frances » Wed Dec 05, 2007 7:28 am

Hi Narcís,

Runtime version: v2.0.50727
Version: 3.2.2868.26903

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

Post by Narcís » Wed Dec 05, 2007 12:19 pm

Hi Frances,

As I told in my previous reply, it works fine for me here using the very same TeeChart version as you. I'm going to send the application .exe file I created here. Could you please replace your current .exe file for the one I send and let us know if it works fine at your end?

Also find below an excerpt of the Visual Studio version I used here. Which version are you using?

Microsoft Visual Studio 2005
Version 8.0.50727.762 (SP.050727-7600)
Microsoft .NET Framework
Version 2.0.50727 SP1

Installed Edition: Professional

Microsoft Visual C# 2005 77626-009-0000007-41978


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

Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Post by Frances » Wed Dec 05, 2007 12:46 pm

Hi Narcís,

thanks for sending me the exe, but unfortunately my e-mail at work rejects it because of our e-mail policy. Could you please send it to the changed e-mail address defined in my profile?

Microsoft Visual Studio 2005
Version 8.0.50727.42 (RTM.050727-4200)
Microsoft .NET Framework
Version 2.0.50727

Installed Edition: Professional

Microsoft Visual C# 2005 77626-009-0000007-41804

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

Post by Narcís » Wed Dec 05, 2007 1:05 pm

Hi Frances,

Sure, no problem, I've just send it again. If e-mailing that sort of files is a problem at your end I could also upload them at our website for you to download.

BTW: It seems your Visual Studio is not up to date. You could try installing updates/service packs available to see if it makes a difference.
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

Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Post by Frances » Wed Dec 05, 2007 1:39 pm

Hi Narcís,

apparently, we're using different TChart versions. When I try to run your exe (in the same folder which contains my TeeChart.dll), I get this error:

Could not load file or assembly 'TeeChart, Version=3.0.2895.23856, Culture=neutral, PublicKeyToken=9c8126276c77bdb7' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

My version is 3.2.2868.26903

By the way, I can't install VS SP1, it causes some bugs with our software which we don't have the time to resolve.

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

Post by Narcís » Wed Dec 05, 2007 2:22 pm

Hi Frances,

Sorry, my bad, I build the application using the maintenance release sources but forgot to change the build number.

I have sent you a new .exe. Could you please try now and let me know how it goes?

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

Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Post by Frances » Wed Dec 05, 2007 2:48 pm

Hi Narcís,

thanks for the new version. This one worked ;)

A strange thing happened. When I started the app, sometimes I could see 2 - 3 points being added, then it stopped again. Interesting...

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

Post by Narcís » Wed Dec 05, 2007 3:20 pm

Hi Frances,

Thanks for the information. Could you please now build the same .exe at your end and send it to us?

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

Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Post by Frances » Thu Dec 06, 2007 6:52 am

Hi Narcís,

I sent my exe to support@steema.com

Thanks,
Frances

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

Post by Narcís » Fri Dec 07, 2007 8:20 am

Hi Frances,

Sorry but this is an obsolete e-mail address as we don't provide direct e-mail support except for the Pro-Support subscribers. You should have received an automatic reply letting you know about our standard support channels.

Could you please send the file at news://www.steema.net/steema.public.attachments newsgroup or at our upload page?

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

Frances
Newbie
Newbie
Posts: 39
Joined: Fri Oct 19, 2007 12:00 am
Location: Netherlands

Post by Frances » Mon Dec 10, 2007 7:26 am

Hi Narcís,

sorry for the late reply. The exe has been uploaded and is called TestHorizLine.exe

Post Reply