Page 1 of 1

Smooth lines

Posted: Mon Feb 06, 2006 8:29 am
by 9637251
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

Posted: Mon Feb 06, 2006 12:58 pm
by narcis
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.

Posted: Thu Feb 09, 2006 12:34 am
by 8120951
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]

Posted: Fri Feb 10, 2006 12:52 pm
by narcis
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();
		}