Bonjour je recherche quelqu'un qui pourrait m'expliquer calmement comment on insère un graphique dynamique.
Voici mon problème, pour l'instant j'arrive à afficher un graphique dans ma page de résulat mais ce sont des résultats statiques. Je voudrais que le graphique prenne en compte le résulat final mais la je bloque.
Voici mon code du graphique classique:
[code]
<?php
$K1 = 1;
$K2 = 3;
$K3 = 100;
include ("jpgraph14/jpgraph.php");
include ("jpgraph14/jpgraph_line.php");
$ydata = array($K1,$K2,$K3);
// Creation du graphique
$graph = new Graph(300,300);
$graph->SetScale("textlin");
// Création du système de points
$lineplot=new LinePlot($ydata);
// On rajoute les points au graphique
$graph->Add($lineplot);
// Affichage
$graph->Stroke();
?>
[/code]
Et voici le code de mon code affichant le résultat:
[code]
<?
include("./header.php");
unset($_SESSION['msg_sel']);
$row = $HTTP_POST_VARS['rows'];
$conc = $HTTP_POST_VARS['concurence'];
//echo($conc);
for ($i=0; $i<$row; $i++)
{
if(isset($HTTP_POST_VARS['chk'.$i])){
if(isset($where))
$where = $where." OR t1.id_film=".$HTTP_POST_VARS['chk'.$i];
else $where="WHERE (t1.id_film=".$HTTP_POST_VARS['chk'.$i];
}
}
$where = $where.")";
print("________________________________________________________________________________________<br><br><br>");
connectionDB($host,$user,$pwd,$base) ;
$query = "SELECT t1.nb_ent, t1.3m, t1.6m, t1.12m FROM films as t1 ".$where ;
// print $query;
$res = execQuery($query) ;
$num_row = mysql_num_rows($res) ;
$imax=$K0=$K3=$K6=$K12=0;
for ($i=0; $i<$num_row; $i++)
{
$row = mysql_fetch_array($res);
$K0 = $K0 + $row[0];
$K3 = $K3 + $row[1];
$K6 = $K6 + $row[2];
$K12 = $K12 + $row[3];
$imax++;
}
$query = "SELECT t1.pourcent FROM concurence as t1 WHERE t1.id_conc=".$conc ;
$res2 = execQuery($query) ;
$num_row2 = mysql_num_rows($res2) ;
$row2 = mysql_fetch_array($res2) ;
$Kk = (100-$row2[0])/100;
if($_SESSION['tv'] <> 1){
$K3 = $Kk*100*$K3 / $K0;
$K6 = $Kk*100*$K6 / $K0;
$K12 = $Kk*100*$K12 / $K0;
}
else{
$K3 = $Kk*$K3 / $imax;
$K6 = $Kk*$K6 / $imax;
$K12 = $Kk*$K12 / $imax;
}
// print $query;
if ($num_row <> 0)
{
// $K3 = $K3/$num_row*100*(1-($row2[0]/100));
// $K6 = $K6/$num_row*100*(1-($row2[0]/100));
// $K12 = $K12/$num_row*100*(1-($row2[0]/100));
// on arrondit à 2 chiffres
if($_SESSION['tv'] <> 1){
$K3 = round($K3, 2);
$K6 = round($K6, 2);
$K12 = round($K12, 2);
print("<center><img border='0' height='100' src='./images/mickey_020.gif' valign='bottom'></center><br><center><img border='4' height='300' src='decision_tree1.php' valign='bottom'></center><br><br><b>Coefficient de transformation à 3 mois = ".$K3."%");
print("<br>Coefficient de transformation à 6 mois = ".$K6."%");
print("<br>Coefficient de transformation à 12 mois = ".$K12."% </b><BR><bR><br><br>");
}
else{
$K3 = round($K3, 0);
$K6 = round($K6, 0);
$K12 = round($K12, 0);
print("<center><img border='0' height='100' src='./images/mickey_020.gif' valign='bottom'></center><br><br><b>Prévision de volume à 3 mois = ".$K3." unités");
print("<br>Prévision de volume à 6 mois = ".$K6." unités");
print("<br>Prévision de volume à 12 mois = ".$K12." unités");
}
}
else
{
$_SESSION['msg_sel'] = "Vous devez selectionner au moins un film...";
print("<script>window.history.back();</script>");
}
include('./feet.php');
?>
[/code]
Merci beaucoup.