Java Code Examples for org.jfree.chart.entity.ChartEntity#getToolTipText()

The following examples show how to use org.jfree.chart.entity.ChartEntity#getToolTipText() . 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: ChartPanel.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 2
Source File: ChartComposite.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example 3
Source File: ChartPanel.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 4
Source File: TooltipHandlerFX.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 5
Source File: ChartComposite.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example 6
Source File: AbstractChartPanel.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 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;

}
 
Example 7
Source File: ChartPanel.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 8
Source File: TooltipHandlerFX.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 9
Source File: ChartComposite.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;

}
 
Example 10
Source File: ChartPanel.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;
}
 
Example 11
Source File: TooltipHandlerFX.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 12
Source File: ChartComposite.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;

}
 
Example 13
Source File: ChartPanel.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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;

}
 
Example 14
Source File: TooltipHandlerFX.java    From jfreechart-fx with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * 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();
}
 
Example 15
Source File: TooltipHandlerFX.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 16
Source File: ChartComposite.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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;

}
 
Example 17
Source File: ImageMapUtilities.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted 
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if 
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuffer sb = new StringBuffer();
    sb.append("<map id=\"" + htmlEscape(name) + "\" name=\"" 
            + htmlEscape(name) + "\">");
    sb.append(StringUtilities.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        for (int i = count - 1; i >= 0; i--) {
            ChartEntity entity = entities.getEntity(i);
            if (entity.getToolTipText() != null 
                    || entity.getURLText() != null) {
                String area = entity.getImageMapAreaTag(
                        toolTipTagFragmentGenerator, 
                        urlTagFragmentGenerator);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtilities.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();
    
}
 
Example 18
Source File: ImageMapUtilities.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuffer sb = new StringBuffer();
    sb.append("<map id=\"" + htmlEscape(name) + "\" name=\""
            + htmlEscape(name) + "\">");
    sb.append(StringUtilities.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        for (int i = count - 1; i >= 0; i--) {
            ChartEntity entity = entities.getEntity(i);
            if (entity.getToolTipText() != null
                    || entity.getURLText() != null) {
                String area = entity.getImageMapAreaTag(
                        toolTipTagFragmentGenerator,
                        urlTagFragmentGenerator);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtilities.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();

}
 
Example 19
Source File: ImageMapUtilities.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Creates an image map element that complies with the XHTML 1.0
 * specification.
 *
 * @param name  the map name (<code>null</code> not permitted).
 * @param info  the chart rendering info (<code>null</code> not permitted).
 * @param toolTipTagFragmentGenerator  a generator for the HTML fragment
 *     that will contain the tooltip text (<code>null</code> not permitted
 *     if <code>info</code> contains tooltip information).
 * @param urlTagFragmentGenerator  a generator for the HTML fragment that
 *     will contain the URL reference (<code>null</code> not permitted if
 *     <code>info</code> contains URLs).
 *
 * @return The map tag.
 */
public static String getImageMap(String name, ChartRenderingInfo info,
        ToolTipTagFragmentGenerator toolTipTagFragmentGenerator,
        URLTagFragmentGenerator urlTagFragmentGenerator) {

    StringBuilder sb = new StringBuilder();
    sb.append("<map id=\"").append(htmlEscape(name));
    sb.append("\" name=\"").append(htmlEscape(name)).append("\">");
    sb.append(StringUtils.getLineSeparator());
    EntityCollection entities = info.getEntityCollection();
    if (entities != null) {
        int count = entities.getEntityCount();
        for (int i = count - 1; i >= 0; i--) {
            ChartEntity entity = entities.getEntity(i);
            if (entity.getToolTipText() != null
                    || entity.getURLText() != null) {
                String area = entity.getImageMapAreaTag(
                        toolTipTagFragmentGenerator,
                        urlTagFragmentGenerator);
                if (area.length() > 0) {
                    sb.append(area);
                    sb.append(StringUtils.getLineSeparator());
                }
            }
        }
    }
    sb.append("</map>");
    return sb.toString();

}
 
Example 20
Source File: JFreeChartReportDrawable.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Returns an optional image-map for the entry.
 *
 * @param bounds the bounds for which the image map is computed.
 * @return the computed image-map or null if there is no image-map available.
 */
public ImageMap getImageMap( final Rectangle2D bounds ) {
  if ( chartRenderingInfo == null ) {
    return null;
  }
  final Rectangle2D dataArea = getDataAreaOffset();
  final Rectangle2D otherArea = new Rectangle2D.Double();

  if ( ( ObjectUtilities.equal( bounds, this.bounds ) ) == false ) {
    final BufferedImage image = new BufferedImage( 1, 1, BufferedImage.TYPE_4BYTE_ABGR );
    final Graphics2D graphics = image.createGraphics();
    draw( graphics, bounds );
    graphics.dispose();
  }

  final ImageMap map = new ImageMap();
  final EntityCollection entityCollection = chartRenderingInfo.getEntityCollection();
  final int count = entityCollection.getEntityCount();
  for ( int i = 0; i < count; i++ ) {
    final ChartEntity chartEntity = entityCollection.getEntity( i );
    final Shape area = chartEntity.getArea();
    final String hrefValue = chartEntity.getURLText();
    final String tooltipValue = chartEntity.getToolTipText();
    if ( StringUtils.isEmpty( tooltipValue ) == false ||
      StringUtils.isEmpty( hrefValue ) == false ) {
      final AbstractImageMapEntry entry;
      if ( chartEntity instanceof XYItemEntity ||
        chartEntity instanceof CategoryItemEntity ||
        chartEntity instanceof PieSectionEntity ) {
        entry = createMapEntry( area, dataArea );
      } else {
        entry = createMapEntry( area, otherArea );
      }
      if ( entry == null ) {
        continue;
      }
      if ( StringUtils.isEmpty( hrefValue ) == false ) {
        entry.setAttribute( LibXmlInfo.XHTML_NAMESPACE, "href", hrefValue );
      } else {
        entry.setAttribute( LibXmlInfo.XHTML_NAMESPACE, "href", "#" );
      }
      if ( StringUtils.isEmpty( tooltipValue ) == false ) {
        entry.setAttribute( LibXmlInfo.XHTML_NAMESPACE, "title", tooltipValue );
      }
      map.addMapEntry( entry );
    }
  }

  return map;
}