For data that are in text files, simply read them and parse them into array variables. Once the data is in array variables, they can be used with the ChartDirector API.
The exact details of reading and parsing text files depend on the format of the text files. The following provides a simple example.
Suppose your text file is in comma delimited text format, with each line representing a record, like the followings:
To read the above into array variables, you may use the following code:
'The following code is in VBScript and is designed to run on web servers.
'If you are using Visual Basic, you can use the Visual Basic "Open" function
'to open the text file instead of FileSystemObject.
Set fso = CreateObject("Scripting.FileSystemObject")
Set myFile = fso.OpenTextFile(Server.MapPath("testdata.txt"))
'Assume we do not know the number of rows. Simply declare the array size
'using the worst case.
'Read in the text file line by line, split the line, and put the result
'in the array variables
i = 0
Do While Not myFile.AtEndOfStream
line = myFile.ReadLine()
If line <> "" Then
fields = Split(line, ",")
col0(i) = fields(0)
col1(i) = fields(1)
col2(i) = fields(2)
i = i + 1
If i > UBound(col0) Then Exit Do
'Now we know the exact number of rows, so we can trim the array.
ReDim Preserve col0(i - 1)
ReDim Preserve col1(i - 1)
ReDim Preserve col2(i - 1)
© 2017 Advanced Software Engineering Limited. All rights reserved.