Java 类org.jfree.ui.TextAnchor 实例源码

项目:parabuild-ci    文件:Marker.java   
/**
 * 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;

}
项目:parabuild-ci    文件:DialValueIndicator.java   
/** 
 * 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;
}
项目:iveely.ml    文件:ChartUtils.java   
public static void setLineRender(CategoryPlot plot, boolean isShowDataLabels, boolean isShapesVisible) {
    plot.setNoDataMessage(NO_DATA_MSG);
    plot.setInsets(new RectangleInsets(10, 10, 0, 10), false);
    LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();

    renderer.setStroke(new BasicStroke(1.5F));
    if (isShowDataLabels) {
        renderer.setBaseItemLabelsVisible(true);
        renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator(StandardCategoryItemLabelGenerator.DEFAULT_LABEL_FORMAT_STRING,
                NumberFormat.getInstance()));
        renderer.setBasePositiveItemLabelPosition(new ItemLabelPosition(ItemLabelAnchor.OUTSIDE1, TextAnchor.BOTTOM_CENTER));
    }
    renderer.setBaseShapesVisible(isShapesVisible);
    setXAixs(plot);
    setYAixs(plot);

}
项目:parabuild-ci    文件:ItemLabelPosition.java   
/**
 * 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 itemLabelAnchor  the item label anchor (<code>null</code> not 
 *                         permitted).
 * @param textAnchor  the text anchor (<code>null</code> not permitted).
 * @param rotationAnchor  the rotation anchor (<code>null</code> not 
 *                        permitted).
 * @param angle  the rotation angle (in radians).
 */
public ItemLabelPosition(ItemLabelAnchor itemLabelAnchor, 
                         TextAnchor textAnchor,
                         TextAnchor rotationAnchor,
                         double angle) {

    if (itemLabelAnchor == null) {
        throw new IllegalArgumentException(
                "Null 'itemLabelAnchor' argument.");
    }
    if (textAnchor == null) {
        throw new IllegalArgumentException("Null 'textAnchor' argument.");
    }
    if (rotationAnchor == null) {
        throw new IllegalArgumentException(
                "Null 'rotationAnchor' argument.");
    }

    this.itemLabelAnchor = itemLabelAnchor;
    this.textAnchor = textAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;

}
项目:parabuild-ci    文件:BarRenderer3D.java   
/**
 * Constructs a new renderer with the specified '3D effect'.
 *
 * @param xOffset  the x-offset for the 3D effect.
 * @param yOffset  the y-offset for the 3D effect.
 */
public BarRenderer3D(double xOffset, double yOffset) {

    super();
    this.xOffset = xOffset;
    this.yOffset = yOffset;
    this.wallPaint = DEFAULT_WALL_PAINT;
    // set the default item label positions
    ItemLabelPosition p1 = new ItemLabelPosition(
        ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER
    );
    setPositiveItemLabelPosition(p1);
    ItemLabelPosition p2 = new ItemLabelPosition(
        ItemLabelAnchor.INSIDE12, TextAnchor.TOP_CENTER
    );
    setNegativeItemLabelPosition(p2);

}
项目:parabuild-ci    文件:CategoryLabelPositions.java   
/**
 * 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
    );
}
项目:parabuild-ci    文件:CategoryLabelPosition.java   
/**
 * 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;

}
项目:parabuild-ci    文件:StandardLegend.java   
/**
 * Draws the legend title.
 * 
 * @param g2  the graphics device (<code>null</code> not permitted).
 * @param legendTitle  the title (<code>null</code> permitted, in which case the method 
 *                     does nothing).
 */
private void drawLegendTitle(Graphics2D g2, DrawableLegendItem legendTitle) {
    if (legendTitle != null) {
        // XXX dsm - make title bold?
        g2.setPaint(legendTitle.getItem().getPaint());
        g2.setPaint(this.itemPaint);
        g2.setFont(getTitleFont());
        TextUtilities.drawAlignedString(
            legendTitle.getItem().getLabel(), g2,
            (float) legendTitle.getLabelPosition().getX(),
            (float) legendTitle.getLabelPosition().getY(), TextAnchor.CENTER_LEFT
        );
        LOGGER.debug("Title x = " + legendTitle.getLabelPosition().getX());
        LOGGER.debug("Title y = " + legendTitle.getLabelPosition().getY());
    }
}
项目:parabuild-ci    文件:ItemLabelPosition.java   
/**
 * 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 itemLabelAnchor  the item label anchor (<code>null</code> not permitted).
 * @param textAnchor  the text anchor (<code>null</code> not permitted).
 * @param rotationAnchor  the rotation anchor (<code>null</code> not permitted).
 * @param angle  the rotation angle (in radians).
 */
public ItemLabelPosition(ItemLabelAnchor itemLabelAnchor, 
                         TextAnchor textAnchor,
                         TextAnchor rotationAnchor,
                         double angle) {

    if (itemLabelAnchor == null) {
        throw new IllegalArgumentException("Null 'itemLabelAnchor' argument.");
    }
    if (textAnchor == null) {
        throw new IllegalArgumentException("Null 'textAnchor' argument.");
    }
    if (rotationAnchor == null) {
        throw new IllegalArgumentException("Null 'rotationAnchor' argument.");
    }

    this.itemLabelAnchor = itemLabelAnchor;
    this.textAnchor = textAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;

}
项目:parabuild-ci    文件:MarkerTests.java   
/**
 * Some checks for the getLabelTextAnchor() and setLabelTextAnchor() 
 * methods.
 */
public void testGetSetLabelTextAnchor() {
    // we use ValueMarker for the tests, because we need a concrete 
    // subclass...
    ValueMarker m = new ValueMarker(1.1);
    m.addChangeListener(this);
    this.lastEvent = null;
    assertEquals(TextAnchor.CENTER, m.getLabelTextAnchor());
    m.setLabelTextAnchor(TextAnchor.BASELINE_LEFT);
    assertEquals(TextAnchor.BASELINE_LEFT, m.getLabelTextAnchor());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelTextAnchor(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
项目:parabuild-ci    文件:CategoryTickTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    Comparable c1 = "C1";
    TextBlock tb1 = new TextBlock();
    tb1.addLine(new TextLine("Block 1"));
    tb1.addLine(new TextLine("Block 2"));
    TextBlockAnchor tba1 = TextBlockAnchor.CENTER;
    TextAnchor ta1 = TextAnchor.CENTER;

    CategoryTick t1 = new CategoryTick(c1, tb1, tba1, ta1, 1.0f);
    CategoryTick t2 = new CategoryTick(c1, tb1, tba1, ta1, 1.0f);
    assertTrue(t1.equals(t2));
    int h1 = t1.hashCode();
    int h2 = t2.hashCode();
    assertEquals(h1, h2);
}
项目:parabuild-ci    文件:BarRenderer3D.java   
/**
 * Constructs a new renderer with the specified '3D effect'.
 *
 * @param xOffset  the x-offset for the 3D effect.
 * @param yOffset  the y-offset for the 3D effect.
 */
public BarRenderer3D(double xOffset, double yOffset) {

    super();
    this.xOffset = xOffset;
    this.yOffset = yOffset;
    this.wallPaint = DEFAULT_WALL_PAINT;
    // set the default item label positions
    ItemLabelPosition p1 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, 
            TextAnchor.TOP_CENTER);
    setPositiveItemLabelPosition(p1);
    ItemLabelPosition p2 = new ItemLabelPosition(ItemLabelAnchor.INSIDE12, 
            TextAnchor.TOP_CENTER);
    setNegativeItemLabelPosition(p2);

}
项目:parabuild-ci    文件:MeterPlot.java   
/**
 * Draws the value label just below the center of the dial.
 * 
 * @param g2  the graphics device.
 * @param area  the plot area.
 */
protected void drawValueLabel(Graphics2D g2, Rectangle2D area) {
    g2.setFont(this.valueFont);
    g2.setPaint(this.valuePaint);
    String valueStr = "No value";
    if (this.dataset != null) {
        Number n = this.dataset.getValue();
        if (n != null) {
            valueStr = this.tickLabelFormat.format(n.doubleValue()) + " " 
                     + this.units;
        }
    }
    float x = (float) area.getCenterX();
    float y = (float) area.getCenterY() + DEFAULT_CIRCLE_SIZE;
    TextUtilities.drawAlignedString(valueStr, g2, x, y, 
            TextAnchor.TOP_CENTER);
}
项目:parabuild-ci    文件:Tick.java   
/**
 * Creates a new tick.
 *
 * @param text  the formatted version of the tick value.
 * @param textAnchor  the text anchor (<code>null</code> not permitted).
 * @param rotationAnchor  the rotation anchor (<code>null</code> not 
 *                        permitted).
 * @param angle  the angle. 
 */
public Tick(String text, TextAnchor textAnchor, TextAnchor rotationAnchor, 
            double angle) {
    if (textAnchor == null) {
        throw new IllegalArgumentException("Null 'textAnchor' argument.");
    }
    if (rotationAnchor == null) {
        throw new IllegalArgumentException(
            "Null 'rotationAnchor' argument."
        );   
    }
    this.text = text;
    this.textAnchor = textAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;
}
项目:parabuild-ci    文件:CategoryLabelPositions.java   
/**
 * 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
    );
}
项目:parabuild-ci    文件:CategoryLabelPositions.java   
/**
 * 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
    );
}
项目:iveely.ml    文件:ChartUtils.java   
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);

    }
项目:parabuild-ci    文件:AbstractRendererTests.java   
/**
 * 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)
    );
}
项目:parabuild-ci    文件:AbstractRendererTests.java   
/**
 * Test that setting the negative item label position for ALL series does in fact work.
 */
public void testSetNegativeItemLabelPosition() {
    BarRenderer r = new BarRenderer();
    r.setNegativeItemLabelPosition(
        new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT)
    );
    assertEquals(
        new ItemLabelPosition(ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT), 
        r.getNegativeItemLabelPosition(0, 0)
    );
}
项目:parabuild-ci    文件:AbstractRenderer.java   
/**
 * 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;
}
项目:parabuild-ci    文件:AbstractRenderer.java   
/**
 * 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;
}
项目:parabuild-ci    文件:StackedBarRenderer.java   
/**
 * Creates a new renderer with no tool tip generator and no URL generator.
 * <P>
 * The defaults (no tool tip or URL generators) have been chosen to minimise the processing
 * required to generate a default chart.  If you require tool tips or URLs, then you can
 * easily add the required generators.
 */
public StackedBarRenderer() {
    super();

    // 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);
}
项目:parabuild-ci    文件:Marker.java   
/**
 * Sets the label text anchor.
 * 
 * @param anchor  the label text anchor (<code>null</code> not permitted).
 */
public void setLabelTextAnchor(TextAnchor anchor) {
    if (anchor == null) { 
        throw new IllegalArgumentException("Null 'anchor' argument.");
    }
    this.labelTextAnchor = anchor;
}
项目:parabuild-ci    文件:Tick.java   
/**
 * Creates a new tick.
 *
 * @param text  the formatted version of the tick value.
 * @param textAnchor  the text anchor (<code>null</code> not permitted).
 * @param rotationAnchor  the rotation anchor (<code>null</code> not permitted).
 * @param angle  the angle. 
 */
public Tick(String text, TextAnchor textAnchor, TextAnchor rotationAnchor, double angle) {
    if (textAnchor == null) {
        throw new IllegalArgumentException("Null 'textAnchor' argument.");   
    }
    if (rotationAnchor == null) {
        throw new IllegalArgumentException("Null 'rotationAnchor' argument.");   
    }
    this.text = text;
    this.textAnchor = textAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;
}
项目:parabuild-ci    文件:CategoryTick.java   
/**
 * Creates a new tick.
 * 
 * @param category  the category.
 * @param label  the label.
 * @param labelAnchor  the label anchor.
 * @param rotationAnchor  the rotation anchor.
 * @param angle  the rotation angle (in radians).
 */
public CategoryTick(Comparable category,
                    TextBlock label,
                    TextBlockAnchor labelAnchor,
                    TextAnchor rotationAnchor,
                    double angle) {

    super("", TextAnchor.CENTER, rotationAnchor, angle);
    this.category = category;
    this.label = label;
    this.labelAnchor = labelAnchor;

}
项目:parabuild-ci    文件:CategoryLabelPosition.java   
/**
 * Creates a new position record with default settings.
 */
public CategoryLabelPosition() {
    this(
        RectangleAnchor.CENTER, TextBlockAnchor.BOTTOM_CENTER, 
        TextAnchor.CENTER, 0.0, CategoryLabelWidthType.CATEGORY, 0.95f
    );
}
项目:parabuild-ci    文件:CategoryLabelPosition.java   
/**
 * Creates a new category label position record.
 * 
 * @param categoryAnchor  the category anchor (<code>null</code> not permitted).
 * @param labelAnchor  the label anchor (<code>null</code> not permitted).
 */
public CategoryLabelPosition(RectangleAnchor categoryAnchor, TextBlockAnchor labelAnchor) {
    // argument checking delegated...
    this(
        categoryAnchor, labelAnchor, TextAnchor.CENTER, 0.0, 
        CategoryLabelWidthType.CATEGORY, 0.95f
    );
}
项目:parabuild-ci    文件:CategoryLabelPosition.java   
/**
 * 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).
 * @param widthType  the width type (<code>null</code> not permitted).
 * @param widthRatio  the maximum label width as a percentage (of the category space or the 
 *                    range space).
 */
public CategoryLabelPosition(RectangleAnchor categoryAnchor, 
                             TextBlockAnchor labelAnchor,
                             TextAnchor rotationAnchor,
                             double angle,
                             CategoryLabelWidthType widthType,
                             float widthRatio) {

    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.");
    }
    if (widthType == null) {
        throw new IllegalArgumentException("Null 'widthType' argument.");   
    }

    this.categoryAnchor = categoryAnchor;
    this.labelAnchor = labelAnchor;
    this.rotationAnchor = rotationAnchor;
    this.angle = angle;
    this.widthType = widthType;
    this.widthRatio = widthRatio;

}
项目:parabuild-ci    文件:CategoryLabelPosition.java   
/**
 * Creates a new category label position record.
 * 
 * @param categoryAnchor  the category anchor (<code>null</code> not 
 *                        permitted).
 * @param labelAnchor  the label anchor (<code>null</code> not permitted).
 * @param widthType  the width type (<code>null</code> not permitted).
 * @param widthRatio  the maximum label width as a percentage (of the 
 *                    category space or the range space).
 */
public CategoryLabelPosition(RectangleAnchor categoryAnchor, 
                             TextBlockAnchor labelAnchor,
                             CategoryLabelWidthType widthType,
                             float widthRatio) {
    // argument checking delegated...
    this(
        categoryAnchor, labelAnchor, TextAnchor.CENTER, 
        0.0, widthType, widthRatio
    );
}
项目:parabuild-ci    文件:CategoryLabelPosition.java   
/**
 * Creates a new position record with default settings.
 */
public CategoryLabelPosition() {
    this(
        RectangleAnchor.CENTER, TextBlockAnchor.BOTTOM_CENTER, 
        TextAnchor.CENTER, 0.0, CategoryLabelWidthType.CATEGORY, 0.95f
    );
}
项目:parabuild-ci    文件:DialValueIndicator.java   
/**
 * Sets the text anchor.
 * 
 * @param anchor  the anchor (<code>null</code> not permitted).
 */
public void setTextAnchor(TextAnchor anchor) {
    if (anchor == null) {
        throw new IllegalArgumentException("Null 'anchor' argument.");
    }
    this.textAnchor = anchor;
    notifyListeners(new DialLayerChangeEvent(this));                        
}
项目:parabuild-ci    文件:DialTextAnnotation.java   
/** 
 * Creates a new instance of <code>DialTextAnnotation</code>.
 * 
 * @param label  the label (<code>null</code> not permitted).
 */
public DialTextAnnotation(String label) {
    if (label == null) {
        throw new IllegalArgumentException("Null 'label' argument.");
    }
    this.angle = -90.0;
    this.radius = 0.3;
    this.font = new Font("Dialog", Font.BOLD, 14);
    this.paint = Color.black;
    this.label = label;
    this.anchor = TextAnchor.TOP_CENTER;
}
项目:parabuild-ci    文件:LogAxis.java   
/**
 * Returns a list of ticks for an axis at the left or right of the chart.
 * 
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param edge  the edge.
 * 
 * @return A list of ticks.
 */
protected List refreshTicksVertical(Graphics2D g2, Rectangle2D dataArea, 
        RectangleEdge edge) {
    Range range = getRange();
    List ticks = new ArrayList();
    double start = Math.floor(calculateLog(getLowerBound()));
    double end = Math.ceil(calculateLog(getUpperBound()));
    double current = start;
    while (current <= end) {
        double v = calculateValue(current);
        if (range.contains(v)) {
            ticks.add(new NumberTick(new Double(v), createTickLabel(v), 
                    TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, 0.0));
        }
        // add minor ticks (for gridlines)
        double next = Math.pow(this.base, current 
                + this.tickUnit.getSize());
        for (int i = 1; i < this.minorTickCount; i++) {
            double minorV = v + i * ((next - v) / this.minorTickCount);
            if (range.contains(minorV)) {
                ticks.add(new NumberTick(new Double(minorV), "", 
                        TextAnchor.CENTER_RIGHT, TextAnchor.CENTER, 0.0));
            }
        }
        current = current + this.tickUnit.getSize();
    }
    return ticks;
}
项目:parabuild-ci    文件:AbstractRendererTests.java   
/**
 * 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));
}
项目:parabuild-ci    文件:AbstractRendererTests.java   
/**
 * Test that setting the negative item label position for ALL series does 
 * in fact work.
 */
public void testSetNegativeItemLabelPosition() {
    BarRenderer r = new BarRenderer();
    r.setNegativeItemLabelPosition(new ItemLabelPosition(
            ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT));
    assertEquals(new ItemLabelPosition(
            ItemLabelAnchor.INSIDE1, TextAnchor.BASELINE_LEFT), 
            r.getNegativeItemLabelPosition(0, 0));
}
项目:parabuild-ci    文件:DateTickTests.java   
/**
 * Two objects that are equal are required to return the same hashCode. 
 */
public void testHashCode() {
    Date d1 = new Date(0L);
    String l1 = "Label 1";
    TextAnchor ta1 = TextAnchor.CENTER;

    DateTick t1 = new DateTick(d1, l1, ta1, ta1, Math.PI / 2.0);
    DateTick t2 = new DateTick(d1, l1, ta1, ta1, Math.PI / 2.0);
    assertTrue(t1.equals(t2));
    int h1 = t1.hashCode();
    int h2 = t2.hashCode();
    assertEquals(h1, h2);
}
项目:parabuild-ci    文件:StackedBarRenderer.java   
/**
 * Creates a new renderer.
 * 
 * @param renderAsPercentages  a flag that controls whether the data values
 *                             are rendered as percentages.
 */
public StackedBarRenderer(boolean renderAsPercentages) {
    super();
    this.renderAsPercentages = renderAsPercentages;

    // 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);
}
项目:parabuild-ci    文件:Marker.java   
/**
 * 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 (must be in the range 0.0f to 
 *     1.0f).
 *     
 * @throws IllegalArgumentException if <code>paint</code> or 
 *     <code>stroke</code> is <code>null</code>, or <code>alpha</code> is 
 *     not in the specified range.
 */
protected 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.");
    }
    if (alpha < 0.0f || alpha > 1.0f)
        throw new IllegalArgumentException(
                "The 'alpha' value must be in the range 0.0f to 1.0f");

    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(3.0, 3.0, 3.0, 3.0);
    this.labelOffsetType = LengthAdjustmentType.CONTRACT;
    this.labelTextAnchor = TextAnchor.CENTER;

    this.listenerList = new EventListenerList();
}
项目:parabuild-ci    文件:CategoryTick.java   
/**
 * Creates a new tick.
 * 
 * @param category  the category.
 * @param label  the label.
 * @param labelAnchor  the label anchor.
 * @param rotationAnchor  the rotation anchor.
 * @param angle  the rotation angle (in radians).
 */
public CategoryTick(Comparable category,
                    TextBlock label,
                    TextBlockAnchor labelAnchor,
                    TextAnchor rotationAnchor,
                    double angle) {

    super("", TextAnchor.CENTER, rotationAnchor, angle);
    this.category = category;
    this.label = label;
    this.labelAnchor = labelAnchor;

}
项目:parabuild-ci    文件:ItemLabelPosition.java   
/**
 * Creates a new position record with default settings.
 */
public ItemLabelPosition() {
    this(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER, 
            TextAnchor.CENTER, 0.0);
}