I have been trying to get a chart with a specific look using a logarithmic x-axis. I need it to look something like this:
The closest I have been able to create is this:
Here is the code I am using:
Code: Select all
XYPlot plot = chart.getXYPlot();
LogAxis domainAxis = new LogAxis("x-axis");
domainAxis.setBase(10);
domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
NumberAxis rangeAxis = new NumberAxis("y-axis");
plot.setDomainAxis(domainAxis);
plot.setRangeAxis(rangeAxis);
chart.setBackgroundPaint(Color.white);
plot.setOutlinePaint(Color.black);
ChartPanel chartPanel = new ChartPanel(chart);
I am also wondering why the 1000 to 10000 range is curved instead of being a line. As far as I can see my data is correct at the random places I have sampled it.
Any help would be greatly appreciated.
PL