Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Dynamic charts with PHP and MySQL

Status
Not open for further replies.

max1x

Programmer
Jan 12, 2005
366
0
0
US
I am running PHP and MySQL and want to create dynamic charts (All different types) and was wondering what do you recommend.
 
and was wondering what do you recommend.

A better explanation of what you hope to do.

"Dynamic charts" is a very broad scope, and provides no explanation of what you (that's you personally) really mean.


But if it really means "Charts that update in 'real time' with no user interaction" the answer is "You can't". PHP runs 'on request' only NOT continuously, so once it has completed, it is done and no further 'update' will occur.

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Thanks Chris.

I was wondering what is the recommended approach to create "Graphs/Charts". By Dynamic, I wanted to option to showcase based on different options i.e Bar, Pie, Line...etc

 
For simple charts have you tried Google? Just output the data in the right format and you can get nice charts, graphs etc - one of mine (please excuse any bad coding)

<script type="text/javascript" src="
<script type="text/javascript">
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['The Hour', 'Views'],
<?php
for($p=0; $p<count($kount); $p++){
echo "['".$p."', ".$kount[$p]."],";
}
?>
]);
var options = {
title: 'Views',
pieSliceText: 'label',
};
var chart = new google.visualization.BarChart(document.getElementById('chart_div'));
chart.draw(data, options);
}
</script>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top