本文整理汇总了Java中org.jfree.chart.entity.XYAnnotationEntity类的典型用法代码示例。如果您正苦于以下问题:Java XYAnnotationEntity类的具体用法?Java XYAnnotationEntity怎么用?Java XYAnnotationEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
XYAnnotationEntity类属于org.jfree.chart.entity包,在下文中一共展示了XYAnnotationEntity类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseClickedInChart
import org.jfree.chart.entity.XYAnnotationEntity; //导入依赖的package包/类
/**
* Handles mouse clicks in the chart panel.
*
* @param event the chart mouse event
*/
private void mouseClickedInChart(ChartMouseEvent event) {
ArrayList<ChartEntity> entities = getEntitiesForPoint(event.getTrigger().getPoint().x, event.getTrigger().getPoint().y);
if (entities.isEmpty()) {
return;
}
boolean dataPointFound = false;
String dataPointTooltip = "";
for (ChartEntity tempEntity : entities) {
if (tempEntity instanceof XYAnnotationEntity) {
if (((XYAnnotationEntity) tempEntity).getToolTipText() != null) {
dataPointFound = true;
dataPointTooltip = ((XYAnnotationEntity) tempEntity).getToolTipText();
}
}
}
if (dataPointFound) {
String dataset = tooltipToDatasetMap.get(dataPointTooltip);
JOptionPane.showMessageDialog(this, dataPointTooltip + ":\n" + vennDiagramResults.get(dataset), "Selected Values", JOptionPane.INFORMATION_MESSAGE);
}
}
示例2: mouseMovedInChart
import org.jfree.chart.entity.XYAnnotationEntity; //导入依赖的package包/类
/**
* Handles mouse movements in the chart panel.
*
* @param event the chart mouse event
*/
private void mouseMovedInChart(ChartMouseEvent event) {
ArrayList<ChartEntity> entities = getEntitiesForPoint(event.getTrigger().getPoint().x, event.getTrigger().getPoint().y);
boolean dataPointFound = false;
for (ChartEntity tempEntity : entities) {
if (tempEntity instanceof XYAnnotationEntity) {
if (((XYAnnotationEntity) tempEntity).getToolTipText() != null) {
dataPointFound = true;
}
}
}
if (dataPointFound) {
chartPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
} else {
chartPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
}
}
示例3: addEntity
import org.jfree.chart.entity.XYAnnotationEntity; //导入依赖的package包/类
/**
* A utility method for adding an {@link XYAnnotationEntity} to
* a {@link PlotRenderingInfo} instance.
*
* @param info the plot rendering info (<code>null</code> permitted).
* @param hotspot the hotspot area.
* @param rendererIndex the renderer index.
* @param toolTipText the tool tip text.
* @param urlText the URL text.
*/
protected void addEntity(PlotRenderingInfo info,
Shape hotspot, int rendererIndex,
String toolTipText, String urlText) {
if (info == null) {
return;
}
EntityCollection entities = info.getOwner().getEntityCollection();
if (entities == null) {
return;
}
XYAnnotationEntity entity = new XYAnnotationEntity(hotspot,
rendererIndex, toolTipText, urlText);
entities.add(entity);
}
示例4: addEntity
import org.jfree.chart.entity.XYAnnotationEntity; //导入依赖的package包/类
/**
* A utility method for adding an {@link XYAnnotationEntity} to
* a {@link PlotRenderingInfo} instance.
*
* @param info the plot rendering info (<code>null</code> permitted).
* @param hotspot the hotspot area.
* @param rendererIndex the renderer index.
* @param toolTipText the tool tip text.
* @param urlText the URL text.
*/
protected void addEntity(PlotRenderingInfo info,
Shape hotspot, int rendererIndex,
String toolTipText, String urlText) {
if (info == null) {
return;
}
EntityCollection entities = info.getOwner().getEntityCollection();
if (entities == null) {
return;
}
XYAnnotationEntity entity = new XYAnnotationEntity(hotspot,
rendererIndex, toolTipText, urlText);
entities.add(entity);
}
示例5: addEntity
import org.jfree.chart.entity.XYAnnotationEntity; //导入依赖的package包/类
/**
* A utility method for adding an {@link XYAnnotationEntity} to
* a {@link PlotRenderingInfo} instance.
*
* @param info the plot rendering info ({@code null} permitted).
* @param hotspot the hotspot area.
* @param rendererIndex the renderer index.
* @param toolTipText the tool tip text.
* @param urlText the URL text.
*/
protected void addEntity(PlotRenderingInfo info,
Shape hotspot, int rendererIndex,
String toolTipText, String urlText) {
if (info == null) {
return;
}
EntityCollection entities = info.getOwner().getEntityCollection();
if (entities == null) {
return;
}
XYAnnotationEntity entity = new XYAnnotationEntity(hotspot,
rendererIndex, toolTipText, urlText);
entities.add(entity);
}
示例6: getGestureEntity
import org.jfree.chart.entity.XYAnnotationEntity; //导入依赖的package包/类
/**
* The gesture entity type
*
* @param entity
* @return
*/
public static Entity getGestureEntity(ChartEntity entity) {
if (entity == null)
return NONE;
if (entity instanceof PlotEntity)
return PLOT;
if (entity instanceof AxisEntity) {
AxisEntity e = (AxisEntity) entity;
if (e.getAxis().getPlot() instanceof XYPlot) {
XYPlot plot = ((XYPlot) e.getAxis().getPlot());
for (int i = 0; i < plot.getDomainAxisCount(); i++)
if (plot.getDomainAxis(i).equals(e.getAxis()))
return DOMAIN_AXIS;
for (int i = 0; i < plot.getRangeAxisCount(); i++)
if (plot.getRangeAxis(i).equals(e.getAxis()))
return RANGE_AXIS;
}
// else return basic axis
return AXIS;
}
if (entity instanceof LegendItemEntity)
return LEGEND_ITEM;
if (entity instanceof XYItemEntity)
return XY_ITEM;
if (entity instanceof XYAnnotationEntity)
return XY_ANNOTATION;
if (entity instanceof TitleEntity) {
if (((TitleEntity) entity).getTitle() instanceof TextTitle)
return TEXT_TITLE;
else
return NON_TEXT_TITLE;
}
if (entity instanceof JFreeChartEntity)
return JFREECHART;
if (entity instanceof CategoryItemEntity)
return CATEGORY_ITEM;
return GENERAL;
}