Java Code Examples for org.jfree.chart.urls.XYURLGenerator#generateURL()

The following examples show how to use org.jfree.chart.urls.XYURLGenerator#generateURL() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 (only 
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only 
 *                 used if <code>area</code> is <code>null</code>).
 */
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;
    XYURLGenerator urlster = getURLGenerator(series, item);
    if (urlster != null) {
        url = urlster.generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(area, dataset, series, item,
            tip, url);
    entities.add(entity);
}
 
Example 2
Source File: AbstractXYItemRenderer.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 selected  is the item selected?
 * @param entityX  the entity's center x-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 * @param entityY  the entity's center y-coordinate in user space (only
 *                 used if <code>area</code> is <code>null</code>).
 *
 * @since 1.2.0
 */
protected void addEntity(EntityCollection entities, Shape area,
        XYDataset dataset, int series, int item, boolean selected,
        double entityX, double entityY) {
    
    if (!getItemCreateEntity(series, item, selected)) {
        return;
    }
    Shape hotspot = area;
    if (hotspot == null) {
        double r = getDefaultEntityRadius();
        double w = r * 2;
        if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
            hotspot = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
        }
        else {
            hotspot = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
        }
    }
    String tip = null;
    XYToolTipGenerator generator = getToolTipGenerator(series, item,
            selected);
    if (generator != null) {
        tip = generator.generateToolTip(dataset, series, item);
    }
    String url = null;
    XYURLGenerator urlster = getURLGenerator(series, item, selected);
    if (urlster != null) {
        url = urlster.generateURL(dataset, series, item);
    }
    XYItemEntity entity = new XYItemEntity(hotspot, dataset, series, item,
            tip, url);
    entities.add(entity);
}