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


Java RefineryUtilities.drawRotatedString方法代碼示例

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


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

示例1: drawItemLabel

import org.jfree.ui.RefineryUtilities; //導入方法依賴的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

示例2: drawItemLabel

import org.jfree.ui.RefineryUtilities; //導入方法依賴的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

示例3: draw

import org.jfree.ui.RefineryUtilities; //導入方法依賴的package包/類
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 */
public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea,
                 ValueAxis domainAxis, ValueAxis rangeAxis) {

    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(plot.getDomainAxisLocation(), 
                                                              orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(plot.getRangeAxisLocation(), 
                                                            orientation);

    float anchorX = (float) domainAxis.valueToJava2D(this.x, dataArea, domainEdge);
    float anchorY = (float) rangeAxis.valueToJava2D(this.y, dataArea, rangeEdge);

    if (orientation == PlotOrientation.HORIZONTAL) {
        float tempAnchor = anchorX;
        anchorX = anchorY;
        anchorY = tempAnchor;
    }
    
    g2.setFont(getFont());
    g2.setPaint(getPaint());
    RefineryUtilities.drawRotatedString(
        getText(), 
        g2,
        anchorX, 
        anchorY,
        getTextAnchor(),
        getRotationAnchor(),
        getRotationAngle()
    );

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:41,代碼來源:XYTextAnnotation.java

示例4: drawItemLabel

import org.jfree.ui.RefineryUtilities; //導入方法依賴的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 data  the dataset.
 * @param row  the row.
 * @param column  the column.
 * @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,
                             CategoryDataset data,
                             int row,
                             int column,
                             CategoryPlot plot,
                             CategoryLabelGenerator generator,
                             Rectangle2D bar,
                             boolean negative) {
                                 
    String label = generator.generateLabel(data, row, column);
    if (label == null) {
        return;  // nothing to do   
    }
    
    Font labelFont = getItemLabelFont(row, column);
    g2.setFont(labelFont);
    Paint paint = getItemLabelPaint(row, column);
    g2.setPaint(paint);

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

    // work out the label anchor point...
    Point2D anchorPoint = calculateLabelAnchorPoint(
        position.getItemLabelAnchor(), bar, plot.getOrientation()
    );
    
    if (isInternalAnchor(position.getItemLabelAnchor())) {
        Shape bounds = RefineryUtilities.calculateRotatedStringBounds(
            label, g2,
            (float) anchorPoint.getX(),
            (float) anchorPoint.getY(),
            position.getTextAnchor(), 
            position.getRotationAnchor(), 
            position.getAngle()
        );
        
        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) {
        RefineryUtilities.drawRotatedString(
            label, g2, (float) anchorPoint.getX(), (float) anchorPoint.getY(),
            position.getTextAnchor(), position.getRotationAnchor(), position.getAngle()
        );
    }        
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:82,代碼來源:BarRenderer.java

示例5: draw

import org.jfree.ui.RefineryUtilities; //導入方法依賴的package包/類
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 */
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea,
                 CategoryAxis domainAxis, ValueAxis rangeAxis) {

    CategoryDataset dataset = plot.getDataset();
    int catIndex = dataset.getColumnIndex(this.category);
    int catCount = dataset.getColumnCount();

    float anchorX = 0.0f;
    float anchorY = 0.0f;
    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(plot.getDomainAxisLocation(), 
                                                              orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(plot.getRangeAxisLocation(), 
                                                            orientation);
    
    if (orientation == PlotOrientation.HORIZONTAL) {
        anchorY = (float) domainAxis.getCategoryJava2DCoordinate(
            this.categoryAnchor, catIndex, catCount, dataArea, domainEdge
        );
        anchorX = (float) rangeAxis.valueToJava2D(this.value, dataArea, rangeEdge);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorX = (float) domainAxis.getCategoryJava2DCoordinate(
            this.categoryAnchor, catIndex, catCount, dataArea, domainEdge
        );
        anchorY = (float) rangeAxis.valueToJava2D(this.value, dataArea, rangeEdge);
    }
    g2.setFont(getFont());
    g2.setPaint(getPaint());
    RefineryUtilities.drawRotatedString(
        getText(), 
        g2,
        anchorX, 
        anchorY,
        getTextAnchor(),
        getRotationAnchor(),
        getRotationAngle()
    );

}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:50,代碼來源:CategoryTextAnnotation.java


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