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


Java CategoryAxis.getCategorySeriesMiddle方法代码示例

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


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

示例1: 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


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