我正在使用jqplot。提到我的图表看起来像第一张图片。在Firefox中看起来不错。但在 chrome(即 v30)中,它看起来像第二张图片。它在 Safari 中根本不起作用。
编辑:我想问题出在日期格式上。例如,我声明min: '01.10.2013',
max: '22.10.2013'
但 chrome 显示 min 10.01.2013
max22.10.2013.
此规则对整个系列都有效。如何更改此行为并告诉 chrome 我使用dd.mm.yyyy
日期格式?
代码:
<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');
});