org.jfree.ui.LengthAdjustmentType Java Examples

The following examples show how to use org.jfree.ui.LengthAdjustmentType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractXYItemRenderer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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 labelOffsetForRange  ??
 * @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);

}
 
Example #2
Source File: AbstractCategoryItemRenderer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #3
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #4
Source File: AbstractXYItemRenderer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #5
Source File: MarkerTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Some checks for the getLabelOffsetType() and setLabelOffsetType()
 * methods.
 */
@Test
public void testGetSetLabelOffsetType() {
    // 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(LengthAdjustmentType.CONTRACT, m.getLabelOffsetType());
    m.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    assertEquals(LengthAdjustmentType.EXPAND, m.getLabelOffsetType());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelOffsetType(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example #6
Source File: AbstractXYItemRenderer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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 labelOffsetForRange  ??
 * @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);

}
 
Example #7
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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.
 * @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 calculateRangeMarkerTextAnchorPoint(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,
                labelOffsetType, LengthAdjustmentType.CONTRACT);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                LengthAdjustmentType.CONTRACT, labelOffsetType);
    }
    return RectangleAnchor.coordinates(anchorRect, anchor);

}
 
Example #8
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #9
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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 labelOffsetForRange  ??
 * @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);

}
 
Example #10
Source File: AbstractCategoryItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #11
Source File: AbstractCategoryItemRenderer.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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.
 * @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 calculateRangeMarkerTextAnchorPoint(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,
                labelOffsetType, LengthAdjustmentType.CONTRACT);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                LengthAdjustmentType.CONTRACT, labelOffsetType);
    }
    return RectangleAnchor.coordinates(anchorRect, anchor);

}
 
Example #12
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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 labelOffsetForRange  ??
 * @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);

}
 
Example #13
Source File: AbstractXYItemRenderer.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #14
Source File: MarkerTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelOffsetType() and setLabelOffsetType()
 * methods.
 */
@Test
public void testGetSetLabelOffsetType() {
    // 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(LengthAdjustmentType.CONTRACT, m.getLabelOffsetType());
    m.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    assertEquals(LengthAdjustmentType.EXPAND, m.getLabelOffsetType());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelOffsetType(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example #15
Source File: AbstractXYItemRenderer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #16
Source File: MarkerTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Some checks for the getLabelOffsetType() and setLabelOffsetType()
 * methods.
 */
@Test
public void testGetSetLabelOffsetType() {
    // 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(LengthAdjustmentType.CONTRACT, m.getLabelOffsetType());
    m.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    assertEquals(LengthAdjustmentType.EXPAND, m.getLabelOffsetType());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelOffsetType(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example #17
Source File: AbstractCategoryItemRenderer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #18
Source File: AbstractCategoryItemRenderer.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * 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.
 * @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 calculateRangeMarkerTextAnchorPoint(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,
                labelOffsetType, LengthAdjustmentType.CONTRACT);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                LengthAdjustmentType.CONTRACT, labelOffsetType);
    }
    return RectangleAnchor.coordinates(anchorRect, anchor);

}
 
Example #19
Source File: AbstractCategoryItemRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * 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.
 * @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 calculateRangeMarkerTextAnchorPoint(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, 
                labelOffsetType, LengthAdjustmentType.CONTRACT);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea, 
                LengthAdjustmentType.CONTRACT, labelOffsetType);
    }
    return RectangleAnchor.coordinates(anchorRect, anchor);
    
}
 
Example #20
Source File: AbstractCategoryItemRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * 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);
    
}
 
Example #21
Source File: AbstractXYItemRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #22
Source File: AbstractXYItemRenderer.java    From opensim-gui with Apache License 2.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #23
Source File: AbstractCategoryItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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.
 * @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 calculateRangeMarkerTextAnchorPoint(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,
                labelOffsetType, LengthAdjustmentType.CONTRACT);
    }
    else if (orientation == PlotOrientation.VERTICAL) {
        anchorRect = markerOffset.createAdjustedRectangle(markerArea,
                LengthAdjustmentType.CONTRACT, labelOffsetType);
    }
    return RectangleAnchor.coordinates(anchorRect, anchor);

}
 
Example #24
Source File: GrammarvizChartPanel.java    From grammarviz2_src with GNU General Public License v2.0 6 votes vote down vote up
/**
 * @param plot plot for the marker
 * @param startVal start postion
 * @param endVal end position
 */
protected void addMarker(XYPlot plot, int startVal, int endVal) {
  IntervalMarker marker = new IntervalMarker(startVal, endVal);
  marker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
  marker.setPaint(new Color(134, 254, 225));
  marker.setAlpha((float) 0.60);
  marker.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
  marker.setLabelPaint(Color.green);
  marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
  marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);

  plot.addDomainMarker(marker, Layer.BACKGROUND);

  ValueMarker markStart = new ValueMarker(startVal, new Color(31, 254, 225),
      new BasicStroke(2.0f));
  ValueMarker markEnd = new ValueMarker(endVal, new Color(31, 254, 225), new BasicStroke(2.0f));
  plot.addDomainMarker(markStart, Layer.BACKGROUND);
  plot.addDomainMarker(markEnd, Layer.BACKGROUND);
}
 
Example #25
Source File: GrammarvizChartPanel.java    From grammarviz2_src with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds a periodicity marker.
 * 
 * @param plot plot for the marker
 * @param startVal start postion
 * @param endVal end position
 */
protected void addPeriodMarker(XYPlot plot, int startVal, int endVal) {

  IntervalMarker marker = new IntervalMarker(startVal, endVal);

  marker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
  marker.setPaint(new Color(134, 254, 225));
  marker.setAlpha((float) 0.60);
  marker.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
  marker.setLabelPaint(Color.blue);
  marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
  marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);

  marker.setPaint(Color.blue);

  plot.addDomainMarker(marker, Layer.BACKGROUND);
}
 
Example #26
Source File: GrammarvizChartPanel.java    From grammarviz2_src with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Adds an anomaly marker.
 * 
 * @param plot plot for the marker
 * @param startVal start postion
 * @param endVal end position
 */
protected void addAnomalyMarker(XYPlot plot, int startVal, int endVal) {

  IntervalMarker marker = new IntervalMarker(startVal, endVal);

  marker.setLabelOffsetType(LengthAdjustmentType.EXPAND);
  marker.setPaint(new Color(134, 254, 225));
  marker.setAlpha((float) 0.60);
  marker.setLabelFont(new Font("SansSerif", Font.PLAIN, 12));
  marker.setLabelPaint(Color.pink);
  marker.setLabelAnchor(RectangleAnchor.TOP_LEFT);
  marker.setLabelTextAnchor(TextAnchor.TOP_LEFT);

  marker.setPaint(Color.pink);

  plot.addDomainMarker(marker, Layer.BACKGROUND);
}
 
Example #27
Source File: AbstractCategoryItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #28
Source File: MarkerTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Some checks for the getLabelOffsetType() and setLabelOffsetType()
 * methods.
 */
@Test
public void testGetSetLabelOffsetType() {
    // 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(LengthAdjustmentType.CONTRACT, m.getLabelOffsetType());
    m.setLabelOffsetType(LengthAdjustmentType.EXPAND);
    assertEquals(LengthAdjustmentType.EXPAND, m.getLabelOffsetType());
    assertEquals(m, this.lastEvent.getMarker());

    // check null argument...
    try {
        m.setLabelOffsetType(null);
        fail("Expected an IllegalArgumentException for null.");
    }
    catch (IllegalArgumentException e) {
        assertTrue(true);
    }
}
 
Example #29
Source File: AbstractXYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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);

}
 
Example #30
Source File: AbstractXYItemRenderer.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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 labelOffsetForRange  ??
 * @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);

}