Hi,
I plot the same YData : Array of Double; with TLineSeries in many different plots. To save memory it will be best to add the YData by adding array of data. My problem is that sometime the Data contains NaN values so I have tried to do like this.
XData is a array of double with values from 1 to Length(YData)
with Series1.XValues do begin
Value := TChartValues(XData);
Count := Length(XData);
Modified := True;
end;
with Series1.YValues do begin
Value := TChartValues(YData);
Count := Length(YData);
Modified := True;
end;
for ii 0 to High(YData) do begin
if IsNaN(YData[ii]) then begin
Series1.SetNull(ii);
end;
end;
Series1.Repaint
But still my program crash with error “Invalid pointer operation”.
So my question is why can’t TChartValues contain NaN values when.
TChartValue : Double;
TChartValues : Array of TChartValue;
And NaN values are defined in IEEE Standard 754.
Best regards
NaN Values
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: NaN Values
Hi BOA,
Thanks in advance.
Can you please attach a simple example project we can run "as-is" to reproduce the problem here¿But still my program crash with error “Invalid pointer operation”.
TeeChart doesn't automatically handle NaN values because there's no standard way to represent them and everybody expects they applications to deal NaNs in a different way so it's left to the programmer processing them to fit their needs.So my question is why can’t TChartValues contain NaN values when.
TChartValue : Double;
TChartValues : Array of TChartValue;
And NaN values are defined in IEEE Standard 754.
Thanks in advance.
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 |
Re: NaN Values
Hi Narcis,
Please see my attach project.
Yes I am award of that.
TTreatNullsStyle = (tnDontPaint, tnSkip, tnIgnore)
And of course TChart needs to know how to draw/handle NaN points. But what wonder me is why TChartValue can’t have the value NaN.
The same problem appear in this
Series1.AddXYNull(100,0); //Okay
Why can I not write?
Series1.AddXYNull(100,NaN); //Invalid floating point operation
Best regards,
Please see my attach project.
Yes I am award of that.
TTreatNullsStyle = (tnDontPaint, tnSkip, tnIgnore)
And of course TChart needs to know how to draw/handle NaN points. But what wonder me is why TChartValue can’t have the value NaN.
The same problem appear in this
Series1.AddXYNull(100,0); //Okay
Why can I not write?
Series1.AddXYNull(100,NaN); //Invalid floating point operation
Best regards,
- Attachments
-
- Project.zip
- (7.44 KiB) Downloaded 396 times
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: NaN Values
Hello,
Thanks for the project. Ok, now that I see the complete code I see that it's just a matter of commenting out the NaN assignment.
Ok, I have added your request (TV52015914) to the wish list to be considered for inclusion in future releases. By the way, how would you expect NaN values to be treated in TeeChart series? Would you consider those points null? And which value would you paint for them? Notice that in some circumstances null points are painted in series as well! That's probably the main reason why NaN values are not supported.
Thanks for the project. Ok, now that I see the complete code I see that it's just a matter of commenting out the NaN assignment.
Code: Select all
The same problem appear in this
Series1.AddXYNull(100,0); //Okay
Why can I not write?
Series1.AddXYNull(100,NaN); //Invalid floating point operation
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 |
Re: NaN Values
Hi Narcis,
I am not quit sure how your null points is define, as I understand it, it still has a real value you just paint it with the same color as the background => invisible.
This is after my opinion not the same as a NaN value because if you for example do something like this
If ANaNValue > ARealValue then you will get the exact error that is the reason to my problem ‘Invalid floating point operation’. Where as if you do something like this ANewValue := ANaNValue * ARealValue you don’t get a error the result is just rightfully NaN.
So after my opinion a NaN value should not be painted at all but still be allowed in the array. You should also be able to do further calculations with the array. This is also how other mathematical programs do (for example Matlab).
Best regards,
I am not quit sure how your null points is define, as I understand it, it still has a real value you just paint it with the same color as the background => invisible.
This is after my opinion not the same as a NaN value because if you for example do something like this
If ANaNValue > ARealValue then you will get the exact error that is the reason to my problem ‘Invalid floating point operation’. Where as if you do something like this ANewValue := ANaNValue * ARealValue you don’t get a error the result is just rightfully NaN.
So after my opinion a NaN value should not be painted at all but still be allowed in the array. You should also be able to do further calculations with the array. This is also how other mathematical programs do (for example Matlab).
Best regards,
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: NaN Values
Hello,
Thanks for the feedback. I'll add in the wish-list description.
Thanks for the feedback. I'll add in the wish-list description.
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 |