CC-4661: Listener Statistics

- better legend for multiple series of data
- consistant number of ticks on x-axis
This commit is contained in:
James 2012-11-06 10:54:52 -05:00
parent a93b588a09
commit 2e79e8421c
3 changed files with 82 additions and 38 deletions

View file

@ -17,9 +17,14 @@ SQL;
$out = array();
foreach ($data as $d) {
$t = new DateTime($d['timestamp'], new DateTimeZone("UTC"));
$t->setTimezone(new DateTimeZone(date_default_timezone_get()));
// tricking javascript so it thinks the server timezone is in UTC
$dt = new DateTime($t->format("Y-m-d H:i:s"), new DateTimeZone("UTC"));
$d['timestamp'] = $dt->format("U");
$out[$d['mount_name']][] = $d;
}
return $out;
}
@ -43,11 +48,11 @@ SQL;
$stats_sql = "INSERT INTO cc_listener_count (timestamp_id, listener_count, mount_name)
VALUES (:timestamp_id, :listener_count, :mount_name)";
foreach ($p_dataPoints as $dp) {
$timestamp_id = Application_Common_Database::prepareAndExecute($timestamp_sql,
$timestamp_id = Application_Common_Database::prepareAndExecute($timestamp_sql,
array('ts'=> $dp['timestamp']), "column");
Application_Common_Database::prepareAndExecute($stats_sql,
array('timestamp_id' => $timestamp_id,
array('timestamp_id' => $timestamp_id,
'listener_count' => $dp["num_listeners"],
'mount_name' => $dp["mount_name"],
)

View file

@ -1,13 +1,7 @@
<div id="listenerstat_content" class="ui-widget ui-widget-content block-shadow alpha-block padded">
Timestamp vs Listener Count<br>
<select id='all_mps'>
<option value="all">All Mount Potins</option>
<?php foreach($this->mps as $mp) {?>
<option value="<?php echo $mp?>"><?php echo $mp?></option>
<?php } ?>
</select>
<div id="flot_placeholder" style="width:600px;height:300px;margin:0px 50px 0px 50px"></div>
<div id="legend" style="width:600px;height:70px;margin:0px 50px 0px 50px"></div>
<?php echo $this->date_form; ?>
</div>