Page 1 of 1

I can't get a correct average line

Posted: Tue Mar 27, 2007 6:36 am
by 9643849
I'm struggeling with an average line that isn't showing correctly. I have some lines on my chart with different number of points. Each point has a DateTime x-value and a float y-value. The problem occurs when the lines do not 'start' at the same DateTime (x-value). In thoose cases, the average value is calculated incorrect, it seems like each 'first point' are included in the average lines first point, no matter what DateTime value the 'first point' for each line has.

So... I read somewhere that 'null' points could be added to my lines in order to make them include the same number of points. I tried to do "myLine.Add()" each time a point was 'missing', but the result wasn't exactly what I expected. If the first point that is added for a line is a null point, the graph (including the average value) starts at 1800-something. Even if I make sure each line has a valid first point, the average isn't calculated correctly anyway.

I looked for a way to add a point like myLine.Add(myDate, null), but it seems unsupported.

Is there a solution to my problem?

Regards Andreas

Posted: Tue Mar 27, 2007 2:27 pm
by 9643849
Is my question unclear or stupid?

I really can't get the average line to work correctly. Can anyone just give me a little hint or a follow up question?

Best Regards Andreas

Posted: Tue Mar 27, 2007 2:36 pm
by narcis
Hi Andreas,

Your question not unclear neither stupid. We just need to review Average function behaviour. We will get back to you when we have further information.

Posted: Wed Mar 28, 2007 10:36 am
by 9643849
Ahh, great to hear Narcis!
I look forward to your answer!

%Regards Andreas

Posted: Fri Mar 30, 2007 2:19 pm
by narcis
Hi Andreas,

The only solution is to use the very same x values in all series to obtain the appropriate average. A solution could be adding null values for the points that shouldn't be in the series but it is not supported in current version. It is already on our wish-list to be implemented in future releases.

Posted: Mon Apr 02, 2007 7:58 am
by 9643849
Hi again, and thatn you for your reply!

The solution with adding the exact same x-values for each line has a problem (as I guess you know). I'll need to add points for lines where I have no valid Y-value, and since null isn't allowed I'll need to go with 0 (or something) and make the point transparent. The problem is just that the '0' will affect the calculated average line.

Perhaps I should create my own average function... At least until null values are supported.

Regards Andreas

Posted: Mon Apr 02, 2007 9:29 am
by narcis
Hi Andreas,

Yes, that may be an option. To create your custom function you can use Custom y=y(x) function as shown at All Features\Welcome !\Functions\Extended\Custom y=y(x) example in the features demo.

You'll find the demo at TeeChart's program group.