开发者

Get the Following Coordinate In JFreeChart

I wish to get the following coordinate in JFreeChart.

I try to use

chartPanel.getScreenDataArea(开发者_如何学JAVA)

But, it is not the area I want.

The returned rectangle is outside the area I wish to have.

The coordinate I wish to have is being marked as ??? in green.

alt text http://sites.google.com/site/yanchengcheok/Home/coordinate-problem-small.png

(zoom in version)

alt text http://sites.google.com/site/yanchengcheok/Home/coordinate-problem-big.png


Here is the solution to the problem.

/* Try to get correct main chart area. */
final Rectangle2D _plotArea = chartPanel.getChartRenderingInfo().getPlotInfo().getSubplotInfo(0).getDataArea();


There are methods to convert chart and AWT/Swing coordinates from one to another, once you can get ahold of the Axis items for the chart.

double ValueAxis.java2DToValue(double) and double ValueAxis.valueToJava2D(double)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜