=15) $name=substr($name, 0, 15); if($pos>=2) { $val=explode(" ",$name); $n=count($val)-1; $x=""; for($j=0;$j $width, 'height' => $height, 'usemap' => true)); $imagemap = $canvas->getImageMap(); $graph =& Image_Graph::factory('graph', $canvas); $font =& $graph->addNew('font', calculate_font_name($lang_crm)); // set the font size to 12 $font->setSize(8); if($theme == "blue") { $font_color = "#212473"; } else { $font_color = "#000000"; } $font->setColor($font_color); $graph->setFont($font); $titlestr =& Image_Graph::factory('title', array($title,10)); $plotarea =& Image_Graph::factory('plotarea',array( 'axis', 'axis', 'vertical' )); $graph->add( Image_Graph::vertical($titlestr, $plotarea, 5 ) ); // Now create a bar plot $max=0; $xlabels = array(); $dataset = & Image_Graph::factory('dataset'); if($theme == 'woodspice') $fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_HORIZONTAL_MIRRORED, '#804000', 'white')); elseif($theme == 'bluelagoon') $fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_HORIZONTAL_MIRRORED, 'blue', 'white')); elseif($theme == 'softed') $fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_HORIZONTAL_MIRRORED, 'blue', 'white')); else $fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_HORIZONTAL_MIRRORED, 'black', 'white')); for($i=0;$i=$max) $max=$datay[$i]; $dataset->addPoint( $x, $datay[$i], array( 'url' => $target[$i], 'alt' => $alts[$i] ) ); // build the xaxis label array to allow intermediate ticks $xlabels[$x] = $datax[$i]; $xlabels[$x+1] = ''; } //$bplot = new BarPlot($datay); $bplot = & $plotarea->addNew('bar', $dataset); $bplot->setFillStyle($fill); //You can change the width of the bars if you like $bplot->setBarWidth(50/count($datax),"%"); $bplot->setPadding(array('top'=>20)); $bplot->setBackground(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'white', 'white'))); // Setup X-axis $xaxis =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_X); $yaxis =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_Y); $yaxis->setFontSize(10); // set grid $gridY =& $plotarea->addNew('line_grid', IMAGE_GRAPH_AXIS_Y); $gridY->setLineColor('#FFFFFF@0.5'); $gridY2 =& $plotarea->addNew('bar_grid', null, IMAGE_GRAPH_AXIS_Y); $gridY2->setFillColor('#FFFFFF@0.2'); // Add some grace to y-axis so the bars doesn't go // all the way to the end of the plot area if($max<=10) $yaxis->forceMaximum(round(($max * 1.1) + 1.5)); elseif($max>10 && $max<=100) $yaxis->forceMaximum(round(($max * 1.1) + 1.5)); elseif($max>100 && $max<=1000) $yaxis->forceMaximum(round(($max * 1.1) + 10.5)); else $yaxis->forceMaximum(round(($max * 1.1) + 100.5)); $ticks = get_tickspacing(round(($max * 1.1) + 2.0)); // First make the labels look right $yaxis->setLabelInterval($ticks[0]); $yaxis->setTickOptions(5,0); $yaxis->setLabelInterval($ticks[1],2); $yaxis->setTickOptions(2,0,2); // Create the xaxis labels $array_data =& Image_Graph::factory('Image_Graph_DataPreprocessor_Array', array($xlabels) ); // Then fix the tick marks $xaxis->setDataPreprocessor($array_data); $xaxis->forceMinimum(0); $xaxis->forceMaximum(2*count($datay)); $xaxis->setFontAngle('vertical'); $xaxis->setLabelInterval(1); $xaxis->setTickOptions(0,0); $xaxis->setLabelInterval(2,2); $xaxis->setTickOptions(5,0,2); // set markers $marker =& $graph->addNew('value_marker', IMAGE_GRAPH_VALUE_Y); $marker->setFillColor('000000@0.0'); $marker->setBorderColor('000000@0.0'); $marker->setFontSize(10); // shift markers 10 pix right $marker_pointing =& $graph->addNew('Image_Graph_Marker_Pointing', array(0,-10,& $marker)); $marker_pointing->setLineColor('000000@0.0'); $bplot->setMarker($marker_pointing); //Getting the graph in the form of html page $img = $graph->done( array( 'tohtml' => true, 'border' => 0, 'filename' => $cache_file_name, 'filepath' => '', 'urlpath' => '' )); save_image_map($cache_file_name.'.map', $img); return $img; } ?>