Let's say I have 10 lines (series of line typ) drawn on a chart. It could be the temperature for 10 different temperature meters for a couple of days.
Now I would like to draw an average line, showing the average temperature for each day (every line has one reading per day). Is this possible with the Average function or with the MovingAverage function?
The examples in the FeatureDemo regarding average values only deals with one series.
Regards Andreas
Draw an average line
Hi Wicket
Yes it's possible, you can do this in design-time with editor or in run-time. You can put more of one serie in a Function, doing array of series as below code:
You can find more information about Functions in the Tuturial 7 "Working with Functions"
Yes it's possible, you can do this in design-time with editor or in run-time. You can put more of one serie in a Function, doing array of series as below code:
Code: Select all
//Add a series to be used for an Average Function
Line average = new Line(tChart1.Chart);
//Define the Function Type for the new Series
Steema.TeeChart.Functions.Average average1 = new Steema.TeeChart.Functions.Average();
average.Function = average1;
//Define the Datasource for the new Function Series
average.DataSource = new object[] { this.line1, this.line2, this.line3, this.line5,
this.line6,this.line6, this.line7, this.line8,
this.line9,this.line10};
average.Color = Color.Black;
average.Function.Period = 1;
average.CheckDataSource();
Hmm, I think I am in trouble again! =(
I followed your example, and it seemd to work fine!
However... When I add lines with different 'start date' (different start position on the x axis), the average line is calculated wrong. It seems like it adds all 'forst points' (for each line) and divide them by the number of 'first points', then all second points etc...
So, My line that starts in the middle of the graph affects the average to the far left on the graph. What am I doing wrong?
regards Andreas
I followed your example, and it seemd to work fine!
However... When I add lines with different 'start date' (different start position on the x axis), the average line is calculated wrong. It seems like it adds all 'forst points' (for each line) and divide them by the number of 'first points', then all second points etc...
So, My line that starts in the middle of the graph affects the average to the far left on the graph. What am I doing wrong?
regards Andreas
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Andreas,
Please find my reply at your other thread about the same issue:
http://www.teechart.net/support/viewtop ... 1820#21820
Please find my reply at your other thread about the same issue:
http://www.teechart.net/support/viewtop ... 1820#21820
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |