ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  Data from DB for Polar chart
Posted by Karteek on Oct-09-2014 00:29
Hi Peter,
We are trying to fetch data from DB for polar chart. When the db is updated with new
record the existing chart is replaced with new chart which we dont wont. Its the whole
point for us to see progression for every new measurement. Is it possible to draw new
chart with new data when db is updated. Which means i would like to still see the old chart
with old data and chart with new data so that i could have possibility to see the progress of
the data.

Thanks
Karteek

  Re: Data from DB for Polar chart
Posted by Peter Kwan on Oct-10-2014 02:49
Hi Karteek,

I assume that means you are not storing all the data in your database, but only the
latest value. In this case, you must find something to store all your data in your
computer. ChatDirector is not designed as a database and cannot store data. It can only
plot the data that you have stored.

If you are using PHP, PHP will automatically delete all local variables when the script
ends. If you want to store the data for the duration of the user PHP session, you can use
PHP session variables. If you want to store the data for a much longer time (eg. if you
want the data to survive even if the user close off the browser and reopne it the next
day), you would need to store it in the database or somewhere on your hard disk.

An example of using PHP session variables is:

if (!session_id())
     session_start();

# Obtain the old data stored in the PHP session variable 'xxx'
if (isset($_SESSION['xxx']))
    $data = $_SESSION['xxx'];
else
    # If there is no old data, initialize the $data to something you like as the initial data
    $data = array(85, 156, 179.5, 211, 123);

...... read data from the database .....

# append the value the old data
$data[] = $myDataValueFromDatabase;

# store the data in a PHP session variable so the data will not be deleted by PHP after
# this script ends
$_SESSION['xxx'] = $data;

Hope this can help.

Regards
Peter Kwan