所以,我有一个谷歌线图显示与已被转换为JSON谷歌线图表的可视化与JSON团块
在这里的数据集是一些代码与属性:
var chartOptions = {curveType: 'none',
width: 1200, height: 768,
vAxis: {maxValue: 8000, title: 'Load time in ms'},
hAxis: {title: 'Date and Time'},
title: 'A Line Graph Example',
titlePosition: 'out',
titleTextStyle: {fontSize: 14,textIndent: 10},
fontSize: 12
};
//Load core chart visualization
google.load('visualization', '1', {packages: ['corechart']});
//On load call back invoke function
google.setOnLoadCallback(getData);
的JSON团块那我不得不遍历和折线图中显示看起来是这样的:
{
"cols": [
{
"id": "formatted_timestamp",
"label": "Formatted timestamp",
"type": "number"
},
{
"id": "fully_loaded",
"label": "Fully loaded",
"type": "number"
},
{
"id": "load_time",
"label": "Load time",
"type": "number"
},
{
"id": "location",
"label": "Test location",
"type": "string"
},
{
"id": "time_to_first_byte",
"label": "Time to first byte",
"type": "number"
},
{
"id": "timestamp",
"label": "Timestamp",
"type": "datetime"
},
{
"id": "url",
"label": "URL",
"type": "string"
},
{
"id": "view",
"label": "View #",
"type": "number"
}
],
"rows": [
{
"c": [
{
"v": 1288888570000
},
{
"v": 9236
},
{
"v": 6348
},
{
"v": "Dulles, VA USA"
},
{
"v": 466
},
{
"v": "Date(2010, 10, 4, 16, 36, 10)"
},
{
"v": "http://example.com"
},
{
"v": 1
}
]
},
{
"c": [
{
"v": 1288888592000
},
{
"v": 4499
},
{
"v": 3630
},
{
"v": "Dulles, VA USA"
},
{
"v": 322
},
{
"v": "Date(2010, 10, 4, 16, 36, 32)"
},
{
"v": "http://example2.com"
},
{
"v": 2
}
]
},
{
"c": [
{
"v": 1288888582000
},
{
"v": 4499
},
{
"v": 3630
},
{
"v": "Dulles, VA USA"
},
{
"v": 322
},
{
"v": "Date(2010, 10, 4, 16, 36, 32)"
},
{
"v": "http://example3.com"
},
{
"v": 2
}
]
},
为了简洁起见,我略行,因为有很多人,但他们prett你可以重复使用不同的数据。
我的问题是我将如何遍历这个blob,然后显示在谷歌折线图可视化?另外,我将如何从此选择不同的数据集并将其显示在绘制在同一图上的其他数据上?
在此先感谢。
您是否设法获取图例/悬停框中的图表名称?我使用几乎相同的语法,但无法从cols []获取数据以显示任何地方.. – supertopi 2011-12-02 00:43:22