Smooth lines

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Anthony
Newbie
Newbie
Posts: 35
Joined: Wed Feb 25, 2004 5:00 am
Location: WL| Delft Hydraulics, Holland
Contact:

Smooth lines

Post by Anthony » Thu Jan 13, 2005 11:36 am

Hi,

Is there an option in TeeChart fro drawing smooth lines for data series ?

In my application all series points are connected with straight lines.
(I remember splines are doing a great job for drawing smooth lines)

In the TeeChart documentation I went thru all the different line options (fastline, bezier) but I did not come across something about smooth lines.

Some help would be nice.

Thanks,
Antoon Koster
Netherlands

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 Jan 13, 2005 12:39 pm

Hi Antoon,

You can use the smoothing function, creating a line series and setting it's datasource to a smoothing function with another line series as source. Then you can hide the source line series if you wish.
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

Anthony
Newbie
Newbie
Posts: 35
Joined: Wed Feb 25, 2004 5:00 am
Location: WL| Delft Hydraulics, Holland
Contact:

Post by Anthony » Fri Jan 14, 2005 8:32 am

Hi,


Thanks for your reply. I studied the TeeChart examples, and tried the following, but no smooth lines ....

Any idea what might be wrong ...

My code looks like:
internal void SetLocationSeries()
{
Steema.TeeChart.Styles.Line line;
int iSeries=0;
for (int iPar=0;iPar<noPars;iPar++)
{
for (int iTime=0;iTime<noTimes;iTime++)
{
float[] xValues = new float[noLocs];
float[] yValues = new float[noLocs];
line = new Steema.TeeChart.Styles.Line();
line.CustomVertAxis = customAxis[iPar];
// populating series
line.XValues.DateTime = false;
// line.Marks.Visible = true;
line.Pointer.Visible = true;
line.Pointer.Style = pointerStyles[iPar];
line.Color = lineColors[iSeries];
line.LinePen.Width = 1;
// Smooth lines
Steema.TeeChart.Styles.Line
smoothLine = new Steema.TeeChart.Styles.Line();
Steema.TeeChart.Functions.Smoothing
smoothing = new Steema.TeeChart.Functions.Smoothing();
smoothing.Interpolate = true;
smoothing.Period = 1;
smoothing.Factor = 10;
smoothLine.Function = smoothing;
smoothLine.DataSource = line;
smoothLine.Visible = true;

tChart1.Series.Add(smoothLine); // add smooth line
for (int iLoc=0;iLoc<noLocs;iLoc++)
{
smoothLine.Labels.Add(gsLocations[iLoc]);
xValues[iLoc] = iLoc;
yValues[iLoc] = gsSeries[iPar,iLoc,iTime];
}
tChart1.Series[iSeries].Add(xValues,yValues);
tChart1.Series[iSeries].Title =
gsParameters[iPar] + this.dateTimes[iTime];
tChart1.BackColor = Color.White;
iSeries++;
}
}
noSeries = iSeries;
}

I am using 8 data points per series. That's enough for proper smooting I guess.

Some help would be nice.

Best regards,
Antoon Koster

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 Jan 14, 2005 9:47 am

Hi Antoon,

You should use

Code: Select all

smoothLine.CheckDataSource();
when populating your input series manually.
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

Anthony
Newbie
Newbie
Posts: 35
Joined: Wed Feb 25, 2004 5:00 am
Location: WL| Delft Hydraulics, Holland
Contact:

Post by Anthony » Fri Jan 14, 2005 12:39 pm

Hi Narcis,

I must say I already tried your suggestion, as I found that extra line of code

smoothLine.CheckDataSource();

in the TeeChart example for smoothing lines.

But this did not have any effect for me ... still straight lines

Any idea what may be wrong ??

Regards,
Antoon Koster
[/img]

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Wed Jan 26, 2005 5:17 pm

Hi Antoon,

have you seen the example of this Function type in the Demo Features project (included with the TeeChart for Net v1 installation ) under :
What's New -> Welcome ! -> New Functions -> Smoothing SpLine ?
It shows how to do this.

Anthony
Newbie
Newbie
Posts: 35
Joined: Wed Feb 25, 2004 5:00 am
Location: WL| Delft Hydraulics, Holland
Contact:

Post by Anthony » Thu Jan 27, 2005 11:31 am

Hi,

Yes, I walked thru that example many times, and copied some code from it, but I don't get the smooth spline even after 2 days working ....

I must say, I (and my boss) will be VERY PLEASED if you could send me a complete Visual Studio .NET solution (so a *.sln file) with all the files included for that demo, so that I can check if I get the smooth spline.

Maybe there is something wrong with the installation, In that case I can check that.

My email is: [email protected]

Kind regards,
Antoon Koster
Netherlands

Pep
Site Admin
Site Admin
Posts: 3303
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Post by Pep » Fri Jan 28, 2005 3:32 pm

Hi Antoon,

te sources of the Demo Features project are included in the TeeChart for Net installation, you can find them under :
F:\Program Files\Steema Software\TeeChart for .NET v1\Examples\DemoProject

Post Reply