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


Java CategoryAxis.getCategoryMiddle方法代码示例

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


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

示例1: calculateBarW0

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * Calculates the coordinate of the first "side" of a bar.  This will be the minimum 
 * x-coordinate for a vertical bar, and the minimum y-coordinate for a horizontal bar.
 * 
 * @param plot  the plot.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param state  the renderer state (has the bar width precalculated).
 * @param row  the row index.
 * @param column  the column index.
 * 
 * @return the coordinate.
 */
protected double calculateBarW0(CategoryPlot plot, 
                                PlotOrientation orientation, 
                                Rectangle2D dataArea,
                                CategoryAxis domainAxis,
                                CategoryItemRendererState state,
                                int row,
                                int column) {
    // calculate bar width...
    double space = 0.0;
    if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.getHeight();
    }
    else {
        space = dataArea.getWidth();
    }
    double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), dataArea,
                                               plot.getDomainAxisEdge());
    int seriesCount = getRowCount();
    int categoryCount = getColumnCount();
    if (seriesCount > 1) {
        double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1));
        double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount);
        barW0 = barW0 + row * (seriesW + seriesGap) 
                      + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
    }
    else {
        barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea,
                                             plot.getDomainAxisEdge())
                - state.getBarWidth() / 2.0;
    }
    return barW0;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:47,代码来源:LevelRenderer.java

示例2: calculateBarW0

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * Calculates the coordinate of the first "side" of a bar.  This will be the minimum 
 * x-coordinate for a vertical bar, and the minimum y-coordinate for a horizontal bar.
 * 
 * @param plot  the plot.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param state  the renderer state (has the bar width precalculated).
 * @param row  the row index.
 * @param column  the column index.
 * 
 * @return the coordinate.
 */
protected double calculateBarW0(CategoryPlot plot, 
                                PlotOrientation orientation, 
                                Rectangle2D dataArea,
                                CategoryAxis domainAxis,
                                CategoryItemRendererState state,
                                int row,
                                int column) {
    // calculate bar width...
    double space = 0.0;
    if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.getHeight();
    }
    else {
        space = dataArea.getWidth();
    }
    double barW0 = domainAxis.getCategoryStart(
        column, getColumnCount(), dataArea, plot.getDomainAxisEdge()
    );
    int seriesCount = getRowCount();
    int categoryCount = getColumnCount();
    if (seriesCount > 1) {
        double seriesGap = space * getItemMargin() / (categoryCount * (seriesCount - 1));
        double seriesW = calculateSeriesWidth(space, domainAxis, categoryCount, seriesCount);
        barW0 = barW0 + row * (seriesW + seriesGap) 
                      + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
    }
    else {
        barW0 = domainAxis.getCategoryMiddle(
            column, getColumnCount(), dataArea, plot.getDomainAxisEdge()
        ) - state.getBarWidth() / 2.0;
    }
    return barW0;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:48,代码来源:BarRenderer.java

示例3: calculateBarW0

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * Calculates the coordinate of the first "side" of a bar.  This will be the minimum 
 * x-coordinate for a vertical bar, and the minimum y-coordinate for a horizontal bar.
 * 
 * @param plot  the plot.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param state  the renderer state (has the bar width precalculated).
 * @param row  the row index.
 * @param column  the column index.
 * 
 * @return the coordinate.
 */
protected double calculateBarW0(CategoryPlot plot, 
                                PlotOrientation orientation, 
                                Rectangle2D dataArea,
                                CategoryAxis domainAxis,
                                CategoryItemRendererState state,
                                int row,
                                int column) {
    // calculate bar width...
    double space = 0.0;
    if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.getHeight();
    }
    else {
        space = dataArea.getWidth();
    }
    double barW0 = domainAxis.getCategoryStart(
        column, getColumnCount(), dataArea, plot.getDomainAxisEdge()
    );
    int groupCount = this.seriesToGroupMap.getGroupCount();
    int groupIndex = this.seriesToGroupMap.getGroupIndex(
        this.seriesToGroupMap.getGroup(plot.getDataset().getRowKey(row))
    );
    int categoryCount = getColumnCount();
    if (groupCount > 1) {
        double groupGap = space * getItemMargin() / (categoryCount * (groupCount - 1));
        double groupW = calculateSeriesWidth(space, domainAxis, categoryCount, groupCount);
        barW0 = barW0 + groupIndex * (groupW + groupGap) 
                      + (groupW / 2.0) - (state.getBarWidth() / 2.0);
    }
    else {
        barW0 = domainAxis.getCategoryMiddle(
            column, getColumnCount(), dataArea, plot.getDomainAxisEdge()
        ) - state.getBarWidth() / 2.0;
    }
    return barW0;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:51,代码来源:GroupedStackedBarRenderer.java

示例4: calculateBarW0

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * Calculates the coordinate of the first "side" of a bar.  This will be 
 * the minimum x-coordinate for a vertical bar, and the minimum 
 * y-coordinate for a horizontal bar.
 * 
 * @param plot  the plot.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param state  the renderer state (has the bar width precalculated).
 * @param row  the row index.
 * @param column  the column index.
 * 
 * @return The coordinate.
 */
protected double calculateBarW0(CategoryPlot plot, 
                                PlotOrientation orientation, 
                                Rectangle2D dataArea,
                                CategoryAxis domainAxis,
                                CategoryItemRendererState state,
                                int row,
                                int column) {
    // calculate bar width...
    double space = 0.0;
    if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.getHeight();
    }
    else {
        space = dataArea.getWidth();
    }
    double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), 
            dataArea, plot.getDomainAxisEdge());
    int seriesCount = getRowCount();
    int categoryCount = getColumnCount();
    if (seriesCount > 1) {
        double seriesGap = space * getItemMargin() 
                / (categoryCount * (seriesCount - 1));
        double seriesW = calculateSeriesWidth(space, domainAxis, 
                categoryCount, seriesCount);
        barW0 = barW0 + row * (seriesW + seriesGap) 
                      + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
    }
    else {
        barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), 
                dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() 
                / 2.0;
    }
    return barW0;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:50,代码来源:LevelRenderer.java

示例5: calculateBarW0

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * Calculates the coordinate of the first "side" of a bar.  This will be 
 * the minimum x-coordinate for a vertical bar, and the minimum 
 * y-coordinate for a horizontal bar.
 *
 * @param plot  the plot.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param state  the renderer state (has the bar width precalculated).
 * @param row  the row index.
 * @param column  the column index.
 * 
 * @return The coordinate.
 */
protected double calculateBarW0(CategoryPlot plot, 
                                PlotOrientation orientation, 
                                Rectangle2D dataArea,
                                CategoryAxis domainAxis,
                                CategoryItemRendererState state,
                                int row,
                                int column) {
    // calculate bar width...
    double space = 0.0;
    if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.getHeight();
    }
    else {
        space = dataArea.getWidth();
    }
    double barW0 = domainAxis.getCategoryStart(column, getColumnCount(), 
            dataArea, plot.getDomainAxisEdge());
    int seriesCount = getRowCount();
    int categoryCount = getColumnCount();
    if (seriesCount > 1) {
        double seriesGap = space * getItemMargin() 
                           / (categoryCount * (seriesCount - 1));
        double seriesW = calculateSeriesWidth(space, domainAxis, 
                categoryCount, seriesCount);
        barW0 = barW0 + row * (seriesW + seriesGap) 
                      + (seriesW / 2.0) - (state.getBarWidth() / 2.0);
    }
    else {
        barW0 = domainAxis.getCategoryMiddle(column, getColumnCount(), 
                dataArea, plot.getDomainAxisEdge()) - state.getBarWidth() 
                / 2.0;
    }
    return barW0;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:50,代码来源:BarRenderer.java

示例6: calculateBarW0

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * Calculates the coordinate of the first "side" of a bar.  This will be 
 * the minimum x-coordinate for a vertical bar, and the minimum 
 * y-coordinate for a horizontal bar.
 * 
 * @param plot  the plot.
 * @param orientation  the plot orientation.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param state  the renderer state (has the bar width precalculated).
 * @param row  the row index.
 * @param column  the column index.
 * 
 * @return The coordinate.
 */
protected double calculateBarW0(CategoryPlot plot, 
                                PlotOrientation orientation, 
                                Rectangle2D dataArea,
                                CategoryAxis domainAxis,
                                CategoryItemRendererState state,
                                int row,
                                int column) {
    // calculate bar width...
    double space = 0.0;
    if (orientation == PlotOrientation.HORIZONTAL) {
        space = dataArea.getHeight();
    }
    else {
        space = dataArea.getWidth();
    }
    double barW0 = domainAxis.getCategoryStart(
        column, getColumnCount(), dataArea, plot.getDomainAxisEdge()
    );
    int groupCount = this.seriesToGroupMap.getGroupCount();
    int groupIndex = this.seriesToGroupMap.getGroupIndex(
        this.seriesToGroupMap.getGroup(plot.getDataset().getRowKey(row))
    );
    int categoryCount = getColumnCount();
    if (groupCount > 1) {
        double groupGap = space * getItemMargin() 
                          / (categoryCount * (groupCount - 1));
        double groupW = calculateSeriesWidth(
            space, domainAxis, categoryCount, groupCount
        );
        barW0 = barW0 + groupIndex * (groupW + groupGap) 
                      + (groupW / 2.0) - (state.getBarWidth() / 2.0);
    }
    else {
        barW0 = domainAxis.getCategoryMiddle(
            column, getColumnCount(), dataArea, plot.getDomainAxisEdge()
        ) - state.getBarWidth() / 2.0;
    }
    return barW0;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:55,代码来源:GroupedStackedBarRenderer.java

示例7: drawItem

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * This function is taken directly from JFreeChart with adjustments to draw differently colored
 * items.
 * 
 * When updating JFreeChart this function must probably be adapted.
 * 
 */
@Override
public void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot,
		CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass) {

	// do nothing if item is not visible
	if (!getItemVisible(row, column)) {
		return;
	}
	int visibleRow = state.getVisibleSeriesIndex(row);
	if (visibleRow < 0) {
		return;
	}
	int visibleRowCount = state.getVisibleSeriesCount();

	PlotOrientation orientation = plot.getOrientation();

	ValueSourceToMultiValueCategoryDatasetAdapter dataSet = (ValueSourceToMultiValueCategoryDatasetAdapter) dataset;
	List values = dataSet.getValues(row, column);
	if (values == null) {
		return;
	}
	int valueCount = values.size();
	for (int i = 0; i < valueCount; i++) {
		// current data point...
		double x1;
		if (getUseSeriesOffset()) {
			x1 = domainAxis.getCategorySeriesMiddle(column, dataset.getColumnCount(), visibleRow, visibleRowCount,
					getItemMargin(), dataArea, plot.getDomainAxisEdge());
		} else {
			x1 = domainAxis.getCategoryMiddle(column, getColumnCount(), dataArea, plot.getDomainAxisEdge());
		}
		Number n = (Number) values.get(i);
		int idx = dataSet.getValueIndex(row, column, i);
		double value = n.doubleValue();
		double y1 = rangeAxis.valueToJava2D(value, dataArea, plot.getRangeAxisEdge());

		Shape shape = getItemShape(row, idx);
		if (orientation == PlotOrientation.HORIZONTAL) {
			shape = ShapeUtilities.createTranslatedShape(shape, y1, x1);
		} else if (orientation == PlotOrientation.VERTICAL) {
			shape = ShapeUtilities.createTranslatedShape(shape, x1, y1);
		}
		if (getItemShapeFilled(row, column)) {
			if (getUseFillPaint()) {
				g2.setPaint(getItemFillPaint(row, column));
			} else {
				g2.setPaint(getItemPaint(row, idx));
			}
			g2.fill(shape);
		}
		if (getDrawOutlines()) {
			if (getUseOutlinePaint()) {
				g2.setPaint(getItemOutlinePaint(row, column));
			} else {
				g2.setPaint(getItemPaint(row, idx));
			}
			g2.setStroke(getItemOutlineStroke(row, column));
			g2.draw(shape);
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:69,代码来源:FormattedScatterRenderer.java

示例8: draw

import org.jfree.chart.axis.CategoryAxis; //导入方法依赖的package包/类
/**
 * Draws the annotation.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param dataArea  the data area.
 * @param domainAxis  the domain axis.
 * @param rangeAxis  the range axis.
 */
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea,
        CategoryAxis domainAxis, ValueAxis rangeAxis) {

    PlotOrientation orientation = plot.getOrientation();
    RectangleEdge domainEdge = Plot.resolveDomainAxisLocation(
            plot.getDomainAxisLocation(), orientation);
    RectangleEdge rangeEdge = Plot.resolveRangeAxisLocation(
            plot.getRangeAxisLocation(), orientation);
    CategoryDataset dataset = plot.getDataset();
    int catIndex = dataset.getColumnIndex(getCategory());
    int catCount = dataset.getColumnCount();
    double j2DX = domainAxis.getCategoryMiddle(catIndex, catCount, 
            dataArea, domainEdge);
    double j2DY = rangeAxis.valueToJava2D(getValue(), dataArea, rangeEdge);
    if (orientation == PlotOrientation.HORIZONTAL) {
        double temp = j2DX;
        j2DX = j2DY;
        j2DY = temp;
    }
    double startX = j2DX + Math.cos(this.angle) * this.baseRadius;
    double startY = j2DY + Math.sin(this.angle) * this.baseRadius;

    double endX = j2DX + Math.cos(this.angle) * this.tipRadius;
    double endY = j2DY + Math.sin(this.angle) * this.tipRadius;

    double arrowBaseX = endX + Math.cos(this.angle) * this.arrowLength;
    double arrowBaseY = endY + Math.sin(this.angle) * this.arrowLength;

    double arrowLeftX = arrowBaseX 
        + Math.cos(this.angle + Math.PI / 2.0) * this.arrowWidth;
    double arrowLeftY = arrowBaseY 
        + Math.sin(this.angle + Math.PI / 2.0) * this.arrowWidth;

    double arrowRightX = arrowBaseX 
        - Math.cos(this.angle + Math.PI / 2.0) * this.arrowWidth;
    double arrowRightY = arrowBaseY 
        - Math.sin(this.angle + Math.PI / 2.0) * this.arrowWidth;

    GeneralPath arrow = new GeneralPath();
    arrow.moveTo((float) endX, (float) endY);
    arrow.lineTo((float) arrowLeftX, (float) arrowLeftY);
    arrow.lineTo((float) arrowRightX, (float) arrowRightY);
    arrow.closePath();

    g2.setStroke(this.arrowStroke);
    g2.setPaint(this.arrowPaint);
    Line2D line = new Line2D.Double(startX, startY, endX, endY);
    g2.draw(line);
    g2.fill(arrow);

    // draw the label
    g2.setFont(getFont());
    g2.setPaint(getPaint());
    double labelX = j2DX 
        + Math.cos(this.angle) * (this.baseRadius + this.labelOffset);
    double labelY = j2DY 
        + Math.sin(this.angle) * (this.baseRadius + this.labelOffset);
    /* Rectangle2D hotspot = */ TextUtilities.drawAlignedString(getText(), 
            g2, (float) labelX, (float) labelY, getTextAnchor());
    // TODO: implement the entity for the annotation
    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:72,代码来源:CategoryPointerAnnotation.java


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