Exemplo n.º 1
0
    $renderer = new GD_GRenderer($_REQUEST["width"], $_REQUEST["height"]);
    $graph = new MultibarGraphic();
    $graph->setTitle(tra($_REQUEST["title"]));
    $graph->setData(array('x' => $dataxy->xdata, 'y0' => $dataxy->ydata));
    if ($_REQUEST["type"] == 'barvert') {
        $graph->setParam('grid-independant-location', 'horizontal');
    } else {
        $graph->setParam('grid-independant-location', 'vertical');
        $graph->setParam('grid-horizontal-position', 'top');
    }
    $graph->setParam('grid-independant-major-font', 'Normal-Text');
    $graph->setParam('grid-independant-major-guide', false);
} elseif ($_REQUEST["type"] == 'multiline') {
    // multiline not working as yet	so shouldn't get here
    $renderer = new GD_GRenderer($_REQUEST["width"], $_REQUEST["height"]);
    $graph = new MultilineGraphic();
    $graph->setTitle(tra($_REQUEST["title"]));
    $graph->setData(array('x' => $dataxy['xdata'], 'y0' => $dataxy['ydata']));
    $graph->setParam('grid-independant-location', 'vertical');
    $graph->setParam('grid-independant-major-font', 'Normal-Text');
    $graph->setParam('grid-independant-major-guide', false);
} elseif ($_REQUEST["type"] == 'pie') {
    // pie not working as yet so shouldn't get here
    $renderer = new GD_GRenderer($_REQUEST["width"], $_REQUEST["height"]);
    $graph = new PieChartGraphic();
    $graph->setTitle(tra($_REQUEST["title"]));
    $graph->setData(array('x' => $dataxy['xdata'], 'y0' => $dataxy['ydata']));
    $graph->setParam('grid-independant-location', 'vertical');
    $graph->setParam('grid-independant-major-font', 'Normal-Text');
    $graph->setParam('grid-independant-major-guide', false);
} else {
Exemplo n.º 2
0
<?php

// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id: tiki-pv_chart.php 44444 2013-01-05 21:24:24Z changi67 $
require_once 'tiki-setup.php';
$access->check_feature('feature_stats');
$access->check_permission('tiki_p_view_stats');
require_once "lib/graph-engine/gd.php";
require_once "lib/graph-engine/graph.multiline.php";
//Define the object
$renderer = new GD_GRenderer(450, 300);
$graph = new MultilineGraphic();
$graph->setTitle(tra('Pageviews'));
//Set some data
if (!isset($_REQUEST["days"])) {
    $_REQUEST["days"] = 7;
}
$statslib = TikiLib::lib('stats');
$data = $statslib->get_pv_chart_data($_REQUEST["days"]);
foreach ($data['xdata'] as $key => $date) {
    $data['xdata'][$key] = strtotime($date) / 24 / 3600;
}
$graph->setData(array('x' => $data['xdata'], 'y0' => $data['ydata']));
$graph->setParam('grid-independant-major-font', false);
$graph->setParam('grid-independant-major-guide', false);
$graph->draw($renderer);
$renderer->httpOutput('stats.png');
Exemplo n.º 3
0
}
$access->check_permission('feature_sheet');
if (!(is_numeric($_GET['w']) && is_numeric($_GET['h']) && is_numeric($_GET['s']) && $_GET['s'] <= 500 && $_GET['s'] > 0 && is_numeric($_GET['min']) && is_numeric($_GET['max']) && is_array($_GET['f']) && $_GET['min'] < $_GET['max'] && $_GET['w'] >= 100 && $_GET['h'] >= 100)) {
    die;
}
switch ($_GET['t']) {
    case 'png':
        $renderer = new GD_GRenderer($_GET['w'], $_GET['h']);
        break;
    case 'pdf':
        $renderer = new PDFLib_GRenderer($_GET['p'], $_GET['o']);
        break;
    default:
        die;
}
$graph = new MultilineGraphic();
$graph->setTitle($_GET['title']);
$size = ($_GET['max'] - $_GET['min']) / $_GET['s'];
$data = array();
foreach (array_values($_GET['f']) as $key => $formula) {
    $formula = convert_formula($formula);
    $data['x'] = array();
    $data['y' . $key] = array();
    for ($x = $_GET['min']; $_GET['max'] > $x; $x += $size) {
        $data['x'][] = $x;
        $data['y' . $key][] = $formula($x);
    }
}
$graph->setData($data);
$graph->draw($renderer);
$renderer->httpOutput("graph.{$_GET['t']}");