芝麻web文件管理V1.00
编辑当前文件:/home/prismawe/www/resupres/application/views/admin/stat/stat1.php
SetScale("textlin"); $theme_class = new UniversalTheme; $graph->SetTheme($theme_class); $graph->img->SetAntiAliasing(false); $graph->title->Set('Vote par jour sur 7 jours'); $graph->SetBox(false); $graph->img->SetAntiAliasing(); $graph->yaxis->HideZeroLabel(); $graph->yaxis->HideLine(false); $graph->yaxis->HideTicks(false, false); $graph->xgrid->Show(); $graph->xgrid->SetLineStyle("solid"); $today = new DateTime(); $d1 = new DateTime(); $d2 = new DateTime(); $d3 = new DateTime(); $d4 = new DateTime(); $d5 = new DateTime(); $d6 = new DateTime(); $d1->setDate($today->format("Y"), $today->format("m"), $today->format("d") - 1); $d2->setDate($today->format("Y"), $today->format("m"), $today->format("d") - 2); $d3->setDate($today->format("Y"), $today->format("m"), $today->format("d") - 3); $d4->setDate($today->format("Y"), $today->format("m"), $today->format("d") - 4); $d5->setDate($today->format("Y"), $today->format("m"), $today->format("d") - 5); $d6->setDate($today->format("Y"), $today->format("m"), $today->format("d") - 6); //on met au premier du mois suivant $graph->xaxis->SetTickLabels(array($jours[$d6->format('N') - 1], $jours[$d5->format('N') - 1], $jours[$d4->format('N') - 1], $jours[$d3->format('N') - 1], $jours[$d2->format('N') - 1], $jours[$d1->format('N') - 1], $jours[$today->format('N') - 1])); $graph->xgrid->SetColor('#E3E3E3'); // Create the first line $p1 = new LinePlot($datay1); $graph->Add($p1); $p1->value->Show(); $p1->value->SetFormat('%d'); $p1->SetColor("#6495ED"); $p1->SetLegend('Vote'); /* // Create the second line $p2 = new LinePlot($datay2); $graph->Add($p2); $p2->SetColor("#B22222"); $p2->SetLegend('Line 2'); // Create the third line $p3 = new LinePlot($datay3); $graph->Add($p3); $p3->SetColor("#FF1493"); $p3->SetLegend('Line 3'); */ $graph->legend->SetFrameWeight(1); // Output line if (file_exists("images/stats/vote7jrs.png")) { unlink("images/stats/vote7jrs.png"); } $im = $graph->Stroke(_IMG_HANDLER); imagepng($im, "images/stats/vote7jrs.png"); /***************** * Graphi bar ****************/ $label = array(); //récup valeur candidat 1 $datayC1 = array(); foreach ($barDuelAgeC1 as $key => $value) { $label[] = $key; $datayC1[] = $value; } //récup valeur candidat 2 $datayC2 = array(); foreach ($barDuelAgeC2 as $key => $value) { $datayC2[] = $value; } //récup valeur blanc $datayB = array(); foreach ($barDuelAgeB as $key => $value) { $datayB[] = $value; } // Create the graph. These two calls are always required $graphBar = new Graph(900, 250, 'auto'); $graphBar->SetScale("textlin"); $theme_class = new UniversalTheme; $graphBar->SetTheme($theme_class); $graphBar->SetBox(false); $graphBar->ygrid->SetFill(false); $graphBar->xaxis->SetTickLabels($label); $graphBar->yaxis->HideLine(false); $graphBar->yaxis->HideTicks(false, false); // Create the bar plots $b1plot = new BarPlot($datayC1); $b2plot = new BarPlot($datayC2); $b3plot = new BarPlot($datayB); // Create the grouped bar plot $gbplot = new GroupBarPlot(array($b1plot, $b3plot, $b2plot)); // ...and add it to the graPH $graphBar->Add($gbplot); $b1plot->value->Show(); $b1plot->value->SetFormat('%d'); $b2plot->value->Show(); $b2plot->value->SetFormat('%d'); $b3plot->value->Show(); $b3plot->value->SetFormat('%d'); $b1plot->SetLegend($duel->candidat1->prenom . ' ' . $duel->candidat1->nom); $b2plot->SetLegend($duel->candidat2->prenom . ' ' . $duel->candidat2->nom); $b3plot->SetLegend('Blanc'); $b1plot->SetColor("black"); $b1plot->SetFillColor("#1111cc"); $b2plot->SetColor("black"); $b2plot->SetFillColor("#cc1111"); $b3plot->SetColor("black"); $b3plot->SetFillColor("white"); $graphBar->title->Set("Vote par tranche d'age"); // Output bar if (file_exists("images/stats/barDuelAge.png")) { unlink("images/stats/barDuelAge.png"); } $im = $graphBar->Stroke(_IMG_HANDLER); imagepng($im, "images/stats/barDuelAge.png"); /*********************** * barDuelRegion ***********************/ $label = array(); //récup valeur candidat 1 $datayC1 = array(); foreach ($barDuelRegionC1 as $key => $value) { $label[] = $key; $datayC1[] = $value; } //récup valeur candidat 2 $datayC2 = array(); foreach ($barDuelRegionC2 as $key => $value) { $datayC2[] = $value; } //récup valeur blanc $datayB = array(); foreach ($barDuelRegionB as $key => $value) { $datayB[] = $value; } // Create the graph. These two calls are always required $graphBar = new Graph(1200, 500, 'auto'); $graphBar->SetScale("textlin"); $theme_class = new UniversalTheme; $graphBar->SetTheme($theme_class); $graphBar->SetBox(false); $graphBar->ygrid->SetFill(false); $graphBar->xaxis->SetTickLabels($label); $graphBar->yaxis->HideLine(false); $graphBar->yaxis->HideTicks(false, false); $graphBar->xaxis->SetLabelAngle(45); // Create the bar plots $b1plot = new BarPlot($datayC1); $b2plot = new BarPlot($datayC2); $b3plot = new BarPlot($datayB); // Create the grouped bar plot $gbplot = new GroupBarPlot(array($b1plot, $b3plot, $b2plot)); // ...and add it to the graPH $graphBar->Add($gbplot); $b1plot->value->Show(); $b1plot->value->SetFont(FF_FONT0, FS_NORMAL, 6); $b1plot->value->SetFormat('%d'); $b2plot->value->Show(); $b2plot->value->SetFont(FF_FONT0, FS_NORMAL, 6); $b2plot->value->SetFormat('%d'); $b3plot->value->Show(); $b3plot->value->SetFont(FF_FONT0, FS_NORMAL, 6); $b3plot->value->SetFormat('%d'); $b1plot->SetLegend($duel->candidat1->prenom . ' ' . $duel->candidat1->nom); $b2plot->SetLegend($duel->candidat2->prenom . ' ' . $duel->candidat2->nom); $b3plot->SetLegend('Blanc'); $b1plot->SetColor("black"); $b1plot->SetFillColor("#1111cc"); $b2plot->SetColor("black"); $b2plot->SetFillColor("#cc1111"); $b3plot->SetColor("black"); $b3plot->SetFillColor("white"); $graphBar->title->Set("Vote par région"); // Output bar if (file_exists("images/stats/barDuelRegion.png")) { unlink("images/stats/barDuelRegion.png"); } $im = $graphBar->Stroke(_IMG_HANDLER); imagepng($im, "images/stats/barDuelRegion.png"); /*********************** * barDuelSociau ***********************/ $label = array(); //récup valeur candidat 1 $datayC1 = array(); foreach ($barDuelSociauC1 as $key => $value) { $label[] = $key; $datayC1[] = $value; } //récup valeur candidat 2 $datayC2 = array(); foreach ($barDuelSociauC2 as $key => $value) { $datayC2[] = $value; } //récup valeur blanc $datayB = array(); foreach ($barDuelSociauB as $key => $value) { $datayB[] = $value; } // Create the graph. These two calls are always required $graphBar = new Graph(900, 400, 'auto'); $graphBar->SetScale("textlin"); $theme_class = new UniversalTheme; $graphBar->SetTheme($theme_class); //$graphBar->yaxis->SetTickPositions(array(0, 30, 60, 90, 120, 150), array(15, 45, 75, 105, 135)); $graphBar->SetBox(false); $graphBar->ygrid->SetFill(false); $graphBar->xaxis->SetTickLabels($label); $graphBar->yaxis->HideLine(false); $graphBar->yaxis->HideTicks(false, false); $graphBar->xaxis->SetLabelAngle(45); // Create the bar plots $b1plot = new BarPlot($datayC1); $b2plot = new BarPlot($datayC2); $b3plot = new BarPlot($datayB); // Create the grouped bar plot $gbplot = new GroupBarPlot(array($b1plot, $b3plot, $b2plot)); // ...and add it to the graPH $graphBar->Add($gbplot); $b1plot->value->Show(); $b1plot->value->SetFont(FF_FONT0, FS_NORMAL, 8); $b1plot->value->SetFormat('%d'); $b2plot->value->Show(); $b2plot->value->SetFont(FF_FONT0, FS_NORMAL, 8); $b2plot->value->SetFormat('%d'); $b3plot->value->Show(); $b3plot->value->SetFont(FF_FONT0, FS_NORMAL, 8); $b3plot->value->SetFormat('%d'); $b1plot->SetLegend($duel->candidat1->prenom . ' ' . $duel->candidat1->nom); $b2plot->SetLegend($duel->candidat2->prenom . ' ' . $duel->candidat2->nom); $b3plot->SetLegend('Blanc'); $b1plot->SetColor("black"); $b1plot->SetFillColor("#1111cc"); $b2plot->SetColor("black"); $b2plot->SetFillColor("#cc1111"); $b3plot->SetColor("black"); $b3plot->SetFillColor("white"); $graphBar->title->Set("Vote par catégorie sociau-professionnelle"); // Output bar if (file_exists("images/stats/barDuelSociau.png")) { unlink("images/stats/barDuelSociau.png"); } $im = $graphBar->Stroke(_IMG_HANDLER); imagepng($im, "images/stats/barDuelSociau.png"); ?>