I have a problem where my LogarithmicAxis
is not showing values at minor ticks. Is there a way to show these values or specify the values by hand? I would like to have more values on my y-axis. Any idea?
public void Woehler_zeichnen(JTable table, JPanel content) {
XYPlot plot = new XYPlot();
XYDataset scatterPlotDataset = getMesspunkte(table);
plot.setDataset(0, scatterPlotDataset);
plot.setRenderer(0, new XYLineAndShapeRenderer(false, true));
LogAxis xax = new LogAxis("Schwingspielzahl n");
LogarithmicAxis yax = new LogarithmicAxis("Spannung [MPa]");
xax.setBase(10);
//yax.setBase(10);
//yax.setTickUnit(new NumberTickUnit(1.0, NumberFormat.getInstance(), 9));
//yax.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
yax.setTickMarkInsideLength(2f);
yax.setTickMarkOutsideLength(4f);
yax.setTickMarkPaint(Color.GREEN);
yax.setTickMarkStroke(new BasicStroke(2f));
yax.setMinorTickMarksVisible(true);
plot.setDomainAxis(0, xax); //X-Achse
plot.setRangeAxis(0, yax); //Y-Achse
plot.mapDatasetToDomainAxis(0, 0);
plot.mapDatasetToRangeAxis(0, 0);
XYDataset functionDataset = getAusgleichsgerade();
plot.setDataset(1, functionDataset);
plot.setRenderer(1, new XYLineAndShapeRenderer(true, false));
plot.mapDatasetToDomainAxis(1, 0);
plot.mapDatasetToRangeAxis(1, 0);
JFreeChart chart = new JFreeChart("W?hlerlinie",JFreeChart.DEFAULT_TITLE_FONT, plot, true);
ChartPanel chartPanel = new ChartPanel(null);
chartPanel.setChart(chart);
if (woehler_ausgegeben == false) {
content.add(chartPanel);
woehler_ausgegeben = true;
}
content.revalidate();
}
question from:
https://stackoverflow.com/questions/65602914/how-do-i-label-minor-ticks-in-a-jfreechart-in-java 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…