実際、jQChart プラグインを使用しているすべてのレポートのグラフ チャートを作成しようとしています。私はPHPでグラフレポートを作成しましたが、私の頭にはアニメーション付きのレポートが必要なので、jQChartに行きますが、連想配列の値をAjaxに渡す方法がわかりません。
$results = mysql_query("SELECT vaccum_value,date FROM vaccum_details where serial_number='10P1005'");
$data1=array();
while ($row = mysql_fetch_array($results))
{
$data1[$row['date']]=$row['vaccum_value'];
}
$data = Array ( "28-Sep-2012" => 31.6, "04-Oct-2012" => 0.99, "03-Oct-2012" => -3 );
しかし、この結果を Ajax に渡してから、以下のように変換する必要があります。
データ: [['2012 年 9 月 28 日', 31.6], ['2012 年 10 月 4 日', 0.99], ['2012 年 10 月 3 日', -3]]
参照用の詳細なスクリプト:
<script lang="javascript" type="text/javascript">
$(document).ready(function () {
$('#jqChart').jqChart({ title: { text: 'Animation' }, animation: { delayTime: 1, duration: 2 }, series: [ { type: 'line', title: 'Line', data: [['A', 69], ['B', 57], ['C', 86], ['D', 23], ['E', 70], ['F', 60], ['D', 88], ['H', 22]] } ] }); });
</script>