我有以下问题。使用库 JFreeChart 1.0.14 和烛台图,我想根据 X 轴的值检查图表上是否有蜡烛。如果蜡烛存在,我想得到它的值。下面是检索 X 轴值的代码。
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);
}
有任何想法吗?