当前位置: 首页>>代码示例>>Java>>正文


Java CategoryAxis.draw方法代码示例

本文整理汇总了Java中org.jfree.chart.axis.CategoryAxis.draw方法的典型用法代码示例。如果您正苦于以下问题:Java CategoryAxis.draw方法的具体用法?Java CategoryAxis.draw怎么用?Java CategoryAxis.draw使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jfree.chart.axis.CategoryAxis的用法示例。


在下文中一共展示了CategoryAxis.draw方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: draw

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:66,代码来源:CombinedDomainCategoryPlot.java

示例2: draw

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * 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);
    }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:68,代码来源:CombinedDomainCategoryPlot.java


注:本文中的org.jfree.chart.axis.CategoryAxis.draw方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。