当前位置: 首页>>代码示例>>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;未经允许,请勿转载。