Page 1 of 1
Concatenate new points with older ones in a serie
Posted: Thu Feb 10, 2005 2:53 pm
by 9524648
Hi !
I would like to know if it's possible to add new points to a serie without deleting the points which already exist in it.
As I have huge quantities of points to add to my serie, I currently use the AddArray function.
The problem is that if I add a set of points whith this function twice, the first set is deleted.
Any Idea ?
Best regards.
Posted: Thu Feb 10, 2005 4:06 pm
by narcis
Hi tdm,
Yes, that's true. You should create a bigger array were you concatenate the "partial" arrays and add the result array to the chart like:
Code: Select all
Dim i, j As Integer
Dim Arr1(100), Arr2(100), Arr3(200) As Integer
For i = LBound(Arr1) To UBound(Arr1)
Arr1(i) = Rnd(1000) * 1000
Arr3(i) = Arr1(i)
Next
For j = LBound(Arr2) To UBound(Arr2)
Arr2(j) = Rnd(1000) * 1000
Arr3(i + j - 1) = Arr2(j)
Next
TChart1.Series(0).AddArray UBound(Arr3), Arr3
Posted: Fri Feb 11, 2005 8:15 am
by 9524648
Yeah sure.
But the problem is the number of points I work with.
If my series owns 2000000 points or more and If I want to add to this serie 2000000 or more points, if I follow your advice, I must read the 2000000 first points the serie already owns, put them in an array and then and my 2000000 new point in this array.
Then I just have to pass this array to the serie with the addarray method.
The problem of this method is the time of the reading of the points the serie already owns. Indeed, there is no method "getarray" which gives the data in the serie as two arrays X[] and Y[] as opposed to "addarray" which is used to add points.
I must do a loop and get the points one per one with the GetValue method of the two IValueList objects (X and Y value lists) derived from the Serie class.
This loop is too much time consuming.
Any idea or other advice ?
Thanks a lot.
Posted: Fri Feb 11, 2005 9:01 am
by narcis
Hi tdm,
How many point do you want do you want to show your clients at any one time?
You might find it easier to load the points to be viewed dynamically at run-time from your arrays.
Posted: Fri Feb 11, 2005 9:28 am
by 9524648
Hi.
In fact the Chart is used to display curves of data acquisition : temperature, hygrometry, presure...
The data is acquired from an acquisition system and each channel has a different acquisition frequency. The maximum frequency is 1pt/min and the curves must be displayed over 6 months !!!
That is to say a serie can hold about 60min*24hours*31days*6months = 267840 points.
Other mode of the acquisition system is quick acquisition. If an event (user programmable, such as a verifying that the data acquired is beyond a certain value) occurs, the data acquisition frequency changes : the maximum frequency is 4000Hz (4000pt/sec).
The time of the acquisition is limited (max 1 hour) because of the volume of data acquired. The max number of points is there : 4000*60sec*60min = 7200000 !!!
The data acquired are downloaded from the acquisition system on the user's demand and are saved in a mysql database.
The user can let pass 5-6 months before downloading the new data...
The data already in the database are displayed in the chart as curves=f(time) and when the download of the new data is achieved, the user can refresh the chart if he wants to.
It's there that's my problem is (adding new points to a serie).
Is it OK ?
Posted: Fri Feb 11, 2005 10:05 am
by narcis
Hi tdm,
Yes, I understand your case.
The data acquired are downloaded from the acquisition system on the user's demand and are saved in a mysql database.
The user can let pass 5-6 months before downloading the new data...
Have you thought using a DataSource then?
You can see how to do it at "Tutorial 8 - ADO Database access". Also an example of it is available at "C:\Program Files\Steema Software\TeeChart Pro v7 ActiveX Control\Examples\Visual Basic\Visual Basic 5 & 6\ADO Databases" (default english installation path". You can also find some examples included in the TeeChart feature demo.
Posted: Fri Feb 11, 2005 10:21 am
by 9524648
Yeah we thought about.
I found it difficult to use because we are not running neitheir Visual Basic nor Visual C++. Our program is written under LabWindows CVI, from Nationnal Instruments.
I will read the tutorial you advised me and studdy the exemple and then I will repost my conclusions...
Thanks a lot for your help and usefull advices.
Best regards.