Iam使用Google图表显示我的销售图表
在我的图表中需要显示日期明智的销售
在X轴上显示日期,在Y轴上显示金额
但是在Google图表中,我无法打印日期。下面是我的代码
<html>
<head>
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>
</head>
<body>
<div id="curve_chart" style="width: 900px; height: 500px"></div>
<script type="text/javascript">
google.charts.load('current', {'packages':['corechart']});
google.charts.setOnLoadCallback(drawChart);
function drawChart(){
var data = new google.visualization.DataTable();
data.addColumn('datetime', 'Time of Day');
data.addColumn('number','Head Office');
data.addColumn('number','Mohans Shoppy');
data.addColumn('number','My shoppy');
data.addRows([
[[new Date(2019,03,02)],2599,0,0],[[new Date(2019,03,03)],0,0,0],[[new Date(2019,03,04)],28625,0,15900],[[new Date(2019,03,05)],3934,0,0],[[new Date(2019,03,06)],0,0,0],[[new Date(2019,03,07)],3201,0,0],[[new Date(2019,03,09)],1500,0,0],
]);
var options = {
title: 'Sales Chart',
legend: { position: 'bottom' },
width: 900,
height: 500
};
var chart = new google.visualization.LineChart(document.getElementById('curve_chart'));
chart.draw(data, options);
}
</script>
</body>
</html>
我在控制台中收到错误:未捕获(承诺)错误:键入不匹配。值Tue Apr 02 2019 00:00:00 GMT + 0530(印度标准时间)与列索引0中的类型datetime不匹配
杨魅力
相关分类