Пример #1
0
$graph = new CLineGraphDraw(getRequest('type'));
$graph->setPeriod($timeline['period']);
$graph->setSTime($timeline['stime']);
// change how the graph will be displayed if more than one item is selected
if (getRequest('batch')) {
    // set a default header
    if (count($hostNames) == 1) {
        $graph->setHeader($hostNames[0] . NAME_DELIMITER . _('Item values'));
    } else {
        $graph->setHeader(_('Item values'));
    }
    // hide triggers
    $graph->showTriggers(false);
}
if (isset($_REQUEST['from'])) {
    $graph->setFrom($_REQUEST['from']);
}
if (isset($_REQUEST['width'])) {
    $graph->setWidth($_REQUEST['width']);
}
if (isset($_REQUEST['height'])) {
    $graph->setHeight($_REQUEST['height']);
}
if (isset($_REQUEST['border'])) {
    $graph->setBorder(0);
}
foreach ($items as $item) {
    $graph->addItem($item['itemid'], GRAPH_YAXIS_SIDE_DEFAULT, getRequest('batch') ? CALC_FNC_AVG : CALC_FNC_ALL, rgb2hex(get_next_color(1)));
}
$graph->draw();
require_once dirname(__FILE__) . '/include/page_footer.php';