jfreechart:更新domainaxis

dy1byipe  于 2021-07-09  发布在  Java
关注(0)|答案(0)|浏览(152)

如何定义 DomainAxis 只显示第10个类别?

final CategoryItemRenderer renderer = new CategoryStepRenderer(true);
    final CategoryAxis domainAxis = new CategoryAxis("Time");
    domainAxis.setLowerMargin(0.0);
    domainAxis.setUpperMargin(0.0);
    final ValueAxis rangeAxis = new NumberAxis("Net demand");
    rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
    final CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer);
    final JFreeChart chart = new JFreeChart("Category Step Chart", plot);

    Title t = new TextTitle("Subtitle");
    chart.addSubtitle(t);

    chart.setBackgroundPaint(Color.white);

    plot.setForegroundAlpha(0.5f);
    plot.setBackgroundPaint(Color.lightGray);
    plot.setDomainGridlinesVisible(true);
    plot.setDomainGridlinePaint(Color.white);
    plot.setRangeGridlinesVisible(true);
    plot.setRangeGridlinePaint(Color.white);

暂无答案!

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

相关问题