0
我正在使用jfreechart庫繪製系列圖。我已經取得了y軸上的值,x軸上的時間和3個系列的值。一切都很好,但我無法放大域軸,雖然它的範圍軸的罰款。任何人都可以告訴我,如果有可能,如果是的話,請幫助代碼。JFreeChart:當使用CategoryAxis時,域軸放大功能不起作用
下面的代碼行可以幫你找到我的代碼一些場景
final ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setDomainZoomable(true);
chartPanel.setRangeZoomable(true);
this.add(chartPanel, BorderLayout.CENTER);
和
//set plot specifications
final CategoryPlot plot = (CategoryPlot) chart.getPlot();
plot.setBackgroundPaint(new Color(0xffffe0));
plot.setDomainGridlinesVisible(true);
plot.setDomainGridlinePaint(Color.lightGray);
plot.setRangeGridlinePaint(Color.lightGray);
//CUSTOMIZE DOMAIN AXIS
final CategoryAxis domainAxis = (CategoryAxis) plot.getDomainAxis();
//customize domain label position
domainAxis.setCategoryLabelPositions(
CategoryLabelPositions.createUpRotationLabelPositions(Math.PI/6.0)
);
Thanks @GrahmaA。如果我可以使用除CategoryPlot以外的任何其他類別來將類別顯示爲具有域放大選項的系列? – dirtyhandsphp
@dirtyhandsphp如果你可以用[SSCCE](http://sscce.org/)更新你的帖子或者指向[JFreeChart Demo](http://www.jfree.org/jfreechart)的方向/jfreechart-1.0.13-demo.jnlp)顯示我將進一步調查的問題。在JFreeChart演示LineChartDemo3顯示與類別的'XYPlot'這是一個合適的解決方案? – GrahamA
我的圖形和LineChartDemo3唯一的區別是我在域軸上使用時間而不是數值。 – dirtyhandsphp