Java 类org.jfree.chart.entity.EntityCollection 实例源码

项目:rapidminer    文件:AbstractChartPanel.java   
/**
 * Returns a string for the tooltip.
 * 
 * @param e
 *            the mouse event.
 * 
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */

@Override
public String getToolTipText(MouseEvent e) {

    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity((int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:rapidminer    文件:AbstractChartPanel.java   
/**
 * Returns the chart entity at a given point.
 * <P>
 * This method will return null if there is (a) no entity at the given point, or (b) no entity
 * collection has been generated.
 * 
 * @param viewX
 *            the x-coordinate.
 * @param viewY
 *            the y-coordinate.
 * 
 * @return The chart entity (possibly <code>null</code>).
 */

@Override
public ChartEntity getEntityForPoint(int viewX, int viewY) {

    ChartEntity result = null;
    if (this.info != null) {
        Insets insets = getInsets();
        double x = (viewX - insets.left) / this.scaleX;
        double y = (viewY - insets.top) / this.scaleY;
        EntityCollection entities = this.info.getEntityCollection();
        result = entities != null ? entities.getEntity(x, y) : null;
    }
    return result;

}
项目:jfreechart-fx    文件:TooltipHandlerFX.java   
/**
 * Returns the tooltip text.
 * 
 * @param canvas  the canvas that is displaying the chart.
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 * 
 * @return String The tooltip text (possibly {@code null}).
  */
private String getTooltipText(ChartCanvas canvas, double x, double y) {
    ChartRenderingInfo info = canvas.getRenderingInfo();
    if (info == null) {
        return null;
    }
    EntityCollection entities = info.getEntityCollection();
    if (entities == null) {
        return null;
    }
    ChartEntity entity = entities.getEntity(x, y);
    if (entity == null) {
        return null;
    }
    return entity.getToolTipText();
}
项目:parabuild-ci    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return a tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(MouseEvent e) {

    String result = null;

    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                (int) ((e.getX() - insets.left) / this.scaleX),
                (int) ((e.getY() - insets.top) / this.scaleY)
            );
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }

    return result;

}
项目:parabuild-ci    文件:ImageMapUtil.java   
/**
 * Creates an HTML image map.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  the tool tip generator.
 * @param urlTagFragmentGenerator  the url generator.
 *
 * @return the map tag.
 */
public static String getImageMap(String name,
                                 ChartRenderingInfo info,
                                 ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
                                 URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuffer sb = new StringBuffer();
    sb.append("<MAP NAME=\"" + name + "\">");
    sb.append(System.getProperty("line.separator"));
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        Iterator iterator = entities.iterator();
        while (iterator.hasNext()) {
            ChartEntity entity = (ChartEntity) iterator.next();
            String area = entity.getImageMapAreaTag(toolTipTagFragmentGenerator,
                                                    urlTagFragmentGenerator);
            if (area.length() > 0) {
                sb.append(area);
                sb.append(System.getProperty("line.separator"));
            }
        }
    }
    sb.append("</MAP>");

    return sb.toString();
}
项目:parabuild-ci    文件:AbstractXYItemRenderer.java   
/**
 * Adds an entity to the collection.
 * 
 * @param entities  the entity collection being populated.
 * @param area  the entity area (if <code>null</code> a default will be used).
 * @param entityX  the entity's center x-coordinate in user space.
 * @param entityY  the entity's center y-coordinate in user space.
 * @param dataset  the dataset.
 * @param series  the series.
 * @param item  the item.
 */
protected void addEntity(EntityCollection entities, Shape area, 
                         XYDataset dataset, int series, int item,
                         double entityX, double entityY) {

    if (area == null) {
        area = new Ellipse2D.Double(
            entityX - this.defaultEntityRadius, entityY - this.defaultEntityRadius, 
            this.defaultEntityRadius * 2, this.defaultEntityRadius * 2
        );
    }
    String tip = null;
    XYToolTipGenerator generator = getToolTipGenerator(series, item);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, series, item);
    }
    String url = null;
    if (getURLGenerator() != null) {
        url = getURLGenerator().generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(area, dataset, series, item, tip, url);
    entities.addEntity(entity);
}
项目:parabuild-ci    文件:ChartComposite.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(org.eclipse.swt.events.MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Rectangle insets = getBounds();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.x - insets.x) / this.scaleX),
                    (int) ((e.y - insets.y) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:parabuild-ci    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(MouseEvent e) {

    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:parabuild-ci    文件:AbstractXYItemRenderer.java   
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param area  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param series  the series.
 * @param item  the item.
 * @param entityX  the entity's center x-coordinate in user space.
 * @param entityY  the entity's center y-coordinate in user space.
 */
protected void addEntity(EntityCollection entities, Shape area,
                         XYDataset dataset, int series, int item,
                         double entityX, double entityY) {
    if (!getItemCreateEntity(series, item)) {
        return;
    }
    if (area == null) {
        area = new Ellipse2D.Double(entityX - this.defaultEntityRadius,
                entityY - this.defaultEntityRadius,
                this.defaultEntityRadius * 2, this.defaultEntityRadius * 2);
    }
    String tip = null;
    XYToolTipGenerator generator = getToolTipGenerator(series, item);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, series, item);
    }
    String url = null;
    if (getURLGenerator() != null) {
        url = getURLGenerator().generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(area, dataset, series, item,
            tip, url);
    entities.add(entity);
}
项目:parabuild-ci    文件:AbstractCategoryItemRenderer.java   
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot.
 */
protected void addItemEntity(EntityCollection entities,
                             CategoryDataset dataset, int row, int column,
                             Shape hotspot) {

    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, row, dataset.getColumnKey(column), column);
    entities.add(entity);

}
项目:ccu-historian    文件:ChartComposite.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(org.eclipse.swt.events.MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Rectangle insets = getClientArea();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.x - insets.x) / this.scaleX),
                    (int) ((e.y - insets.y) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:ccu-historian    文件:StandardXYItemRendererTest.java   
/**
 * A check to ensure that an item that falls outside the plot's data area
 * does NOT generate an item entity.
 */
@Test
public void testNoDisplayedItem() {
    XYSeriesCollection dataset = new XYSeriesCollection();
    XYSeries s1 = new XYSeries("S1");
    s1.add(10.0, 10.0);
    dataset.addSeries(s1);
    JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y",
            dataset, PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StandardXYItemRenderer());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setRange(0.0, 5.0);
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setRange(0.0, 5.0);
    BufferedImage image = new BufferedImage(200 , 100,
            BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    ChartRenderingInfo info = new ChartRenderingInfo();
    chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, info);
    g2.dispose();
    EntityCollection ec = info.getEntityCollection();
    assertFalse(TestUtilities.containsInstanceOf(ec.getEntities(),
            XYItemEntity.class));
}
项目:ccu-historian    文件:TooltipHandlerFX.java   
/**
 * Returns the tooltip text.
 * 
 * @param canvas  the canvas that is displaying the chart.
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 * 
 * @return String The tooltip text (possibly <code>null</code>).
  */
private String getTooltipText(ChartCanvas canvas, double x, double y) {
    ChartRenderingInfo info = canvas.getRenderingInfo();
    if (info == null) {
        return null;
    }
    EntityCollection entities = info.getEntityCollection();
    if (entities == null) {
        return null;
    }
    ChartEntity entity = entities.getEntity(x, y);
    if (entity == null) {
        return null;
    }
    return entity.getToolTipText();
}
项目:ccu-historian    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
@Override
public String getToolTipText(MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;
}
项目:ccu-historian    文件:AbstractCategoryItemRenderer.java   
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
项目:jfreechart    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or {@code null} if no tooltip is available.
 */
@Override
public String getToolTipText(MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;
}
项目:jfreechart    文件:AbstractCategoryItemRenderer.java   
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot ({@code null} not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    Args.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
项目:jfreechart    文件:StandardXYItemRendererTest.java   
/**
 * A check to ensure that an item that falls outside the plot's data area
 * does NOT generate an item entity.
 */
@Test
public void testNoDisplayedItem() {
    XYSeriesCollection dataset = new XYSeriesCollection();
    XYSeries s1 = new XYSeries("S1");
    s1.add(10.0, 10.0);
    dataset.addSeries(s1);
    JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y",
            dataset, PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StandardXYItemRenderer());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setRange(0.0, 5.0);
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setRange(0.0, 5.0);
    BufferedImage image = new BufferedImage(200 , 100,
            BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    ChartRenderingInfo info = new ChartRenderingInfo();
    chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, info);
    g2.dispose();
    EntityCollection ec = info.getEntityCollection();
    assertFalse(TestUtils.containsInstanceOf(ec.getEntities(),
            XYItemEntity.class));
}
项目:aya-lang    文件:ChartComposite.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(org.eclipse.swt.events.MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Rectangle insets = getClientArea();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.x - insets.x) / this.scaleX),
                    (int) ((e.y - insets.y) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:aya-lang    文件:StandardXYItemRendererTest.java   
/**
 * A check to ensure that an item that falls outside the plot's data area
 * does NOT generate an item entity.
 */
@Test
public void testNoDisplayedItem() {
    XYSeriesCollection dataset = new XYSeriesCollection();
    XYSeries s1 = new XYSeries("S1");
    s1.add(10.0, 10.0);
    dataset.addSeries(s1);
    JFreeChart chart = ChartFactory.createXYLineChart("Title", "X", "Y",
            dataset, PlotOrientation.VERTICAL, false, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    plot.setRenderer(new StandardXYItemRenderer());
    NumberAxis xAxis = (NumberAxis) plot.getDomainAxis();
    xAxis.setRange(0.0, 5.0);
    NumberAxis yAxis = (NumberAxis) plot.getRangeAxis();
    yAxis.setRange(0.0, 5.0);
    BufferedImage image = new BufferedImage(200 , 100,
            BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    ChartRenderingInfo info = new ChartRenderingInfo();
    chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, info);
    g2.dispose();
    EntityCollection ec = info.getEntityCollection();
    assertFalse(TestUtilities.containsInstanceOf(ec.getEntities(),
            XYItemEntity.class));
}
项目:aya-lang    文件:TooltipHandlerFX.java   
/**
 * Returns the tooltip text.
 * 
 * @param canvas  the canvas that is displaying the chart.
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 * 
 * @return String The tooltip text (possibly <code>null</code>).
  */
private String getTooltipText(ChartCanvas canvas, double x, double y) {
    ChartRenderingInfo info = canvas.getRenderingInfo();
    if (info == null) {
        return null;
    }
    EntityCollection entities = info.getEntityCollection();
    if (entities == null) {
        return null;
    }
    ChartEntity entity = entities.getEntity(x, y);
    if (entity == null) {
        return null;
    }
    return entity.getToolTipText();
}
项目:aya-lang    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
@Override
public String getToolTipText(MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;
}
项目:aya-lang    文件:AbstractCategoryItemRenderer.java   
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
项目:rapidminer-studio    文件:AbstractChartPanel.java   
/**
 * Returns a string for the tooltip.
 * 
 * @param e
 *            the mouse event.
 * 
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */

@Override
public String getToolTipText(MouseEvent e) {

    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity((int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:rapidminer-studio    文件:AbstractChartPanel.java   
/**
 * Returns the chart entity at a given point.
 * <P>
 * This method will return null if there is (a) no entity at the given point, or (b) no entity
 * collection has been generated.
 * 
 * @param viewX
 *            the x-coordinate.
 * @param viewY
 *            the y-coordinate.
 * 
 * @return The chart entity (possibly <code>null</code>).
 */

@Override
public ChartEntity getEntityForPoint(int viewX, int viewY) {

    ChartEntity result = null;
    if (this.info != null) {
        Insets insets = getInsets();
        double x = (viewX - insets.left) / this.scaleX;
        double y = (viewY - insets.top) / this.scaleY;
        EntityCollection entities = this.info.getEntityCollection();
        result = entities != null ? entities.getEntity(x, y) : null;
    }
    return result;

}
项目:mzmine2    文件:ChartGestureMouseAdapter.java   
/**
 * Find chartentities like JFreeChartEntity, AxisEntity, PlotEntity, TitleEntity, XY...
 * 
 * @param chartPanel
 * @param x
 * @param y
 * @return
 */
private ChartEntity findChartEntity(ChartPanel chartPanel, MouseEvent e) {
  // coordinates to find chart entities
  Insets insets = chartPanel.getInsets();
  int x = (int) ((e.getX() - insets.left) / chartPanel.getScaleX());
  int y = (int) ((e.getY() - insets.top) / chartPanel.getScaleY());

  if (lastEntity != null && x == lastEntityX && y == lastEntityY)
    return lastEntity;
  else {
    ChartRenderingInfo info = chartPanel.getChartRenderingInfo();
    ChartEntity entity = null;
    if (info != null) {
      EntityCollection entities = info.getEntityCollection();
      if (entities != null) {
        entity = entities.getEntity(x, y);
      }
    }
    return entity;
  }
}
项目:compomics-utilities    文件:VennDiagramPanel.java   
/**
 * Returns a list of the entities at the given x, y view location.
 *
 * @param viewX the x location
 * @param viewY the y location
 * @return a list of the entities
 */
public ArrayList<ChartEntity> getEntitiesForPoint(int viewX, int viewY) {

    ArrayList<ChartEntity> entitiesForPoint = new ArrayList<ChartEntity>();
    ChartRenderingInfo info = chartPanel.getChartRenderingInfo();

    if (info != null) {
        Insets insets = chartPanel.getInsets();
        double x = (viewX - insets.left) / chartPanel.getScaleX();
        double y = (viewY - insets.top) / chartPanel.getScaleY();
        EntityCollection allEntities = info.getEntityCollection();
        int numEntities = allEntities.getEntityCount();

        for (int i = 0; i < numEntities; i++) {
            ChartEntity entity = allEntities.getEntity(i);
            if (entity.getArea().contains(x, y)) {
                entitiesForPoint.add(entity);
            }
        }
    }

    return entitiesForPoint;
}
项目:compomics-utilities    文件:XYPlottingDialog.java   
/**
 * Returns a list of the entities at the given x, y view location.
 *
 * @param viewX the x location
 * @param viewY the y location
 * @return a list of the entities
 */
public ArrayList<ChartEntity> getEntitiesForPoint(int viewX, int viewY) {

    ArrayList<ChartEntity> entitiesForPoint = new ArrayList<ChartEntity>();
    ChartRenderingInfo info = chartPanel.getChartRenderingInfo();

    if (info != null) {
        Insets insets = chartPanel.getInsets();
        double x = (viewX - insets.left) / chartPanel.getScaleX();
        double y = (viewY - insets.top) / chartPanel.getScaleY();
        EntityCollection allEntities = info.getEntityCollection();
        int numEntities = allEntities.getEntityCount();

        for (int i = 0; i < numEntities; i++) {
            ChartEntity entity = allEntities.getEntity(i);
            if (entity.getArea().contains(x, y)) {
                entitiesForPoint.add(entity);
            }
        }
    }

    return entitiesForPoint;
}
项目:HTML5_WebSite    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(MouseEvent e) {

    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:HTML5_WebSite    文件:AbstractCategoryItemRenderer.java   
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot.
 */
protected void addItemEntity(EntityCollection entities,
                             CategoryDataset dataset, int row, int column,
                             Shape hotspot) {

    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);

}
项目:populus    文件:TooltipHandlerFX.java   
/**
 * Returns the tooltip text.
 * 
 * @param canvas  the canvas that is displaying the chart.
 * @param x  the x-coordinate of the mouse pointer.
 * @param y  the y-coordinate of the mouse pointer.
 * 
 * @return String The tooltip text (possibly <code>null</code>).
  */
private String getTooltipText(ChartCanvas canvas, double x, double y) {
    ChartRenderingInfo info = canvas.getRenderingInfo();
    if (info == null) {
        return null;
    }
    EntityCollection entities = info.getEntityCollection();
    if (entities == null) {
        return null;
    }
    ChartEntity entity = entities.getEntity(x, y);
    if (entity == null) {
        return null;
    }
    return entity.getToolTipText();
}
项目:populus    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
@Override
public String getToolTipText(MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;
}
项目:populus    文件:AbstractCategoryItemRenderer.java   
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
        CategoryDataset dataset, int row, int column, Shape hotspot) {
    ParamChecks.nullNotPermitted(hotspot, "hotspot");
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
项目:PI    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(MouseEvent e) {

    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:PI    文件:AbstractCategoryItemRenderer.java   
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot (<code>null</code> not permitted).
 */
protected void addItemEntity(EntityCollection entities,
                             CategoryDataset dataset, int row, int column,
                             Shape hotspot) {
    if (hotspot == null) {
        throw new IllegalArgumentException("Null 'hotspot' argument.");
    }
    if (!getItemCreateEntity(row, column)) {
        return;
    }
    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
    entities.add(entity);
}
项目:nabs    文件:ChartComposite.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(org.eclipse.swt.events.MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Rectangle insets = getBounds();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.x - insets.x) / this.scaleX),
                    (int) ((e.y - insets.y) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:nabs    文件:ChartPanel.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(MouseEvent e) {

    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Insets insets = getInsets();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.getX() - insets.left) / this.scaleX),
                    (int) ((e.getY() - insets.top) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}
项目:nabs    文件:AbstractXYItemRenderer.java   
/**
 * Adds an entity to the collection.
 *
 * @param entities  the entity collection being populated.
 * @param area  the entity area (if <code>null</code> a default will be
 *              used).
 * @param dataset  the dataset.
 * @param series  the series.
 * @param item  the item.
 * @param entityX  the entity's center x-coordinate in user space.
 * @param entityY  the entity's center y-coordinate in user space.
 */
protected void addEntity(EntityCollection entities, Shape area,
                         XYDataset dataset, int series, int item,
                         double entityX, double entityY) {
    if (!getItemCreateEntity(series, item)) {
        return;
    }
    if (area == null) {
        area = new Ellipse2D.Double(entityX - this.defaultEntityRadius,
                entityY - this.defaultEntityRadius,
                this.defaultEntityRadius * 2, this.defaultEntityRadius * 2);
    }
    String tip = null;
    XYToolTipGenerator generator = getToolTipGenerator(series, item);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, series, item);
    }
    String url = null;
    if (getURLGenerator() != null) {
        url = getURLGenerator().generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(area, dataset, series, item,
            tip, url);
    entities.add(entity);
}
项目:nabs    文件:AbstractCategoryItemRenderer.java   
/**
 * Adds an entity with the specified hotspot.
 *
 * @param entities  the entity collection.
 * @param dataset  the dataset.
 * @param row  the row index.
 * @param column  the column index.
 * @param hotspot  the hotspot.
 */
protected void addItemEntity(EntityCollection entities,
                             CategoryDataset dataset, int row, int column,
                             Shape hotspot) {

    String tip = null;
    CategoryToolTipGenerator tipster = getToolTipGenerator(row, column);
    if (tipster != null) {
        tip = tipster.generateToolTip(dataset, row, column);
    }
    String url = null;
    CategoryURLGenerator urlster = getItemURLGenerator(row, column);
    if (urlster != null) {
        url = urlster.generateURL(dataset, row, column);
    }
    CategoryItemEntity entity = new CategoryItemEntity(hotspot, tip, url,
            dataset, row, dataset.getColumnKey(column), column);
    entities.add(entity);

}
项目:ECG-Viewer    文件:ChartComposite.java   
/**
 * Returns a string for the tooltip.
 *
 * @param e  the mouse event.
 *
 * @return A tool tip or <code>null</code> if no tooltip is available.
 */
public String getToolTipText(org.eclipse.swt.events.MouseEvent e) {
    String result = null;
    if (this.info != null) {
        EntityCollection entities = this.info.getEntityCollection();
        if (entities != null) {
            Rectangle insets = getClientArea();
            ChartEntity entity = entities.getEntity(
                    (int) ((e.x - insets.x) / this.scaleX),
                    (int) ((e.y - insets.y) / this.scaleY));
            if (entity != null) {
                result = entity.getToolTipText();
            }
        }
    }
    return result;

}