View unanswered posts | View active topics It is currently Wed Apr 17, 2024 6:51 am



Reply to topic  [ 1 post ] 
Problems with a bar graph 
Author Message
New pChart user
New pChart user

Joined: Mon Jun 03, 2013 6:53 am
Posts: 1
Post Problems with a bar graph
Hello, I have a problem with my graph. Here is my problem: my bars start from the point of the horizontal axes at I'd like the middle of the bar is on the point of abscissa. Another thing, my bars are all the same color but my legend shows well 4 different colors. Could someone help me please?
Here is my code :
Code:
// Récupération des variables de l'URL
$dept = explode('|', $_GET["dept"]);
$poids = explode('|', $_GET["poids"]);
$CA = explode('|', $_GET["CA"]);
$obj = explode('|',$_GET["obj"]);
$prctg = explode('|', $_GET["prctg"]);

// Définition des variables de dessin
$largeur = 800;
$hauteur = 300;
$DataSet = new pData;
$DataSet->AddPoint($dept, "serie1");
$DataSet->AddPoint($prctg, "serie2");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("serie1");
    for($nbr=0;$nbr<count($dept); $nbr++)
    {
$DataSet->SetSerieName($prctg[$nbr], $nbr));
    }

// Init du graph
$Bar = new pChart($largeur, $hauteur);
$Bar->setFontProperties("Config/pChart/Fonts/tahoma.ttf", 8);
$Bar->setGraphArea(40, 30, $largeur-100, $hauteur-30);
$Bar->drawFilledRoundedRectangle(7, 7, $largeur-14, $hauteur-7, 5, 225, 220, 200);
$Bar->drawRoundedRectangle(20, 20, $largeur-10, $hauteur-50, 50, 225, 220, 200);
$Bar->drawGraphArea(255, 255, 255, TRUE);
$Bar->drawScale($DataSet->GetData(), $DataSet->GetDataDescription(), SCALE_NORMAL, 0, 0, 0, TRUE, 0, 20, TRUE);
$Bar->drawGrid(4, TRUE, 225, 220, 200, 100);

// Dessin de l'axe des abscisses
$Bar->setFontProperties("Config/pChart/Fonts/tahoma.ttf", 6);
$Bar->drawTreshold(0, 143, 55, 72, TRUE, TRUE);

// Dessin du graph
$Bar->drawBarGraph($DataSet->GetData(), $DataSet->GetDataDescription(), TRUE);

// Fin du graph
$Bar->setFontProperties("Config/pChart/Fonts/tahoma.ttf", 8);
$Bar->drawLegend(610, 150, $DataSet->GetDataDescription(), 255, 255, 255);
$Bar->setFontProperties("Config/pChart/Fonts/tahoma.ttf", 10);
$Bar->drawTitle(50, 22, "Pourcentage sur objectif", 50, 50 ,50, 585);
$Bar->Render("prctg.png");
?>


Mon Jun 03, 2013 6:57 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron