|
Real Time Web |
Posted by Rafael on Oct-14-2008 17:12 |
|
Hello,
I'm drawing a web graphic in real-time based on a Asp.NET page. The graphic is showing data that comes from a Serial Port. The graphic is showing the data but the line is fixed and don't refresh with the date time. For instants, my second measurement is 98 with the time 16.00. When a third measurement cames the second measurement goes to time 16.10. With this situation i can't give to the chart the idea of rolling. If I wasn't enough clear please tell me that I will explain better. Thanks, in advance. |
Re: Real Time Web |
Posted by Peter Kwan on Oct-14-2008 21:37 |
|
Hi Rafael,
I assume you would like to create a "rolling" real time chart. So the chart is showing a fixed number of points. When a new point come in, the oldest point will be "shifted out".
For simplicity, let us assume the chart is showing 5 data points. Suppose initially the 5 points are:
16:00 98
16:10 44
16:20 46
16:30 83
16:40 75
So your timestamp array should contain 5 dates, representing the 5 timestamps above. Your data array should contain 5 numbers, representing the 5 readings.
Now when a new data point comes in at 16:50 and the value is 60, you should update the array to:
16:10 98
16:20 44
16:30 46
16:40 83
16:50 60
Thne you may use these data to plot the new chart. In this way, the chart will appear as scrolling.
Note that you must use your own code to read the data from the serial port and update the array. ChartDirector will not read the data from the serial port or update the array.
In a web application, because the updating must be done independent to web request (that is, the updating should be done at the same rate, no matter there are zero browser or 1000 browsers accessing the web site), so typically the updating is done in a background program. The background program typically reads in new data, and store them to a database. The charting script will just get the latest 5 records from the database and plot it.
Hope this can help.
Regards
Peter Kwan |
Re: Real Time Web |
Posted by Rafael on Oct-15-2008 19:07 |
|
Thanks
It was very helpful
Keep going the good job |
|