2013-05-29 35 views
0

我有一個highstock圖表存在問題。我需要爲我的大學項目展示我可以在我的個人電腦上的日誌中找到的實時價值圖表。從我的電腦上的外部文件加載數據

我從網站下載了highstock zip並研究了這些例子。特別是我試圖修改動態更新index.html

如何替換y值的隨機函數以從我的csv文件獲取數據?

這是原來的代碼:

$('#container').highcharts('StockChart', { 
    chart : { 
     events : { 
      load : function() { 

       // set up the updating of the chart each second 
       var series = this.series[0]; 
       setInterval(function() { 
        var x = (new Date()).getTime(), // current time 
        y = Math.round(Math.random() * 100); 
        series.addPoint([x, y], true, true); 
       }, 1000); 
      } 
     } 
    }, 

非常感謝您的幫助!

回答

0

我建議準備www服務器,在那裏你將保存你的文件,然後通過$ .get()加載到你的機器上。

+0

你能告訴我一些代碼示例,以便更好地理解如何使用$ .get()在y中推送單個int值(來自csv文件)?謝謝! – matfire88