1

我在页面http://iten.pro/wx/上遇到问题

来源是:

<html>
  <head>
    <script type="text/javascript" src="https://www.google.com/jsapi"></script>
    <script type="text/javascript" src="jquery.js"></script>
    <script type="text/javascript">

      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);

      function drawChart() {
        var jsonData = $.ajax({
          url: "getData.php",
          dataType:"json",
          async: false
        }).responseText;

        var options = {
          title: 'Temperatur'
        };

        var data = new google.visualization.DataTable(jsonData);
        var chart = new google.visualization.LineChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
    </script>

  </head>

  <body>
    <div id="chart_div" style="width: 900px; height: 500px;"></div>
  </body>
</html>

getData.php 返回的数据是:

{
"cols": [
    {
        "id": "",
        "label": "Zeit",
        "pattern": "",
        "type": "datetime"
    },
    {
        "id": "",
        "label": "Temperatur",
        "pattern": "",
        "type": "string"
    }
],
"rows": [
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 08, 00)"
            },
            {
                "v": 22.2
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 11, 00)"
            },
            {
                "v": 22.2
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 14, 00)"
            },
            {
                "v": 22.2
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 17, 00)"
            },
            {
                "v": 22.2
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 20, 00)"
            },
            {
                "v": 21.7
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 23, 00)"
            },
            {
                "v": 21.7
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 26, 00)"
            },
            {
                "v": 21.7
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 29, 00)"
            },
            {
                "v": 21.7
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 32, 00)"
            },
            {
                "v": 21.7
            }
        ]
    },
    {
        "c": [
            {
                "v": "Date(2013, 6, 14, 06, 32, 00)"
            },
            {
                "v": 21.7
            }
        ]
    }
]

}

我收到以下错误:轴 #0 的数据列不能是字符串类型

4

0 回答 0