当前位置: 首页>>代码示例>>Java>>正文


Java ItemLabelPosition类代码示例

本文整理汇总了Java中org.jfree.chart.labels.ItemLabelPosition的典型用法代码示例。如果您正苦于以下问题:Java ItemLabelPosition类的具体用法?Java ItemLabelPosition怎么用?Java ItemLabelPosition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ItemLabelPosition类属于org.jfree.chart.labels包,在下文中一共展示了ItemLabelPosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSeriesNegativeItemLabelPosition

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Returns the item label position for all negative values in a series.
 * 
 * @param series  the series index (zero-based).
 * 
 * @return The item label position (never <code>null</code>).
 */
public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series) {

    // return the override, if there is one...
    if (this.negativeItemLabelPosition != null) {
        return this.negativeItemLabelPosition;
    }

    // otherwise look up the position list
    ItemLabelPosition position 
        = (ItemLabelPosition) this.negativeItemLabelPositionList.get(series);
    if (position == null) {
        position = this.baseNegativeItemLabelPosition;
    }
    return position;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:AbstractRenderer.java

示例2: getSeriesNegativeItemLabelPosition

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Returns the item label position for all negative values in a series.
 * 
 * @param series  the series index (zero-based).
 * 
 * @return The item label position (never <code>null</code>).
 * 
 * @see #setSeriesNegativeItemLabelPosition(int, ItemLabelPosition)
 */
public ItemLabelPosition getSeriesNegativeItemLabelPosition(int series) {

    // return the override, if there is one...
    if (this.negativeItemLabelPosition != null) {
        return this.negativeItemLabelPosition;
    }

    // otherwise look up the position list
    ItemLabelPosition position = (ItemLabelPosition) 
        this.negativeItemLabelPositionList.get(series);
    if (position == null) {
        position = this.baseNegativeItemLabelPosition;
    }
    return position;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:AbstractRenderer.java

示例3: getSeriesPositiveItemLabelPosition

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Returns the item label position for all positive values in a series.
 * 
 * @param series  the series index (zero-based).
 * 
 * @return The item label position (never <code>null</code>).
 * 
 * @see #setSeriesPositiveItemLabelPosition(int, ItemLabelPosition)
 */
public ItemLabelPosition getSeriesPositiveItemLabelPosition(int series) {

    // return the override, if there is one...
    if (this.positiveItemLabelPosition != null) {
        return this.positiveItemLabelPosition;
    }

    // otherwise look up the position table
    ItemLabelPosition position = (ItemLabelPosition) 
        this.positiveItemLabelPositionList.get(series);
    if (position == null) {
        position = this.basePositiveItemLabelPosition;
    }
    return position;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:AbstractRenderer.java

示例4: setTimeSeriesRender

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
public static void setTimeSeriesRender(Plot plot, boolean isShowData, boolean isShapesVisible) {

        XYPlot xyplot = (XYPlot) plot;
        xyplot.setNoDataMessage(NO_DATA_MSG);
        xyplot.setInsets(new RectangleInsets(10, 10, 5, 10));

        XYLineAndShapeRenderer xyRenderer = (XYLineAndShapeRenderer) xyplot.getRenderer();

        xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
        xyRenderer.setBaseShapesVisible(false);
        if (isShowData) {
            xyRenderer.setBaseItemLabelsVisible(true);
            xyRenderer.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
            xyRenderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));
        }
        xyRenderer.setBaseShapesVisible(isShapesVisible);

        DateAxis domainAxis = (DateAxis) xyplot.getDomainAxis();
        domainAxis.setAutoTickUnitSelection(false);
        DateTickUnit dateTickUnit = new DateTickUnit(DateTickUnitType.YEAR, 1, new SimpleDateFormat("yyyy-MM"));
        domainAxis.setTickUnit(dateTickUnit);

        StandardXYToolTipGenerator xyTooltipGenerator = new StandardXYToolTipGenerator("{1}:{2}", new SimpleDateFormat("yyyy-MM-dd"), new DecimalFormat("0"));
        xyRenderer.setBaseToolTipGenerator(xyTooltipGenerator);

        setXY_XAixs(xyplot);
        setXY_YAixs(xyplot);

    }
 
开发者ID:Fanping,项目名称:iveely.ml,代码行数:30,代码来源:ChartUtils.java

示例5: testSetPositiveItemLabelPosition

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Test that setting the positive item label position for ALL series does in fact work.
 */
public void testSetPositiveItemLabelPosition() {
    BarRenderer r = new BarRenderer();
    r.setPositiveItemLabelPosition(
        new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT)
    );
    assertEquals(
        new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT), 
        r.getPositiveItemLabelPosition(0, 0)
    );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:AbstractRendererTests.java

示例6: drawItemLabel

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Draws an item label.
 *
 * @param g2  the graphics device.
 * @param orientation  the orientation.
 * @param dataset  the dataset.
 * @param row  the row.
 * @param column  the column.
 * @param x  the x coordinate (in Java2D space).
 * @param y  the y coordinate (in Java2D space).
 * @param negative  indicates a negative value (which affects the item
 *                  label position).
 */
protected void drawItemLabel(Graphics2D g2,
                             PlotOrientation orientation,
                             CategoryDataset dataset,
                             int row, int column,
                             double x, double y,
                             boolean negative) {

    CategoryItemLabelGenerator generator
        = getItemLabelGenerator(row, column);
    if (generator != null) {
        Font labelFont = getItemLabelFont(row, column);
        Paint paint = getItemLabelPaint(row, column);
        g2.setFont(labelFont);
        g2.setPaint(paint);
        String label = generator.generateLabel(dataset, row, column);
        ItemLabelPosition position = null;
        if (!negative) {
            position = getPositiveItemLabelPosition(row, column);
        }
        else {
            position = getNegativeItemLabelPosition(row, column);
        }
        Point2D anchorPoint = calculateLabelAnchorPoint(
                position.getItemLabelAnchor(), x, y, orientation);
        TextUtilities.drawRotatedString(label, g2,
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(),
                position.getAngle(), position.getRotationAnchor());
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:45,代码来源:AbstractCategoryItemRenderer.java

示例7: setBaseNegativeItemLabelPosition

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Sets the base negative item label position and, if requested, sends a 
 * {@link RendererChangeEvent} to all registered listeners.
 * 
 * @param position  the position (<code>null</code> not permitted).
 * @param notify  notify registered listeners?
 */
public void setBaseNegativeItemLabelPosition(ItemLabelPosition position, boolean notify) {
    if (position == null) {
        throw new IllegalArgumentException("Null 'position' argument.");   
    }
    this.baseNegativeItemLabelPosition = position;
    if (notify) {
        notifyListeners(new RendererChangeEvent(this));
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:AbstractRenderer.java

示例8: getBaseItemLabelAnchor

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Returns the base item label anchor.
 * 
 * @return The anchor point.
 * 
 * @deprecated Use getBasePositiveItemLabelPosition()/getBaseNegativeItemLabelPosition().
 */
public ItemLabelAnchor getBaseItemLabelAnchor() {
    ItemLabelAnchor result = null;
    ItemLabelPosition p = getBasePositiveItemLabelPosition();
    if (p != null) {
        return p.getItemLabelAnchor();
    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:AbstractRenderer.java

示例9: getBaseItemLabelTextAnchor

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Returns the base item label text anchor.
 * 
 * @return The text anchor.
 * 
 * @deprecated Use getBasePositiveItemLabelPosition()/getBaseNegativeItemLabelPosition().
 */
public TextAnchor getBaseItemLabelTextAnchor() {
    TextAnchor result = null;
    ItemLabelPosition p = getBasePositiveItemLabelPosition();
    if (p != null) {
        result = p.getTextAnchor();
    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:AbstractRenderer.java

示例10: getBaseItemLabelRotationAnchor

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Returns the base item label rotation anchor point.
 * 
 * @return The anchor point.
 * 
 * @deprecated Use getBasePositiveItemLabelPosition()/getBaseNegativeItemLabelPosition().
 */
public TextAnchor getBaseItemLabelRotationAnchor() {
    TextAnchor result = null;
    ItemLabelPosition p = this.getBasePositiveItemLabelPosition();
    if (p != null) {
        result = p.getRotationAnchor();
    }
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:16,代码来源:AbstractRenderer.java

示例11: drawItemLabel

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Draws an item label.
 *
 * @param g2  the graphics device.
 * @param orientation  the orientation.
 * @param dataset  the dataset.
 * @param series  the series index (zero-based).
 * @param item  the item index (zero-based).
 * @param x  the x coordinate (in Java2D space).
 * @param y  the y coordinate (in Java2D space).
 * @param negative  indicates a negative value (which affects the item label position).
 */
protected void drawItemLabel(Graphics2D g2, 
                             PlotOrientation orientation,
                             XYDataset dataset, 
                             int series, 
                             int item,
                             double x, 
                             double y, 
                             boolean negative) {
                                 
    XYLabelGenerator generator = getLabelGenerator(series, item);
    if (generator != null) {
        Font labelFont = getItemLabelFont(series, item);
        Paint paint = getItemLabelPaint(series, item);
        g2.setFont(labelFont);
        g2.setPaint(paint);
        String label = generator.generateLabel(dataset, series, item);

        // get the label position..
        ItemLabelPosition position = null;
        if (!negative) {
            position = getPositiveItemLabelPosition(series, item);
        }
        else {
            position = getNegativeItemLabelPosition(series, item);
        }

        // work out the label anchor point...
        Point2D anchorPoint = calculateLabelAnchorPoint(
            position.getItemLabelAnchor(), x, y, orientation
        );
        RefineryUtilities.drawRotatedString(
            label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
            position.getTextAnchor(), position.getRotationAnchor(), position.getAngle()
        );
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:50,代码来源:AbstractXYItemRenderer.java

示例12: setBaseNegativeItemLabelPosition

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Sets the base negative item label position and, if requested, sends a 
 * {@link RendererChangeEvent} to all registered listeners.
 * 
 * @param position  the position (<code>null</code> not permitted).
 * @param notify  notify registered listeners?
 * 
 * @see #getBaseNegativeItemLabelPosition()
 */
public void setBaseNegativeItemLabelPosition(ItemLabelPosition position, 
                                             boolean notify) {
    if (position == null) {
        throw new IllegalArgumentException("Null 'position' argument.");   
    }
    this.baseNegativeItemLabelPosition = position;
    if (notify) {
        fireChangeEvent();
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:AbstractRenderer.java

示例13: StackedXYBarRenderer

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Creates a new renderer.
 *
 * @param margin  the percentual amount of the bars that are cut away.
 */
public StackedXYBarRenderer(double margin) {
    super(margin);
    this.renderAsPercentages = false;
    
    // set the default item label positions, which will only be used if 
    // the user requests visible item labels...
    ItemLabelPosition p = new ItemLabelPosition(ItemLabelAnchor.CENTER, 
            TextAnchor.CENTER);
    setBasePositiveItemLabelPosition(p);
    setBaseNegativeItemLabelPosition(p);
    setPositiveItemLabelPositionFallback(null);
    setNegativeItemLabelPositionFallback(null);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:19,代码来源:StackedXYBarRenderer.java

示例14: drawItemLabel

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Draws an item label.
 *
 * @param g2  the graphics device.
 * @param orientation  the orientation.
 * @param dataset  the dataset.
 * @param row  the row.
 * @param column  the column.
 * @param x  the x coordinate (in Java2D space).
 * @param y  the y coordinate (in Java2D space).
 * @param negative  indicates a negative value (which affects the item label position).
 */
protected void drawItemLabel(Graphics2D g2, 
                             PlotOrientation orientation,
                             CategoryDataset dataset, 
                             int row, int column,
                             double x, double y, 
                             boolean negative) {
                                 
    CategoryLabelGenerator generator = getLabelGenerator(row, column);
    if (generator != null) {
        Font labelFont = getItemLabelFont(row, column);
        Paint paint = getItemLabelPaint(row, column);
        g2.setFont(labelFont);
        g2.setPaint(paint);
        String label = generator.generateLabel(dataset, row, column);
        ItemLabelPosition position = null;
        if (!negative) {
            position = getPositiveItemLabelPosition(row, column);
        }
        else {
            position = getNegativeItemLabelPosition(row, column);
        }
        Point2D anchorPoint = calculateLabelAnchorPoint(
            position.getItemLabelAnchor(), x, y, orientation
        );
        RefineryUtilities.drawRotatedString(
            label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
            position.getTextAnchor(), position.getRotationAnchor(), position.getAngle()
        );
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:44,代码来源:AbstractCategoryItemRenderer.java

示例15: drawItemLabel

import org.jfree.chart.labels.ItemLabelPosition; //导入依赖的package包/类
/**
 * Draws an item label.  This method is overridden so that the bar can be 
 * used to calculate the label anchor point.
 * 
 * @param g2  the graphics device.
 * @param dataset  the dataset.
 * @param series  the series index.
 * @param item  the item index.
 * @param plot  the plot.
 * @param generator  the label generator.
 * @param bar  the bar.
 * @param negative  a flag indicating a negative value.
 */
protected void drawItemLabel(Graphics2D g2, XYDataset dataset,
        int series, int item, XYPlot plot, XYItemLabelGenerator generator, 
        Rectangle2D bar, boolean negative) {
                                 
    String label = generator.generateLabel(dataset, series, item);
    if (label == null) {
        return;  // nothing to do   
    }
    
    Font labelFont = getItemLabelFont(series, item);
    g2.setFont(labelFont);
    Paint paint = getItemLabelPaint(series, item);
    g2.setPaint(paint);

    // find out where to place the label...
    ItemLabelPosition position = null;
    if (!negative) {
        position = getPositiveItemLabelPosition(series, item);
    }
    else {
        position = getNegativeItemLabelPosition(series, item);
    }

    // work out the label anchor point...
    Point2D anchorPoint = calculateLabelAnchorPoint(
            position.getItemLabelAnchor(), bar, plot.getOrientation());
    
    if (isInternalAnchor(position.getItemLabelAnchor())) {
        Shape bounds = TextUtilities.calculateRotatedStringBounds(label, 
                g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(),
                position.getRotationAnchor());
        
        if (bounds != null) {
            if (!bar.contains(bounds.getBounds2D())) {
                if (!negative) {
                    position = getPositiveItemLabelPositionFallback();
                }
                else {
                    position = getNegativeItemLabelPositionFallback();
                }
                if (position != null) {
                    anchorPoint = calculateLabelAnchorPoint(
                            position.getItemLabelAnchor(), bar, 
                            plot.getOrientation());
                }
            }
        }
    
    }
    
    if (position != null) {
        TextUtilities.drawRotatedString(label, g2, 
                (float) anchorPoint.getX(), (float) anchorPoint.getY(),
                position.getTextAnchor(), position.getAngle(), 
                position.getRotationAnchor());
    }        
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:72,代码来源:XYBarRenderer.java


注:本文中的org.jfree.chart.labels.ItemLabelPosition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。