asLine with NULL values from database

TeeChart for ActiveX, COM and ASP
Post Reply
Mike
Newbie
Newbie
Posts: 40
Joined: Wed Jan 28, 2004 5:00 am

asLine with NULL values from database

Post by Mike » Thu Feb 26, 2004 11:59 am

hello,

I read data values from SQL Server 2000 database. The information is the following, for example:

timestamp current voltage potential1 potential2 .......
-----------------------------------------------------------------------------------
1.1.2004 1.2984 NULL 1.5656 12.4633
2.1.2004 1.2933 NULL 1.9467 11.9364
3.1.2004 1.3100 NULL 2.1342 10.9456
.........
19.1.2004 1.2936 6.4735 2.0463 9.4732


When I fetch the data from DB with SQL statement including WHERE voltage IS NOT NULL, the asLine graph displays normally (using AddArray method for adding the data). However, the only voltage data point having a value is shown as the first data point in the voltage series, although it should be the 19th data value.

This should be avoided by adding NULL values to the graph, but when removing the WHERE voltage IS NOT NULL clause from the SQL statement, a catastrophic failure is given. This is caused by the AddArray method.

Is there another way of adding several dataseries to a linechart having occasional NULL values and still showing the correct timestamp for each data value? Should I have a loop going through all data values and check, whether the values is null and then use the AddNull method and otherwise use AddXY method, for example.

TIA

Mike

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Mon Mar 01, 2004 2:00 pm

Hi Mike,
Is there another way of adding several dataseries to a linechart having occasional NULL values and still showing the correct timestamp for each data value? Should I have a loop going through all data values and check, whether the values is null and then use the AddNull method and otherwise use AddXY method, for example.
I believe you have two options:
1) Connect the lineseries directly to the database via ADO as in the example under: C:\Program Files\Steema Software\TeeChart Pro v6 ActiveX Control\Examples\Visual Basic\Visual Basic 5 & 6\ADO Databases
2) Fill your arrays without the where statement and then loop through them as you suggest using the ISeries.IsNull method.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

Post Reply