【问题标题】:JFreeChart solution to draw a graph with a lot of data (>100) or (>1000)用大量数据(>100)或(>1000)绘制图形的 JFreeChart 解决方案
【发布时间】:2016-10-23 05:26:59
【问题描述】:

我有一个包含大量数据 (>100) 或 (>1000) 的图表。下面是 JFreeChart 现在打印图表的方式。

只有 11 个数据点,每个人的名字应该出现在 x 轴上,但有省略号。有没有一种理想的方式来打印这样的大量数据?

public void barchartResults(ArrayList<Person> results, String testName) {
    int i;
    setLayout(new FlowLayout(FlowLayout.LEFT, 20, 20));
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    String test = results.get(0).getTrait();

    for (i = 0; i < results.size(); i ++) { // Iterate until the end of the results array
        dataset.setValue(results.get(i).getScore(), results.get(i).getTrait(), results.get(i).getName());
    }

    JFreeChart chart = ChartFactory.createBarChart3D( testName + ": " + test,
            "Examinees", "Score", dataset, PlotOrientation.VERTICAL, true, true, false );

    ChartPanel chartPanel = new ChartPanel(chart, W, H, W, H, W, H, false, true, true, true, true, true); 
    chart.setBorderVisible(true);
    chartPanel.setSpaceBetweenGroupsOfBars(1);
    this.add(chartPanel);
    revalidate();
    repaint();
}

【问题讨论】:

    标签: java swing graph jfreechart


    【解决方案1】:

    一些选项:

    • 在您的域轴上调用 setVerticalTickLabels(),如图所示 here

    • 以所需的角度调用setCategoryLabelPositions(),如herehere 所示。

    • 使用SlidingCategoryDataset,如heredemo 所示。

    【讨论】:

      猜你喜欢
      • 2011-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-09
      • 2011-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多