2012-02-07 25 views
0

我正在使用jqplot繪製日期在x軸上的線圖..我的圖表在Chrome瀏覽器中完美工作,但不幸的是我得到「this.proxy.getTime不是在Firefox的功能異常」異常[螢火蟲控制檯] ..this.proxy.getTime不是jqplot中的函數例外

function rndColor() { 
    function c() { 
     return ('0' + Math.floor(Math.random() * 256).toString(16)).substr(-2); 
    } 
    return '#' + c() + c() + c(); 
} 
    var plot1 = $.jqplot('chart1', [[['2012-01-23 00:23:03', 23], ['2012-02-01 00:14:02', 23]]], { 
     title:'Disk Usage', 
     axes:{ 
     xaxis:{ 
      renderer:$.jqplot.DateAxisRenderer, 
      tickOptions:{ 
     formatString:'%b-%Y' 
      }, 
     min: 'Jan-2012', 
     max: 'Dec-2012', 
     timeInterval: '1 month', 
     }, 
     yaxis:{ 
      tickOptions:{ 
      formatString:'%1.2f TB' 
      } 
     } 
     }, 
     highlighter: { 
     show: true, 
     sizeAdjust: 7.5, 
     }, 
      legend: {show: true,placement: "outsideGrid",}, 
     series:[ 
     {color: rndColor(),label: '/user/aaaa/'}, 
     ], 
     cursor: { 
     show: false 
     }, 
    }); 

因此圖沒有得到繪製。在我的配置中是否有任何錯誤導致此行爲,任何幫助都將非常有幫助。

回答

4

我真的不能告訴你爲什麼得到錯誤,但我可以告訴你是什麼原因造成:

min: 'Jan-2012', 
max: 'Dec-2012', 

指定日期作爲文本字符串,那麼就需要被解析成數值應避免 。 jqPlot試圖智能地將它們轉換爲JavaScript日期對象,但是失敗。你應該習慣傳遞日期的物體或大紀元時報(對JavaScript這是自1月1日的毫秒數,1970年

修改代碼爲:

min: 1326585600000, // number of milliseconds 1/15/2012 
    max: 1355529600000, // number of milliseconds 12/15/2012