我正在使用Date Axes Renderer当图表只有一个数据时 绘制,x轴勾选,但y轴值未显示! 请帮帮我!以下是我的代码: -
function plotgraph(data)
{
var mydata = [];
var dateticks = [];
$.each(data, function (index, value) {
var date = formatdate(data[index].TextColumnString);
dateticks.push([date]);
mydata.push([date, s]);
});
$.jqplot.config.enablePlugins = true;
plot1 = $.jqplot('newgraph', [mydata], {
title: 'Revenue',
legend: { show: true, location: 'ne' },
grid: {
drawBorder:false,
borderWidth: null,
background: '#ffffff',
gridLineColor: '#e0e0e0',
shadow:false
},
axes:
{
xaxis:
{
label: 'Dates',
numberTicks: dateticks.length,
ticks:dateticks,
renderer: $.jqplot.DateAxisRenderer,
tickRenderer: $.jqplot.CanvasAxisTickRenderer,
tickOptions:{
fontSize: '10px',
fontFamily: 'Arial',
angle:-30
},
},
yaxis: { label: 'Revenue(in $)', autoscale:true,
labelRenderer: $.jqplot.CanvasAxisLabelRenderer,
tickOptions: { formatString: '$%.2f'} }
},
series:[
{ showLabel: true, lineWidth: 3.5, label:
'Revenue', markerOptions: { style: 'circle'}}],
highlighter : { show : true, sizeAdjust : 7.5},
cursor : { show : false }
});
}
}
//this function is used to format the date from the given to required format.
function formatdate(date) {
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
date = date.replace(',', '');
var fdate = date.split(' ');
var day = fdate[0];
var month = months.indexOf(fdate[1], 0);
month = Number(month) + 1;
var year = fdate[2];
var mydate = year + '-' + month + '-' + day;
return mydate;
}
提前致谢!