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

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

Introduction

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

Prototype

public final double getScaleX() 

Source Link

Usage

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

/**
 * Find chartentities like JFreeChartEntity, AxisEntity, PlotEntity, TitleEntity, XY...
 * /*ww  w  .jav a  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;
}