Example usage for org.jfree.chart.fx ChartCanvas getRenderingInfo

List of usage examples for org.jfree.chart.fx ChartCanvas getRenderingInfo

Introduction

In this page you can find the example usage for org.jfree.chart.fx ChartCanvas getRenderingInfo.

Prototype

public ChartRenderingInfo getRenderingInfo() 

Source Link

Document

Returns the rendering info from the most recent drawing of the chart.

Usage

From source file:net.sf.mzmine.chartbasics.ChartLogicsFX.java

/**
 * Find chartentities like JFreeChartEntity, AxisEntity, PlotEntity, TitleEntity, XY...
 * /* w ww  .  j  ava  2s  . c  o m*/
 * @param chart
 * @return
 */
public static ChartEntity findChartEntity(ChartCanvas chart, double mx, double my) {
    // TODO check if insets were needed
    // coordinates to find chart entities
    int x = (int) (mx / chart.getScaleX());
    int y = (int) (my / chart.getScaleY());

    ChartRenderingInfo info = chart.getRenderingInfo();
    ChartEntity entity = null;
    if (info != null) {
        EntityCollection entities = info.getEntityCollection();
        if (entities != null) {
            entity = entities.getEntity(x, y);
        }
    }
    return entity;
}