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


Java CategoryItemRendererState.getVisibleSeriesIndex方法代码示例

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


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

示例1: getPoints

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的package包/类
private List<Point2D> getPoints(int row, Rectangle2D dataArea, CategoryDataset dataset,
        CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRendererState state) {
    List<Point2D> points = Lists.newArrayList();
    for(int column = 0; true; column++) {
        Number v = null;
        try {
            v = dataset.getValue(row, column);
        } catch(Exception e) {}
        if (v == null) {
            break;
        }
        int visibleRow = state.getVisibleSeriesIndex(row);
        if (visibleRow < 0) {
            break;
        }
        int visibleRowCount = state.getVisibleSeriesCount();
        double x1;
        if (this.getUseSeriesOffset()) {
            x1 = domainAxis.getCategorySeriesMiddle(column,
                    dataset.getColumnCount(), visibleRow, visibleRowCount,
                    getItemMargin(), dataArea, plot.getDomainAxisEdge());
        }
        else {
            x1 = domainAxis.getCategoryMiddle(column, getColumnCount(),
                    dataArea, plot.getDomainAxisEdge());
        }
        double value = v.doubleValue();
        double y1 = rangeAxis.valueToJava2D(value, dataArea,
                plot.getRangeAxisEdge());
        points.add(new Point2D.Double(x1, y1));
    }
    return points;
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:34,代码来源:TrackingTowardsTargets.java

示例2: drawItem

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的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

示例3: drawItem

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的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<Double> 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 = 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:rapidminer,项目名称:rapidminer-studio,代码行数:69,代码来源:FormattedScatterRenderer.java

示例4: drawItem

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的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:rapidminer,项目名称:rapidminer-5,代码行数:78,代码来源:FormattedScatterRenderer.java

示例5: _drawItem

import org.jfree.chart.renderer.category.CategoryItemRendererState; //导入方法依赖的package包/类
private void _drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea,
    CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset,
    int row, int column, int pass) {
  StatisticalCategoryDataset statDataset = (StatisticalCategoryDataset) dataset;
  int visibleRow = state.getVisibleSeriesIndex(row);
  int visibleRowCount = state.getVisibleSeriesCount();
  PlotOrientation orientation = plot.getOrientation();
  // 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 meanValue = statDataset.getMeanValue(row, column);
  if (meanValue == null) {
    return;
  }
  double y1 = rangeAxis.valueToJava2D(meanValue.doubleValue(), dataArea,
          plot.getRangeAxisEdge());
  if (pass == 0 && getItemLineVisible(row, column)) {
    if (column != 0) {
      Number previousValue = statDataset.getValue(row, column - 1);
      if(previousValue != null) {
        // ignore this case here because the call to super.drawItem(...) took care if it.
        return;
      } else {
        // previous data point...
        Integer pIdx = findPreviousIndex(statDataset, row, column);
        if(pIdx == null) {
          return;
        }
        previousValue = statDataset.getValue(row, pIdx.intValue());
        double previous = previousValue.doubleValue();
        double x0;
        if (getUseSeriesOffset()) {
          x0 = domainAxis.getCategorySeriesMiddle(
              pIdx.intValue(), dataset.getColumnCount(),
              visibleRow, visibleRowCount,
              getItemMargin(), dataArea,
              plot.getDomainAxisEdge());
        }
        else {
          x0 = domainAxis.getCategoryMiddle(pIdx.intValue(),
              getColumnCount(), dataArea,
              plot.getDomainAxisEdge());
        }
        double y0 = rangeAxis.valueToJava2D(previous, dataArea,
            plot.getRangeAxisEdge());

        Line2D line = null;
        if (orientation == PlotOrientation.HORIZONTAL) {
          line = new Line2D.Double(y0, x0, y1, x1);
        }
        else if (orientation == PlotOrientation.VERTICAL) {
          line = new Line2D.Double(x0, y0, x1, y1);
        }
        g2.setPaint(getItemPaint(row, column));
        g2.setStroke(getItemStroke(row, column));
        g2.draw(line);
      }
    }
  }
}
 
开发者ID:uq-eresearch,项目名称:aorra,代码行数:70,代码来源:TrendsSeagrassAbundance.java


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