Java 类org.jfree.chart.axis.AxisState 实例源码

项目:aorra    文件:PartitionedNumberAxis.java   
@Override
public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea,
        Rectangle2D dataArea, RectangleEdge edge,
        PlotRenderingInfo plotState) {
    if(partitions.isEmpty()) {
        throw new RuntimeException("no partitions");
    }
    checkSize();
    if(edge != RectangleEdge.LEFT) {
        throw new RuntimeException("axis not on left");
    }
    if (isAxisLineVisible()) {
        drawAxisLine(g2, cursor, dataArea, edge);
    }
    drawPartitions(g2, dataArea);
    AxisState state = drawTickMarksAndLabels(g2, cursor, plotArea, dataArea, edge);
    state = drawLabel(getLabel(), g2, plotArea, dataArea, edge, state);
    createAndAddEntity(cursor, state, dataArea, edge, plotState);
    return state;
}
项目:proactive-component-monitoring    文件:MatrixChart.java   
/**
 * Calculates the positions of the tick labels for the axis, storing the
 * results in the tick label list (ready for drawing).
 *
 * @param g2
 *            the graphics device.
 * @param state
 *            the axis state.
 * @param dataArea
 *            the area in which the plot should be drawn.
 * @param edge
 *            the location of the axis.
 *
 * @return A list of ticks.
 *
 */
@Override
public List<NumberTick> refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea,
        RectangleEdge edge) {
    List<NumberTick> result = new java.util.ArrayList<NumberTick>();
    if (RectangleEdge.isTopOrBottom(edge)) {
        result = this.refreshTicksHorizontal(g2, dataArea, edge);
    } else if (RectangleEdge.isLeftOrRight(edge)) {
        result = this.refreshTicksVertical(g2, dataArea, edge);
    }

    int size = result.size();
    NumberTick first = result.get(0);
    NumberTick last = result.get(size - 1);

    NumberTick newFirst = new NumberTick(0, "", first.getTextAnchor(), first.getRotationAnchor(),
        first.getAngle());

    NumberTick newLast = new NumberTick(0, "", last.getTextAnchor(), last.getRotationAnchor(), last
            .getAngle());

    result.set(0, newFirst);
    result.set(size - 1, newLast);
    return result;
}
项目:parabuild-ci    文件:LogAxis.java   
/**
 * Calculates the positions of the tick labels for the axis, storing the 
 * results in the tick label list (ready for drawing).
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 * 
 * @return A list of ticks.
 *
 */
public List refreshTicks(Graphics2D g2, AxisState state, 
        Rectangle2D dataArea, RectangleEdge edge) {

    List result = new java.util.ArrayList();
    if (RectangleEdge.isTopOrBottom(edge)) {
        result = refreshTicksHorizontal(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        result = refreshTicksVertical(g2, dataArea, edge);
    }
    return result;

}
项目:Prism-gsoc16    文件:PrismLogarithmicAxis.java   
/**
 * Calculates the positions of the tick labels for the axis, storing the 
 * results in the tick label list (ready for drawing).
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 * 
 * @return A list of ticks.
 *
 */
public List refreshTicks(Graphics2D g2, AxisState state, 
        Rectangle2D dataArea, RectangleEdge edge) {

    List result = new java.util.ArrayList();
    if (RectangleEdge.isTopOrBottom(edge)) {
        result = refreshTicksHorizontal(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        result = refreshTicksVertical(g2, dataArea, edge);
    }
    return result;

}
项目:nabs    文件:LogAxis.java   
/**
 * Calculates the positions of the tick labels for the axis, storing the 
 * results in the tick label list (ready for drawing).
 *
 * @param g2  the graphics device.
 * @param state  the axis state.
 * @param dataArea  the area in which the plot should be drawn.
 * @param edge  the location of the axis.
 * 
 * @return A list of ticks.
 *
 */
public List refreshTicks(Graphics2D g2, AxisState state, 
        Rectangle2D dataArea, RectangleEdge edge) {

    List result = new java.util.ArrayList();
    if (RectangleEdge.isTopOrBottom(edge)) {
        result = refreshTicksHorizontal(g2, dataArea, edge);
    }
    else if (RectangleEdge.isLeftOrRight(edge)) {
        result = refreshTicksVertical(g2, dataArea, edge);
    }
    return result;

}
项目:aorra    文件:AutoSubCategoryAxis.java   
@Override
public AxisSpace reserveSpace(Graphics2D g2, Plot plot,
        Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) {
    Rectangle2D labelEnclosure = getLabelEnclosure(g2, edge);
    space.add(labelEnclosure.getHeight() + this.getCategoryLabelPositionOffset(), edge);
    AxisState axisState = drawCategoryLabels(g2, plotArea,
        space.shrink(plotArea, null), edge, new AxisState(), null, false);
    space.add(axisState.getCursor(), RectangleEdge.BOTTOM);
    return space;
}
项目:parabuild-ci    文件:PolarPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a printer).
 * <P>
 * This plot relies on an {@link org.jfree.chart.renderer.DefaultPolarItemRenderer} to draw 
 * each item in the plot.  This allows the visual representation of the data to be changed 
 * easily.
 * <P>
 * The optional info argument collects information about the rendering of
 * the plot (dimensions, tooltip information etc).  Just pass in <code>null</code> if
 * you do not need this information.
 *
 * @param g2  the graphics device.
 * @param plotArea  the area within which the plot (including axes and labels) should be drawn.
 * @param parentState  ignored.
 * @param info  collects chart drawing information (<code>null</code> permitted).
 */
public void draw(Graphics2D g2, 
                 Rectangle2D plotArea, 
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // if the plot area is too small, just return...
    boolean b1 = (plotArea.getWidth() <= MINIMUM_WIDTH_TO_DRAW);
    boolean b2 = (plotArea.getHeight() <= MINIMUM_HEIGHT_TO_DRAW);
    if (b1 || b2) {
        return;
    }

    // record the plot area...
    if (info != null) {
        info.setPlotArea(plotArea);
    }

    // adjust the drawing area for the plot insets (if any)...
    Insets insets = getInsets();
    if (insets != null) {
        plotArea.setRect(plotArea.getX() + insets.left,
                         plotArea.getY() + insets.top,
                         plotArea.getWidth() - insets.left - insets.right,
                         plotArea.getHeight() - insets.top - insets.bottom);
    }

    Rectangle2D dataArea = plotArea;
    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);
    double h = Math.min(dataArea.getWidth() / 2.0, dataArea.getHeight() / 2.0) - MARGIN;
    Rectangle2D quadrant = new Rectangle2D.Double(
        dataArea.getCenterX(), dataArea.getCenterY(), h, h
    );
    AxisState state = drawAxis(g2, plotArea, quadrant);
    if (this.renderer != null) {
        Shape originalClip = g2.getClip();
        Composite originalComposite = g2.getComposite();

        g2.clip(dataArea);
        g2.setComposite(
            AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())
        );

        drawGridlines(g2, dataArea, this.angleTicks, state.getTicks());

        // draw...
        render(g2, dataArea, info);

        g2.setClip(originalClip);
        g2.setComposite(originalComposite);
    }
    drawOutline(g2, dataArea);
    drawCornerTextItems(g2, dataArea);
}
项目:parabuild-ci    文件:CombinedDomainXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 * 
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space (<code>null</code> permitted).
 * @param parentState  the state from the parent plot, if there is one (<code>null</code> 
 *                     permitted).
 * @param info  collects chart drawing information (<code>null</code> permitted).
 */
public void draw(Graphics2D g2,
                 Rectangle2D area,
                 Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    Insets insets = getInsets();
    if (insets != null) {
        area.setRect(
            area.getX() + insets.left, area.getY() + insets.top,
            area.getWidth() - insets.left - insets.right,
            area.getHeight() - insets.top - insets.bottom
        );
    }

    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getDomainAxis();
    RectangleEdge edge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState, subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:parabuild-ci    文件:CombinedRangeCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a printer).
 * Will perform all the placement calculations for each sub-plots and then tell these to draw
 * themselves.
 *
 * @param g2  the graphics device.
 * @param plotArea  the area within which the plot (including axis labels) should be drawn.
 * @param parentState  the parent state.
 * @param info  collects information about the drawing (<code>null</code> permitted).
 */
public void draw(Graphics2D g2, Rectangle2D plotArea, PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(plotArea);
    }

    // adjust the drawing area for plot insets (if any)...
    Insets insets = getInsets();
    if (insets != null) {
        plotArea.setRect(
            plotArea.getX() + insets.left,
            plotArea.getY() + insets.top,
            plotArea.getWidth() - insets.left - insets.right,
            plotArea.getHeight() - insets.top - insets.bottom
        );
    }

    // calculate the data area...
    AxisSpace space = calculateAxisSpace(g2, plotArea);
    Rectangle2D dataArea = space.shrink(plotArea, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge rangeEdge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, rangeEdge);
    AxisState state = axis.draw(g2, cursor, plotArea, dataArea, rangeEdge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, state);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotArea[i], parentState, subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:parabuild-ci    文件:FastScatterPlot.java   
/**
 * Draws the fast scatter plot on a Java 2D graphics device (such as the screen or
 * a printer).
 *
 * @param g2  the graphics device.
 * @param plotArea   the area within which the plot (including axis labels) should be drawn.
 * @param parentState  the state from the parent plot, if there is one.
 * @param info  collects chart drawing information (<code>null</code> permitted).
 */
public void draw(Graphics2D g2, Rectangle2D plotArea, PlotState parentState, 
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(plotArea);

    }

    // adjust the drawing area for plot insets (if any)...
    Insets insets = getInsets();
    if (insets != null) {
        plotArea.setRect(plotArea.getX() + insets.left,
                         plotArea.getY() + insets.top,
                         plotArea.getWidth() - insets.left - insets.right,
                         plotArea.getHeight() - insets.top - insets.bottom);
    }

    AxisSpace space = new AxisSpace();
    space = this.domainAxis.reserveSpace(g2, this, plotArea, RectangleEdge.BOTTOM, space);
    space = this.rangeAxis.reserveSpace(g2, this, plotArea, RectangleEdge.LEFT, space);
    Rectangle2D dataArea = space.shrink(plotArea, null);

    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);

    AxisState domainAxisState = null;
    AxisState rangeAxisState = null;
    if (this.domainAxis != null) {
        domainAxisState = this.domainAxis.draw(
            g2, dataArea.getMaxY(), plotArea, dataArea, RectangleEdge.BOTTOM, info
        );
    }
    if (this.rangeAxis != null) {
        rangeAxisState = this.rangeAxis.draw(
            g2, dataArea.getMinX(), plotArea, dataArea, RectangleEdge.LEFT, info
        );
    }
    drawDomainGridlines(g2, dataArea, domainAxisState.getTicks());
    drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks());

    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(
        AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())
    );

    render(g2, dataArea, info, null);

    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);

}
项目:parabuild-ci    文件:CombinedRangeXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 * 
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space (<code>null</code> permitted).
 * @param parentState  the state from the parent plot, if there is one (<code>null</code> 
 *                     permitted).
 * @param info  collects chart drawing information (<code>null</code> permitted).
 */
public void draw(Graphics2D g2,
                 Rectangle2D area,
                 Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    Insets insets = getInsets();
    if (insets != null) {
        area.setRect(area.getX() + insets.left,
                     area.getY() + insets.top,
                     area.getWidth() - insets.left - insets.right,
                     area.getHeight() - insets.top - insets.bottom);
    }

    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);
    //this.axisOffset.trim(dataArea);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge edge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);

    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState, subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:parabuild-ci    文件:CombinedDomainCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a printer).
 * Will perform all the placement calculations for each sub-plots and then tell these to draw
 * themselves.
 *
 * @param g2  the graphics device.
 * @param plotArea  the area within which the plot (including axis labels) should be drawn.
 * @param parentState  the state from the parent plot, if there is one.
 * @param info  collects information about the drawing (<code>null</code> permitted).
 */
public void draw(Graphics2D g2, 
                 Rectangle2D plotArea, 
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(plotArea);
    }

    // adjust the drawing area for plot insets (if any)...
    Insets insets = getInsets();
    if (insets != null) {
        plotArea.setRect(
            plotArea.getX() + insets.left,
            plotArea.getY() + insets.top,
            plotArea.getWidth() - insets.left - insets.right,
            plotArea.getHeight() - insets.top - insets.bottom
        );
    }

    // calculate the data area...
    setFixedRangeAxisSpaceForSubplots(null);
    AxisSpace space = calculateAxisSpace(g2, plotArea);
    Rectangle2D dataArea = space.shrink(plotArea, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    CategoryAxis axis = getDomainAxis();
    RectangleEdge domainEdge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, domainEdge);
    AxisState axisState = axis.draw(g2, cursor, plotArea, dataArea, domainEdge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], parentState, subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:parabuild-ci    文件:PolarPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a 
 * printer).
 * <P>
 * This plot relies on a {@link PolarItemRenderer} to draw each 
 * item in the plot.  This allows the visual representation of the data to 
 * be changed easily.
 * <P>
 * The optional info argument collects information about the rendering of
 * the plot (dimensions, tooltip information etc).  Just pass in 
 * <code>null</code> if you do not need this information.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axes and 
 *              labels) should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  ignored.
 * @param info  collects chart drawing information (<code>null</code> 
 *              permitted).
 */
public void draw(Graphics2D g2, 
                 Rectangle2D area, 
                 Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // if the plot area is too small, just return...
    boolean b1 = (area.getWidth() <= MINIMUM_WIDTH_TO_DRAW);
    boolean b2 = (area.getHeight() <= MINIMUM_HEIGHT_TO_DRAW);
    if (b1 || b2) {
        return;
    }

    // record the plot area...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for the plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    Rectangle2D dataArea = area;
    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);
    double h = Math.min(dataArea.getWidth() / 2.0, 
            dataArea.getHeight() / 2.0) - MARGIN;
    Rectangle2D quadrant = new Rectangle2D.Double(dataArea.getCenterX(), 
            dataArea.getCenterY(), h, h);
    AxisState state = drawAxis(g2, area, quadrant);
    if (this.renderer != null) {
        Shape originalClip = g2.getClip();
        Composite originalComposite = g2.getComposite();

        g2.clip(dataArea);
        g2.setComposite(AlphaComposite.getInstance(
                AlphaComposite.SRC_OVER, getForegroundAlpha()));

        drawGridlines(g2, dataArea, this.angleTicks, state.getTicks());

        // draw...
        render(g2, dataArea, info);

        g2.setClip(originalClip);
        g2.setComposite(originalComposite);
    }
    drawOutline(g2, dataArea);
    drawCornerTextItems(g2, dataArea);
}
项目:parabuild-ci    文件:CombinedDomainXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 * 
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space (<code>null</code> 
 *                permitted).
 * @param parentState  the state from the parent plot, if there is one 
 *                     (<code>null</code> permitted).
 * @param info  collects chart drawing information (<code>null</code> 
 *              permitted).
 */
public void draw(Graphics2D g2,
                 Rectangle2D area,
                 Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getDomainAxis();
    RectangleEdge edge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState, 
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:parabuild-ci    文件:CombinedRangeCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a 
 * printer).  Will perform all the placement calculations for each 
 * sub-plots and then tell these to draw themselves.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axis labels)
 *              should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the parent state.
 * @param info  collects information about the drawing (<code>null</code> 
 *              permitted).
 */
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    // calculate the data area...
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge rangeEdge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, rangeEdge);
    AxisState state = axis.draw(g2, cursor, area, dataArea, rangeEdge, 
            info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, state);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotArea[i], null, parentState, subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:parabuild-ci    文件:FastScatterPlot.java   
/**
 * Draws the fast scatter plot on a Java 2D graphics device (such as the 
 * screen or a printer).
 *
 * @param g2  the graphics device.
 * @param area   the area within which the plot (including axis labels)
 *                   should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the state from the parent plot (ignored).
 * @param info  collects chart drawing information (<code>null</code> 
 *              permitted).
 */
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = new AxisSpace();
    space = this.domainAxis.reserveSpace(g2, this, area, 
            RectangleEdge.BOTTOM, space);
    space = this.rangeAxis.reserveSpace(g2, this, area, RectangleEdge.LEFT, 
            space);
    Rectangle2D dataArea = space.shrink(area, null);

    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);

    AxisState domainAxisState = this.domainAxis.draw(g2, 
            dataArea.getMaxY(), area, dataArea, RectangleEdge.BOTTOM, info);
    AxisState rangeAxisState = this.rangeAxis.draw(g2, dataArea.getMinX(), 
            area, dataArea, RectangleEdge.LEFT, info);
    drawDomainGridlines(g2, dataArea, domainAxisState.getTicks());
    drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks());

    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 
            getForegroundAlpha()));

    render(g2, dataArea, info, null);

    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);

}
项目:parabuild-ci    文件:CombinedRangeXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 * 
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space (<code>null</code> 
 *                permitted).
 * @param parentState  the state from the parent plot, if there is one 
 *                     (<code>null</code> permitted).
 * @param info  collects chart drawing information (<code>null</code> 
 *              permitted).
 */
public void draw(Graphics2D g2,
                 Rectangle2D area,
                 Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);
    //this.axisOffset.trim(dataArea);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge edge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);

    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState, 
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:parabuild-ci    文件:CombinedDomainCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a 
 * printer).  Will perform all the placement calculations for each of the
 * sub-plots and then tell these to draw themselves.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axis labels) 
 *              should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the state from the parent plot, if there is one.
 * @param info  collects information about the drawing (<code>null</code> 
 *              permitted).
 */
public void draw(Graphics2D g2, 
                 Rectangle2D area, 
                 Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    area.setRect(area.getX() + insets.getLeft(),
            area.getY() + insets.getTop(),
            area.getWidth() - insets.getLeft() - insets.getRight(),
            area.getHeight() - insets.getTop() - insets.getBottom());


    // calculate the data area...
    setFixedRangeAxisSpaceForSubplots(null);
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    CategoryAxis axis = getDomainAxis();
    RectangleEdge domainEdge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, domainEdge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, 
            domainEdge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], null, parentState, subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:ccu-historian    文件:PolarPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).
 * <P>
 * This plot relies on a {@link PolarItemRenderer} to draw each
 * item in the plot.  This allows the visual representation of the data to
 * be changed easily.
 * <P>
 * The optional info argument collects information about the rendering of
 * the plot (dimensions, tooltip information etc).  Just pass in
 * <code>null</code> if you do not need this information.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axes and
 *              labels) should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  ignored.
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // if the plot area is too small, just return...
    boolean b1 = (area.getWidth() <= MINIMUM_WIDTH_TO_DRAW);
    boolean b2 = (area.getHeight() <= MINIMUM_HEIGHT_TO_DRAW);
    if (b1 || b2) {
        return;
    }

    // record the plot area...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for the plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    Rectangle2D dataArea = area;
    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);
    int axisCount = this.axes.size();
    AxisState state = null;
    for (int i = 0; i < axisCount; i++) {
        ValueAxis axis = getAxis(i);
        if (axis != null) {
            PolarAxisLocation location
                    = (PolarAxisLocation) this.axisLocations.get(i);
            AxisState s = this.drawAxis(axis, location, g2, dataArea);
            if (i == 0) {
                state = s;
            }
        }
    }

    // now for each dataset, get the renderer and the appropriate axis
    // and render the dataset...
    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            getForegroundAlpha()));
    this.angleTicks = refreshAngleTicks();
    drawGridlines(g2, dataArea, this.angleTicks, state.getTicks());
    render(g2, dataArea, info);
    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);
    drawCornerTextItems(g2, dataArea);
}
项目:ccu-historian    文件:PolarPlot.java   
/**
 * Draws the axis with the specified index.
 *
 * @param axis  the axis.
 * @param location  the axis location.
 * @param g2  the graphics target.
 * @param plotArea  the plot area.
 *
 * @return The axis state.
 *
 * @since 1.0.14
 */
protected AxisState drawAxis(ValueAxis axis, PolarAxisLocation location,
        Graphics2D g2, Rectangle2D plotArea) {

    double centerX = plotArea.getCenterX();
    double centerY = plotArea.getCenterY();
    double r = Math.min(plotArea.getWidth() / 2.0,
            plotArea.getHeight() / 2.0) - this.margin;
    double x = centerX - r;
    double y = centerY - r;

    Rectangle2D dataArea = null;
    AxisState result = null;
    if (location == PolarAxisLocation.NORTH_RIGHT) {
        dataArea = new Rectangle2D.Double(x, y, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.RIGHT, null);
    }
    else if (location == PolarAxisLocation.NORTH_LEFT) {
        dataArea = new Rectangle2D.Double(centerX, y, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.LEFT, null);
    }
    else if (location == PolarAxisLocation.SOUTH_LEFT) {
        dataArea = new Rectangle2D.Double(centerX, centerY, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.LEFT, null);
    }
    else if (location == PolarAxisLocation.SOUTH_RIGHT) {
        dataArea = new Rectangle2D.Double(x, centerY, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.RIGHT, null);
    }
    else if (location == PolarAxisLocation.EAST_ABOVE) {
        dataArea = new Rectangle2D.Double(centerX, centerY, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.TOP, null);
    }
    else if (location == PolarAxisLocation.EAST_BELOW) {
        dataArea = new Rectangle2D.Double(centerX, y, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.BOTTOM, null);
    }
    else if (location == PolarAxisLocation.WEST_ABOVE) {
        dataArea = new Rectangle2D.Double(x, centerY, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.TOP, null);
    }
    else if (location == PolarAxisLocation.WEST_BELOW) {
        dataArea = new Rectangle2D.Double(x, y, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.BOTTOM, null);
    }

    return result;
}
项目:ccu-historian    文件:CombinedDomainXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 *
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space (<code>null</code>
 *                permitted).
 * @param parentState  the state from the parent plot, if there is one
 *                     (<code>null</code> permitted).
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    setFixedRangeAxisSpaceForSubplots(null);
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getDomainAxis();
    RectangleEdge edge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:ccu-historian    文件:CombinedRangeCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).  Will perform all the placement calculations for each
 * sub-plots and then tell these to draw themselves.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axis labels)
 *              should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the parent state.
 * @param info  collects information about the drawing (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    // calculate the data area...
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge rangeEdge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, rangeEdge);
    AxisState state = axis.draw(g2, cursor, area, dataArea, rangeEdge,
            info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, state);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        Point2D subAnchor = null;
        if (anchor != null && this.subplotArea[i].contains(anchor)) {
            subAnchor = anchor;
        }
        plot.draw(g2, this.subplotArea[i], subAnchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:ccu-historian    文件:FastScatterPlot.java   
/**
 * Draws the fast scatter plot on a Java 2D graphics device (such as the
 * screen or a printer).
 *
 * @param g2  the graphics device.
 * @param area   the area within which the plot (including axis labels)
 *                   should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the state from the parent plot (ignored).
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
                 PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = new AxisSpace();
    space = this.domainAxis.reserveSpace(g2, this, area,
            RectangleEdge.BOTTOM, space);
    space = this.rangeAxis.reserveSpace(g2, this, area, RectangleEdge.LEFT,
            space);
    Rectangle2D dataArea = space.shrink(area, null);

    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);

    AxisState domainAxisState = this.domainAxis.draw(g2,
            dataArea.getMaxY(), area, dataArea, RectangleEdge.BOTTOM, info);
    AxisState rangeAxisState = this.rangeAxis.draw(g2, dataArea.getMinX(),
            area, dataArea, RectangleEdge.LEFT, info);
    drawDomainGridlines(g2, dataArea, domainAxisState.getTicks());
    drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks());

    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            getForegroundAlpha()));

    render(g2, dataArea, info, null);

    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);

}
项目:ccu-historian    文件:CombinedRangeXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 *
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space (<code>null</code>
 *                permitted).
 * @param parentState  the state from the parent plot, if there is one
 *                     (<code>null</code> permitted).
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);
    //this.axisOffset.trim(dataArea);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge edge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);

    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:ccu-historian    文件:CombinedDomainCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).  Will perform all the placement calculations for each of the
 * sub-plots and then tell these to draw themselves.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axis labels)
 *              should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the state from the parent plot, if there is one.
 * @param info  collects information about the drawing (<code>null</code>
 *              permitted).
 */
@Override
 public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    area.setRect(area.getX() + insets.getLeft(),
            area.getY() + insets.getTop(),
            area.getWidth() - insets.getLeft() - insets.getRight(),
            area.getHeight() - insets.getTop() - insets.getBottom());


    // calculate the data area...
    setFixedRangeAxisSpaceForSubplots(null);
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    CategoryAxis axis = getDomainAxis();
    RectangleEdge domainEdge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, domainEdge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea,
            domainEdge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        Point2D subAnchor = null;
        if (anchor != null && this.subplotAreas[i].contains(anchor)) {
            subAnchor = anchor;
        }
        plot.draw(g2, this.subplotAreas[i], subAnchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:jfreechart    文件:PolarPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).
 * <P>
 * This plot relies on a {@link PolarItemRenderer} to draw each
 * item in the plot.  This allows the visual representation of the data to
 * be changed easily.
 * <P>
 * The optional info argument collects information about the rendering of
 * the plot (dimensions, tooltip information etc).  Just pass in
 * {@code null} if you do not need this information.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axes and
 *              labels) should be drawn.
 * @param anchor  the anchor point ({@code null} permitted).
 * @param parentState  ignored.
 * @param info  collects chart drawing information ({@code null}
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // if the plot area is too small, just return...
    boolean b1 = (area.getWidth() <= MINIMUM_WIDTH_TO_DRAW);
    boolean b2 = (area.getHeight() <= MINIMUM_HEIGHT_TO_DRAW);
    if (b1 || b2) {
        return;
    }

    // record the plot area...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for the plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    Rectangle2D dataArea = area;
    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);
    int axisCount = this.axes.size();
    AxisState state = null;
    for (int i = 0; i < axisCount; i++) {
        ValueAxis axis = getAxis(i);
        if (axis != null) {
            PolarAxisLocation location
                    = (PolarAxisLocation) this.axisLocations.get(i);
            AxisState s = this.drawAxis(axis, location, g2, dataArea);
            if (i == 0) {
                state = s;
            }
        }
    }

    // now for each dataset, get the renderer and the appropriate axis
    // and render the dataset...
    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            getForegroundAlpha()));
    this.angleTicks = refreshAngleTicks();
    drawGridlines(g2, dataArea, this.angleTicks, state.getTicks());
    render(g2, dataArea, info);
    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);
    drawCornerTextItems(g2, dataArea);
}
项目:jfreechart    文件:PolarPlot.java   
/**
 * Draws the axis with the specified index.
 *
 * @param axis  the axis.
 * @param location  the axis location.
 * @param g2  the graphics target.
 * @param plotArea  the plot area.
 *
 * @return The axis state.
 *
 * @since 1.0.14
 */
protected AxisState drawAxis(ValueAxis axis, PolarAxisLocation location,
        Graphics2D g2, Rectangle2D plotArea) {

    double centerX = plotArea.getCenterX();
    double centerY = plotArea.getCenterY();
    double r = Math.min(plotArea.getWidth() / 2.0,
            plotArea.getHeight() / 2.0) - this.margin;
    double x = centerX - r;
    double y = centerY - r;

    Rectangle2D dataArea = null;
    AxisState result = null;
    if (location == PolarAxisLocation.NORTH_RIGHT) {
        dataArea = new Rectangle2D.Double(x, y, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.RIGHT, null);
    }
    else if (location == PolarAxisLocation.NORTH_LEFT) {
        dataArea = new Rectangle2D.Double(centerX, y, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.LEFT, null);
    }
    else if (location == PolarAxisLocation.SOUTH_LEFT) {
        dataArea = new Rectangle2D.Double(centerX, centerY, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.LEFT, null);
    }
    else if (location == PolarAxisLocation.SOUTH_RIGHT) {
        dataArea = new Rectangle2D.Double(x, centerY, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.RIGHT, null);
    }
    else if (location == PolarAxisLocation.EAST_ABOVE) {
        dataArea = new Rectangle2D.Double(centerX, centerY, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.TOP, null);
    }
    else if (location == PolarAxisLocation.EAST_BELOW) {
        dataArea = new Rectangle2D.Double(centerX, y, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.BOTTOM, null);
    }
    else if (location == PolarAxisLocation.WEST_ABOVE) {
        dataArea = new Rectangle2D.Double(x, centerY, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.TOP, null);
    }
    else if (location == PolarAxisLocation.WEST_BELOW) {
        dataArea = new Rectangle2D.Double(x, y, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.BOTTOM, null);
    }

    return result;
}
项目:jfreechart    文件:CombinedDomainXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 *
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space ({@code null}
 *                permitted).
 * @param parentState  the state from the parent plot, if there is one
 *                     ({@code null} permitted).
 * @param info  collects chart drawing information ({@code null}
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    setFixedRangeAxisSpaceForSubplots(null);
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getDomainAxis();
    RectangleEdge edge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:jfreechart    文件:CombinedRangeCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).  Will perform all the placement calculations for each
 * sub-plots and then tell these to draw themselves.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axis labels)
 *              should be drawn.
 * @param anchor  the anchor point ({@code null} permitted).
 * @param parentState  the parent state.
 * @param info  collects information about the drawing ({@code null}
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    // calculate the data area...
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge rangeEdge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, rangeEdge);
    AxisState state = axis.draw(g2, cursor, area, dataArea, rangeEdge,
            info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, state);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        Point2D subAnchor = null;
        if (anchor != null && this.subplotArea[i].contains(anchor)) {
            subAnchor = anchor;
        }
        plot.draw(g2, this.subplotArea[i], subAnchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:jfreechart    文件:FastScatterPlot.java   
/**
 * Draws the fast scatter plot on a Java 2D graphics device (such as the
 * screen or a printer).
 *
 * @param g2  the graphics device.
 * @param area   the area within which the plot (including axis labels)
 *                   should be drawn.
 * @param anchor  the anchor point ({@code null} permitted).
 * @param parentState  the state from the parent plot (ignored).
 * @param info  collects chart drawing information ({@code null}
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
                 PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = new AxisSpace();
    space = this.domainAxis.reserveSpace(g2, this, area,
            RectangleEdge.BOTTOM, space);
    space = this.rangeAxis.reserveSpace(g2, this, area, RectangleEdge.LEFT,
            space);
    Rectangle2D dataArea = space.shrink(area, null);

    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);

    AxisState domainAxisState = this.domainAxis.draw(g2,
            dataArea.getMaxY(), area, dataArea, RectangleEdge.BOTTOM, info);
    AxisState rangeAxisState = this.rangeAxis.draw(g2, dataArea.getMinX(),
            area, dataArea, RectangleEdge.LEFT, info);
    drawDomainGridlines(g2, dataArea, domainAxisState.getTicks());
    drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks());

    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            getForegroundAlpha()));

    render(g2, dataArea, info, null);

    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);

}
项目:jfreechart    文件:CombinedRangeXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 *
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space ({@code null}
 *                permitted).
 * @param parentState  the state from the parent plot, if there is one
 *                     ({@code null} permitted).
 * @param info  collects chart drawing information ({@code null}
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);
    //this.axisOffset.trim(dataArea);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge edge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);

    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:jfreechart    文件:CombinedDomainCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).  Will perform all the placement calculations for each of the
 * sub-plots and then tell these to draw themselves.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axis labels)
 *              should be drawn.
 * @param anchor  the anchor point ({@code null} permitted).
 * @param parentState  the state from the parent plot, if there is one.
 * @param info  collects information about the drawing ({@code null}
 *              permitted).
 */
@Override
 public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    area.setRect(area.getX() + insets.getLeft(),
            area.getY() + insets.getTop(),
            area.getWidth() - insets.getLeft() - insets.getRight(),
            area.getHeight() - insets.getTop() - insets.getBottom());


    // calculate the data area...
    setFixedRangeAxisSpaceForSubplots(null);
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    CategoryAxis axis = getDomainAxis();
    RectangleEdge domainEdge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, domainEdge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea,
            domainEdge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        Point2D subAnchor = null;
        if (anchor != null && this.subplotAreas[i].contains(anchor)) {
            subAnchor = anchor;
        }
        plot.draw(g2, this.subplotAreas[i], subAnchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:aya-lang    文件:PolarPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).
 * <P>
 * This plot relies on a {@link PolarItemRenderer} to draw each
 * item in the plot.  This allows the visual representation of the data to
 * be changed easily.
 * <P>
 * The optional info argument collects information about the rendering of
 * the plot (dimensions, tooltip information etc).  Just pass in
 * <code>null</code> if you do not need this information.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axes and
 *              labels) should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  ignored.
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // if the plot area is too small, just return...
    boolean b1 = (area.getWidth() <= MINIMUM_WIDTH_TO_DRAW);
    boolean b2 = (area.getHeight() <= MINIMUM_HEIGHT_TO_DRAW);
    if (b1 || b2) {
        return;
    }

    // record the plot area...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for the plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    Rectangle2D dataArea = area;
    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);
    int axisCount = this.axes.size();
    AxisState state = null;
    for (int i = 0; i < axisCount; i++) {
        ValueAxis axis = getAxis(i);
        if (axis != null) {
            PolarAxisLocation location
                    = (PolarAxisLocation) this.axisLocations.get(i);
            AxisState s = this.drawAxis(axis, location, g2, dataArea);
            if (i == 0) {
                state = s;
            }
        }
    }

    // now for each dataset, get the renderer and the appropriate axis
    // and render the dataset...
    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            getForegroundAlpha()));
    this.angleTicks = refreshAngleTicks();
    drawGridlines(g2, dataArea, this.angleTicks, state.getTicks());
    render(g2, dataArea, info);
    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);
    drawCornerTextItems(g2, dataArea);
}
项目:aya-lang    文件:PolarPlot.java   
/**
 * Draws the axis with the specified index.
 *
 * @param axis  the axis.
 * @param location  the axis location.
 * @param g2  the graphics target.
 * @param plotArea  the plot area.
 *
 * @return The axis state.
 *
 * @since 1.0.14
 */
protected AxisState drawAxis(ValueAxis axis, PolarAxisLocation location,
        Graphics2D g2, Rectangle2D plotArea) {

    double centerX = plotArea.getCenterX();
    double centerY = plotArea.getCenterY();
    double r = Math.min(plotArea.getWidth() / 2.0,
            plotArea.getHeight() / 2.0) - this.margin;
    double x = centerX - r;
    double y = centerY - r;

    Rectangle2D dataArea = null;
    AxisState result = null;
    if (location == PolarAxisLocation.NORTH_RIGHT) {
        dataArea = new Rectangle2D.Double(x, y, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.RIGHT, null);
    }
    else if (location == PolarAxisLocation.NORTH_LEFT) {
        dataArea = new Rectangle2D.Double(centerX, y, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.LEFT, null);
    }
    else if (location == PolarAxisLocation.SOUTH_LEFT) {
        dataArea = new Rectangle2D.Double(centerX, centerY, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.LEFT, null);
    }
    else if (location == PolarAxisLocation.SOUTH_RIGHT) {
        dataArea = new Rectangle2D.Double(x, centerY, r, r);
        result = axis.draw(g2, centerX, plotArea, dataArea,
                RectangleEdge.RIGHT, null);
    }
    else if (location == PolarAxisLocation.EAST_ABOVE) {
        dataArea = new Rectangle2D.Double(centerX, centerY, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.TOP, null);
    }
    else if (location == PolarAxisLocation.EAST_BELOW) {
        dataArea = new Rectangle2D.Double(centerX, y, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.BOTTOM, null);
    }
    else if (location == PolarAxisLocation.WEST_ABOVE) {
        dataArea = new Rectangle2D.Double(x, centerY, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.TOP, null);
    }
    else if (location == PolarAxisLocation.WEST_BELOW) {
        dataArea = new Rectangle2D.Double(x, y, r, r);
        result = axis.draw(g2, centerY, plotArea, dataArea,
                RectangleEdge.BOTTOM, null);
    }

    return result;
}
项目:aya-lang    文件:CombinedDomainXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 *
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space (<code>null</code>
 *                permitted).
 * @param parentState  the state from the parent plot, if there is one
 *                     (<code>null</code> permitted).
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    setFixedRangeAxisSpaceForSubplots(null);
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getDomainAxis();
    RectangleEdge edge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:aya-lang    文件:CombinedRangeCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).  Will perform all the placement calculations for each
 * sub-plots and then tell these to draw themselves.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axis labels)
 *              should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the parent state.
 * @param info  collects information about the drawing (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
                 PlotState parentState,
                 PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    // calculate the data area...
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge rangeEdge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, rangeEdge);
    AxisState state = axis.draw(g2, cursor, area, dataArea, rangeEdge,
            info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, state);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        Point2D subAnchor = null;
        if (anchor != null && this.subplotArea[i].contains(anchor)) {
            subAnchor = anchor;
        }
        plot.draw(g2, this.subplotArea[i], subAnchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:aya-lang    文件:FastScatterPlot.java   
/**
 * Draws the fast scatter plot on a Java 2D graphics device (such as the
 * screen or a printer).
 *
 * @param g2  the graphics device.
 * @param area   the area within which the plot (including axis labels)
 *                   should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the state from the parent plot (ignored).
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
                 PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = new AxisSpace();
    space = this.domainAxis.reserveSpace(g2, this, area,
            RectangleEdge.BOTTOM, space);
    space = this.rangeAxis.reserveSpace(g2, this, area, RectangleEdge.LEFT,
            space);
    Rectangle2D dataArea = space.shrink(area, null);

    if (info != null) {
        info.setDataArea(dataArea);
    }

    // draw the plot background and axes...
    drawBackground(g2, dataArea);

    AxisState domainAxisState = this.domainAxis.draw(g2,
            dataArea.getMaxY(), area, dataArea, RectangleEdge.BOTTOM, info);
    AxisState rangeAxisState = this.rangeAxis.draw(g2, dataArea.getMinX(),
            area, dataArea, RectangleEdge.LEFT, info);
    drawDomainGridlines(g2, dataArea, domainAxisState.getTicks());
    drawRangeGridlines(g2, dataArea, rangeAxisState.getTicks());

    Shape originalClip = g2.getClip();
    Composite originalComposite = g2.getComposite();

    g2.clip(dataArea);
    g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER,
            getForegroundAlpha()));

    render(g2, dataArea, info, null);

    g2.setClip(originalClip);
    g2.setComposite(originalComposite);
    drawOutline(g2, dataArea);

}
项目:aya-lang    文件:CombinedRangeXYPlot.java   
/**
 * Draws the plot within the specified area on a graphics device.
 *
 * @param g2  the graphics device.
 * @param area  the plot area (in Java2D space).
 * @param anchor  an anchor point in Java2D space (<code>null</code>
 *                permitted).
 * @param parentState  the state from the parent plot, if there is one
 *                     (<code>null</code> permitted).
 * @param info  collects chart drawing information (<code>null</code>
 *              permitted).
 */
@Override
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    insets.trim(area);

    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);
    //this.axisOffset.trim(dataArea);

    // set the width and height of non-shared axis of all sub-plots
    setFixedDomainAxisSpaceForSubplots(space);

    // draw the shared axis
    ValueAxis axis = getRangeAxis();
    RectangleEdge edge = getRangeAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, edge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea, edge, info);

    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the charts
    for (int i = 0; i < this.subplots.size(); i++) {
        XYPlot plot = (XYPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        plot.draw(g2, this.subplotAreas[i], anchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:aya-lang    文件:CombinedDomainCategoryPlot.java   
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a
 * printer).  Will perform all the placement calculations for each of the
 * sub-plots and then tell these to draw themselves.
 *
 * @param g2  the graphics device.
 * @param area  the area within which the plot (including axis labels)
 *              should be drawn.
 * @param anchor  the anchor point (<code>null</code> permitted).
 * @param parentState  the state from the parent plot, if there is one.
 * @param info  collects information about the drawing (<code>null</code>
 *              permitted).
 */
@Override
 public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor,
        PlotState parentState, PlotRenderingInfo info) {

    // set up info collection...
    if (info != null) {
        info.setPlotArea(area);
    }

    // adjust the drawing area for plot insets (if any)...
    RectangleInsets insets = getInsets();
    area.setRect(area.getX() + insets.getLeft(),
            area.getY() + insets.getTop(),
            area.getWidth() - insets.getLeft() - insets.getRight(),
            area.getHeight() - insets.getTop() - insets.getBottom());


    // calculate the data area...
    setFixedRangeAxisSpaceForSubplots(null);
    AxisSpace space = calculateAxisSpace(g2, area);
    Rectangle2D dataArea = space.shrink(area, null);

    // set the width and height of non-shared axis of all sub-plots
    setFixedRangeAxisSpaceForSubplots(space);

    // draw the shared axis
    CategoryAxis axis = getDomainAxis();
    RectangleEdge domainEdge = getDomainAxisEdge();
    double cursor = RectangleEdge.coordinate(dataArea, domainEdge);
    AxisState axisState = axis.draw(g2, cursor, area, dataArea,
            domainEdge, info);
    if (parentState == null) {
        parentState = new PlotState();
    }
    parentState.getSharedAxisStates().put(axis, axisState);

    // draw all the subplots
    for (int i = 0; i < this.subplots.size(); i++) {
        CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
        PlotRenderingInfo subplotInfo = null;
        if (info != null) {
            subplotInfo = new PlotRenderingInfo(info.getOwner());
            info.addSubplotInfo(subplotInfo);
        }
        Point2D subAnchor = null;
        if (anchor != null && this.subplotAreas[i].contains(anchor)) {
            subAnchor = anchor;
        }
        plot.draw(g2, this.subplotAreas[i], subAnchor, parentState,
                subplotInfo);
    }

    if (info != null) {
        info.setDataArea(dataArea);
    }

}
项目:fhaes    文件:NumericCategoryAxis.java   
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, RectangleEdge edge) {

    List ticks = new java.util.ArrayList();

    // sanity check for data area...
    if (dataArea.getHeight() <= 0.0 || dataArea.getWidth() < 0.0)
    {
        return ticks;
    }

    CategoryPlot plot = (CategoryPlot) getPlot();
    List categories = plot.getCategoriesForAxis(this);
    double max = 0.0;

    if (categories != null)
    {
        CategoryLabelPosition position = this.getCategoryLabelPositions().getLabelPosition(edge);
        float r = this.getMaximumCategoryLabelWidthRatio();
        if (r <= 0.0)
        {
            r = position.getWidthRatio();
        }

        float l = 0.0f;
        if (position.getWidthType() == CategoryLabelWidthType.CATEGORY)
        {
            l = (float) calculateCategorySize(categories.size(), dataArea, edge);
        }
        else
        {
            if (RectangleEdge.isLeftOrRight(edge))
            {
                l = (float) dataArea.getWidth();
            }
            else
            {
                l = (float) dataArea.getHeight();
            }
        }
        int categoryIndex = 0;
        Iterator iterator = categories.iterator();
        while (iterator.hasNext())
        {
            Comparable category = (Comparable) iterator.next();

            try
            {
                Integer intcategory = Integer.valueOf(category.toString());

                int modulus = intcategory % labelEveryXCategories;

                if (modulus != 0)
                    category = " ";

            }
            catch (NumberFormatException e)
            {

            }

            TextBlock label = createLabel(category, l * r, edge, g2);
            if (edge == RectangleEdge.TOP || edge == RectangleEdge.BOTTOM)
            {
                max = Math.max(max, calculateTextBlockHeight(label, position, g2));
            }
            else if (edge == RectangleEdge.LEFT || edge == RectangleEdge.RIGHT)
            {
                max = Math.max(max, calculateTextBlockWidth(label, position, g2));
            }
            Tick tick = new CategoryTick(category, label, position.getLabelAnchor(), position.getRotationAnchor(), position.getAngle());
            ticks.add(tick);
            categoryIndex = categoryIndex + 1;
        }
    }
    state.setMax(max);
    return ticks;
}