@extends($stats_layout)
@section('page-contents')
@stop
@section('page-secondary-contents')
@lang('tracker::tracker.page_views_by_country')
@include('pragmarx/tracker::_summaryPiechart')
@stop
@section('inline-javascript')
jQuery(function()
{
console.log(jQuery('#pageViews'));
var pageViewsLine = Morris.Line({
element: 'pageViewsLine',
parseTime:false,
grid: true,
data: [{'date': 0, 'total': 0}],
xkey: 'date',
ykeys: ['total'],
labels: ['Page Views']
});
jQuery.ajax({
type: "GET",
url: "{{ route('tracker.stats.api.pageviews') }}",
data: { }
})
.done(function( data ) {
console.log(data);
pageViewsLine.setData(formatDates(data));
});
var convertToPlottableData = function(data)
{
plottable = [];
jsondata = JSON.parse(data);
for(key in jsondata)
{
plottable[key] = {
label: jsondata[key].label,
data: jsondata[key].value
}
}
return plottable;
};
var formatDates = function(data)
{
data = JSON.parse(data);
for(key in data)
{
if (data[key].date !== 'undefined')
{
data[key].date = moment(data[key].date, "YYYY-MM-DD").format('dddd[,] MMM Do');
}
}
return data;
};
});
@stop
@section('required-scripts-top')
@stop