请帮忙用csv显示图表
Please help to display chart with csv
我正在尝试根据时间显示温度图表。
这是我的 csv 文件的摘录 'temperature1.csv' 来自我的资源目录:
Date heure,Chambre d'amis,salon,Salle de Bain,Chambre,Dehors
07/10/15 151006,24,23.299999237061,22.799999237061,22.39999961853,28.89999961853
07/10/15 151506,24,23.299999237061,22.89999961853,22.5,28.89999961853
07/10/15 152006,24,23.299999237061,22.89999961853,22.5,28.89999961853
07/10/15 152506,24,23.299999237061,22.89999961853,22.5,28.89999961853
07/10/15 153006,24,23.299999237061,22.89999961853,22.60000038147,29.5
07/10/15 153506,24.10000038147,23.39999961853,22.89999961853,22.60000038147,29.60000038147
07/10/15 154006,24.10000038147,23.39999961853,22.89999961853,22.60000038147,29.700000762939
07/10/15 154506,24.10000038147,23.39999961853,22.89999961853,22.60000038147,29.89999961853
07/10/15 155006,24.10000038147,23.39999961853,23,22.700000762939,29.799999237061
07/10/15 155506,24.10000038147,23.5,23,22.700000762939,30.10000038147
07/10/15 160010,24.10000038147,23.5,23,22.700000762939,30.299999237061
07/10/15 160506,24.10000038147,23.5,23,22.799999237061,30.39999961853
第一行是表头,下一行是数据。
那是 html 代码:
<!DOCTYPE html>
<html>
<head>
<!--Script Reference[1]-->
<script src="./zingchart/zingchart.min.js"></script>
<script>
var chartData={
"csv":{
"url":"./ressources/temperature1.csv",
"horizontal-labels":true
};
window.onload=function(){ // Render Method[2]
zingchart.render({
id:'chartDiv',
data:chartData,
height:400,
width:600
});
};
</script>
</head>
<body>
<!--Chart Placement[3]-->
<div id ='chartDiv'></div>
</body>
</html>
我看到了 chartDiv,但图表上没有任何显示:(
你能帮帮我吗?
您的图表没有显示,因为您的图表中没有设置图表类型 JSON。我将使用 "type":"line"
作为示例。
var chartData = {
"type": "line",
"csv":{
"url":"./ressources/temperature1.csv",
"smart-scales":true
}
};
我正在尝试根据时间显示温度图表。
这是我的 csv 文件的摘录 'temperature1.csv' 来自我的资源目录:
Date heure,Chambre d'amis,salon,Salle de Bain,Chambre,Dehors
07/10/15 151006,24,23.299999237061,22.799999237061,22.39999961853,28.89999961853
07/10/15 151506,24,23.299999237061,22.89999961853,22.5,28.89999961853
07/10/15 152006,24,23.299999237061,22.89999961853,22.5,28.89999961853
07/10/15 152506,24,23.299999237061,22.89999961853,22.5,28.89999961853
07/10/15 153006,24,23.299999237061,22.89999961853,22.60000038147,29.5
07/10/15 153506,24.10000038147,23.39999961853,22.89999961853,22.60000038147,29.60000038147
07/10/15 154006,24.10000038147,23.39999961853,22.89999961853,22.60000038147,29.700000762939
07/10/15 154506,24.10000038147,23.39999961853,22.89999961853,22.60000038147,29.89999961853
07/10/15 155006,24.10000038147,23.39999961853,23,22.700000762939,29.799999237061
07/10/15 155506,24.10000038147,23.5,23,22.700000762939,30.10000038147
07/10/15 160010,24.10000038147,23.5,23,22.700000762939,30.299999237061
07/10/15 160506,24.10000038147,23.5,23,22.799999237061,30.39999961853
第一行是表头,下一行是数据。
那是 html 代码:
<!DOCTYPE html>
<html>
<head>
<!--Script Reference[1]-->
<script src="./zingchart/zingchart.min.js"></script>
<script>
var chartData={
"csv":{
"url":"./ressources/temperature1.csv",
"horizontal-labels":true
};
window.onload=function(){ // Render Method[2]
zingchart.render({
id:'chartDiv',
data:chartData,
height:400,
width:600
});
};
</script>
</head>
<body>
<!--Chart Placement[3]-->
<div id ='chartDiv'></div>
</body>
</html>
我看到了 chartDiv,但图表上没有任何显示:(
你能帮帮我吗?
您的图表没有显示,因为您的图表中没有设置图表类型 JSON。我将使用 "type":"line"
作为示例。
var chartData = {
"type": "line",
"csv":{
"url":"./ressources/temperature1.csv",
"smart-scales":true
}
};