TeeChart Pro ActiveX vs TeeChart Pro .Net

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Haianh
Newbie
Newbie
Posts: 11
Joined: Wed Sep 17, 2008 12:00 am

TeeChart Pro ActiveX vs TeeChart Pro .Net

Post by Haianh » Thu Sep 25, 2008 10:08 am

Hi,

1.
I develop application in .Net framework 2.0 SP1 and I have two versions for TeeChart:
+ TeeChart Pro ActiveX
+ TeeChart Pro .Net
Which version should I use for my project?

2.
If I develop using TeeChart Pro .Net version, later on I want to change to TeeChart Pro ActiveX version. Does my source code still compatible with TeeChart Pro ActiveX version?

3.
How is the comparison about performance between using TeeChart Pro ActiveX and TeeChart Pro .Net for developing application in .Net framework 2.0 SP1?

Could you please feedback me soon?
Thanks for your support!

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 Sep 25, 2008 10:34 am

Hi Haianh,
1.
I develop application in .Net framework 2.0 SP1 and I have two versions for TeeChart:
+ TeeChart Pro ActiveX
+ TeeChart Pro .Net
Which version should I use for my project?
For developing with .NET Framework we strongly recommend using the C# native version which is TeeChart for .NET.
2.
If I develop using TeeChart Pro .Net version, later on I want to change to TeeChart Pro ActiveX version. Does my source code still compatible with TeeChart Pro ActiveX version?
You'll have to change your project's references, TeeChart components at designtime and do some little code changes to adapt one version syntax to the other. TeeChart's architecture is identical.
3.
How is the comparison about performance between using TeeChart Pro ActiveX and TeeChart Pro .Net for developing application in .Net framework 2.0 SP1?
We don't have specific results and may depend on usage but in general .NET Framework is known to be slower than Win32 so we think the ActiveX version should be a little bit quicker than the .NET version.

If you have any specific needs we can try to do some tests here.
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

Haianh
Newbie
Newbie
Posts: 11
Joined: Wed Sep 17, 2008 12:00 am

Post by Haianh » Thu Sep 25, 2008 11:13 am

Thanks a lot for your prompt support.

About #3, I would like to clarify one more point: in our case, we have to develop an application that will be compiled into .NET managed code, however TeeChart Pro ActiveX is win32 based component, which means COM Wrapper mechanism must be used in our application.

As our understanding, using COM Wrapper to bridge between managed code and un-managed code will have some performance penalties.

So...if we use TeeChart Pro ActiveX version:
1. We will have performance penalty of using COM Wrapper.
2. On the other hand, we have advantage that win32 un-managed code in TeeChart Pro ActiveX running faster than TeeChart Pro .Net

Totally, if we use TeeChart Pro ActiveX version in .NET framework 2.0 application, our application will run faster or slower?

We have another question:
Suppose we have to display 8 hours data of 8 series in a chart (Data is stored every 50msec):

Data amount of 1 series =20×1×60×60×8hours=576,000
Data amount of 8 series =576,000×8 types=4,608,000

We wonder if we should pass all data to TeeChart for processing and optimizing itself or we should optimize data by reducing number of data points before passing data to TeeChart?

Many thanks in advance for your support.

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 Sep 26, 2008 11:28 am

Hi Haianh,
So...if we use TeeChart Pro ActiveX version:
1. We will have performance penalty of using COM Wrapper.
2. On the other hand, we have advantage that win32 un-managed code in TeeChart Pro ActiveX running faster than TeeChart Pro .Net
Yes, that's correct.
Totally, if we use TeeChart Pro ActiveX version in .NET framework 2.0 application, our application will run faster or slower?

We have another question:
Suppose we have to display 8 hours data of 8 series in a chart (Data is stored every 50msec):

Data amount of 1 series =20×1×60×60×8hours=576,000
Data amount of 8 series =576,000×8 types=4,608,000
Given your requests I have done the test below which plots 8 series with the given number of points for an ActiveX and a .NET chart. ActiveX version proves to be much quicker (between 10-15 times faster). You can try running the code at your place to see how it performs exactly on your environment. On our side, we will investigate if this .NET code can be speeded up.

Code: Select all

		public Form1()
		{
			InitializeComponent();
			InitializeChart();
		}

		private System.Diagnostics.Stopwatch stopWatchNET;
		private System.Diagnostics.Stopwatch stopWatchAX;
		private int NumPoints = 576000;

		private void InitializeChart()
		{
			stopWatchNET = new System.Diagnostics.Stopwatch();
			stopWatchAX = new System.Diagnostics.Stopwatch();

			tChart1.Aspect.View3D = false;
			tChart1.Legend.Visible = false;
			axTChart1.Aspect.View3D = false;
			axTChart1.Legend.Visible = false;

			for (int i = 0; i < 8; i++)
			{
				tChart1.Series.Add(new Steema.TeeChart.Styles.FastLine());

				//pre-assign ChartPens
				Pen rPen = new Pen(Color.Red);
				Steema.TeeChart.Drawing.ChartPen redPen = new Steema.TeeChart.Drawing.ChartPen(tChart1.Chart, rPen);;
				((Steema.TeeChart.Styles.FastLine)tChart1[i]).LinePen = redPen;

				axTChart1.AddSeries(TeeChart.ESeriesClass.scFastLine);
			}

			tChart1.AfterDraw += new Steema.TeeChart.PaintChartEventHandler(tChart1_AfterDraw);
			axTChart1.OnAfterDraw += new EventHandler(axTChart1_OnAfterDraw);

			buttonNET.Click += new EventHandler(buttonNET_Click);
			buttonAX.Click += new EventHandler(buttonAX_Click);
		}

		void buttonAX_Click(object sender, EventArgs e)
		{
			buttonAX.Enabled = false;

			stopWatchAX.Reset();
			stopWatchAX.Start();

			//axTChart1.AutoRepaint = false;

			double[] x1 = new double[NumPoints];
			for (int i = 0; i < x1.Length; i++)
			{
				x1[i] = i;
			}

			double[] random1 = new double[NumPoints];

			for (int i = 0; i < axTChart1.SeriesCount; i++)
			{
				FillArray(random1);
				axTChart1.Series(i).AddArray(x1.Length, random1, x1);
				//axTChart1.AutoRepaint = true;
				Application.DoEvents();
			}

			stopWatchAX.Stop();

			buttonAX.Enabled = true;

		}

		void buttonNET_Click(object sender, EventArgs e)
		{
			buttonNET.Enabled = false;

			stopWatchNET.Reset();
			stopWatchNET.Start();

			tChart1.AutoRepaint = false;

			double[] x1 = new double[NumPoints];
			for (int i = 0; i < x1.Length; i++)
			{
				x1[i] = i;
			}

			double[] random1 = new double[NumPoints];

			for (int i = 0; i < tChart1.Series.Count; i++)
			{
				FillArray(random1);
				tChart1[i].Add(x1, random1);
				tChart1.AutoRepaint = true;
				Application.DoEvents();
			}
			Application.DoEvents();

			stopWatchNET.Stop();

			buttonNET.Enabled = true;
		}

		private static void FillArray(double[] myArray)
		{
			Random y = new Random();
			for (int i = 0; i < myArray.Length; i++)
			{
				myArray[i] = y.Next();
			}
		}


		void axTChart1_OnAfterDraw(object sender, EventArgs e)
		{
			labelAX.Text = "Elapsed time: " + ElapsedTime(stopWatchAX) + " s";
		}

		private string ElapsedTime(System.Diagnostics.Stopwatch sw)
		{
			TimeSpan elapsedTime = sw.Elapsed;
			return elapsedTime.TotalSeconds.ToString(); ;
		}

		void tChart1_AfterDraw(object sender, Steema.TeeChart.Drawing.Graphics3D g)
		{
			labelNET.Text = "Elapsed time: " + ElapsedTime(stopWatchNET) + " s";
		}
We wonder if we should pass all data to TeeChart for processing and optimizing itself or we should optimize data by reducing number of data points before passing data to TeeChart?
If you process data before passing it to TeeChart it will render more quickly because it won't have to do this processing and won't have to draw so many points. Anyway, TeeChart includes data optimizing features as you can see in the All Features\Welcome !\Functions\Extended\Reducing number of points examples at the features demo available at TeeChart's program group. This feature is supported for both .NET and ActiveX versions.

BTW: You may also be interested in reading the Real-time Charting article here.
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

Haianh
Newbie
Newbie
Posts: 11
Joined: Wed Sep 17, 2008 12:00 am

Post by Haianh » Tue Sep 30, 2008 1:13 pm

Hi Narcís,

From your investigate, the ActiveX version proves to be much quicker than the .NET version, why we should use TeeChart for .NET instead of TeeChart for ActiveX?

Thanks for your support.

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 Sep 30, 2008 1:47 pm

Hi Haianh,

The two main TeeChart for .NET characteristics I can think of that may be an advantage in comparision to the ActiveX version are:

1. If you are developing .NET Framework applications, TeeChart for .NE v3 is a 100% native component suite.

2. TeeChart for .NET v3's 100% C# managed source code is available as an option. TeeChart Pro v8 ActiveX's sources are not available as it is a COM wrapper of TeeChart Pro v8 VCL.
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

Post Reply