Smooth lines

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Erwin
Newbie
Newbie
Posts: 7
Joined: Tue Jun 21, 2005 4:00 am

Smooth lines

Post by Erwin » Mon Feb 06, 2006 8:29 am

Hello,

What's the best way to draw smooth lines for data series ?

In my application all series points are connected with straight lines. I want them to be connected with a smooth line. I saw an examples of how it can be done but it didn't work in my case. I also saw in that example that the smoothline has a 'normal' line series as datasource. That meens that I need to draw 8 lines in stead of 4 and have to make the 4 straight lines invisible?!

Is this the best way to do this? Or is there an other way to become smooth lines?

Kind regards,
Erwin

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

Post by Narcís » Mon Feb 06, 2006 12:58 pm

Hi Erwin,

Which series type are you using? Could you please post an example project we can run "as-is" or post some code so that we can reproduce the issue here and so that we can help you?

You can post your files at [url]news://www.steema.net/steema.public.attachments[/url] newsgroup.

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

GordonLindsay
Newbie
Newbie
Posts: 5
Joined: Fri Nov 15, 2002 12:00 am
Location: Melbourne, AUS
Contact:

Post by GordonLindsay » Thu Feb 09, 2006 12:34 am

Hi,

I have the same question as Erwin. Is it possible just to smooth an existing series without creating a new smoothed series?

We have a large amount of existing code which currently displays straight lines which would like to smooth without having to create extra smoothed series for.

As Erwin says the example for Smoothing shows a 2nd series using the 1st series as its datasource, and just adding Smoothing as the function for the 1st series doesn't seem to work (and/or I did it wrong).

Thanks.

Andreas :)

[email protected]

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 Feb 10, 2006 12:52 pm

Hi Erwin and Andreas,

The code below is what we would recommend for the smoothing function. Only one series is in the chart and one uses a dummy series which isn't added to the chart as the repository of the original data.

Code: Select all

		Steema.TeeChart.Styles.Line line1;
		Steema.TeeChart.Styles.Line line2;
		Steema.TeeChart.Functions.Smoothing smoothing1;

		private void Form1_Load(object sender, System.EventArgs e)
		{
			line1 = new Steema.TeeChart.Styles.Line(tChart1.Chart);
			line2 = new Steema.TeeChart.Styles.Line();
			smoothing1 = new Steema.TeeChart.Functions.Smoothing(tChart1.Chart);

			double[] XValues = new double[] {1,2,3,4,5};
			double[] YValues = new double[] {5,1,4,3,2};
			line2.Add(XValues, YValues);
			line1.DataSource = line2;
			line1.Function = smoothing1;
			smoothing1.Factor = 50;
			line1.CheckDataSource();
		}
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