function get_graph_by_type($graph_by, $graph_title, $module, $where, $query)
{
    global $user_id, $date_start, $end_date, $type;
    //Giving the Cached image name
    $cache_file_name = abs(crc32($user_id)) . "_" . $type . "_" . crc32($date_start . $end_date) . ".png";
    $html_imagename = $graph_by;
    //Html image name for the graph
    $graph_details = module_Chart($user_id, $date_start, $end_date, $query, $graph_by, $graph_title, $where, $module, $type);
    if ($graph_details != 0) {
        $name_val = $graph_details[0];
        $cnt_val = $graph_details[1];
        $graph_title = $graph_details[2];
        $target_val = $graph_details[3];
        $graph_date = $graph_details[4];
        $urlstring = $graph_details[5];
        $cnt_table = $graph_details[6];
        $test_target_val = $graph_details[7];
        $width = 600;
        $height = 400;
        $top = 30;
        $left = 140;
        $bottom = 120;
        $title = $graph_title;
        return get_graph($cache_file_name, $html_imagename, $cnt_val, $name_val, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $graph_date, $urlstring, $test_target_val, $date_start, $end_date);
    } else {
    }
}
function get_graph_by_type($graph_by, $graph_title, $module, $where, $query, $width = 900, $height = 900, $frompage = '')
{
    global $user_id, $date_start, $end_date, $type, $mod_strings;
    $time = time();
    //Giving the Cached image name
    $cache_file_name = abs(crc32($user_id)) . "_" . $type . "_" . crc32($date_start . $end_date) . $time . ".png";
    $html_imagename = $graph_by;
    //Html image name for the graph
    $graph_details = module_Chart($user_id, $date_start, $end_date, $query, $graph_by, $graph_title, $where, $module, $type);
    if ($graph_details != 0) {
        $name_val = $graph_details[0];
        $cnt_val = $graph_details[1];
        $graph_title = $graph_details[2];
        $target_val = $graph_details[3];
        $graph_date = $graph_details[4];
        $urlstring = $graph_details[5];
        $cnt_table = $graph_details[6];
        $test_target_val = $graph_details[7];
        if (isset($_REQUEST['display_view']) && $_REQUEST['display_view'] == 'MATRIX') {
            $width = 250;
            $height = 250;
        } else {
            $width = 850;
            $height = 500;
        }
        $top = 20;
        $left = 140;
        $bottom = 120;
        $title = $graph_title;
        if ($frompage != '') {
            //echo $width.'------'.$height.'------'.$left.'------'.$right.'------'.$top.'------'.$bottom.'------'.$title.'------'.$test_target_val.'------'.$date_start.'------'.$end_date;
            //die;
            return get_graph_homepg($cache_file_name, $html_imagename, $cnt_val, $name_val, 280, 285, $left, $right, $top, $bottom, $title, $target_val, $graph_date, $urlstring, $test_target_val, $date_start, $end_date);
        } else {
            return get_graph($cache_file_name, $html_imagename, $cnt_val, $name_val, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $graph_date, $urlstring, $test_target_val, $date_start, $end_date);
        }
    } else {
        sleep(1);
        echo '<h3>' . $mod_strings['LBL_NO_DATA'] . '</h3>';
    }
}