public function iterationSummaryAux($id) { JpGraph\JpGraph::load(); JpGraph\JpGraph::module('bar'); $datay = array(12, 26, 9, 17, 31); // Create the graph. // One minute timeout for the cached image // INLINE_NO means don't stream it back to the browser. $graph = new Graph(310, 250, 'auto'); $graph->SetScale("textlin"); $graph->img->SetMargin(60, 30, 20, 40); $graph->yaxis->SetTitleMargin(45); $graph->yaxis->scale->SetGrace(30); $graph->SetShadow(); // Turn the tickmarks $graph->xaxis->SetTickSide(SIDE_DOWN); $graph->yaxis->SetTickSide(SIDE_LEFT); // Create a bar pot $bplot = new BarPlot($datay); // Create targets for the image maps. One for each column $targ = array("bar_clsmex1.php#1", "bar_clsmex1.php#2", "bar_clsmex1.php#3", "bar_clsmex1.php#4", "bar_clsmex1.php#5", "bar_clsmex1.php#6"); $alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d"); $bplot->SetCSIMTargets($targ, $alts); $bplot->SetFillColor("orange"); // Use a shadow on the bar graphs (just use the default settings) $bplot->SetShadow(); $bplot->value->SetFormat(" \$ %2.1f", 70); $bplot->value->SetFont(FF_ARIAL, FS_NORMAL, 9); $bplot->value->SetColor("blue"); $bplot->value->Show(); $graph->Add($bplot); $graph->title->Set("Image maps barex1"); $graph->xaxis->title->Set("X-title"); $graph->yaxis->title->Set("Y-title"); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD); $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD); // Send back the HTML page which will call this script again // to retrieve the image. $graph->StrokeCSIM(); }
$graph->yaxis->SetLabelAlign('center','top'); // Create the bar plots with image maps $b1plot = new BarPlot($data1y); $b1plot->SetFillColor("orange"); $targ=array("bar_clsmex2.php#1","bar_clsmex2.php#2","bar_clsmex2.php#3", "bar_clsmex2.php#4","bar_clsmex2.php#5","bar_clsmex2.php#6"); $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); $b1plot->SetCSIMTargets($targ,$alts); $b2plot = new BarPlot($data2y); $b2plot->SetFillColor("blue"); $targ=array("bar_clsmex2.php#7","bar_clsmex2.php#8","bar_clsmex2.php#9", "bar_clsmex2.php#10","bar_clsmex2.php#11","bar_clsmex2.php#12"); $alts=array("val=%d","val=%d","val=%d","val=%d","val=%d","val=%d"); $b2plot->SetCSIMTargets($targ,$alts); // Create the accumulated bar plot $abplot = new AccBarPlot(array($b1plot,$b2plot)); $abplot->SetShadow(); // We want to display the value of each bar at the top $abplot->value->Show(); $abplot->value->SetFont(FF_FONT1,FS_NORMAL); $abplot->value->SetAlign('left','center'); $abplot->value->SetColor("black","darkred"); $abplot->value->SetFormat('%.1f mkr'); // ...and add it to the graph $graph->Add($abplot);
$graph = new Graph(400, 250); $graph->SetScale('textlin'); $graph->SetMargin(50, 80, 20, 40); // Create a bar pot $bplot = new BarPlot($datay); $n = count($datay); // Number of bars global $_wrapperfilename; // Create targets for the image maps. One for each column $targ = array(); $alt = array(); $wtarg = array(); for ($i = 0; $i < $n; ++$i) { $urlarg = 'clickedon=' . ($i + 1); $targ[] = $_wrapperfilename . '?' . $urlarg; $alt[] = 'val=%d'; $wtarg[] = ''; } $bplot->SetCSIMTargets($targ, $alt, $wtarg); $graph->Add($bplot); $graph->title->Set('Multiple Image maps'); $graph->title->SetFont(FF_FONT1, FS_BOLD); $graph->title->SetCSIMTarget('#45', 'Title for Bar', '_blank'); $graph->yaxis->title->SetFont(FF_FONT1, FS_BOLD); $graph->yaxis->title->SetCSIMTarget('#55', 'Y-axis title'); $graph->yaxis->title->Set("Y-title"); $graph->xaxis->title->SetFont(FF_FONT1, FS_BOLD); $graph->xaxis->title->SetCSIMTarget('#55', 'X-axis title'); $graph->xaxis->title->Set("X-title"); // Send back the image when we are called from within the <img> tag $graph->StrokeCSIMImage();
$numDatas++; } if ($currentCategoryId != 'none') { $targets[$currentCategoryId][] = "javascript:reachThroughTimespan('" . $beginDates[$currentKey]->getFormatted() . "', '" . $endDates[$currentKey]->getFormatted() . "', '{$currentCategoryId}');"; } else { $targets[$currentCategoryId][] = ''; } } } $colorIndex = 0; $bars = array(); foreach ($labels as $currentCategoryId => $currentLabel) { $bar = new BarPlot($data[$currentCategoryId]); $bar->SetFillColor($chartColors[$colorIndex % count($chartColors)]); $bar->SetLegend($labels[$currentCategoryId]); $bar->SetCSIMTargets($targets[$currentCategoryId], $dataNames[$currentCategoryId]); $bars[] = $bar; $colorIndex++; } $groupBar = new GroupBarPlot($bars); $graph->add($groupBar); $graph->xaxis->SetTickLabels($tickLabels); $graph->xaxis->SetFont(FF_VERA, FS_BOLD); $graph->xaxis->SetColor('black', 'green'); $interval = $numDatas / MAX_LABELS; if ($interval < 1) { $interval = 1; } //echo "numDatas: $numDatas; interval: $interval"; $graph->xaxis->SetTextLabelInterval($interval); $graph->yaxis->SetFont(FF_VERA);