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


Java CategoryItemRendererState.getBarWidth方法代码示例

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


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

示例1: drawMean

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的package包/类
private double drawMean(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, ValueAxis rangeAxis,
        int row, int column, BoxAndWhiskerCategoryDataset bawDataset, double xx, double aRadius,
        RectangleEdge location) {
    double yyAverage;
    double newARadius = aRadius;
    // draw mean - SPECIAL AIMS REQUIREMENT...
    Number yMean = bawDataset.getMeanValue(row, column);
    if (yMean != null) {
        yyAverage = rangeAxis.valueToJava2D(yMean.doubleValue(), dataArea, location);
        newARadius = state.getBarWidth() / 4;
        Ellipse2D.Double avgEllipse = new Ellipse2D.Double(xx + aRadius, yyAverage - aRadius, aRadius * 2,
                aRadius * 2);
        g2.fill(avgEllipse);
        g2.draw(avgEllipse);
    }
    return newARadius;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:18,代码来源:BoxAndWhiskerCoinPlotRenderer.java

示例2: calculateBarW0

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的package包/类
@Override
protected double calculateBarW0(CategoryPlot plot,
        PlotOrientation orientation, Rectangle2D dataArea,
        CategoryAxis domainAxis, CategoryItemRendererState state,
        int row, int column) {
    return domainAxis.getCategoryMiddle(column, getColumnCount(),
            dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() / 2.0;
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:9,代码来源:PSIIMaxHeq.java

示例3: initialise

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public CategoryItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot,
        int rendererIndex, PlotRenderingInfo info) {

    CategoryItemRendererState state = super.initialise(g2, dataArea, plot, rendererIndex, info);

    if (state.getBarWidth() > maxBarWidth) {
        state.setBarWidth(maxBarWidth);
    }
    return state;

}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:16,代码来源:BoxAndWhiskerCoinPlotRenderer.java

示例4: drawRectangles

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的package包/类
private RectangleEdge drawRectangles(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea,
        CategoryPlot plot, ValueAxis rangeAxis, int row, int column, BoxAndWhiskerCategoryDataset bawDataset,
        double xx) {
    RectangleEdge location = plot.getRangeAxisEdge();

    Number yQ1 = bawDataset.getQ1Value(row, column);
    Number yQ3 = bawDataset.getQ3Value(row, column);
    Number yMax = bawDataset.getMaxRegularValue(row, column);
    Number yMin = bawDataset.getMinRegularValue(row, column);
    Shape box = null;
    if (yQ1 != null && yQ3 != null && yMax != null && yMin != null) {
        double yyQ1 = rangeAxis.valueToJava2D(yQ1.doubleValue(), dataArea, location);
        double yyQ3 = rangeAxis.valueToJava2D(yQ3.doubleValue(), dataArea, location);
        double yyMax = rangeAxis.valueToJava2D(yMax.doubleValue(), dataArea, location);
        double yyMin = rangeAxis.valueToJava2D(yMin.doubleValue(), dataArea, location);
        double xxmid = xx + state.getBarWidth() / 2.0;

        // draw the upper shadow...
        g2.draw(new Line2D.Double(xxmid, yyMax, xxmid, yyQ3));
        g2.draw(new Line2D.Double(xx, yyMax, xx + state.getBarWidth(), yyMax));

        // draw the lower shadow...
        g2.draw(new Line2D.Double(xxmid, yyMin, xxmid, yyQ1));
        g2.draw(new Line2D.Double(xx, yyMin, xx + state.getBarWidth(), yyMin));

        // draw the body...
        box = new Rectangle2D.Double(xx, Math.min(yyQ1, yyQ3), state.getBarWidth(), Math.abs(yyQ1 - yyQ3));
        if (getFillBox()) {
            g2.fill(box);
        }
        g2.draw(box);
    }
    return location;
}
 
开发者ID:NCIP,项目名称:caintegrator,代码行数:35,代码来源:BoxAndWhiskerCoinPlotRenderer.java

示例5: drawItem

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的package包/类
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state,
        Rectangle2D dataArea, CategoryPlot plot,
        CategoryAxis domainAxis, ValueAxis rangeAxis,
        CategoryDataset dataset, int row, int column, int pass) {
    super.drawItem(g2, state, dataArea, plot, domainAxis, rangeAxis, dataset, row,
            column, pass);
    // after the stacked bar is completely rendered draw the glow text into it.
    if((pass == 2) && isSeriesComplete(dataset, row) && renderBarLabel(dataset, row, column)) {
        GraphUtils g = new GraphUtils(g2);
        String rowKey = dataset.getRowKey(row).toString();
        String colKey = dataset.getColumnKey(column).toString();
        String label = String.format("%s %s", colKey, getSeries(rowKey));
        double barW0 = calculateBarW0(plot, plot.getOrientation(), dataArea, domainAxis,
                state, row, column);
        // centre the label
        double labelx = barW0 + state.getBarWidth()/2;
        double labely = (dataArea.getMinY()+dataArea.getHeight() / 2) -
                (g.getBounds(label).getWidth() / 2);
        AffineTransform saveT = g2.getTransform();
        AffineTransform transform = new AffineTransform();
        // jfree chart seem to be using the transform on the Graphics2D object 
        // for scaling when the window gets very small or large
        // therefore we can not just overwrite the transform but have to factor it into 
        // our rotation and translation transformations.
        transform.concatenate(saveT);
        transform.concatenate(AffineTransform.getRotateInstance(-Math.PI/2, labelx, labely));
        g2.setTransform(transform);
        g2.setFont(LEGEND_FONT);
        g2.setColor(Color.black);
        g.drawGlowString(label, Color.white, 6, (int)labelx, (int)labely);
        g2.setTransform(saveT);
    }
    if((pass == 2) && isLastRow(dataset, row)) {
        // Workaround: because the dataArea sits on the the Axis the 0% gridline gets drawn 
        // over the category axis making it gray. To fix this as we draw another black line
        // to restore the black axis.
        g2.setColor(Color.black);
        g2.setStroke(new BasicStroke(2));
        g2.drawLine((int)dataArea.getMinX(), (int)dataArea.getMaxY(), (int)dataArea.getMaxX(), (int)dataArea.getMaxY());
        g2.drawLine((int)dataArea.getMinX(), (int)dataArea.getMinY(), (int)dataArea.getMinX(), (int)dataArea.getMaxY());
    }
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:44,代码来源:LandPracticeSystems.java

示例6: initialise

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的package包/类
/**
 * Initialises the renderer.  This method gets called once at the start of 
 * the process of drawing a chart.
 *
 * @param g2  the graphics device.
 * @param dataArea  the area in which the data is to be plotted.
 * @param plot  the plot.
 * @param rendererIndex  the renderer index.
 * @param info  collects chart rendering information for return to caller.
 *
 * @return The renderer state.
 */
public CategoryItemRendererState initialise(Graphics2D g2,
                                            Rectangle2D dataArea,
                                            CategoryPlot plot,
                                            int rendererIndex,
                                            PlotRenderingInfo info) {

    CategoryItemRendererState state = super.initialise(
        g2, dataArea, plot, rendererIndex, info
    );

    // calculate the box width
    CategoryAxis domainAxis = getDomainAxis(plot, rendererIndex);
    CategoryDataset dataset = plot.getDataset(rendererIndex);
    if (dataset != null) {
        int columns = dataset.getColumnCount();
        int rows = dataset.getRowCount();
        double space = 0.0;
        PlotOrientation orientation = plot.getOrientation();
        if (orientation == PlotOrientation.HORIZONTAL) {
            space = dataArea.getHeight();
        }
        else if (orientation == PlotOrientation.VERTICAL) {
            space = dataArea.getWidth();
        }
        double categoryMargin = 0.0;
        double currentItemMargin = 0.0;
        if (columns > 1) {
            categoryMargin = domainAxis.getCategoryMargin();
        }
        if (rows > 1) {
            currentItemMargin = getItemMargin();
        }
        double used = space * (1 - domainAxis.getLowerMargin() 
                                 - domainAxis.getUpperMargin()
                                 - categoryMargin - currentItemMargin);
        if ((rows * columns) > 0) {
            state.setBarWidth(
                used / (dataset.getColumnCount() * dataset.getRowCount())
            );
        }
        else {
            state.setBarWidth(used);
        }
    }
    
    if (state.getBarWidth() > maxBarWidth)
    	state.setBarWidth(maxBarWidth);
    return state;

}
 
开发者ID:NCIP,项目名称:stats-application-commons,代码行数:63,代码来源:BoxAndWhiskerDotsRenderer.java


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