ページを更新せずに、テキスト ファイルから on.php/html のリアルタイム グラフを表示するつもりです。現在、次のプロセスで問題が発生しました。
ソースファイル: データを含む .txt ファイルで、solaris サーバーから生成されます。
1) 定期的に、solaris サーバーからサーバーにデータを要求します。(宛先フォルダーが /home/sadm/htdocs/00000001/updateShop として指定されていると仮定)
2) テキスト ファイル (inventory.txt) からデータを取得します。
3) データを解析して新しい行を追加します。テキスト ファイルの (2008-1-6:33322:39463) から
[新しい日付 (2008, 1 ,6), 33322, 未定義, 未定義, 39463, 未定義, 未定義]
私が間違っていなければ、それを行うには AJAX を使用する必要がありますが、動作させることができませんでした。3 ステップのプロセスのコーディングを依頼してもよろしいですか?
どんな形の助けも大歓迎です。
参考までに、私が使用している Google Graph API コードを以下に示します。
<html>
<head>
<script type='text/javascript' src='http://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {'packages':['annotatedtimeline']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('date', 'Date');
data.addColumn('number', 'Sold Pencils');
data.addColumn('string', 'title1');
data.addColumn('string', 'text1');
data.addColumn('number', 'Sold Pens');
data.addColumn('string', 'title2');
data.addColumn('string', 'text2');
data.addRows([
[new Date(2008, 1 ,1), 30000, undefined, undefined, 40645, undefined, undefined],
[new Date(2008, 1 ,2), 14045, undefined, undefined, 20374, undefined, undefined],
[new Date(2008, 1 ,3), 55022, undefined, undefined, 50766, undefined, undefined],
[new Date(2008, 1 ,4), 75284, undefined, undefined, 14334, 'Out of Stock','Ran out of stock on pens at 4pm'],
[new Date(2008, 1 ,5), 41476, 'Bought Pens','Bought 200k pens', 66467, undefined, undefined],
[new Date(2008, 1 ,6), 33322, undefined, undefined, 39463, undefined, undefined]
]);
var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
chart.draw(data, {displayAnnotations: true});
}
</script>
</head>
<body>
// Note how you must specify the size of the container element explicitly!
<div id='chart_div' style='width: 700px; height: 240px;'></div>
</body>
</html>