I am trying to plot a XYPlot using JfreeChart. My X axis has number or client say 30, 50 ,70 and Y axis has cache hit ratio( Value of which sometime varies by 0.01) When i set AutoRange the y axis show range as 0.1 0.2 0.3..... 1.0. So sometimes my plot is nearly straight line since it varies by such a small factor.
I have tried this code
JFreeChart chart = ChartFactory.createXYLineChart(
"Effect of Number of Clients", // Title
"Number of Clients", // x-axis Label
"Cache Hit Ratio", // y-axis Label
datasetLRU, // Dataset
PlotOrientation.VERTICAL, // Plot Orientation
true, // Show Legend
true, // Use tooltips
false // Configure chart to generate URLs?
);
chart.setBackgroundPaint(Color.white);
plot= chart.getXYPlot();
plot.setBackgroundPaint(Color.black);
plot.setDomainGridlinePaint(Color.white);
plot.setRangeGridlinePaint(Color.white);
final ValueAxis axis = plot.getDomainAxis();
axis.setAutoRange(false);
final NumberAxis axis2 = new NumberAxis("Axis 2");
axis2.setAutoRangeIncludesZero(false);
axis2.setTickUnit(new NumberTickUnit(0.01));
plot.setDataset(1, datasetMARS);
plot.setRenderer(1, new StandardXYItemRenderer());
plot.setDataset(2, datasetNEW);
plot.setRenderer(2, new StandardXYItemRenderer());
So Can any one help in setting Y axis range as 0.01 0.02 0.03 .... 0.98 0.99 1.00 Thanks