本文整理汇总了Java中org.jfree.chart.entity.CategoryItemEntity类的典型用法代码示例。如果您正苦于以下问题:Java CategoryItemEntity类的具体用法?Java CategoryItemEntity怎么用?Java CategoryItemEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CategoryItemEntity类属于org.jfree.chart.entity包,在下文中一共展示了CategoryItemEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addItemEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的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);
}
示例2: addItemEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的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);
}
示例3: addItemEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的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} not permitted).
*/
protected void addItemEntity(EntityCollection entities,
CategoryDataset dataset, int row, int column, Shape hotspot) {
Args.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);
}
示例4: getEntityHyperlink
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
@Override
public JRPrintHyperlink getEntityHyperlink(ChartEntity entity)
{
JRPrintHyperlink printHyperlink = null;
if (hasHyperlinks() && entity instanceof CategoryItemEntity)
{
CategoryItemEntity itemEntity = (CategoryItemEntity) entity;
Comparable<?> serie = itemEntity.getRowKey();
Map<Comparable<?>,JRPrintHyperlink> serieHyperlinks = itemHyperlinks.get(serie);
if (serieHyperlinks != null)
{
Comparable<?> category = itemEntity.getColumnKey();
printHyperlink = serieHyperlinks.get(category);
}
}
return printHyperlink;
}
示例5: addItemEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的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, dataset.getRowKey(row), dataset.getColumnKey(column));
entities.add(entity);
}
示例6: addItemEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的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) {
if (hotspot == null) {
throw new IllegalArgumentException("Null 'hotspot' argument.");
}
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);
}
示例7: getModelCoordinatesInfo
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
@Override
public void getModelCoordinatesInfo(final int xOnScreen, final int yOnScreen, final IDisplaySurface g,
final Point positionInPixels, final StringBuilder sb) {
final int x = xOnScreen - positionInPixels.x;
final int y = yOnScreen - positionInPixels.y;
final ChartEntity entity = info.getEntityCollection().getEntity(x, y);
// getChart().handleClick(x, y, info);
final Comparable<?> columnKey = ((CategoryItemEntity) entity).getColumnKey();
final String title = columnKey.toString();
final CategoryDataset data = ((CategoryItemEntity) entity).getDataset();
final Comparable<?> rowKey = ((CategoryItemEntity) entity).getRowKey();
final double xx = data.getValue(rowKey, columnKey).doubleValue();
final boolean xInt = xx % 1 == 0;
sb.append(title).append(" ").append(xInt ? (int) xx : String.format("%.2f", xx));
}
示例8: addItemEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
/**
* Adds an entity with the specified hotspot, but only if an entity
* collection is accessible via the renderer state.
*
* @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);
}
示例9: addItemEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
/**
* Override the method so we can set custom tooltips
*/
@Override
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;
if((index-1) < tooltips.size()){
tip = tooltips.get(index-1);
}
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);
}
示例10: chartMouseClicked
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
@Override
public void chartMouseClicked(ChartMouseEvent event) {
if (event.getEntity().getClass() == CategoryItemEntity.class) {
if ((getChart() != null) && (getChart().getClass() == HighlightableBarChart.class)) {
HighlightableBarChart chart = (HighlightableBarChart) getChart();
CategoryItemEntity entity = (CategoryItemEntity) event.getEntity();
// toggle highlight if already selected
if (chart.isHighlighted(entity)) {
chart.clearHighlights();
firePropertyChange("highlightedBar", getRowAndColumn(entity), null);
}
else {
chart.clearHighlights();
chart.highlightEntity(entity);
firePropertyChange("highlightedBar", null, getRowAndColumn(entity));
}
// assume whatever fired the event will repaint the chart
}
}
}
示例11: addEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
/**
* Adds an entity to the collection.
*
* @param entities the entity collection being populated.
* @param hotspot the entity area (if <code>null</code> a default will be
* used).
* @param dataset the dataset.
* @param row the series.
* @param column the item.
* @param entityX the entity's center x-coordinate in user space (only
* used if <code>area</code> is <code>null</code>).
* @param entityY the entity's center y-coordinate in user space (only
* used if <code>area</code> is <code>null</code>).
*
* @since 1.0.13
*/
protected void addEntity(EntityCollection entities, Shape hotspot,
CategoryDataset dataset, int row, int column,
double entityX, double entityY) {
if (!getItemCreateEntity(row, column)) {
return;
}
Shape s = hotspot;
if (hotspot == null) {
double r = getDefaultEntityRadius();
double w = r * 2;
if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
}
else {
s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
}
}
String tip = null;
CategoryToolTipGenerator generator = getToolTipGenerator(row, column);
if (generator != null) {
tip = generator.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(s, tip, url,
dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
entities.add(entity);
}
示例12: addEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
/**
* Adds an entity to the collection.
*
* @param entities the entity collection being populated.
* @param hotspot the entity area (if {@code null} a default will be
* used).
* @param dataset the dataset.
* @param row the series.
* @param column the item.
* @param entityX the entity's center x-coordinate in user space (only
* used if {@code area} is {@code null}).
* @param entityY the entity's center y-coordinate in user space (only
* used if {@code area} is {@code null}).
*
* @since 1.0.13
*/
protected void addEntity(EntityCollection entities, Shape hotspot,
CategoryDataset dataset, int row, int column,
double entityX, double entityY) {
if (!getItemCreateEntity(row, column)) {
return;
}
Shape s = hotspot;
if (hotspot == null) {
double r = getDefaultEntityRadius();
double w = r * 2;
if (getPlot().getOrientation() == PlotOrientation.VERTICAL) {
s = new Ellipse2D.Double(entityX - r, entityY - r, w, w);
}
else {
s = new Ellipse2D.Double(entityY - r, entityX - r, w, w);
}
}
String tip = null;
CategoryToolTipGenerator generator = getToolTipGenerator(row, column);
if (generator != null) {
tip = generator.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(s, tip, url,
dataset, dataset.getRowKey(row), dataset.getColumnKey(column));
entities.add(entity);
}
示例13: getEntityDataset
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
protected Dataset getEntityDataset(ChartEntity entity)
{
Dataset dataset = null;
if (entity instanceof CategoryItemEntity)
{
dataset = ((CategoryItemEntity) entity).getDataset();
}
else if (entity instanceof XYItemEntity)
{
dataset = ((XYItemEntity) entity).getDataset();
}
return dataset;
}
示例14: getGestureEntity
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的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;
}
示例15: getGraphColumn
import org.jfree.chart.entity.CategoryItemEntity; //导入依赖的package包/类
/**
* Get BarGraphColumn for ChartEntity
* @param event
* @return BarGraphColumn or null if not found
*/
private GraphColumn getGraphColumn(ChartMouseEvent event)
{
ChartEntity entity = event.getEntity();
String key = null;
if (entity instanceof CategoryItemEntity)
{
Comparable<?> colKey = ((CategoryItemEntity)entity).getColumnKey();
if (colKey != null)
{
key = colKey.toString();
}
}
else if (entity instanceof PieSectionEntity)
{
Comparable<?> sectionKey = ((PieSectionEntity)entity).getSectionKey();
if (sectionKey != null)
{
key = sectionKey.toString();
}
}
if (key == null)
{
return null;
}
for (int i = 0; i < list.size(); i++)
{
final String label = list.get(i).getLabel();
if (key.equals(label))
{
return list.get(i);
}
}
//
return null;
}