function html_graph($names, $values, $bars, $vals, $dvalues = 0, $dbars = 0) { // set the error level on entry and exit so as not to interfear with anyone elses error checking. $er = error_reporting(1); // set the values that the user didn't $vals = hv_graph_defaults($vals); $html_graph_string = start_graph($vals, $names); if ($vals['type'] == 0) { $html_graph_string .= horizontal_graph($names, $values, $bars, $vals); } elseif ($vals['type'] == 1) { $html_graph_string .= vertical_graph($names, $values, $bars, $vals); } elseif ($vals['type'] == 2) { $html_graph_string .= double_horizontal_graph($names, $values, $bars, $vals, $dvalues, $dbars); } elseif ($vals['type'] == 3) { $html_graph_string .= double_vertical_graph($names, $values, $bars, $vals, $dvalues, $dbars); } $html_graph_string .= end_graph(); // Set the error level back to where it was. error_reporting($er); return $html_graph_string; }
function render_graph($cache_file_name, $html_imagename, $cnt_val, $name_val, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $graph_type) { //Checks whether the cached image is present or not if (file_exists($cache_file_name)) { @unlink($cache_file_name); } if (file_exists($cache_file_name . '.map')) { @unlink($cache_file_name . '.map'); } if (!file_exists($cache_file_name) || !file_exists($cache_file_name . '.map')) { //If the Cached image is not present if ($graph_type == "horizontal") { return horizontal_graph($cnt_val, $name_val, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $cache_file_name, $html_imagename); } else { if ($graph_type == "vertical") { return vertical_graph($cnt_val, $name_val, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $cache_file_name, $html_imagename); } else { if ($graph_type == "pie") { return pie_chart($cnt_val, $name_val, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $cache_file_name, $html_imagename); } } } } else { //Getting the cached image $imgMap_fp = fopen($cache_file_name . '.map', "rb"); $imgMap = fread($imgMap_fp, filesize($cache_file_name . '.map')); fclose($imgMap_fp); $base_name_cache_file = basename($cache_file_name); $ccc = "cache/images/" . $base_name_cache_file; $return = "\n{$imgMap}\n"; $return .= "<img src={$ccc} ismap usemap=#{$html_imagename} border='0'>"; return $return; } }