![](/img/trans.png)
[英]Get Java2D y-coordinate in category plot corresponding to a value in jfreechart
[英]Get the Following Coordinate In JFreeChart
我希望在JFreeChart中获得以下坐标。
我尝试使用
chartPanel.getScreenDataArea()
但是,这不是我想要的区域。
返回的矩形在我想要的区域之外。
我希望拥有的坐标被标记为??? 绿色。
替代文字http://sites.google.com/site/yanchengcheok/Home/coordinate-problem-small.png
(版本放大)
替代文字http://sites.google.com/site/yanchengcheok/Home/coordinate-problem-big.png
这是解决问题的方法。
/* Try to get correct main chart area. */
final Rectangle2D _plotArea = chartPanel.getChartRenderingInfo().getPlotInfo().getSubplotInfo(0).getDataArea();
一旦您掌握了图表的“轴”项,就有一些方法可以将图表和AWT / Swing坐标从一个转换为另一个。
double ValueAxis.java2DToValue(double)
和double ValueAxis.valueToJava2D(double)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.