$result = \Kofradia\DB::get()->query("SELECT WEEKDAY(FROM_UNIXTIME(uhi_secs_hour)) AS date, SUM(uhi_hits) sum_hits, SUM(uhi_hits_redirect) sum_hits_redirect FROM users_hits, users_players WHERE up_u_id = {$u_id} AND up_id = uhi_up_id GROUP BY WEEKDAY(FROM_UNIXTIME(uhi_secs_hour)) ORDER BY date");
while ($row = $result->fetch()) {
    $stats[$row['date'] + 1] = (int) $row['sum_hits'];
    $stats_redir[$row['date'] + 1] = (int) $row['sum_hits_redirect'];
}
$x = array();
global $_lang;
foreach ($stats as $date => $dummy) {
    if ($date == 7) {
        $date = 0;
    }
    $x[] = $_lang['weekdays'][$date];
}
$ofc = new OFC();
$ofc->title(new OFC_Title("Sidevisninger for {$up_name}"));
$bar = new OFC_Charts_Bar();
$bar->text("Antall visninger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# visninger");
$bar->values(array_values($stats));
$bar->colour(OFC_Colours::$colours[0]);
$ofc->add_element($bar);
$bar = new OFC_Charts_Bar();
$bar->text("Antall videresendinger");
$bar->dot_style()->type("solid-dot")->dot_size(3)->halo_size(2)->tip("#x_label#<br>#val# videresendinger");
$bar->values(array_values($stats_redir));
$bar->colour(OFC_Colours::$colours[1]);
$ofc->add_element($bar);
$ofc->axis_x()->label()->steps(ceil(count($x) / 20))->rotate(330)->labels($x);
$ofc->axis_y()->set_numbers(0, max(max($stats), max($stats_redir)));
$ofc->dark_colors();
echo $ofc;