Page 1 of 1

DBChart doesn't handle NaN values?

Posted: Thu Sep 26, 2013 9:13 pm
by 16565932
I have a fairly complex chart with multi-series linked off a database and while it generally works as intended, when a value in the database is NaN I get an 'Invalid floating point operation' error when I try to show the chart and I cannot seem to find a way around it. I have a similar application that just uses a TChart and manually populates the series with AddXY and AddNullXY, which that works fine with NaN values. It would be a major rewrite and perhaps performance hit to have to use TChart rather than TDBChart. Looking at the DBChart source all the values appear to be entered in without any checks for nulls. Is this a flaw with the source? Is there a work-around?

Dave

Re: DBChart doesn't handle NaN values?

Posted: Fri Sep 27, 2013 11:13 am
by yeray
Hi Dave,
davealaw wrote:Looking at the DBChart source all the values appear to be entered in without any checks for nulls. Is this a flaw with the source? Is there a work-around?
Right, we don't want to manipulate the sources or the numbers that are entered into the series. Note some customers may consider a NaN should be considered as a null, but others may want to consider them as a zero, skip adding them or any other behaviour. So we prefer to keep it open.
Then, the only way is to handle the NaNs yourself. I can think on two ways to do this:
- Modify the TeeChart sources so the NaNs are handled as you wish.
- Loop into the DataBase and add the values manually. Note TeeChart also loops the dataset to add the values to the series.