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


Java DefaultPointRenderer2D类代码示例

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


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

示例1: add

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的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

示例2: formatFilledArea

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的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

示例3: formatFilledArea

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的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

示例4: formatLineArea

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的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

示例5: render

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的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

示例6: testGetPointRenderers

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的package包/类
@Test
public void testGetPointRenderers() {
	DataSource data = new DummyData(2, 1, 1.0);
	MockXYPlot plot = new MockXYPlot(data);
	PointRenderer renderer1 = new DefaultPointRenderer2D();
	PointRenderer renderer2 = new DefaultPointRenderer2D();
	plot.setPointRenderers(data, renderer1, renderer2);
	assertNotNull(plot.getPointRenderers(new DummyData(4, 2, 0.0)));
	assertNotNull(plot.getPointRenderers(null));

	List<PointRenderer> renderers = plot.getPointRenderers(data);
	assertTrue(renderers.contains(renderer1));
	assertTrue(renderers.contains(renderer2));
	assertEquals(renderers.size(), 2);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:16,代码来源:XYPlotTest.java

示例7: testAddPointRenderer

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的package包/类
@Test
public void testAddPointRenderer() {
	DataSource data = new DummyData(2, 1, 1);
	MockXYPlot plot = new MockXYPlot();
	assertTrue(plot.getPointRenderers(data).isEmpty());

	PointRenderer renderer = new DefaultPointRenderer2D();
	plot.addPointRenderer(data, renderer);
	List<PointRenderer> pointRenderers = plot.getPointRenderers(data);
	assertEquals(pointRenderers.size(), 1);
	assertEquals(pointRenderers.get(0), renderer);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:13,代码来源:XYPlotTest.java

示例8: testRemovePointRenderer

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的package包/类
@Test
public void testRemovePointRenderer() {
	DataSource data = new DummyData(2, 1, 1);
	MockXYPlot plot = new MockXYPlot();
	plot.removePointRenderer(null, null);
	plot.removePointRenderer(data, null);

	PointRenderer renderer = new DefaultPointRenderer2D();
	plot.addPointRenderer(data, renderer);
	plot.removePointRenderer(data, renderer);
	assertTrue(plot.getPointRenderers(data).isEmpty());
}
 
开发者ID:eseifert,项目名称:gral,代码行数:13,代码来源:XYPlotTest.java

示例9: formatFilledArea

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

示例10: formatLineArea

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

示例11: MultiplePointRenderers

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public MultiplePointRenderers() {
	// Generate data
	DataTable data = new DataTable(Double.class, Double.class);
	for (double x = 1.0; x <= 20.0; x += 1.0) {
		data.add(x, x*x);
	}

	// Create new xy-plot
	XYPlot plot = new XYPlot(data);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 60.0, 40.0, 40.0));
	plot.setBackground(Color.WHITE);
	plot.getTitle().setText(getDescription());

	// Format rendering of data points
	PointRenderer defaultPointRenderer = new DefaultPointRenderer2D();
	defaultPointRenderer.setColor(GraphicsUtils.deriveDarker(COLOR1));
	plot.setPointRenderers(data, defaultPointRenderer);
	PointRenderer shadowRenderer = new ShadowPointRenderer(defaultPointRenderer);
	plot.addPointRenderer(data, shadowRenderer);

	LineRenderer lineRenderer = new DefaultLineRenderer2D();
	lineRenderer.setGap(2.0);
	plot.setLineRenderers(data, lineRenderer);

	// Add plot to Swing component
	add(new InteractivePanel(plot), BorderLayout.CENTER);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:31,代码来源:MultiplePointRenderers.java

示例12: formatLineArea

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的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:Arnauld,项目名称:cucumber-contrib,代码行数:12,代码来源:AreaPlot.java

示例13: add

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的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);

	// Assign default renderers
	PointRenderer pointRendererDefault = new DefaultPointRenderer2D();
	LineRenderer lineRendererDefault = null;
	AreaRenderer areaRendererDefault = null;
	setPointRenderer(source, pointRendererDefault);
	setLineRenderer(source, lineRendererDefault);
	setAreaRenderer(source, areaRendererDefault);
}
 
开发者ID:charles-cooper,项目名称:idylfin,代码行数:16,代码来源:XYPlot.java

示例14: createSpecificPlot

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的package包/类
private JPanel createSpecificPlot() {

		GridResult grid = results.get(selectedIndex);

		for (int i = 0; i < grid.test.size(); i++) {
			dataSpecific.add((double)i, grid.test.get(i), grid.train.get(i) );
		}

		DataSeries seriesTest  = new DataSeries("Test",dataSpecific, 0, 1);
		DataSeries seriesTrain = new DataSeries("Training",dataSpecific, 0, 2);

		// Create a new xy-plot
		final XYPlot plot = new XYPlot(seriesTest,seriesTrain);

		// Format plot
		plot.setInsets(new Insets2D.Double(60, 60, 60, 20));
		plot.getTitle().setText(grid.name);
		plot.setLegendVisible(true);
		plot.setLegendLocation(Location.NORTH);

		specificPlot = plot;

		SmoothLineRenderer2D renderTest = new SmoothLineRenderer2D();
		renderTest.setColor(deriveDarker(Color.RED));
		PointRenderer renderTestPoint = new DefaultPointRenderer2D();
		renderTestPoint.setColor(renderTest.getColor());
		plot.setLineRenderers(seriesTest, renderTest);
		plot.setPointRenderers(seriesTest, renderTestPoint);

		SmoothLineRenderer2D renderTrain = new SmoothLineRenderer2D();
		renderTrain.setColor(deriveDarker(Color.BLUE));
		PointRenderer renderTrainPoint = new DefaultPointRenderer2D();
		renderTrainPoint.setColor(renderTrain.getColor());
		plot.setLineRenderers(seriesTrain, renderTrain);
		plot.setPointRenderers(seriesTrain, renderTrainPoint);

		plot.getAxisRenderer(XYPlot.AXIS_X).getLabel().setText("Epoc");
		plot.getAxisRenderer(XYPlot.AXIS_Y).getLabel().setText("Score");
		plot.getAxis(XYPlot.AXIS_Y).setAutoscaled(false);
		plot.getAxis(XYPlot.AXIS_Y).setRange(0,101);


		specificPlotPanel = new InteractivePanel(plot);
		JPanel wrapper = new JPanel();
		wrapper.setLayout(new BorderLayout());
		wrapper.add(specificPlotPanel,BorderLayout.CENTER);
		wrapper.setBackground(Color.WHITE);
		return wrapper;
	}
 
开发者ID:lessthanoptimal,项目名称:DeepBoof,代码行数:50,代码来源:GridParameterResultsApp.java

示例15: SimpleXYPlot

import de.erichseifert.gral.plots.points.DefaultPointRenderer2D; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public SimpleXYPlot() {
	// Generate data
	DataTable data = new DataTable(Double.class, Double.class, Double.class,
			Double.class, Double.class, Double.class);
	for (double x = 1.0; x <= 400.0; x *= 1.5) {
		double x2 = x/5.0;
		data.add(x2, -Math.sqrt(x2) + 5.0,  5.0*Math.log10(x2),
			random.nextDouble() + 1.0, random.nextDouble() + 0.5, 1.0 + 2.0*random.nextDouble());
	}

	// Create data series
	DataSeries seriesLog = new DataSeries(data, 0, 2, 3, 4);
	DataSeries seriesLin = new DataSeries(data, 0, 1, 5);

	// Create new xy-plot
	XYPlot plot = new XYPlot(seriesLog, seriesLin);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 40.0, 40.0, 40.0));
	plot.setBackground(Color.WHITE);
	plot.getTitle().setText(getDescription());

	// Format plot area
	plot.getPlotArea().setBackground(new RadialGradientPaint(
		new Point2D.Double(0.5, 0.5),
		0.75f,
		new float[] { 0.6f, 0.8f, 1.0f },
		new Color[] { new Color(0, 0, 0, 0), new Color(0, 0, 0, 32), new Color(0, 0, 0, 128) }
	));
	plot.getPlotArea().setBorderStroke(null);

	// Format axes
	AxisRenderer axisRendererX = new LogarithmicRenderer2D();
	AxisRenderer axisRendererY = plot.getAxisRenderer(XYPlot.AXIS_Y);
	axisRendererX.setLabel(new Label("Logarithmic axis"));
	plot.setAxisRenderer(XYPlot.AXIS_X, axisRendererX);
	// Custom tick labels
	Map<Double, String> labels = new HashMap<>();
	labels.put(2.0, "Two");
	labels.put(1.5, "OnePointFive");
	axisRendererX.setCustomTicks(labels);
	// Custom stroke for the x-axis
	BasicStroke stroke = new BasicStroke(2f);
	axisRendererX.setShapeStroke(stroke);
	Label linearAxisLabel = new Label("Linear axis");
	linearAxisLabel.setRotation(90);
	axisRendererY.setLabel(linearAxisLabel);
	// Change intersection point of Y axis
	axisRendererY.setIntersection(1.0);
	// Change tick spacing
	axisRendererX.setTickSpacing(2.0);

	// Format rendering of data points
	PointRenderer sizeablePointRenderer = new SizeablePointRenderer();
	sizeablePointRenderer.setColor(GraphicsUtils.deriveDarker(COLOR1));
	plot.setPointRenderers(seriesLin, sizeablePointRenderer);
	PointRenderer defaultPointRenderer = new DefaultPointRenderer2D();
	defaultPointRenderer.setColor(GraphicsUtils.deriveDarker(COLOR2));
	defaultPointRenderer.setErrorVisible(true);
	defaultPointRenderer.setErrorColor(COLOR2);
	plot.setPointRenderers(seriesLog, defaultPointRenderer);

	// Format data lines
	DiscreteLineRenderer2D discreteRenderer = new DiscreteLineRenderer2D();
	discreteRenderer.setColor(COLOR1);
	discreteRenderer.setStroke(new BasicStroke(
			3.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND,
			10.0f, new float[] {3f, 6f}, 0.0f));
	plot.setLineRenderers(seriesLin, discreteRenderer);
	// Custom gaps for points
	discreteRenderer.setGap(2.0);
	discreteRenderer.setGapRounded(true);
	// Custom ascending
	discreteRenderer.setAscentDirection(Orientation.VERTICAL);
	discreteRenderer.setAscendingPoint(0.5);

	// Add plot to Swing component
	add(new InteractivePanel(plot), BorderLayout.CENTER);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:81,代码来源:SimpleXYPlot.java


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