This commit is contained in:
Daniel Camargo 2013-07-30 16:35:04 -03:00
parent c9f4581f43
commit 6914c7d329
5 changed files with 30 additions and 25 deletions

View File

@ -56,6 +56,13 @@ class Crunchbutton_Chart_Order extends Crunchbutton_Chart {
'orders-by-weekday-by-community' => array( 'title' => '', 'type' => 'area', 'method' => 'byWeekdayByCommunity' )
)
),
'group-orders-track-frequece' => array(
'title' => 'Track Orders Frequency',
'tags' => array( 'detailed-analytics' ),
'charts' => array(
'orders-track-frequece' => array( 'title' => 'Orders', 'interval' => 'week', 'type' => 'area', 'method' => 'trackFrequence' ),
)
),
'group-orders-per-restaurant-by-community' => array(
'title' => 'Orders per Restaurant by Community',
'tags' => array( 'detailed-analytics' ),
@ -63,13 +70,6 @@ class Crunchbutton_Chart_Order extends Crunchbutton_Chart {
'orders-per-restaurant-by-community' => array( 'title' => '', 'type' => 'pie_communities', 'method' => 'perRestaurantPerCommunity' )
)
),
'group-orders-track-frequece' => array(
'title' => 'Track Orders Frequency',
'tags' => array( 'detailed-analytics' ),
'charts' => array(
'orders-track-frequece' => array( 'title' => 'Orders', 'interval' => 'week', 'type' => 'area', 'method' => 'trackFrequence' ),
)
),
);
public function __construct() {
@ -440,7 +440,7 @@ class Crunchbutton_Chart_Order extends Crunchbutton_Chart {
(SELECT count(*) AS orders,
o.id_restaurant
FROM `order` o
WHERE o.date BETWEEN CURDATE() - INTERVAL 14 DAY AND CURDATE()
WHERE o.date BETWEEN CURDATE() - INTERVAL 1400 DAY AND CURDATE()
GROUP BY o.id_restaurant) orders
INNER JOIN restaurant r ON r.id_restaurant = orders.id_restaurant
WHERE r.community IS NOT NULL";

View File

@ -93,6 +93,14 @@
</div>
</div>
<?php if( $hasResults ){ ?>
<div id="chart-<?=$chartId?>" style="min-width: 100%; height:250px; margin: 0 auto"></div>
<div id="options-<?=$divId?>" style="height:95px;background:#F5F5F5;width:98%;overflow-x:auto;overflow-y:hidden;<?php if( $hideSlider ) { echo 'display:none;'; } ?>">
<br/>
<?php if( $groups && !$hideGroups ){ ?>
<span class="pull-right">
<select class="charts-select" id="select-<?=$chartId?>" data-divId="<?php echo $divId; ?>" onchange="loadSubChart( this.id )">
@ -104,41 +112,39 @@
</select>
</span>
<?php } ?>
<?php if( $hasResults ){ ?>
<div id="chart-<?=$chartId?>" style="min-width: 100%; height:300px; margin: 0 auto"></div>
<br/>
<br/>
<br/>
<div class="row-fluid">
<div class="row-fluid" style="padding:0 20px; font-size:11px;">
<div class="span3" id="week-<?=$chartId?>">
<?php
if( $interval == 'week' ){
?>
Weeks from <?php echo $from; ?> to <?php echo $to; ?> (of <?php echo $totalWeeks; ?>):
Weeks <?php echo $from; ?> to <?php echo $to; ?> (of <?php echo $totalWeeks; ?>):
<?php
} else if( $interval == 'month' ){
?>
Months from <?php echo $from_month; ?> to <?php echo $to_month; ?> (of <?php echo $totalMonths; ?>):
Months <?php echo $from_month; ?> to <?php echo $to_month; ?> (of <?php echo $totalMonths; ?>):
<?php
} else if( $interval == 'day' ){
?>
Months from <?php echo $from_day; ?> to <?php echo $to_day; ?> (of <?php echo $totalDays; ?>):
Months <?php echo $from_day; ?> to <?php echo $to_day; ?> (of <?php echo $totalDays; ?>):
<?php
} ?>
</div>
<div class="span8">
<div id="slider-<?=$divId?>" data-from="<?php echo $from; ?>" data-to="<?php echo $to; ?>"></div>
</div>
<?php } else {
<?php }
else {
echo 'No results for <b>' . $groups[ $chartId ] . '</b>';
} ?>
</div>
<hr />
</div>
<?php if( $hasResults ){ ?>
<script type="text/javascript">
$(function () {
var data = <?=json_encode($jsData, JSON_NUMERIC_CHECK)?>;
console.log(data);
$('#chart-<?=$chartId?>').highcharts({
chart: {
type: 'area',
@ -157,6 +163,7 @@ $(function () {
rotation: -45,
align: 'right'
<?php if( $interval == 'day' ){ ?>,step:10<?php } ?>
<?php if( $interval == 'day' ){ ?>,step:2<?php } ?>
}
},
yAxis: {

View File

@ -82,7 +82,7 @@
<h4 style="text-align:center;"><?php echo $title; ?></h4>
</div>
</div>
<div id="chart-<?=$chartId?>" style="min-width: 100%; height:300px; margin: 0 auto"></div>
<div id="chart-<?=$chartId?>" style="min-width: 100%; height:250px; margin: 0 auto"></div>
</div>
<hr />
<script type="text/javascript">

View File

@ -18,9 +18,7 @@
<div class="span12">
<h5 style="text-align:center;"><?php echo $group; ?></h5>
</div>
<div id="chart-<?=$chartId?><?php echo $count; ?>" style="min-width: 100%; height:300px; margin: 0 auto"></div>
<br/>
<br/>
<div id="chart-<?=$chartId?><?php echo $count; ?>" style="min-width: 100%; height:250px; margin: 0 auto"></div>
<br/>
<br/>
<br/>

View File

@ -105,7 +105,7 @@
foreach ( $graphs as $id => $graph ){
$chart = $graph[ 'url' ];
$divId = $id;
echo '<div id="' . $divId . '" data-permalink="' . $chart . '" class="chart" style="display:none;width:49%;height:420px;;float:left;border-bottom:1px solid #CCC;"><i class="icon-spinner icon-spin"></i> Loading </div>';
echo '<div id="' . $divId . '" data-permalink="' . $chart . '" class="chart" style="display:none;width:49%;min-height:420px;;float:left;border-bottom:1px solid #CCC;"><i class="icon-spinner icon-spin"></i> Loading </div>';
} ?>
<div style="clear:both;"></div>