Add analytics
[bus.git] / busui / owa / modules / base / templates / report_trend_section.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<div class="owa_reportSectionContent">
        
        <div id="trend-chart"></div>
 
        
        <div id="trend-title" class="owa_reportHeadline"></div> 
        <div id="trend-metrics" style="height:auto;width:auto;<?php if($pie) {echo 'float:right';}?>"></div>
        <div style="clear:both;"></div>
        <script>
                
                var trendurl = '<?php echo $this->makeApiLink(array('do' => 'getResultSet', 
                                                                                                                                        'metrics' => $metrics, 
                                                                                                                                        'dimensions' => 'date', 
                                                                                                                                        'sort' => 'date',
                                                                                                                                        'format' => 'json',
                                                                                                                                        'constraints' => $constraints
                                                                                                                                        ),true);?>';
                                                                                                                                          
                var trend = new OWA.resultSetExplorer('trend-chart');
                trend.options.sparkline.metric = 'visits';
                <?php if ($trendTitle):?>
                trend.asyncQueue.push(['renderTemplate', '<?php echo $trendTitle;?>', {d: trend}, 'replace', 'trend-title']);
                <?php endif;?>
                trend.asyncQueue.push(['makeAreaChart', [{x: 'date', y: '<?php echo $trendChartMetric; ?>'}], 'trend-chart']);
                trend.options.metricBoxes.width = '150px';
                trend.asyncQueue.push(['makeMetricBoxes' , 'trend-metrics']);
                trend.load(trendurl);
                
        </script>
 
</div>