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
 * Permissions
 */
$dbGraph = API::Graph()->get(array('graphids' => $_REQUEST['graphid'], 'selectHosts' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND));
if (!$dbGraph) {
    access_deny();
} else {
    $dbGraph = reset($dbGraph);
}
$host = reset($dbGraph['hosts']);
/*
 * 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']) {