|
Realtime Financial Chart |
Posted by peter on Jun-12-2014 08:45 |
|
Hi,
Thank you for your last reply.
I want to build a realtime financial chart.
In your realtime demo, you use a fixed size array.
But I thought that I should set the data array to be dynamically grow.
At the beginning, I declare a very large array.
After getting a data from my source, the data size increase by 1.
Then I redim the array size to the total data size.
And if one more data coming, I enlarge the array size by 1.
Should I repeatly do this work? Will this consume too many CPU work?
Any better solution? |
Re: Realtime Financial Chart |
Posted by Peter Kwan on Jun-12-2014 18:19 |
|
Hi Peter,
If I were you, I will declare an array larger than your current data, so that you do not need
to ReDim the array every time.
For example, suppose initially you need 1000 points, then you add more points. I would
declare the array to be of size 2000 initially and use only the first 1000 positions. The
remaining positions can be filled with Chart.NoValue (or cd.NoValue, depending on your
programming language edition of ChartDirector). When new data come, you may add them
to the array without ReDim it. When the array is full (that is, there are 2000 points), you
can double the array size (eg. ReDim to 4000) and fill the unused position by Chart.NoValue.
It means you only need to ReDim the array very rarely.
Hope this can help.
Regards
Peter Kwan |
|