Exemple #1
0
    include_once $homeurl . 'include/graphs/functions_fsgraph.php';
    include_once $homeurl . 'include/graphs/functions_gd.php';
    include_once $homeurl . 'include/graphs/functions_utils.php';
}
// Clean the output buffer and turn off output buffering
ob_end_clean();
switch ($graph_type) {
    case 'histogram':
        $width = get_parameter('width');
        $height = get_parameter('height');
        $font = get_parameter('font');
        $data = json_decode(safe_output(get_parameter('data')), true);
        $max = get_parameter('max');
        $title = get_parameter('title');
        $mode = get_parameter('mode', 1);
        gd_histogram($width, $height, $mode, $data, $max, $font, $title);
        break;
    case 'progressbar':
        $width = get_parameter('width');
        $height = get_parameter('height');
        $progress = get_parameter('progress');
        $out_of_lim_str = get_parameter('out_of_lim_str', false);
        $out_of_lim_image = get_parameter('out_of_lim_image', false);
        $font = get_parameter('font');
        $title = get_parameter('title');
        $mode = get_parameter('mode', 1);
        gd_progress_bar($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode);
        break;
}
function histogram($chart_data, $width, $height, $font, $max, $title, $mode, $ttl = 1)
{
Exemple #2
0
$graph_type = get_parameter('graph_type', '');
$ttl = get_parameter("ttl", 1);
if ($id_graph && in_array($graph_type, $types)) {
    if (!$id_graph) {
        exit;
    }
    $graph = unserialize_in_temp($id_graph, true, $ttl);
    if (!isset($graph)) {
        exit;
    }
    if (!isset($graph['fontsize'])) {
        $graph['fontsize'] = 6;
    }
    switch ($graph_type) {
        case 'histogram':
            gd_histogram($graph['width'], $graph['height'], $graph['mode'], json_decode($graph['data'], true), $graph['max'], $graph['font'], $graph['title'], $graph['fontsize']);
            break;
        case 'progressbar':
            gd_progress_bar($graph['width'], $graph['height'], $graph['progress'], $graph['title'], $graph['font'], $graph['out_of_lim_str'], $graph['out_of_lim_image'], $graph['mode'], $graph['fontsize']);
            break;
        case 'funnel':
            gd_funnel_chart($graph['data'], $graph['font']);
            break;
    }
}
function gd_histogram($width, $height, $mode, $data, $max_value, $font, $title, $fontsize = 8)
{
    // $title is for future use
    $nvalues = count($data);
    Header("Content-type: image/png");
    $image = imagecreate($width, $height);