joined:June 15, 2010
Disclaimer: I'm a noob.
I've been interning at a company throughout the summer developing a website that will display various data from some buoys. The data is stuff like latitude, longitude, water temperature, depth, etc.
I'd like to display this data in an "Open Flash Chart" chart. I'm not sure if you're familiar with that application or not, here is a link to their official site: [teethgrinder.co.uk
] (note: I'm using the older version of Open Flash Chart, not Open Flash Chart 2)
The reason I'm even using this particular application to display charts in the first place is someone here at the company had set it up beforehand. If someone can offer a better alternative for what I am trying to do, like using something besides Open Flash Chart, that would be awesome.
I have an SQL database already set up, it's all good to go. All I want to do is take the last 25 rows or so and pull data from that. The database has thousands upon thousands of rows, because it's updated with every new data report from a buoy.
In this Open Flash Chart application, I can get the chart to work if I just use a text file, but I really need it to be able to get the data from a database.
Here is a small sample of the code from one of the chart.php files:
$link = mysql_connect("localhost","root","password") or die(mysql_error());
$query="select * from data order by uid asc limit 1";
$result=mysql_query($query,$link) or die(mysql_error());
while ($track = mysql_fetch_array($result))
$lat = $row['lat'];
$long = $row['long'];
$n = count($lat);
$ymax = $lat;
$ymin = $lat;
$xmax = $long;
$xmin = $long;
$j = 0;
for ($i=0; $i<$n; $i++)
$track[$i] = new point ($long[$i], $lat[$i] , 3);
if ($lat[$i] >= $ymax)
$ymax = $lat[$i] + .0001;
if ($long[$i] >= $xmax)
$xmax = $long[$i] + .0001;
if ($lat[$i] <= $ymin)
$ymin = $lat[$i] - .0001;
if ($long[$i] <= $xmin)
$xmin = $long[$i] - .0001;
echo nl2br ("x min \n");
Connecting to the SQL database is no problem. But I'm sure I'm just doing something wrong with forming the array and setting the xmin, xmax, ymin, ymax for the table. I really don't know if I can describe this any better than I have. If anyone is familiar with Open Flash Chart, perhaps you can help me. But I'm wondering if Open Flash Chart can even work with SQL databases like I want it to. I've looked up the documentation on their site and haven't found anything particularly helpful.
Any ideas, suggestions, help is greatly appreciated. I'm on a pretty tight deadline to get this thing finished before I go back to school for the fall and I'm stressing like crazy. I'm just so new to all this. Thank you for your help.