2016-05-13 29 views
0

我是Jqplot中的新成員,我有一個與IE11相關的問題。我試圖在xaxis上顯示帶有「月」的圖形。這是我的代碼。Jqplot圖形數據無法正常工作

var line1=[["1", 4],["2", 4],["3", 4], ["4", 6.5], ["5", 5.7], ["6", 9]]; 
var plot1 = $.jqplot('chart', [line1], { 
    title:'Rotated Axis Text', 
    axesDefaults: { 
      labelRenderer: $.jqplot.CanvasAxisLabelRenderer 
    }, 
    axes:{ 
     xaxis:{ 
       label:"test axes des abs", 
       pad: 0, 
       renderer:$.jqplot.DateAxisRenderer, 
       rendererOptions:{ 
         tickRenderer:$.jqplot.CanvasAxisTickRenderer 
       }, 
       tickOptions:{ 
         fontSize:'10pt', 
         fontFamily:'Tahoma', 
         angle:-40, 
         formatString:'%B' 
       } 
     }, 

     yaxis:{ 
      label:'Cosine', 
     }     
    }, 
    legend: { 
      renderer: $.jqplot.EnhancedLegendRenderer, 
      show: true, 
      showLabels: true, 
      location: 'ne', 
      placement: 'outside', 
      fontSize: '11px', 
      fontFamily: ["Lucida Grande","Lucida Sans Unicode","Arial",], 
      rendererOptions: { 
       seriesToggle: 'normal' 
      } 
    }, 
    series:[{"label":"test des lignes"}], 
    cursor:{ 
      zoom:true, 
      looseZoom: true 
     } 
}); 

其中「圖表」是圖表容器中的標識符。這個作品在鉻 when I use chrome

但是,當我使用IE瀏覽器只顯示一個月。 enter image description here

如何解決?提前致謝。

回答

0

你應該提供可以解析爲日期爲x軸值較低的可疑字符串:

var line1=[["2016-01-01", 4], ["2016-02-01", 4], ["2016-03-01", 4], ["2016-04-01", 6.5], ["2016-05-01", 5.7], ["2016-06-01", 9]]; 

如有疑問,提供一個實際的Date對象,而不是一個字符串。

在內部,渲染器將調用new $.jsDate(your-x-axis-value),這在您的瀏覽器中針對您提供的值看起來會產生不同的結果。