Categories
Uncategorized

How to show multiple Y- axis in jqplot

jqPlot is a plotting and charting plugin for the jQuery Javascript framework. jqPlot produces beautiful line, bar and pie charts with many features.

We can declare multiple Y-axis for a jqplot, like as shown below:

Code

$(document).ready(function(){
var line1=[['11-01-2011',22], ['11-02-2011',3], ['11-03-2011',11], ['11-04-2011',33], ['11-05-2011',44], ['11-06-2011',14], ['11-07-2011',55]];
var line2=[['11-01-2011',2121], ['11-02-2011',32323], ['11-03-2011',65656], ['11-04- 11',21212], ['11-05-2011',32323], ['11-06-2011',54544], ['11-07-2011',31230]];
$.jqplot.config.enablePlugins = true;
var plot1 = $.jqplot('chart1', [line1, line2], {
title:'Revenue, Impressions vs Date',
axes:{
xaxis:{
renderer:$.jqplot.DateAxisRenderer
},
yaxis:{
autoscale:true,
label: "Revenue"
},
y2axis:{
autoscale:true,
tickOptions:{showGridline:false},
label: "Impressions"
}
},
series:[{lineWidth:4}, {yaxis:'y2axis'}]
});
});