當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。