I think what you need is logAxis.setNumberFormatOverride(NumberFormat format);
EDIT: Since further help is needed... try this:
logAxis.setBase(10);
LogFormat format = new LogFormat(logAxis.getBase(), "", "", true);
logAxis.setNumberFormatOverride(format);
Here's a whole method that can be used to play with...:
public static void main(String[] args) {
XYSeries series = new XYSeries("");
series.add(1, 10);
series.add(2, 100);
series.add(3, 1000);
series.add(4, 10000);
series.add(5, 100000);
series.add(6, 1000000);
// NumberAxis yAxis = new NumberAxis("");
LogAxis yAxis = new LogAxis("");
yAxis.setBase(10);
LogFormat format = new LogFormat(yAxis.getBase(), "", "", true);
yAxis.setNumberFormatOverride(format);
XYPlot plot = new XYPlot(
new XYSeriesCollection(series),
new NumberAxis(""),
yAxis,
new XYLineAndShapeRenderer(true, false));
JFreeChart chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, false);
JFrame frame = new JFrame("LogAxis Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(new ChartPanel(chart));
frame.pack();
frame.setVisible(true);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…