I am able to draw gridlines only for the ticks on the primary axis. However i want to draw gridlines for both primary and secondary axises.
Here is my code:
Code:
final JFreeChart chart = ChartFactory.createXYLineChart(
footer, // chart title
"E'/E'' (Pa)", // domain axis label
xaxis, // range axis label
dataset, // data
PlotOrientation.VERTICAL,
false, // include legend
true,
false
);
final XYPlot plot = chart.getXYPlot();
final NumberAxis domainAxis = new NumberAxis(xaxis);
final LogarithmicAxis rangeAxis = new LogarithmicAxis("E'/E'' (Pa)");
final LogarithmicAxis rangeAxisY2 = new LogarithmicAxis("Tan Delta");
final XYSeriesCollection dataset2 = createDataset(2);
plot.setDataset(3, dataset2);
plot.mapDatasetToRangeAxis(3,3);
plot.setRangeAxis(3,rangeAxisY2);
plot.setRangeAxisLocation(3,AxisLocation.BOTTOM_OR_RIGHT);
plot.setDomainAxis(domainAxis);
plot.setRangeAxis(rangeAxis);
chart.setBackgroundPaint(Color.white);
Plotting gridlines from Y2 (Secondary) axis
Re: Plotting gridlines from Y2 (Secondary) axis
Has anyone solved this? I also wish to plot gridlines for my secondary Y axis and have not found a suitable solution on the internet