1

我正在尝试根据时间显示温度图表。

这是我的资源目录中我的 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,但图表上没有显示任何内容:(

你能帮助我吗 ?

4

1 回答 1

1

您的图表未显示,因为您的图表 JSON 中没有设置图表类型。我将"type":"line"用于我的示例。

var chartData = {
  "type": "line", 
  "csv":{
      "url":"./ressources/temperature1.csv",
      "smart-scales":true
    }
};
于 2015-10-02T17:17:23.717 回答