當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityCollection.addEntity方法代碼示例

本文整理匯總了Java中org.jfree.chart.entity.EntityCollection.addEntity方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityCollection.addEntity方法的具體用法?Java EntityCollection.addEntity怎麽用?Java EntityCollection.addEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.jfree.chart.entity.EntityCollection的用法示例。


在下文中一共展示了EntityCollection.addEntity方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:34,代碼來源:AbstractXYItemRenderer.java

示例2: drawSeriesElements

import org.jfree.chart.entity.EntityCollection; //導入方法依賴的package包/類
/**
 * Draws the series elements.
 * 
 * @param g2  the graphics device.
 * @param items  the items.
 * @param translation  the translation point.
 * @param info  optional carrier for rendering info.
 */
private void drawSeriesElements(Graphics2D g2, List items, Point2D translation, 
                                ChartRenderingInfo info) {
    EntityCollection entities = null;
    if (info != null) {
        entities = info.getEntityCollection();
    }
    // Draw individual series elements
    for (int i = 0; i < items.size(); i++) {
        DrawableLegendItem item = (DrawableLegendItem) items.get(i);
        g2.setPaint(item.getItem().getPaint());
        Shape keyBox = item.getMarker();
        if (this.displaySeriesLines) {
            g2.setStroke(item.getLineStroke());
            g2.draw(item.getLine());

            if (this.displaySeriesShapes) {
                if (item.isMarkerFilled()) {
                    g2.fill(keyBox);
                }
                else {
                    g2.draw(keyBox);
                }
            }
        } 
        else {
            if (item.isMarkerFilled()) {
                g2.fill(keyBox);
            }
            else {
                g2.draw(keyBox);
            }
        }
        if (getOutlineShapes()) {
            g2.setPaint(this.shapeOutlinePaint);
            g2.setStroke(this.shapeOutlineStroke);
            g2.draw(keyBox);
        }
        g2.setPaint(this.itemPaint);
        g2.setFont(this.itemFont);
        TextUtilities.drawAlignedString(
            item.getItem().getLabel(), g2,
            (float) item.getLabelPosition().getX(), (float) item.getLabelPosition().getY(),
            TextAnchor.CENTER_LEFT
        );
        LOGGER.debug("Item x = " + item.getLabelPosition().getX());
        LOGGER.debug("Item y = " + item.getLabelPosition().getY());

        if (entities != null) {
            Rectangle2D area = new Rectangle2D.Double(
                translation.getX() + item.getX(),
                translation.getY() + item.getY(),
                item.getWidth(), item.getHeight()
            );
            LegendItemEntity entity = new LegendItemEntity(area);
            entity.setSeriesIndex(i);
            entities.addEntity(entity);
        }
    }
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:68,代碼來源:StandardLegend.java


注:本文中的org.jfree.chart.entity.EntityCollection.addEntity方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。