Jfreechart烛台图表 - 蜡烛由X轴值

时间:2012-02-20 10:43:53

标签: java jfreechart mousemove candlestick-chart

我有以下问题。使用库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);
}

有什么想法吗?

0 个答案:

没有答案