如何在java中标记jfreechart中的次要记号?

avkwfej4  于 2021-06-26  发布在  Java
关注(0)|答案(0)|浏览(201)

我有个问题 LogarithmicAxis 不以小刻度显示值。有没有办法显示这些值或手动指定值?我想在我的y轴上有更多的值。你知道吗?

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();
    }

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题