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


Java RectangleAnchor類代碼示例

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


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

示例1: Marker

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Constructs a new marker.
 *
 * @param paint  the paint (<code>null</code> not permitted).
 * @param stroke  the stroke (<code>null</code> not permitted).
 * @param outlinePaint  the outline paint (<code>null</code> permitted).
 * @param outlineStroke  the outline stroke (<code>null</code> permitted).
 * @param alpha  the alpha transparency.
 */
public Marker(Paint paint, Stroke stroke, 
              Paint outlinePaint, Stroke outlineStroke, 
              float alpha) {

    if (paint == null) {
        throw new IllegalArgumentException("Null 'paint' argument.");
    }
    if (stroke == null) {
        throw new IllegalArgumentException("Null 'stroke' argument.");
    }
    
    this.paint = paint;
    this.stroke = stroke;
    this.outlinePaint = outlinePaint;
    this.outlineStroke = outlineStroke;
    this.alpha = alpha;
    
    this.labelFont = new Font("SansSerif", Font.PLAIN, 9);
    this.labelPaint = Color.black;
    this.labelAnchor = RectangleAnchor.TOP_LEFT;
    this.labelOffset = new RectangleInsets(UnitType.ABSOLUTE, 3.0, 3.0, 3.0, 3.0);
    this.labelTextAnchor = TextAnchor.CENTER;
    
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:34,代碼來源:Marker.java

示例2: DialValueIndicator

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/** 
 * Creates a new instance of <code>DialValueIndicator</code>.
 * 
 * @param datasetIndex  the dataset index.
 * @param label  the label.
 */
public DialValueIndicator(int datasetIndex, String label) {
    this.datasetIndex = datasetIndex;
    this.angle = -90.0;
    this.radius = 0.3;
    this.frameAnchor = RectangleAnchor.CENTER;
    this.templateValue = new Double(100.0);
    this.formatter = new DecimalFormat("0.0");
    this.font = new Font("Dialog", Font.BOLD, 14);
    this.paint = Color.black;
    this.backgroundPaint = Color.white;
    this.outlineStroke = new BasicStroke(1.0f);
    this.outlinePaint = Color.blue;
    this.insets = new RectangleInsets(4, 4, 4, 4);
    this.valueAnchor = RectangleAnchor.RIGHT;
    this.textAnchor = TextAnchor.CENTER_RIGHT;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:23,代碼來源:DialValueIndicator.java

示例3: LegendTitle

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Creates a new legend title with the specified arrangement.
 * 
 * @param source  the source.
 * @param hLayout  the horizontal item arrangement (<code>null</code> not
 *                 permitted).
 * @param vLayout  the vertical item arrangement (<code>null</code> not
 *                 permitted).
 */
public LegendTitle(LegendItemSource source, 
                   Arrangement hLayout, Arrangement vLayout) {
    this.sources = new LegendItemSource[] {source};
    this.items = new BlockContainer(hLayout);
    this.hLayout = hLayout;
    this.vLayout = vLayout;
    this.backgroundPaint = null;  
    this.legendItemGraphicEdge = RectangleEdge.LEFT;
    this.legendItemGraphicAnchor = RectangleAnchor.CENTER;
    this.legendItemGraphicLocation = RectangleAnchor.CENTER;
    this.legendItemGraphicPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
    this.itemFont = DEFAULT_ITEM_FONT;
    this.itemPaint = DEFAULT_ITEM_PAINT;
    this.itemLabelPadding = new RectangleInsets(2.0, 2.0, 2.0, 2.0);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:25,代碼來源:LegendTitle.java

示例4: calculateDomainMarkerTextAnchorPoint

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Calculates the (x, y) coordinates for drawing a marker label.
 *
 * @param g2  the graphics device.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param markerArea  the rectangle surrounding the marker area.
 * @param markerOffset  the marker label offset.
 * @param labelOffsetType  the label offset type.
 * @param anchor  the label anchor.
 *
 * @return The coordinates for drawing the marker label.
 */
protected Point2D calculateDomainMarkerTextAnchorPoint(Graphics2D g2,
        PlotOrientation orientation,
        Rectangle2D dataArea,
        Rectangle2D markerArea,
        RectangleInsets markerOffset,
        LengthAdjustmentType labelOffsetType,
        RectangleAnchor anchor) {

    Rectangle2D anchorRect = null;
    if (orientation == PlotOrientation.HORIZONTAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                LengthAdjustmentType.CONTRACT, labelOffsetType);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                labelOffsetType, LengthAdjustmentType.CONTRACT);
    }
    return RectangleAnchor.coordinates(anchorRect, anchor);

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

示例5: calculateRangeMarkerTextAnchorPoint

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Calculates the (x, y) coordinates for drawing a marker label.
 *
 * @param g2  the graphics device.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param markerArea  the marker area.
 * @param markerOffset  the marker offset.
 * @param anchor  the label anchor.
 *
 * @return The coordinates for drawing the marker label.
 */
private Point2D calculateRangeMarkerTextAnchorPoint(Graphics2D g2,
                                  PlotOrientation orientation,
                                  Rectangle2D dataArea,
                                  Rectangle2D markerArea,
                                  RectangleInsets markerOffset,
                                  LengthAdjustmentType labelOffsetForRange,
                                  RectangleAnchor anchor) {

    Rectangle2D anchorRect = null;
    if (orientation == PlotOrientation.HORIZONTAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                labelOffsetForRange, LengthAdjustmentType.CONTRACT);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                LengthAdjustmentType.CONTRACT, labelOffsetForRange);
    }
    return RectangleAnchor.coordinates(anchorRect, anchor);

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

示例6: calculateDomainMarkerTextAnchorPoint

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Calculates the (x, y) coordinates for drawing the label for a marker on
 * the range axis.
 *
 * @param g2  the graphics device.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param markerArea  the rectangle surrounding the marker.
 * @param markerOffset  the marker offset.
 * @param labelOffsetType  the label offset type.
 * @param anchor  the label anchor.
 *
 * @return The coordinates for drawing the marker label.
 */
protected Point2D calculateDomainMarkerTextAnchorPoint(Graphics2D g2,
                                  PlotOrientation orientation,
                                  Rectangle2D dataArea,
                                  Rectangle2D markerArea,
                                  RectangleInsets markerOffset,
                                  LengthAdjustmentType labelOffsetType,
                                  RectangleAnchor anchor) {

    Rectangle2D anchorRect = null;
    if (orientation == PlotOrientation.HORIZONTAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                LengthAdjustmentType.CONTRACT, labelOffsetType);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                labelOffsetType, LengthAdjustmentType.CONTRACT);
    }
    return RectangleAnchor.coordinates(anchorRect, anchor);

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

示例7: getItemRenderer

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
@Override
public AbstractXYItemRenderer getItemRenderer(boolean nominal, int size, double minColor, double maxColor) {
	XYBlockRenderer renderer = new XYBlockRenderer();
	renderer.setPaintScale(new BlockPaintScale(minColor, maxColor));
	renderer.setBlockAnchor(RectangleAnchor.CENTER);

	// if Block dimension is increased (e.g 1.2x1.2), the grid effect gets bigger
	// so it could be that blocks are overlapping a little
	// but if Block dimension is decreased (e.g. 0.9x0.9), each rectangle seems to have
	// a less-transparent border (you have to zoom-in to notice), and that could be the cause of
	// the grid effect.
	// renderer.setBlockHeight(1.0);
	// renderer.setBlockWidth(1.0);

	return renderer;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:17,代碼來源:BlockChartPlotter.java

示例8: createChart

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Creates a sample chart.
 * 
 * @param dataset  the dataset.
 * 
 * @return A sample chart.
 */
private JFreeChart createChart(IntervalXYDataset dataset,String s) {
    final JFreeChart chart = ChartFactory.createXYBarChart(
        "Histogram Plot: "+s,
        "Keyword index", 
        false,
        "frequency", 
        dataset,
        PlotOrientation.VERTICAL,
        true,
        true,
        false
    );
    
    XYPlot plot = (XYPlot) chart.getPlot();
    final IntervalMarker target = new IntervalMarker(400.0, 700.0);
    //target.setLabel("Target Range");
    target.setLabelFont(new Font("SansSerif", Font.ITALIC, 11));
    target.setLabelAnchor(RectangleAnchor.LEFT);
    target.setLabelTextAnchor(TextAnchor.CENTER_LEFT);
    target.setPaint(new Color(222, 222, 255, 128));
    plot.addRangeMarker(target, Layer.BACKGROUND);
    return chart;    
}
 
開發者ID:Subarno,項目名稱:SentimentAnalysisJava,代碼行數:31,代碼來源:HistogramExample.java

示例9: drawLeftLabel

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Draws a section label on the left side of the pie chart.
 * 
 * @param g2  the graphics device.
 * @param state  the state.
 * @param record  the label record.
 */
protected void drawLeftLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record) {
    double theta = record.getAngle();
    double linkX = state.getPieCenterX() 
                   + Math.cos(theta) * state.getPieWRadius() * record.getLinkPercent();
    double linkY = state.getPieCenterY() 
                   - Math.sin(theta) * state.getPieHRadius() * record.getLinkPercent();
    double elbowX = state.getPieCenterX() 
                    + Math.cos(theta) * state.getLinkArea().getWidth() / 2.0;
    double elbowY = state.getPieCenterY() 
                    - Math.sin(theta) * state.getLinkArea().getHeight() / 2.0;
    double anchorX = state.getLinkArea().getMinX();
    double anchorY = elbowY;
    double targetX = anchorX - record.getGap();
    double targetY = record.getAllocatedY();
    g2.setPaint(this.labelLinkPaint);
    g2.setStroke(this.labelLinkStroke);
    g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));
    g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));
    g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));
    TextBox tb = record.getLabel();
    tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.RIGHT);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:PiePlot.java

示例10: drawRightLabel

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Draws a section label on the right side of the pie chart.
 * 
 * @param g2  the graphics device.
 * @param state  the state.
 * @param record  the label record.
 */
protected void drawRightLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record) {
    double theta = record.getAngle();
    double linkX = state.getPieCenterX() 
                   + Math.cos(theta) * state.getPieWRadius() * record.getLinkPercent();
    double linkY = state.getPieCenterY() 
                   - Math.sin(theta) * state.getPieHRadius() * record.getLinkPercent();
    double elbowX = state.getPieCenterX() 
                    + Math.cos(theta) * state.getLinkArea().getWidth() / 2.0;
    double elbowY = state.getPieCenterY() 
                    - Math.sin(theta) * state.getLinkArea().getHeight() / 2.0;
    double anchorX = state.getLinkArea().getMaxX();
    double anchorY = elbowY;
    double targetX = anchorX + record.getGap();
    double targetY = record.getAllocatedY();
    g2.setPaint(this.labelLinkPaint);
    g2.setStroke(this.labelLinkStroke);
    g2.draw(new Line2D.Double(linkX, linkY, elbowX, elbowY));
    g2.draw(new Line2D.Double(anchorX, anchorY, elbowX, elbowY));
    g2.draw(new Line2D.Double(anchorX, anchorY, targetX, targetY));
    TextBox tb = record.getLabel();
    tb.draw(g2, (float) targetX, (float) targetY, RectangleAnchor.LEFT);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:30,代碼來源:PiePlot.java

示例11: testEquals

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Problem equals method.
 */
public void testEquals() {
    CategoryLabelPositions p1 = new CategoryLabelPositions(
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER) 
    );
    CategoryLabelPositions p2 = new CategoryLabelPositions(
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER), 
        new CategoryLabelPosition(RectangleAnchor.TOP, TextBlockAnchor.CENTER) 
    );
    assertEquals(p1, p2);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:19,代碼來源:CategoryLabelPositionsTests.java

示例12: createUpRotationLabelPositions

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Creates a new instance where the category labels angled upwards by the specified amount.
 * 
 * @param angle  the rotation angle (should be < Math.PI / 2.0).
 * 
 * @return A category label position specification.
 */
public static CategoryLabelPositions createUpRotationLabelPositions(double angle) {
    return new CategoryLabelPositions(
        new CategoryLabelPosition(
            RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_LEFT, 
            TextAnchor.BOTTOM_LEFT, -angle,
            CategoryLabelWidthType.RANGE, 0.50f
        ), // TOP
        new CategoryLabelPosition(
            RectangleAnchor.TOP, TextBlockAnchor.TOP_RIGHT, 
            TextAnchor.TOP_RIGHT, -angle,
            CategoryLabelWidthType.RANGE, 0.50f
        ), // BOTTOM
        new CategoryLabelPosition(
            RectangleAnchor.RIGHT, TextBlockAnchor.BOTTOM_RIGHT, 
            TextAnchor.BOTTOM_RIGHT, -angle,
            CategoryLabelWidthType.RANGE, 0.50f
        ), // LEFT
        new CategoryLabelPosition(
            RectangleAnchor.LEFT, TextBlockAnchor.TOP_LEFT, 
            TextAnchor.TOP_LEFT, -angle,
            CategoryLabelWidthType.RANGE, 0.50f
        ) // RIGHT
    );
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:32,代碼來源:CategoryLabelPositions.java

示例13: createDownRotationLabelPositions

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Creates a new instance where the category labels angled downwards by the specified amount.
 * 
 * @param angle  the rotation angle (should be < Math.PI / 2.0).
 * 
 * @return A category label position specification.
 */
public static CategoryLabelPositions createDownRotationLabelPositions(double angle) {
    return new CategoryLabelPositions(
        new CategoryLabelPosition(
            RectangleAnchor.BOTTOM, TextBlockAnchor.BOTTOM_RIGHT, 
            TextAnchor.BOTTOM_RIGHT, angle,
            CategoryLabelWidthType.RANGE, 0.50f
        ), // TOP
        new CategoryLabelPosition(
            RectangleAnchor.TOP, TextBlockAnchor.TOP_LEFT, 
            TextAnchor.TOP_LEFT, angle,
            CategoryLabelWidthType.RANGE, 0.50f
        ), // BOTTOM
        new CategoryLabelPosition(
            RectangleAnchor.RIGHT, TextBlockAnchor.TOP_RIGHT, 
            TextAnchor.TOP_RIGHT, angle,
            CategoryLabelWidthType.RANGE, 0.50f
        ), // LEFT
        new CategoryLabelPosition(
            RectangleAnchor.LEFT, TextBlockAnchor.BOTTOM_LEFT, 
            TextAnchor.BOTTOM_LEFT, angle,
            CategoryLabelWidthType.RANGE, 0.50f
        ) // RIGHT
    );
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:32,代碼來源:CategoryLabelPositions.java

示例14: CategoryLabelPosition

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Creates a new position record.  The item label anchor is a point relative to the
 * data item (dot, bar or other visual item) on a chart.  The item label is aligned
 * by aligning the text anchor with the item label anchor.
 * 
 * @param categoryAnchor  the category anchor (<code>null</code> not permitted).
 * @param labelAnchor  the label anchor (<code>null</code> not permitted).
 * @param rotationAnchor  the rotation anchor (<code>null</code> not permitted).
 * @param angle  the rotation angle (<code>null</code> not permitted).
 * 
 * @deprecated Use alternative constructor.
 */
public CategoryLabelPosition(RectangleAnchor categoryAnchor, 
                             TextBlockAnchor labelAnchor,
                             TextAnchor rotationAnchor,
                             double angle) {
    
    if (categoryAnchor == null) {
        throw new IllegalArgumentException("Null 'categoryAnchor' argument.");
    }
    if (labelAnchor == null) {
        throw new IllegalArgumentException("Null 'labelAnchor' argument.");
    }
    if (rotationAnchor == null) {
        throw new IllegalArgumentException("Null 'rotationAnchor' argument.");
    }
    
    this.categoryAnchor = categoryAnchor;
    this.labelAnchor = labelAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;
    this.widthType = CategoryLabelWidthType.CATEGORY;
    this.widthRatio = 0.90f;

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

示例15: XYTitleAnnotation

import org.jfree.ui.RectangleAnchor; //導入依賴的package包/類
/**
 * Creates a new annotation to be displayed at the specified (x, y) 
 * location.
 *
 * @param x  the x-coordinate (in data space).
 * @param y  the y-coordinate (in data space).
 * @param title  the title (<code>null</code> not permitted).
 * @param anchor  the title anchor (<code>null</code> not permitted).
 */
public XYTitleAnnotation(double x, double y, Title title, 
        RectangleAnchor anchor) {
    if (title == null) {
        throw new IllegalArgumentException("Null 'title' argument.");      
    }
    if (anchor == null) {
        throw new IllegalArgumentException("Null 'anchor' argument.");
    }
    this.coordinateType = XYCoordinateType.RELATIVE;
    this.x = x;
    this.y = y;
    this.maxWidth = 0.0;
    this.maxHeight = 0.0;
    this.title = title;
    this.anchor = anchor;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:26,代碼來源:XYTitleAnnotation.java


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