2013-10-22 102 views
3

我正在使用jqplot。我的圖表被提到看起來像在第一個圖像。 它在Firefox中看起來不錯。但在鉻(即v30)中,它看起來像在第二個圖像。 它在Safari中完全不起作用。瀏覽器不兼容 - 錯誤呈現

編輯:我想問題是日期格式。 我聲明例如min: '01.10.2013',max: '22.10.2013' 但鉻顯示分鐘10.01.2013最大22.10.2013.此規則適用於整個系列。 如何更改此行爲並告訴Chrome,我使用的日期格式爲dd.mm.yyyy

enter image description here

enter image description here

代碼:

<div id="chart2" style="height:250px; width:596px;"></div> 

$(document).ready(function(){ 


    var line1 = [['01.10.2013',0],['02.10.2013',-0.42437431991294],['03.10.2013',-1.9912948857454],['04.10.2013',-1.512513601741],['07.10.2013',-2.3177366702938],['08.10.2013',-2.6115342763874],['09.10.2013',-3.4711643090316],['10.10.2013',-1.316648531012],['11.10.2013',-0.54406964091403],['14.10.2013',-0.71817192600653],['15.10.2013',-1.7627856365615],['16.10.2013',-1.8824809575626],['17.10.2013',-2.9815016322089],['18.10.2013',-1.0663764961915],['21.10.2013',-1.512513601741]]; 
    var line2 = [['01.10.2013',0],['02.10.2013',-0.42437431991294],['03.10.2013',-1.9912948857454],['04.10.2013',-1.512513601741],['07.10.2013',-2.3177366702938],['08.10.2013',-2.6115342763874],['09.10.2013',-3.4711643090316],['10.10.2013',-1.316648531012],['11.10.2013',-0.54406964091403],['14.10.2013',-0.71817192600653],['15.10.2013',-1.7627856365615],['16.10.2013',-1.8824809575626],['17.10.2013',-2.9815016322089],['18.10.2013',-1.0663764961915],['21.10.2013',-1.512513601741]]; 
    var plot3 = $.jqplot('chart2', [line2,line1], { 


    seriesDefaults: { lineWidth: 0.8, showMarker:false, showMarker:false }, 




    grid: {background:'#fdfdfd', borderWidth: 0.4 }, 
     series: [    
     {label: 'incl. Dividende'}, 
     {label: 'excl. Dividende'} 
     ], 
     seriesColors: [ "#009933", "#003399"], 
    axes:{ 
     xaxis:{ 
      renderer:$.jqplot.DateAxisRenderer, 
     tickOptions: { 
       formatString: '%d.%m.%Y' 
      }, 
     min: '01.10.2013', 
     max: '22.10.2013' 
    } 
     } 
    }); 
    mytitle = $('<div class="my-jqplot-title" style="opacity:0.4;filter:alpha(opacity=40);font-weight:bold;font-family:Tahoma, Geneva, sans-serif ;color:#DDDDDD; font-size:27px;position:absolute;text-align:center;top: 101px;width:100%; ">CHART</div>').insertBefore('.jqplot-series-canvas');//('.jqplot-grid-canvas'); 


}); 
+0

你可以發佈代碼,以便我們可以嘗試和複製? –

+0

另外請提及您用於測試的瀏覽器版本。 – AsG

+0

@Sébastien:我也應該發佈line2和line1嗎? – MaMu

回答

1

您需要正確的格式來定義最小值和最大值:

axes: { 
xaxis: { 
    renderer: $.jqplot.DateAxisRenderer, 
    tickOptions: { formatString: '%d.%m.%Y' }, 
    min: '2013-10-01', 
    max: '2013-10-22' 
} 
} 

請參閱工作示例here

+0

謝謝!你讓我今天一整天都感覺很好! – MaMu