PHP出力に基づいてフロー棒グラフを作成したいと思います。なんとかphpからデータ出力できましたが、ラベルも使ってxaxisに表示したいです。何らかの理由で、以下のコードの出力は無効です。ラベルは表示されますが、バーと xaxis のラベルは表示されません。
PHP:
function getOverview() {
$arr[] = array(
'label' => "Label 1",
'data' => array(0, 1)
);
$arr[] = array(
'label' => "Label 2",
'data' => array(1, 2)
);
echo json_encode($arr);
}
出力: [{"ラベル":"ラベル 1","データ":[0,1]},{"ラベル":"ラベル 2","データ":[1,2]}]
jQuery:
$(document).ready(function(){
$.ajax({
url: 'http://localhost/getOverview.php',
method: 'GET',
dataType:"json",
success: onOutboundReveived
});
function onOutboundReveived(series)
{
var options = {
series: {
bars: {
show: true,
barWidth: .1,
align: 'center'
}
},
xaxis: {
tickSize: 1
}
};
$.plot("#chart_filled_blue", series, options);
}
});
誰でも私を助けることができますか?