Page 1 of 1
Smooth lines
Posted: Thu Jan 13, 2005 11:36 am
by 9080952
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
Posted: Thu Jan 13, 2005 12:39 pm
by narcis
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.
Posted: Fri Jan 14, 2005 8:32 am
by 9080952
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
Posted: Fri Jan 14, 2005 9:47 am
by narcis
Hi Antoon,
You should use
when populating your input series manually.
Posted: Fri Jan 14, 2005 12:39 pm
by 9080952
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]
Posted: Wed Jan 26, 2005 5:17 pm
by Pep
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.
Posted: Thu Jan 27, 2005 11:31 am
by 9080952
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
Posted: Fri Jan 28, 2005 3:32 pm
by Pep
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