<?php $relPath = "./../../pinc/"; include_once $relPath . 'base.inc'; include_once $relPath . 'dpsql.inc'; include_once $relPath . 'page_tally.inc'; include_once 'common.inc'; $valid_tally_names = array_keys($page_tally_names); $tally_name = get_enumerated_param($_GET, 'tally_name', null, $valid_tally_names); // Initialize the graph before anything else. // This makes use of the jpgraph cache if enabled. // Argument to init_pages_graph is the cache timeout in minutes. $graph = init_pages_graph(60); /////////////////////////////////////////////////// //Total pages by month since beginning of stats $result = mysql_query(select_from_site_past_tallies_and_goals($tally_name, "SELECT {year_month}, SUM(tally_delta), SUM(goal)", "", "GROUP BY 1", "ORDER BY 1", "")); list($datax, $datay1, $datay2) = dpsql_fetch_columns($result); draw_pages_graph($graph, $datax, $datay1, $datay2, null, null, 'monthly', 'increments', _('Pages Done Each Month Since the Beginning of Statistics Collection')); // vim: sw=4 ts=4 expandtab
if (isset($average_lookup[$day])) { $moving_average[] = $average_lookup[$day]; } else { $moving_average[] = 0; } } // Ensure we don't have more SMA data points than we do $datax points. // This can happen if the statistics use to be kept but aren't any longer. for ($index = count($moving_average) - count($datax); $index > 0; $index--) { array_pop($moving_average); } } else { $moving_average = null; $days_to_average = 0; } // if no data was returned from the SELECT, create an empty dataset // otherwise we get an unsightly jpgraph error if (empty($datax)) { // set arrays to empty before populating them $datax = $datay1 = array(); $datay2 = null; // don't go past the current date $end_timestamp = min($end_timestamp, time()); // iterate through the days of the specified month for ($dateTimestamp = $start_timestamp; $dateTimestamp <= $end_timestamp; $dateTimestamp += 60 * 60 * 24) { $datax[] = strftime('%Y-%m-%d', $dateTimestamp); $datay1[] = 0; } } draw_pages_graph($graph, $datax, $datay1, $datay2, $moving_average, sprintf(_("%d-day SMA"), $days_to_average), 'daily', $c_or_i, "{$main_title} ({$title_timeframe})"); // vim: sw=4 ts=4 expandtab