本文整理汇总了Java中org.jfree.chart.ChartRenderingInfo.getEntityCollection方法的典型用法代码示例。如果您正苦于以下问题:Java ChartRenderingInfo.getEntityCollection方法的具体用法?Java ChartRenderingInfo.getEntityCollection怎么用?Java ChartRenderingInfo.getEntityCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.ChartRenderingInfo
的用法示例。
在下文中一共展示了ChartRenderingInfo.getEntityCollection方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTooltipText
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* 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();
}
示例2: getImageMap
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* 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();
}
示例3: testNoDisplayedItem
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* 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));
}
示例4: getTooltipText
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* 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();
}
示例5: testNoDisplayedItem
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* 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));
}
示例6: getImageMap
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* 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=\"" + name + "\" name=\"" + name + "\">");
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();
}
示例7: getEntityCollection
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* A convenience method that returns a reference to the entity
* collection (may be <code>null</code>) being used to record
* chart entities.
*
* @return The entity collection (possibly <code>null</code>).
*/
public EntityCollection getEntityCollection() {
EntityCollection result = null;
if (this.info != null) {
ChartRenderingInfo owner = this.info.getOwner();
if (owner != null) {
result = owner.getEntityCollection();
}
}
return result;
}
示例8: getImageMap
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* 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();
}
示例9: getEntityCollection
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* A convenience method that returns a reference to the entity
* collection (may be <code>null</code>) being used to record
* chart entities.
*
* @return The entity collection (possibly <code>null</code>).
*/
public EntityCollection getEntityCollection() {
EntityCollection result = null;
if (this.info != null) {
ChartRenderingInfo owner = this.info.getOwner();
if (owner != null) {
result = owner.getEntityCollection();
}
}
return result;
}
示例10: getImageMap
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* Creates an image map element that complies with the XHTML 1.0
* specification.
*
* @param name the map name ({@code null} not permitted).
* @param info the chart rendering info ({@code null} not permitted).
* @param toolTipTagFragmentGenerator a generator for the HTML fragment
* that will contain the tooltip text ({@code null} not permitted
* if {@code info} contains tooltip information).
* @param urlTagFragmentGenerator a generator for the HTML fragment that
* will contain the URL reference ({@code null} not permitted if
* {@code info} 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();
}
示例11: getEntityCollection
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
* A convenience method that returns a reference to the entity
* collection (may be {@code null}) being used to record
* chart entities.
*
* @return The entity collection (possibly {@code null}).
*/
public EntityCollection getEntityCollection() {
EntityCollection result = null;
if (this.info != null) {
ChartRenderingInfo owner = this.info.getOwner();
if (owner != null) {
result = owner.getEntityCollection();
}
}
return result;
}
示例12: getImageAreaHyperlinks
import org.jfree.chart.ChartRenderingInfo; //导入方法依赖的package包/类
/**
*
*/
public static List<JRPrintImageAreaHyperlink> getImageAreaHyperlinks(
JFreeChart chart,
ChartHyperlinkProvider chartHyperlinkProvider,
Graphics2D grx,
Rectangle2D renderingArea
)// throws JRException
{
List<JRPrintImageAreaHyperlink> areaHyperlinks = null;
if (chartHyperlinkProvider != null && chartHyperlinkProvider.hasHyperlinks())
{
ChartRenderingInfo renderingInfo = new ChartRenderingInfo();
if (grx == null)
{
chart.createBufferedImage((int) renderingArea.getWidth(), (int) renderingArea.getHeight(), renderingInfo);
}
else
{
chart.draw(grx, renderingArea, renderingInfo);
}
EntityCollection entityCollection = renderingInfo.getEntityCollection();
if (entityCollection != null && entityCollection.getEntityCount() > 0)
{
areaHyperlinks = new ArrayList<JRPrintImageAreaHyperlink>(entityCollection.getEntityCount());
for (@SuppressWarnings("unchecked")
Iterator<ChartEntity> it = entityCollection.iterator(); it.hasNext();)
{
ChartEntity entity = it.next();
JRPrintHyperlink printHyperlink = chartHyperlinkProvider.getEntityHyperlink(entity);
if (printHyperlink != null)
{
JRPrintImageArea area = getImageArea(entity);
JRPrintImageAreaHyperlink areaHyperlink = new JRPrintImageAreaHyperlink();
areaHyperlink.setArea(area);
areaHyperlink.setHyperlink(printHyperlink);
areaHyperlinks.add(areaHyperlink);
}
}
}
}
return areaHyperlinks;
}