次のようなjson応答があります。
{ "total": 2, "success": true, "rows": [ {"a1_id":"7847TK10", "output2":"7847TK10", etc.
etc} ]}
現在、私の Google ビジュアライゼーション (円グラフ) コードは、次の場合にのみ適切に実行されます。
<script type="text/javascript">
// load visualization library
google.load('visualization', '1', {packages: ['corechart']});
$(function() {
// when document loads, grab the json
$.getJSON('regiontop11.json', function(data) {
// once grabbed, we run this callback
// setup the new map and its variables
var map = new google.visualization.DataTable();
map.addRows(data.length);
map.addColumn('string', 'outputsix');
map.addColumn('number', 'outputnine');
// now we need to build the map data, loop over each result
$.each(data, function(i,v) {
// set the values for both the name and the population
map.setValue(i, 0, v.output6);
map.setValue(i, 1, v.output9);
});
// finally, create the map!
var chart = new google.visualization.PieChart(
document.getElementById('visualization'));
chart.draw(map, null);
});
});
</script>
....jsonを次のように調整します。
[ {"a1_id":"7847TK10", "output2":"7847TK10", etc. etc} ]
問題は、拡張された (上記を参照) 出力が他のアプリケーションに必要なため、json.php 自体を調整できないことです。したがって、 { "total": 2, "success": true, "rows": の部分をスキップするだけではオプションはありません。どちらのバージョンも有効な Json です。JQuery などを使用して、ブラウザー (Pie Code) で何かを行うことはできますか? ソリューションは大歓迎です!
よろしくピーター