【发布时间】: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