0
我有一个csv文件,我读入一个JavaScript变量。我现在尝试为此创建一个可视化。解析json数据列
<html>
<head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<link href="http://code.jquery.com/ui/1.9.0/themes/cupertino/jquery-ui.css" rel="stylesheet" />
<script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<script></script>
<script src="http://jquery-csv.googlecode.com/git/src/jquery.csv.js"></script>
<script type="text/javascript">
google.load("visualization", "1", {packages:["motionchart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
$.get("stockdata.csv", function(csvString) {
var arrayData = $.csv.toArrays(csvString, {onParseValue: $.csv.hooks.castToScalar});
// this new DataTable object holds all the data
var data = new google.visualization.arrayToDataTable(arrayData);
但是,数据变量的第二列必须被类型转换为日期。该字符串已经是yyyy-mm-dd格式,但这不被可视化接受。我如何才能将第二列转换为日期类型。