Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在JFreeChart中编辑周期轴上的Minortick数_Java_Jfreechart - Fatal编程技术网

Java 如何在JFreeChart中编辑周期轴上的Minortick数

Java 如何在JFreeChart中编辑周期轴上的Minortick数,java,jfreechart,Java,Jfreechart,我有一个JFreeChart标准时间线图。有一个Y轴,数字从0到600,还有一个X轴,显示您希望看到的时间段 我已经实现了以下代码: protected void setupDomainAxis() { final long periodMillis = to.toDate().getTime() - from.toDate().getTime(); if (periodMillis <= DAY_IN_MILLIS) { DateAxis domainAx

我有一个JFreeChart标准时间线图。有一个Y轴,数字从0到600,还有一个X轴,显示您希望看到的时间段

我已经实现了以下代码:

protected void setupDomainAxis() {
    final long periodMillis = to.toDate().getTime() - from.toDate().getTime();
    if (periodMillis <= DAY_IN_MILLIS) {
        DateAxis domainAxis = new DateAxis();
        domainAxis.setDateFormatOverride(new SimpleDateFormat(UserContext.getCurrentUser().getTimeFormat().getPattern()));
        domainAxis.setRange(new DateRange(from.toDate(), to.toDate()), true, true);
        domainAxis.setTickUnit(new DateTickUnit(DateTickUnitType.HOUR, 2));
        domainAxis.setMinorTickMarksVisible(true);
        domainAxis.setMinorTickCount(2);
        getPlot().setDomainAxis(domainAxis);
    }


    else if (periodMillis == 172799999) {

        PeriodAxis domainAxis = new PeriodAxis(null);
        PeriodAxisLabelInfo[] info = new PeriodAxisLabelInfo[1];
        info[0] = new PeriodAxisLabelInfo(Day.class,
                new SimpleDateFormat(UserContext.getCurrentUser().getDateFormat().getWeekdayPattern(), LocaleContextHolder.getLocale()));
        domainAxis.setLabelInfo(info);

        domainAxis.setMinorTickMarksVisible(true);
        domainAxis.setMinorTickMarkOutsideLength(1);
        domainAxis.setMinorTickCount(3);

        domainAxis.setRange(new DateRange(from.toDate(), to.toDate()), true, true);
        getPlot().setDomainAxis(domainAxis);
    }
}

该方法的第一部分非常有效。第一部分和第二部分的区别在于域轴的类型

作为日期轴,我可以设置setMinorTickCount2;方法,但作为PeriodAxis,我可以设置可见性、标记长度,但不能设置记号数


有人有主意吗?我不明白为什么,因为这两种Axis都继承自org.jfree.chart.Axis.ValueAxis,并且都有setMinorTickCountint计数方法。

框架内部是否可能存在缺陷?