I am using Date Axes Renderer, When there is only one point the graph canvas is plotted, with the x axis tick but the y axis value is not shown
I am using Date Axes Renderer When there is only one data the graph is plotted, with the x axis tick but the y axis value is not shown ! Please help me out ! Below is my code :-
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;
}
Thanks in advance !
精彩评论