$imgfilename = 'auto'; $graph = new GanttGraph($main_width - 10, 0, $imgfilename, 1); $graph->SetMarginColor('#C4C4C4'); $graph->SetColor('white'); $graph->SetFrame(true, 'gray', 1); $graph->ShowHeaders(GANTT_HHOUR); $graph->scale->UseWeekendBackground(false); $graph->scale->hour->SetBackgroundColor('lightyellow:1.5'); $graph->scale->hour->SetSundayFontColor('black'); $graph->scale->day->SetBackgroundColor('lightyellow:1.5'); $graph->scale->day->SetSundayFontColor('black'); $graph->scale->hour->SetFont(FF_FONT1); $graph->scale->hour->SetIntervall(1); $graph->scale->hour->SetStyle(HOURSTYLE_H24); $graph->hgrid->SetRowFillColor('whitesmoke@0.9', 'darkblue@0.9'); $graph->setMargin(0, 0, 0, 20); $graph->scale->hour->SetFont(FF_FONT1); $graph->scale->day->SetFont(FF_FONT1, FS_BOLD); $graph->title->SetColor('white'); $graph->scale->UseWeekendBackground(false); $graph->scale->day->SetWeekendColor('lightyellow:1.5'); $graph->scale->week->SetFont(FF_FONT1); $graph->hgrid->Show(true); $graph->hgrid->SetRowFillColor('whitesmoke@0.9', 'darkblue@0.9'); if ($suma > 0) { for ($i = 0; $i < count($data); ++$i) { $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3]); $bar->SetPattern(BAND_RDIAG, 'lightgray'); $bar->SetFillColor('brown'); $bar->SetShadow(true, 'black@0.5'); $graph->Add($bar);
$data[] = array($d[$d1] - 1, date("Y-m-d", $start), date("H:i", $start), $d2 <= $d1 ? date("H:i", $end) : "23:59", $start); } } if (!$data) { // fake 1 record so the chart doesn't error $data[] = array(0, date("Y-m-d"), '00:00', '00:00', time()); } // remove any and all output buffers $ps->ob_clean(); $graph = new GanttGraph(0, 0, $imgfilename, CACHE_TIMEOUT); $showfooter = (bool) $styles->val('image.session.showfooter', 'image.common.footer.show'); $top = intval($styles->val('image.session.margin.top', 'image.common.margin.top', true)); $right = intval($styles->val('image.session.margin.right', 'image.common.margin.right', true)); $bottom = intval($styles->val('image.session.margin.bottom', 'image.common.margin.bottom', true)); $left = intval($styles->val('image.session.margin.left', 'image.common.margin.left', true)); $graph->setMargin($left, $right, $top, ($showfooter and $bottom < 14) ? 14 : $bottom); $graph->ShowHeaders(GANTT_HHOUR); //$graph->SetBackgroundGradient('gray','whitesmoke',GRAD_LEFT_REFLECTION,BGRAD_MARGIN); $graph->SetMarginColor($styles->val('image.session.frame.margin', '#C4C4C4', true)); $graph->SetFrame(true, $styles->val('image.session.frame.color', 'gray', true), $styles->val('image.session.frame.width', 1, true)); //if (!$noname) $graph->title->Set($plrname); //$graph->title->SetColor('blue'); //$graph->subtitle->Set(imgdef($s['frame']['title'], 'Player Sessions')); //$graph->subtitle->SetFont(constant(imgdef($s['@frame']['font'], 'FF_FONT0'))); // must override the weekend settings ... $graph->scale->UseWeekendBackground(false); $graph->scale->day->SetWeekendColor($styles->val('image.session.header.bgcolor', 'lightyellow:1.5', true)); $graph->scale->day->SetFontColor($styles->val('image.session.header.color', 'black', true)); $graph->scale->day->SetSundayFontColor($styles->val('image.session.header.color', 'black', true)); // match the weekend settings ... $graph->scale->hour->SetFontColor($styles->val('image.session.header.color', 'black', true));