Java Jasper多轴图表自定义缩放

Java Jasper多轴图表自定义缩放,java,jasper-reports,jfreechart,Java,Jasper Reports,Jfreechart,我有一个多轴图表,条形图和折线图。我的customizer类有以下代码段 @Override public void customize(final JFreeChart chart, final JRChart jasperChart) { final Plot plot = chart.getPlot(); if (plot instanceof CategoryPlot) { final CategoryPlot cPl

我有一个多轴图表,条形图和折线图。我的customizer类有以下代码段

 @Override
    public void customize(final JFreeChart chart, final JRChart jasperChart) {

        final Plot plot = chart.getPlot();

        if (plot instanceof CategoryPlot) {
            final CategoryPlot cPlot = (CategoryPlot) plot;
            final ValueAxis axis = new NumberAxis();
            axis.setMinorTickMarksVisible(true);
            axis.setMinorTickCount(1);
            cPlot.setRangeAxis(axis);
        } else if (plot instanceof XYPlot) {
            final XYPlot xyPlot = (XYPlot) plot;
            xyPlot.setRangeMinorGridlinesVisible(true);

        }

    }
图表看起来像

天平弄乱了,不在同一条线上

如何解决此问题

谢谢你的帮助


谢谢

将上述代码更改为以下代码,一切正常

 @Override
    public void customize(final JFreeChart chart, final JRChart jasperChart) {

        final Plot plot = chart.getPlot();

        if (plot instanceof CategoryPlot) {
            final CategoryPlot cPlot = (CategoryPlot) plot;
            cPlot.getRangeAxis().setMinorTickCount(2);
            cPlot.getRangeAxis().setMinorTickMarksVisible(true);
        } else if (plot instanceof XYPlot) {
            final XYPlot xyPlot = (XYPlot) plot;
            xyPlot.setRangeMinorGridlinesVisible(true);
            xyPlot.getRangeAxis().setMinorTickCount(2);
            xyPlot.getRangeAxis().setMinorTickMarksVisible(true);

        }

    }

将上面的代码改为下面的代码,一切正常

 @Override
    public void customize(final JFreeChart chart, final JRChart jasperChart) {

        final Plot plot = chart.getPlot();

        if (plot instanceof CategoryPlot) {
            final CategoryPlot cPlot = (CategoryPlot) plot;
            cPlot.getRangeAxis().setMinorTickCount(2);
            cPlot.getRangeAxis().setMinorTickMarksVisible(true);
        } else if (plot instanceof XYPlot) {
            final XYPlot xyPlot = (XYPlot) plot;
            xyPlot.setRangeMinorGridlinesVisible(true);
            xyPlot.getRangeAxis().setMinorTickCount(2);
            xyPlot.getRangeAxis().setMinorTickMarksVisible(true);

        }

    }