Exemple #1
0
 * Display
 */
if ($isDataValid) {
    navigation_bar_calc();
    $graph = new CPieGraphDraw(getRequest('graphtype', GRAPH_TYPE_NORMAL));
    $graph->setHeader(getRequest('name', ''));
    if (!empty($_REQUEST['graph3d'])) {
        $graph->switchPie3D();
    }
    $graph->showLegend(getRequest('legend', 0));
    unset($host);
    if (isset($_REQUEST['period'])) {
        $graph->setPeriod($_REQUEST['period']);
    }
    if (isset($_REQUEST['from'])) {
        $graph->setFrom($_REQUEST['from']);
    }
    if (isset($_REQUEST['stime'])) {
        $graph->setSTime($_REQUEST['stime']);
    }
    if (isset($_REQUEST['border'])) {
        $graph->setBorder(0);
    }
    $graph->setWidth(getRequest('width', 400));
    $graph->setHeight(getRequest('height', 300));
    foreach ($items as $item) {
        $graph->addItem($item['itemid'], $item['calc_fnc'], $item['color'], $item['type']);
    }
    $graph->draw();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
Exemple #2
0
/*
 * Display
 */
$timeline = CScreenBase::calculateTime(array('profileIdx' => get_request('profileIdx', 'web.screens'), 'profileIdx2' => get_request('profileIdx2'), 'updateProfile' => get_request('updateProfile', true), 'period' => get_request('period'), 'stime' => get_request('stime')));
$graph = new CPieGraphDraw($dbGraph['graphtype']);
$graph->setPeriod($timeline['period']);
$graph->setSTime($timeline['stime']);
if (isset($_REQUEST['border'])) {
    $graph->setBorder(0);
}
$width = get_request('width', 0);
if ($width <= 0) {
    $width = $dbGraph['width'];
}
$height = get_request('height', 0);
if ($height <= 0) {
    $height = $dbGraph['height'];
}
$graph->setWidth($width);
$graph->setHeight($height);
$graph->setHeader($host['name'] . NAME_DELIMITER . $dbGraph['name']);
if ($dbGraph['show_3d']) {
    $graph->switchPie3D();
}
$graph->showLegend($dbGraph['show_legend']);
$result = DBselect('SELECT gi.*' . ' FROM graphs_items gi' . ' WHERE gi.graphid=' . zbx_dbstr($dbGraph['graphid']) . ' ORDER BY gi.sortorder,gi.itemid DESC');
while ($dbGraph = DBfetch($result)) {
    $graph->addItem($dbGraph['itemid'], $dbGraph['calc_fnc'], $dbGraph['color'], $dbGraph['type']);
}
$graph->draw();
require_once dirname(__FILE__) . '/include/page_footer.php';