I have to generate a graph that has Bar and line reference with Primary Y-axis(i.e the left one) and anoher line reference with Secondary Y-axis(i.e. the right one).
I approched by plotting overlaid graph as follows
//////////////////////
VerticalCategoryPlot plot1 = new VerticalCategoryPlot(BarDataset, null, null, renderer); // VerticalBarRenderer
VerticalCategoryPlot plot2 = new VerticalCategoryPlot(LineDataset, null, null, renderer2); // LineAndShapeRenderer
OverlaidVerticalCategoryPlot plot = new OverlaidVerticalCategoryPlot(domainAxisLabel,primaryAxisLabel);
plot.add(plot1);
plot.add(plot2);
JFreeChart chart = new JFreeChart("ITEG Chart",null,plot,true);
HorizontalCategoryAxis axis = (HorizontalCategoryAxis) plot.getDomainAxis();
axis.setVerticalCategoryLabels(true);
// Now I have correctly displaye overlaid bar and line graph with references to Primary Y-axis..this is ok
//I tried to plot secondary graph as follows that refers to Secondary Y-axis
LineAndShapeRenderer renderer3 = new LineAndShapeRenderer();
ValueAxis axis2 = new VerticalNumberAxis(secondaryAxisLabel);
plot.setSecondaryRangeAxis(axis2);
plot.setSecondaryDataset(X2LineDataset);
plot.setSecondaryRenderer(renderer3);
//It gives problem since both axes has same values and third line is going out of limit
/////////////
Please help and if my question is not clear, I will make it more clear.
Thank you
Nilesh Shretha