本文整理匯總了Java中org.jfree.chart.entity.EntityCollection類的典型用法代碼示例。如果您正苦於以下問題:Java EntityCollection類的具體用法?Java EntityCollection怎麽用?Java EntityCollection使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EntityCollection類屬於org.jfree.chart.entity包,在下文中一共展示了EntityCollection類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getToolTipText
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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;
}
示例2: getEntityForPoint
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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;
}
示例3: getTooltipText
import org.jfree.chart.entity.EntityCollection; //導入依賴的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();
}
示例4: getToolTipText
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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;
}
示例5: getImageMap
import org.jfree.chart.entity.EntityCollection; //導入依賴的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();
}
示例6: addEntity
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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);
}
示例7: getToolTipText
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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;
}
示例8: getToolTipText
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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;
}
示例9: addEntity
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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);
}
示例10: addItemEntity
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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);
}
示例11: getToolTipText
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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;
}
示例12: testNoDisplayedItem
import org.jfree.chart.entity.EntityCollection; //導入依賴的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));
}
示例13: getTooltipText
import org.jfree.chart.entity.EntityCollection; //導入依賴的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();
}
示例14: getToolTipText
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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;
}
示例15: addItemEntity
import org.jfree.chart.entity.EntityCollection; //導入依賴的package包/類
/**
* 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);
}