<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" media="screen" type="text/css" href="css/style.css" /> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('number', 'Abscisses'); data.addColumn('number', 'Ordonnées'); <?php $I=0;$I<=$num_row - 1; include 'include/bdd.php'; $recup2 = mysql_query("SELECT posx,posy FROM elfik_user WHERE user_rank='1'") or die(mysql_error()); $num_row = mysql_num_rows($recup2);?> data.addRows(<?php echo mysql_num_rows($recup2);?>); <?php while($fetch2 = mysql_fetch_assoc($recup2)) { ?> data.setValue(<?php echo $I;?>, 0, <?php echo $fetch2['posx'];?>); data.setValue(<?php echo $I;?>, 1, <?php echo $fetch2['posy'];?>); <?php $I++; }; ?> var chart = new google.visualization.ScatterChart(document.getElementById('chart_div')); chart.draw(data, {width: 1300, height: 1000, title: 'carte du monde', hAxis: {title: 'Abscisses', minValue: -200, maxValue: 200}, vAxis: {title: 'Ordonnées', minValue: -200, maxValue: 200}, legend: 'none', pointSize : '3' }); } </script> </head> <SCRIPT LANGUAGE="JavaScript" SRC="script/menu.js"></SCRIPT> </html>
<?php include 'include/bdd.php'; require_once "libs/artichow/ScatterPlot.class.php"; $graph = new Graph(800, 600); $graph->title->set('Carte du Monde'); $y = array(); $x = array(); $retour mysql_query("SELECT posx FROM elfik_user WHERE user_rank '1'")or die ('Erreur :'.mysql_error()); while($donnees = mysql_fetch_assoc($retour)) { $x[] =$donnees['posx']; } $retour2 mysql_query("SELECT posy FROM elfik_user WHERE user_rank '1'")or die ('Erreur :'.mysql_error()); while($donnees2 = mysql_fetch_assoc($retour2)) { $y[] =$donnees2['posy']; } $plot = new ScatterPlot($y, $x); $plot->setYMax(200); $plot->setYMin(-200); $plot->xAxis->label->setInterval(50); $plot->yAxis->label->setInterval(50); $plot->setBackgroundColor(new Color(20, 20, 20, 20)); $plot->setPadding(NULL, NULL, 40, 20); $graph->add($plot); $graph->draw(); ?>
l'utilisation d'artichow est elle une bonne solution ?
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question<?php include 'include/bdd.php'; $recup2 = mysql_query("SELECT posx,posy FROM elfik_user WHERE user_rank='1'") or die(mysql_error()); // Ici c'est mes coordonnées X et Y $fetch2 = mysql_fetch_assoc($recup2); // $num_rows = mysql_num_rows($recup2); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" media="screen" type="text/css" href="css/style.css" /> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('number', 'Abscisses'); data.addColumn('number', 'Ordonnées'); data.addRows(10); data.setValue(0, 0, 8); // Bon ça s'est les coordonnées sous la forme nécessaire à l'affichage, moi j'ai juste des X et des Y, et j'aimerai faire le lien avec les valeurs récupérées depuis ma base de donnée. data.setValue(0, 1, 12); data.setValue(1, 0, 4); data.setValue(1, 1, 5.5); data.setValue(2, 0, 11); data.setValue(2, 1, 14); data.setValue(3, 0, 4); data.setValue(3, 1, 4.5); data.setValue(4, 0, 3); data.setValue(4, 1, 3.5); data.setValue(5, 0, 6.5); data.setValue(5, 1, 7); var chart = new google.visualization.ScatterChart(document.getElementById('chart_div')); chart.draw(data, {width: 1300, height: 1000, title: 'Age vs. Weight comparison', hAxis: {title: 'Abscisses', minValue: -300, maxValue: 300}, vAxis: {title: 'Ordonnées', minValue: -300, maxValue: 300}, legend: 'none' }); } </script> </head> <SCRIPT LANGUAGE="JavaScript" SRC="script/menu.js"></SCRIPT> </html>
<?php include 'include/bdd.php'; $recup2 = mysql_query("SELECT posx,posy FROM elfik_user WHERE user_rank='1'") or die(mysql_error()); $fetch2 = mysql_fetch_assoc($recup2); $num_rows = mysql_num_rows($recup2); $posx = $fetch2['posx']; $posy = $fetch2['posy']; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" media="screen" type="text/css" href="css/style.css" /> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("visualization", "1", {packages:["corechart"]}); google.setOnLoadCallback(drawChart); function drawChart() { var data = new google.visualization.DataTable(); data.addColumn('number', 'Abscisses'); data.addColumn('number', 'Ordonnées'); data.addRows(<?php echo $num_rows ?>); <?php for($I=0;$I<=100;$I++) { ?> data.setValue(<?php echo $I;?>, 0, <?php echo $posx;?>); data.setValue(<?php echo $I;?>, 1, <?php echo $posy;?>); <?php } ?> var chart = new google.visualization.ScatterChart(document.getElementById('chart_div')); chart.draw(data, {width: 1300, height: 1000, title: 'Age vs. Weight comparison', hAxis: {title: 'Abscisses', minValue: -50, maxValue: 50}, vAxis: {title: 'Ordonnées', minValue: -50, maxValue: 50}, legend: 'none', pointSize : '3' }); } </script>
data.addColumn('number', 'Abscisses'); data.addColumn('number', 'Ordonnées'); <?php $recup2 = mysql_query("SELECT posx,posy FROM elfik_user WHERE user_rank='1'") or die(mysql_error());?> data.addRows(<?php echo mysql_num_rows($recup2);?>); <?php while($fetch2 = mysql_fetch_assoc($recup2)) { ?> data.setValue(<?php echo $I;?>, 0, <?php echo $fetch2['posx'];?>); data.setValue(<?php echo $I;?>, 1, <?php echo $fetch2['posy'];?>); <?php }; ?> …