echo '</tr>'; $i++; } echo '</table>'; } else { echo '<div class="report">No delivery orders found.</div>'; } ?> <?php echo '<h2 class="report-title">Bottom Selling Produce</h2>'; if (count($reports['bottom_sellers']) > 0) { //show the chart $chart = new Chart('ColumnChart'); $chart->load($reports['bottom_sellers'], 'array'); $options = array('is3D' => true, 'width' => 800, 'height' => 400, 'hAxis' => array('title' => 'Produce Name'), 'chartArea' => array('top' => 5, 'height' => '80%')); echo $chart->draw('bottom_sellers', $options); echo '<div id="bottom_sellers" class="report-chart"></div>'; //show the data echo '<table class="report-data">'; echo '<tr>'; echo '<th>Rank</th>'; foreach (current($reports['bottom_sellers']) as $k => $v) { echo '<th>' . $k . '</th>'; } echo '</tr>'; $i = 1; foreach ($reports['bottom_sellers'] as $row_date => $row) { echo '<tr>'; echo '<td>' . $i . '</td>';
<html> <head> <?php include 'TwitterDB.php'; include 'Chart.php'; $twitterDB = new TwitterDB(); //$twitterDB->printArray($_SERVER); $chart = new Chart('PieChart'); $options = array(); if (!empty($_GET) && isset($_GET) && array_key_exists('charts', $_GET) && !empty($_GET['charts'])) { $flag = false; if ($_GET['charts'] == 'retweetcount-vs-text') { $flag = true; $data = $twitterDB->getRetweetCountAndText(); $chart->load($data, 'array'); $options = array('title' => 'How many times a tweet is retweeted limited to 10.', 'is3D' => true, 'width' => 500, 'height' => 400); } else { if ($_GET['charts'] == 'different-days') { $flag = true; $data = $twitterDB->getTweetsOfDifferentDays(); $chart->load($data, 'array'); $options = array('title' => 'Different days tweets analytics', 'is3D' => true, 'width' => 500, 'height' => 400); } else { if ($_GET['charts'] == 'status-source') { $flag = true; $data = $twitterDB->getStatusSource(); $chart->load($data, 'array'); $options = array('title' => 'Different types of sources used to tweet', 'is3D' => true, 'width' => 500, 'height' => 400); } else { if ($_GET['charts'] == 'favorite-count') { $flag = true;
protected function createChart($chartDiv) { if (count($this->messageResults) == 0) { return ''; } $chart = new Chart('ComboChart'); $data = array(); foreach ($this->messageResults as $row) { $data[] = array('ID' => $row['id'], 'Sent' => (int) $row['sent'], 'Opened' => (int) $row['openUsers'], 'Clicked' => (int) $row['clickUsers'], 'Bounced' => (int) $row['bouncecount']); } $chart->load($data, 'array'); $options = array('height' => self::IMAGE_HEIGHT, 'axisTitlesPosition' => 'out', 'vAxis' => array('title' => 'Subscribers', 'gridlines' => array('count' => 10), 'logScale' => false, 'format' => '#'), 'hAxis' => array('title' => 'Campaign'), 'seriesType' => 'line', 'series' => array(0 => array('type' => 'bars')), 'legend' => array('position' => 'bottom'), 'colors' => array('blue', 'green', 'yellow', 'red')); $result = $chart->draw($chartDiv, $options); return $result; }
} echo '</tr>'; } echo '</table>'; } else { echo '<div class="report">No orders made during this time period.</div>'; } ?> <?php echo '<h2 class="report-title">Value of Orders</h2>'; if (count($reports['value']) > 0) { //show the chart $chart = new Chart('ColumnChart'); $chart->load($reports['value'], 'array'); $options = array('is3D' => true, 'width' => 800, 'height' => 400, 'hAxis' => array('title' => 'Date of Delivery'), 'chartArea' => array('top' => 5, 'height' => '80%')); echo $chart->draw('report-value', $options); echo '<div id="report-value" class="report-chart"></div>'; //show the data echo '<table class="report-data">'; echo '<tr>'; foreach (current($reports['value']) as $k => $v) { echo '<th>' . $k . '</th>'; } echo '</tr>'; foreach ($reports['value'] as $row_date => $row) { echo '<tr>'; foreach ($row as $k => $v) { if (is_float($v)) { echo '<td>£' . number_format($v, 2) . '</td>';