| 1 |
<?php |
| 2 |
// View of Browser Statistics |
| 3 |
function pa_include_browser( $current, $browser_stats ) { |
| 4 |
?> |
| 5 |
<div class="data_boxes"> |
| 6 |
<div class="data_boxes_title"><?php echo _e( 'Browsers Statistics', 'wp-analytify'); ?><div class="arrow_btn"></div></div> |
| 7 |
<div class="data_container"> |
| 8 |
<?php |
| 9 |
if (!empty($browser_stats["rows"])){ ?> |
| 10 |
<script type="text/javascript"> |
| 11 |
google.load("visualization", "1", {packages:["corechart"],'callback': drawChart}); |
| 12 |
function drawChart() { |
| 13 |
|
| 14 |
var data = google.visualization.arrayToDataTable([ |
| 15 |
['Browser (OS)', 'Sessions'], |
| 16 |
<?php |
| 17 |
foreach ($browser_stats["rows"] as $b_stats) { ?> |
| 18 |
['<?php echo $b_stats[0];?> (<?php echo $b_stats[1];?>)', <?php echo $b_stats[2];?>], |
| 19 |
<?php } ?> |
| 20 |
]); |
| 21 |
|
| 22 |
var options = { |
| 23 |
hAxis: {titleTextStyle: {color: 'red'}}, |
| 24 |
legend: 'none', |
| 25 |
}; |
| 26 |
var formatter = new google.visualization.NumberFormat({fractionDigits: 0}); |
| 27 |
formatter.format(data, 1); |
| 28 |
|
| 29 |
var chart = new google.visualization.ColumnChart(document.getElementById('browser_chart')); |
| 30 |
chart.draw(data, options); |
| 31 |
|
| 32 |
} |
| 33 |
</script> |
| 34 |
<div id="browser_chart" style="width: 600px; height: 400px; margin:0 auto;"></div> |
| 35 |
<?php } ?> |
| 36 |
</div> |
| 37 |
<div class="data_boxes_footer"> |
| 38 |
<span class="blk"> |
| 39 |
<span class="dot"></span> |
| 40 |
<span class="line"></span> |
| 41 |
</span> |
| 42 |
<span class="information-txt"><?php echo _e('listing statistics of top five browsers.', 'wp-analytify');?></span> |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
<?php } ?> |
| 46 |
|