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


Java PointRenderer类代码示例

本文整理汇总了Java中de.erichseifert.gral.plots.points.PointRenderer的典型用法代码示例。如果您正苦于以下问题:Java PointRenderer类的具体用法?Java PointRenderer怎么用?Java PointRenderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PointRenderer类属于de.erichseifert.gral.plots.points包,在下文中一共展示了PointRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setPointRenderers

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
/**
 * Sets the {@code PointRenderer}s for a certain data source to the specified value.
 * @param s Data source.
 * @param pointRendererFirst First PointRenderer.
 * @param pointRenderers Remaining PointRenderers to be set.
 */
public void setPointRenderers(DataSource s, PointRenderer pointRendererFirst, PointRenderer... pointRenderers) {
	List<PointRenderer> pointRendererList = null;
	if (pointRendererFirst == null) {
		setPointRenderers(s, pointRendererList);
		return;
	}
	pointRendererList = new ArrayList<>(pointRenderers.length + 1);
	pointRendererList.add(pointRendererFirst);
	for (PointRenderer pointRenderer : pointRenderers) {
		if (pointRenderer == null) {
			throw new IllegalArgumentException("A PointRenderer for a DataSource cannot be null.");
		}
		pointRendererList.add(pointRenderer);
	}
	setPointRenderers(s, pointRendererList);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:23,代码来源:XYPlot.java

示例2: add

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
@Override
public void add(int index, DataSource source, boolean visible) {
	super.add(index, source, visible);

	// Set axis mapping
	setMapping(source, AXIS_X, AXIS_Y);
	// The mapping from columns to axes has changed, so scaling has to be
	// refreshed
	autoscaleAxes();

	// Assign default renderers
	PointRenderer pointRendererDefault = new DefaultPointRenderer2D();
	LineRenderer lineRendererDefault = null;
	AreaRenderer areaRendererDefault = null;
	// FIXME: Overwrites possible present point and line renderers
	setPointRenderers(source, pointRendererDefault);
	setLineRenderers(source, lineRendererDefault);
	setAreaRenderers(source, areaRendererDefault);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:20,代码来源:XYPlot.java

示例3: getValue

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
/**
 * Returns a graphical representation of the value label to be drawn for
 * the specified data value.
 * @param data Information on axes, renderers, and values.
 * @param shape Outline that describes the bounds for the value label.
 * @return Component that can be used to draw the value label.
 */
@Override
public Drawable getValue(final PointData data, final Shape shape) {
	return new AbstractDrawable() {
		/** Version id for serialization. */
		private static final long serialVersionUID1 = -1133369168849171793L;

		public void draw(DrawingContext context) {
			PointRenderer renderer = BarRenderer.this;
			Row row = data.row;

			if (renderer.isValueVisible()) {
				int colValue = renderer.getValueColumn();
				drawValueLabel(context, shape, row, data.index, colValue);
			}
		}
	};
}
 
开发者ID:eseifert,项目名称:gral,代码行数:25,代码来源:BarPlot.java

示例4: testSerialization

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
@Test
public void testSerialization() throws IOException, ClassNotFoundException {
	BoxPlot original = plot;
	BoxPlot deserialized = TestUtils.serializeAndDeserialize(original);

	assertEquals(original.getBackground(), deserialized.getBackground());
	assertEquals(original.getBorderStroke(), deserialized.getBorderStroke());
	assertEquals(original.getBorderColor(), deserialized.getBorderColor());
	assertEquals(original.isLegendVisible(), deserialized.isLegendVisible());
	assertEquals(original.getLegendLocation(), deserialized.getLegendLocation());
	assertEquals(original.getLegendDistance(), deserialized.getLegendDistance(), DELTA);

	List<DataSource> dataSourcesOriginal = original.getData();
	List<DataSource> dataSourcesDeserialized = deserialized.getData();
	assertEquals(dataSourcesOriginal.size(), dataSourcesDeserialized.size());
	for (int index = 0; index < dataSourcesOriginal.size(); index++) {
		List<PointRenderer> pointRenderersOriginal = original.getPointRenderers(
						dataSourcesOriginal.get(index));
		List<PointRenderer> pointRenderersDeserialized = deserialized.getPointRenderers(
						dataSourcesDeserialized.get(index));
		testPointRendererSerialization(pointRenderersOriginal, pointRenderersDeserialized);
	}
   }
 
开发者ID:eseifert,项目名称:gral,代码行数:24,代码来源:BoxPlotTest.java

示例5: testPointRendererSerialization

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
private static void testPointRendererSerialization(
		List<PointRenderer> originalRenderers, List<PointRenderer> deserializedRenderers) {
	for (int rendererIndex = 0; rendererIndex < originalRenderers.size(); rendererIndex++) {
		BoxWhiskerRenderer original = (BoxWhiskerRenderer) originalRenderers.get(rendererIndex);
		BoxWhiskerRenderer deserialized = (BoxWhiskerRenderer) deserializedRenderers.get(rendererIndex);
		assertEquals(original.getPositionColumn(), deserialized.getPositionColumn());
		assertEquals(original.getCenterBarColumn(), deserialized.getCenterBarColumn());
		assertEquals(original.getBottomBarColumn(), deserialized.getBottomBarColumn());
		assertEquals(original.getBoxBottomColumn(), deserialized.getBoxBottomColumn());
		assertEquals(original.getBoxTopColumn(), deserialized.getBoxTopColumn());
		assertEquals(original.getTopBarColumn(), deserialized.getTopBarColumn());
		assertEquals(original.getBoxWidth(), deserialized.getBoxWidth(), DELTA);
		assertEquals(original.getBoxBackground(), deserialized.getBoxBackground());
		assertEquals(original.getBoxBorderColor(), deserialized.getBoxBorderColor());
		assertEquals(original.getBoxBorderStroke(), deserialized.getBoxBorderStroke());
		assertEquals(original.getWhiskerColor(), deserialized.getWhiskerColor());
		assertEquals(original.getWhiskerStroke(), deserialized.getWhiskerStroke());
		assertEquals(original.getBarWidth(), deserialized.getBarWidth(), DELTA);
		assertEquals(original.getCenterBarColor(), deserialized.getCenterBarColor());
		assertEquals(original.getCenterBarStroke(), deserialized.getCenterBarStroke());
	}
}
 
开发者ID:eseifert,项目名称:gral,代码行数:23,代码来源:BoxPlotTest.java

示例6: formatFilledArea

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
private static void formatFilledArea(XYPlot plot, DataSource data, Color color) {
	PointRenderer point = new DefaultPointRenderer2D();
       point.setShape(new Ellipse2D.Double(-3,-3,6,6));
	point.setColor(color);
	plot.setPointRenderer(data, point);

	LineRenderer line = new DefaultLineRenderer2D();
	line.setColor(color);
       float[] DOT_DOT = {4.0f, 4.0f};
       line.setStroke(new BasicStroke(4.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.f, DOT_DOT, 0.f));
	line.setGap(3.0);
	line.setGapRounded(true);
	plot.setLineRenderer(data, line);

       AreaRenderer area = new DefaultAreaRenderer2D();
	area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
	plot.setAreaRenderer(data, area);
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:19,代码来源:AreaPlot.java

示例7: XYPlot

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
/**
 * Initializes a new instance object with the specified data sources and
 * reasonable default settings.
 * @param data Data to be displayed.
 */
public XYPlot(DataSource... data) {
	super();

	pointRenderers = new HashMap<DataSource, PointRenderer>(data.length);
	lineRenderers = new HashMap<DataSource, LineRenderer>(data.length);
	areaRenderers = new HashMap<DataSource, AreaRenderer>(data.length);

	setPlotArea(new XYPlotArea2D(this));
	setLegend(new XYLegend(this));

	// Handle data sources after the renderer lists are initialized
	for (DataSource source : data) {
		add(source);
	}

	createDefaultAxes();
	autoscaleAxes();
	createDefaultAxisRenderers();

	// Listen for changes of the axis range
	for (String axisName : getAxesNames()) {
		getAxis(axisName).addAxisListener(this);
	}
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:30,代码来源:XYPlot.java

示例8: PiePlot

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
/**
 * Initializes a new pie plot with the specified data source.
 * @param data Data to be displayed.
 */
public PiePlot(DataSource data) {
	super();

	setSettingDefault(CENTER, new Point2D.Double(0.5, 0.5));
	setSettingDefault(RADIUS, 1.0);
	setSettingDefault(START, 0.0);
	setSettingDefault(CLOCKWISE, true);

	pointRenderers = new HashMap<DataSource, PointRenderer>();
	slices = new HashMap<DataSource, List<Slice>>();

	setPlotArea(new PiePlotArea2D(this));
	setLegend(new PiePlotLegend(this));

	add(data);

	createDefaultAxes();
	createDefaultAxisRenderers();

	dataUpdated(data);
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:26,代码来源:PiePlot.java

示例9: formatFilledArea

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
private static void formatFilledArea(XYPlot plot, DataSource data, Color color) {
	PointRenderer point = new DefaultPointRenderer2D();
	point.setColor(color);
	plot.setPointRenderer(data, point);
	LineRenderer line = new DefaultLineRenderer2D();
	line.setColor(color);
	line.setGap(3.0);
	line.setGapRounded(true);
	plot.setLineRenderer(data, line);
	AreaRenderer area = new DefaultAreaRenderer2D();
	area.setColor(GraphicsUtils.deriveWithAlpha(color, 64));
	plot.setAreaRenderer(data, area);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:14,代码来源:AreaPlot.java

示例10: formatLineArea

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
private static void formatLineArea(XYPlot plot, DataSource data, Color color) {
	PointRenderer point = new DefaultPointRenderer2D();
	point.setColor(color);
	plot.setPointRenderer(data, point);
	plot.setLineRenderer(data, null);
	AreaRenderer area = new LineAreaRenderer2D();
	area.setGap(3.0);
	area.setColor(color);
	plot.setAreaRenderer(data, area);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:11,代码来源:AreaPlot.java

示例11: render

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
@Override
public void render(Canvas componentCanvas, PLLineChartBlock component) {
    PLLinePlotData data = component.getData();
    if(data != null){
        int linesCount = data.getY().size();
        Class[] classes = Arrays.stream((new Class[linesCount + 1])).map(v -> Double.class).toArray(Class[]::new);
        DataTable dataTable = new DataTable(classes);
        for(int i = 0;i < linesCount;i++){
            final int index = i;
            Double[] points = Stream.concat(Stream.of(data.getX().get(index)),
                    data.getY().stream().map(lineData -> lineData.getY().get(index))).toArray(Double[]::new);
            dataTable.add(points);
        }
        DataSeries[] dataSeries = IntStream.range(0, linesCount).mapToObj(index -> new DataSeries(data.getY().get(index).getName(), dataTable, 0, index + 1)).toArray(DataSeries[]::new);
        XYPlot plot = new XYPlot(dataSeries);
        super.preparePlot(plot, component);
        plot.getAxisRenderer(XYPlot.AXIS_X).setIntersection(-Double.MAX_VALUE);
        plot.getAxisRenderer(XYPlot.AXIS_Y).setIntersection(-Double.MAX_VALUE);

        Color[] seriesColor = (component.getData().getY() == null)?null:component.getData().getY().stream().map(point -> PLColor.create(point.getColor(), Color.class)).toArray(Color[]::new);
        if(seriesColor != null){
            for(int i = 0;i < seriesColor.length;i++){
                try{
                    PointRenderer ptRenderer = new DefaultPointRenderer2D();
                    LineRenderer lineRenderer = new DefaultLineRenderer2D();
                    Color lineColor = seriesColor[i];
                    ptRenderer.setColor(lineColor);
                    lineRenderer.setColor(lineColor);
                    plot.setPointRenderers(dataSeries[i], ptRenderer);
                    plot.setLineRenderers(dataSeries[i], lineRenderer);
                }catch(Exception e){
                    logger.error("Error caused when trying to set color for a series", e);
                }
            }
        }
        super.drawPlot(plot, component, componentCanvas);
    }else{
        logger.warn("data not set, not rendering " + component);
    }
}
 
开发者ID:Amine-H,项目名称:PDFLego,代码行数:41,代码来源:LineChartRenderStrategy.java

示例12: getPointRenderers

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
/**
 * Returns all {@code PointRenderer}s that display the data of the specified data source.
 * @param s Data source in question.
 * @return Renderers being applied on the specified data source.
 */
public List<PointRenderer> getPointRenderers(DataSource s) {
	List<PointRenderer> pointRenderers = pointRenderersByDataSource.get(s);
	if (pointRenderers != null) {
		return Collections.unmodifiableList(pointRenderers);
	}
	return Collections.emptyList();
}
 
开发者ID:eseifert,项目名称:gral,代码行数:13,代码来源:XYPlot.java

示例13: addPointRenderer

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
/**
 * Adds a {@code PointRenderer} for the specified data source.
 * @param s Data to be rendered.
 * @param pointRenderer PointRenderer to be used.
 */
public void addPointRenderer(DataSource s, PointRenderer pointRenderer) {
	List<PointRenderer> pointRenderers = pointRenderersByDataSource.get(s);
	if (pointRenderers == null) {
		pointRenderers = new ArrayList<>();
		pointRenderersByDataSource.put(s, pointRenderers);
	}
	pointRenderers.add(pointRenderer);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:14,代码来源:XYPlot.java

示例14: removePointRenderer

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
/**
 * Decouples the specified {@code PointRenderer} from the rendering of the specified data source.
 * @param s Data to be rendered no longer.
 * @param pointRenderer PointRenderer to be removed.
 */
public void removePointRenderer(DataSource s, PointRenderer pointRenderer) {
	List<PointRenderer> pointRenderers = pointRenderersByDataSource.get(s);
	if (pointRenderers != null) {
		pointRenderers.remove(pointRenderer);
	}
}
 
开发者ID:eseifert,项目名称:gral,代码行数:12,代码来源:XYPlot.java

示例15: getSymbol

import de.erichseifert.gral.plots.points.PointRenderer; //导入依赖的package包/类
@Override
protected Drawable getSymbol(final Row row) {
	List<PointRenderer> pointRenderers = plot.getPointRenderers(row.getSource());
	BarRenderer barRenderer = (BarRenderer) pointRenderers.get(0);
	return new BarPlot.LegendSymbol(row, barRenderer,
			plot.getFont(), plot.getLegend().getSymbolSize());
}
 
开发者ID:eseifert,项目名称:gral,代码行数:8,代码来源:BarPlot.java


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