本文整理汇总了Java中org.jfree.chart.entity.ChartEntity类的典型用法代码示例。如果您正苦于以下问题:Java ChartEntity类的具体用法?Java ChartEntity怎么用?Java ChartEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChartEntity类属于org.jfree.chart.entity包,在下文中一共展示了ChartEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getToolTipText
import org.jfree.chart.entity.ChartEntity; //导入依赖的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.ChartEntity; //导入依赖的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.ChartEntity; //导入依赖的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.ChartEntity; //导入依赖的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.ChartEntity; //导入依赖的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: getToolTipText
import org.jfree.chart.entity.ChartEntity; //导入依赖的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;
}
示例7: testEquals
import org.jfree.chart.entity.ChartEntity; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
ChartRenderingInfo i1 = new ChartRenderingInfo();
ChartRenderingInfo i2 = new ChartRenderingInfo();
assertTrue(i1.equals(i2));
i1.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertFalse(i1.equals(i2));
i2.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertTrue(i1.equals(i2));
i1.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertFalse(i1.equals(i2));
i2.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertTrue(i1.equals(i2));
StandardEntityCollection e1 = new StandardEntityCollection();
e1.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i1.setEntityCollection(e1);
assertFalse(i1.equals(i2));
StandardEntityCollection e2 = new StandardEntityCollection();
e2.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i2.setEntityCollection(e2);
}
示例8: getToolTipText
import org.jfree.chart.entity.ChartEntity; //导入依赖的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: getToolTipText
import org.jfree.chart.entity.ChartEntity; //导入依赖的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;
}
示例10: testEquals
import org.jfree.chart.entity.ChartEntity; //导入依赖的package包/类
/**
* Confirm that the equals method can distinguish all the required fields.
*/
@Test
public void testEquals() {
ChartRenderingInfo i1 = new ChartRenderingInfo();
ChartRenderingInfo i2 = new ChartRenderingInfo();
assertEquals(i1, i2);
i1.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertFalse(i1.equals(i2));
i2.setChartArea(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
assertEquals(i1, i2);
i1.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertFalse(i1.equals(i2));
i2.getPlotInfo().setDataArea(new Rectangle(1, 2, 3, 4));
assertEquals(i1, i2);
StandardEntityCollection e1 = new StandardEntityCollection();
e1.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i1.setEntityCollection(e1);
assertFalse(i1.equals(i2));
StandardEntityCollection e2 = new StandardEntityCollection();
e2.add(new ChartEntity(new Rectangle(1, 2, 3, 4)));
i2.setEntityCollection(e2);
}
示例11: testCloning
import org.jfree.chart.entity.ChartEntity; //导入依赖的package包/类
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
ChartRenderingInfo i1 = new ChartRenderingInfo();
ChartRenderingInfo i2 = (ChartRenderingInfo) i1.clone();
assertNotSame(i1, i2);
assertSame(i1.getClass(), i2.getClass());
assertEquals(i1, i2);
// check independence
i1.getChartArea().setRect(4.0, 3.0, 2.0, 1.0);
assertFalse(i1.equals(i2));
i2.getChartArea().setRect(4.0, 3.0, 2.0, 1.0);
assertEquals(i1, i2);
i1.getEntityCollection().add(new ChartEntity(new Rectangle(1, 2, 2,
1)));
assertFalse(i1.equals(i2));
i2.getEntityCollection().add(new ChartEntity(new Rectangle(1, 2, 2,
1)));
assertEquals(i1, i2);
}
示例12: getTooltipText
import org.jfree.chart.entity.ChartEntity; //导入依赖的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();
}
示例13: getToolTipText
import org.jfree.chart.entity.ChartEntity; //导入依赖的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;
}
示例14: getToolTipText
import org.jfree.chart.entity.ChartEntity; //导入依赖的package包/类
/**
* Returns a string for the tooltip.
*
* @param e the mouse event.
*
* @return A tool tip or {@code null} 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: testCloning
import org.jfree.chart.entity.ChartEntity; //导入依赖的package包/类
/**
* Confirm that cloning works.
* @throws java.lang.CloneNotSupportedException
*/
@Test
public void testCloning() throws CloneNotSupportedException {
ChartRenderingInfo i1 = new ChartRenderingInfo();
ChartRenderingInfo i2 = (ChartRenderingInfo) i1.clone();
assertNotSame(i1, i2);
assertSame(i1.getClass(), i2.getClass());
assertEquals(i1, i2);
// check independence
i1.getChartArea().setRect(4.0, 3.0, 2.0, 1.0);
assertFalse(i1.equals(i2));
i2.getChartArea().setRect(4.0, 3.0, 2.0, 1.0);
assertEquals(i1, i2);
i1.getEntityCollection().add(new ChartEntity(new Rectangle(1, 2, 2,
1)));
assertFalse(i1.equals(i2));
i2.getEntityCollection().add(new ChartEntity(new Rectangle(1, 2, 2,
1)));
assertEquals(i1, i2);
}