Example usage for org.jfree.chart.entity ChartEntity getImageMapAreaTag

List of usage examples for org.jfree.chart.entity ChartEntity getImageMapAreaTag

Introduction

In this page you can find the example usage for org.jfree.chart.entity ChartEntity getImageMapAreaTag.

Prototype

public String getImageMapAreaTag(ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) 

Source Link

Document

Returns an HTML image map tag for this entity.

Usage

From source file:gov.nih.nci.caintegrator.ui.graphing.util.ImageMapUtil.java

/**
 * Write the image map for the collection of bounding entities.
 * @param writer/* w w  w .j a va 2  s  . co  m*/
 * @param name
 * @param boundingEntities
 * @param useOverlibToolTip
 */
private static void writeBoundingRectImageMap(PrintWriter writer, String name,
        Collection<ChartEntity> boundingEntities, boolean useOverlibToolTip) {
    System.out.println("Num entities=" + boundingEntities.size());
    StringBuffer sb = new StringBuffer();
    ChartEntity chartEntity;
    String areaTag;

    StandardToolTipTagFragmentGenerator ttg = new StandardToolTipTagFragmentGenerator();
    StandardURLTagFragmentGenerator urlg = new StandardURLTagFragmentGenerator();
    sb.append("<map id=\"" + name + "\" name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    for (Iterator i = boundingEntities.iterator(); i.hasNext();) {
        chartEntity = (ChartEntity) i.next();
        areaTag = chartEntity.getImageMapAreaTag(ttg, urlg).trim();
        if (areaTag.length() > 0) {
            if (sb.indexOf(chartEntity.getImageMapAreaTag(ttg, urlg)) == -1) {
                sb.append(chartEntity.getImageMapAreaTag(ttg, urlg));
                sb.append(StringUtils.getLineSeparator());
            }
        }
    }
    sb.append("</map>");
    writer.println(sb.toString());
}

From source file:gov.nih.nci.caintegrator.ui.graphing.util.ImageMapUtil.java

public static String getBoundingRectImageMapTag(String name, boolean useOverlibToolTip,
        ChartRenderingInfo info) {/*from  ww  w  . j  av  a 2  s  .co m*/
    EntityCollection collection = info.getEntityCollection();
    Collection entities = collection.getEntities();

    Collection<ChartEntity> myBoundingEntities = getBoundingEntities(entities);

    System.out.println("Num entities=" + myBoundingEntities.size());
    StringBuffer sb = new StringBuffer();
    ChartEntity chartEntity;
    String areaTag;

    ToolTipTagFragmentGenerator ttg = null;

    if (useOverlibToolTip) {
        ttg = new CAIOverlibToolTipTagFragmentGenerator();
    } else {
        ttg = new CAIStandardToolTipTagFragmentGenerator();
    }

    StandardURLTagFragmentGenerator urlg = new StandardURLTagFragmentGenerator();
    sb.append("\n\n<MAP name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    for (Iterator i = myBoundingEntities.iterator(); i.hasNext();) {
        chartEntity = (ChartEntity) i.next();
        areaTag = chartEntity.getImageMapAreaTag(ttg, urlg).trim();
        if (areaTag.length() > 0) {
            if (sb.indexOf(chartEntity.getImageMapAreaTag(ttg, urlg)) == -1) {
                sb.append(chartEntity.getImageMapAreaTag(ttg, urlg));
                sb.append(StringUtils.getLineSeparator());
            }
        }
    }
    sb.append("</MAP>\n\n");
    return sb.toString();
}

From source file:gov.nih.nci.cma.web.graphing.CMAPrincipalComponentAnalysisPlot.java

/**
 * Write the image map for the collection of bounding entities.
 * @param writer/*from  www.j av  a2s  . c o  m*/
 * @param name
 * @param boundingEntities
 * @param useOverlibToolTip
 */
private void writeBoundingRectImageMap(PrintWriter writer, String name,
        Collection<ChartEntity> boundingEntities, boolean useOverlibToolTip) {
    System.out.println("Num entities=" + boundingEntities.size());
    StringBuffer sb = new StringBuffer();
    ChartEntity chartEntity;
    String areaTag;

    StandardToolTipTagFragmentGenerator ttg = new StandardToolTipTagFragmentGenerator();
    StandardURLTagFragmentGenerator urlg = new StandardURLTagFragmentGenerator();
    sb.append("<map id=\"" + name + "\" name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    for (Iterator i = boundingEntities.iterator(); i.hasNext();) {
        chartEntity = (ChartEntity) i.next();
        areaTag = chartEntity.getImageMapAreaTag(ttg, urlg).trim();
        if (areaTag.length() > 0) {
            sb.append(chartEntity.getImageMapAreaTag(ttg, urlg));
            sb.append(StringUtils.getLineSeparator());
        }
    }
    sb.append("</map>");
    writer.println(sb.toString());
}

From source file:gov.nih.nci.caintegrator.ui.graphing.chart.plot.PrincipalComponentAnalysisPlot.java

/**
 * Write the image map for the collection of bounding entities.
 * @param writer//from w w  w  .  ja v a  2 s .  c om
 * @param name
 * @param boundingEntities
 * @param useOverlibToolTip
 */
protected void writeBoundingRectImageMap(PrintWriter writer, String name,
        Collection<ChartEntity> boundingEntities, boolean useOverlibToolTip) {
    System.out.println("Num entities=" + boundingEntities.size());
    StringBuffer sb = new StringBuffer();
    ChartEntity chartEntity;
    String areaTag;

    StandardToolTipTagFragmentGenerator ttg = new StandardToolTipTagFragmentGenerator();
    StandardURLTagFragmentGenerator urlg = new StandardURLTagFragmentGenerator();
    sb.append("<map id=\"" + name + "\" name=\"" + name + "\">");
    sb.append(StringUtils.getLineSeparator());
    for (Iterator i = boundingEntities.iterator(); i.hasNext();) {
        chartEntity = (ChartEntity) i.next();
        areaTag = chartEntity.getImageMapAreaTag(ttg, urlg).trim();
        if (areaTag.length() > 0) {
            sb.append(chartEntity.getImageMapAreaTag(ttg, urlg));
            sb.append(StringUtils.getLineSeparator());
        }
    }
    sb.append("</map>");
    writer.println(sb.toString());
}

From source file:com.tonbeller.jpivot.chart.ChartComponent.java

/**
 * Writes an image map as a String//  w w w.  j a v a2s .co  m
 * This function has been requested to be added to jfreechart
 * Also requires slight change to ChartEntity.getImageMapAreaTag()
 * to produce valid xml tag and use &amp; entity in urls.
 * Diffs sent to jfreechart project - so hopefully this will be in there soon
 *
 * @param name  the map name.
 * @param info  the chart rendering info.
 * @param useOverLibForToolTips  whether to use OverLIB for tooltips
 *                               (http://www.bosrup.com/web/overlib/).
 */
public String writeImageMap(String name, ChartRenderingInfo info, boolean useOverLibForToolTips) {
    StringBuffer sb = new StringBuffer();
    sb.append("<map name=\"" + name + "\">");
    EntityCollection entities = info.getEntityCollection();
    Iterator iterator = entities.iterator();

    while (iterator.hasNext()) {
        ChartEntity entity = (ChartEntity) iterator.next();
        // the tag returned by getImageMapAreaTag is not valid xml
        //String area = entity.getImageMapAreaTag(useOverLibForToolTips);

        String area = "";

        if (useOverLibForToolTips)
            area = entity.getImageMapAreaTag(new org.jfree.chart.imagemap.OverLIBToolTipTagFragmentGenerator(),
                    new org.jfree.chart.imagemap.StandardURLTagFragmentGenerator());
        else
            area = entity.getImageMapAreaTag(new org.jfree.chart.imagemap.StandardToolTipTagFragmentGenerator(),
                    new org.jfree.chart.imagemap.StandardURLTagFragmentGenerator());
        // modify to valid xml tag
        area = area.replaceAll("&", "&amp;");
        //area = area.toLowerCase();
        //area = area.replaceAll(">$", "/>");
        if (area.length() > 0) {
            sb.append(area);
        }
    }
    sb.append("</map>");
    return sb.toString();
}