示例#1
0
// $Id$
require_once 'tiki-setup.php';
$access->check_feature('feature_stats', '', 'general');
$access->check_permission('tiki_p_view_stats');
require_once 'lib/graph-engine/gd.php';
require_once 'lib/graph-engine/graph.bar.php';
$statslib = TikiLib::lib('stats');
//Define the object
if (isset($_REQUEST["type"])) {
    if ($_REQUEST["type"] == "daily") {
        $renderer = new GD_GRenderer(450, 400);
        $graph = new MultibarGraphic();
        $data = $statslib->get_daily_usage_chart_data();
        $graph->setTitle(tra('Daily Usage'));
        $graph->setData(array('x' => $data['xdata'], 'y0' => $data['ydata']));
        $graph->setParam('grid-independant-location', 'vertical');
        $graph->setParam('grid-independant-major-font', 'Normal-Text');
        $graph->setParam('grid-independant-major-guide', false);
    }
} else {
    $renderer = new GD_GRenderer(450, 300);
    $graph = new MultibarGraphic();
    $data = $tikilib->get_usage_chart_data();
    $graph->setTitle(tra('Usage'));
    $graph->setData(array('x' => $data['xdata'], 'y0' => $data['ydata']));
    $graph->setParam('grid-independant-location', 'vertical');
    $graph->setParam('grid-independant-major-font', 'Normal-Text');
    $graph->setParam('grid-independant-major-guide', false);
}
$graph->draw($renderer);
$renderer->httpOutput('stats.png');
示例#2
0
//
// 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$
require_once 'tiki-setup.php';
// this seems to be needed ?
require_once 'lib/graph-engine/gd.php';
require_once 'lib/graph-engine/graph.bar.php';
$access->check_feature('wikiplugin_gdgraph');
//Decode the passed array
$strencxy2 = $_GET['usexydata'];
$dataxy = json_decode(urldecode($strencxy2));
// only the barvert and barhoriz types are working at present
if ($_REQUEST["type"] == 'barvert' || $_REQUEST["type"] == 'barhoriz') {
    $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"]));