分単位で統計情報を表示しようとしていますが、グラフは間違っていますか、間違っていますか? Googleのグラフが正しく表示されない理由
私はここjsfiddle例があります。https://jsfiddle.net/p0j5qfL9/1/
google.charts.load('current', {packages: ['corechart', 'line']});
google.charts.setOnLoadCallback(load_page_data);
function load_page_data(zoom,action,time,entry_id){
zoom = typeof zoom !== 'undefined' ? zoom : 'date';
action = typeof action !== 'undefined' ? action : 'banner view';
time = typeof time !== 'undefined' ? time : $('.actions_logs .sort_time').val();
entry_id = typeof entry_id !== 'undefined' ? entry_id : '';
rows = [];
$.ajax({
url: "/stats/get-stats",
data: {zoom : zoom, action : action, time: time, entry_id : entry_id},
async: false,
success: function(data){
if(data){
var json = jQuery.parseJSON(data);
$.each(json, function(index, value) {
date = new Date(value.created);
rows.push([new Date(value.created),parseInt(value.total)]);
});
drawBasic(rows,action,zoom);
}
}
});
}
function drawBasic(rows,action,zoom) {
var data = new google.visualization.DataTable(rows);
column_type = (zoom == 'minute' || zoom == 'hour') ? 'datetime' : 'date';
data.addColumn(column_type, 'Time of Day');
data.addColumn('number', action);
data.addRows(rows);
var options = {
title: 'Action',
hAxis: {
title: 'Time',
format: (column_type == 'datetime') ? 'yyyy/M/d HH:mm' : null
},
vAxis: {
title: 'Hits'
},
pointSize: 5,
legend: { position: 'top', alignment: 'end' },
animation: {"startup": true}
};
var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
$('.loading-chart').remove();
chart.draw(data, options);
}