我有以下问题。使用库JFreeChart 1.0.14和烛台图表,我想根据X轴的值检查图表上是否有蜡烛。如果蜡烛存在,我想得到它的价值。下面是反转X轴vaule的代码。
public void mouseMoved(MouseEvent e)
{
Point2D p = this.chartPanel.translateScreenToJava2D(new Point(e.getX(), e.getY()));
XYPlot plot = (XYPlot) this.jfc.getPlot();
ChartRenderingInfo info = this.chartPanel.getChartRenderingInfo();
Rectangle2D dataArea = info.getPlotInfo().getDataArea();
ValueAxis domainAxis = plot.getDomainAxis();
RectangleEdge domainAxisEdge = plot.getDomainAxisEdge();
double chartX = domainAxis.java2DToValue(p.getX(), dataArea, domainAxisEdge);
}
有什么想法吗?