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


Java DefaultLineRenderer2D类代码示例

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


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

示例1: SineGraph

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
public SineGraph() throws FileNotFoundException, IOException {
	setDefaultCloseOperation(EXIT_ON_CLOSE);
	setSize(1600, 1400);

	DataTable data = new DataTable(Double.class, Double.class);
	for (double x = -5.0; x <= 5.0; x+=0.25) {
           double y = 5.0*Math.sin(x);
           data.add(x, y);
       }

	XYPlot plot = new XYPlot(data);
	getContentPane().add(new InteractivePanel(plot));
	LineRenderer lines = new DefaultLineRenderer2D();
	plot.setLineRenderer(data, lines);
	Color color = new Color(0.0f, 0.0f, 0.0f);
	plot.getPointRenderer(data).setColor(color);
	plot.getLineRenderer(data).setColor(color);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:19,代码来源:SineGraph.java

示例2: formatFilledArea

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的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: RealTimePlot

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
/**
 * Constructs a new real time plot
 * @param title     the title of the plot
 * @param xTitle    the title of the x-axis
 * @param yTitle    the title of the y-axis
 * @param yMax      the max range of the y-axis
 * @param yGap      the gap between values display on y-axis
 */
public RealTimePlot(String title, String xTitle, String yTitle, int yMax,
                    int yGap) {
    super(new BorderLayout());
    this.data = new DataTable(Long.class, Double.class);
    this.plot = new XYPlot(data);
    this.panel = new InteractivePanel(plot);
    this.lines = new DefaultLineRenderer2D();
    this.yMax = yMax;
    this.yGap = yGap;
    this.title = title;
    this.xTitle = xTitle;
    this.yTitle = yTitle;
    this.bufSize = Integer.parseInt(ConfigurationManager.getProperty(
            ConfigurationManager.REAL_TIME_BUFFER));
    initPanel();
}
 
开发者ID:anthonyjchriste,项目名称:knowledge-is-power,代码行数:25,代码来源:RealTimePlot.java

示例4: addAzimuthLine

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
void addAzimuthLine(XYPlot plot, double azimuth, float length, Color lineColor) {
    DataTable bazLine = new DataTable(Float.class, Float.class);
    float xMid = (plot.getAxis(XYPlot.AXIS_X).getMin().floatValue() + plot.getAxis(XYPlot.AXIS_X)
            .getMax()
            .floatValue()) / 2;
    float yMid = (plot.getAxis(XYPlot.AXIS_Y).getMin().floatValue() + plot.getAxis(XYPlot.AXIS_Y)
            .getMax()
            .floatValue()) / 2;
    float x = (float)(length / 2 * Math.cos(Math.toRadians(90 - azimuth)));
    float y = (float)(length / 2 * Math.sin(Math.toRadians(90 - azimuth)));
    bazLine.add(xMid - x, yMid - y);
    bazLine.add(xMid + x, yMid + y);
    plot.add(bazLine);
    LineRenderer bazlr = new DefaultLineRenderer2D();
    bazlr.setSetting(LineRenderer.COLOR, lineColor);
    plot.setLineRenderer(bazLine, bazlr);
}
 
开发者ID:crotwell,项目名称:sod,代码行数:18,代码来源:ParticleMotionPlot.java

示例5: Graph

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
public Graph(boolean simple) {
	setDefaultCloseOperation(EXIT_ON_CLOSE);
	setSize(1200, 1200);

	for (int i = 0; i < Pitch.pitches.getItemCount(); i++) {
		pitch[i] = Double.valueOf(Pitch.pitches.getItem(i));
		time[i] = Double.valueOf(Pitch.time.getItem(i));
	}

	for (int w = 0; w < pitch.length; w++) {
		dataFull.add(time[w], pitch[w]);
	}

	for (int i = 0; i < Pitch.pitches.getItemCount() / 8; i++) {
		SimpleRegression Regression = new SimpleRegression();
		double x = 0;
		for (int s = 0; s < 8; s++) {
			position++;
			try {
				Regression.addData(time[position], pitch[position]);
				x = x + time[position];
			} catch (Exception e) {
				/* silence... */}
		}
		double average = x / 8;
		data.add(average, Regression.predict(average));
	}

	XYPlot plot = new XYPlot(data);
	XYPlot plotFull = new XYPlot(dataFull);
	LineRenderer lines = new DefaultLineRenderer2D();

	if (simple) {
		getContentPane().add(new InteractivePanel(plot));
		plot.setLineRenderers(data, lines);
	} else {
		getContentPane().add(new InteractivePanel(plotFull));
		plotFull.setLineRenderers(dataFull, lines);
	}
}
 
开发者ID:Scoutdrago3,项目名称:MusicToGraph,代码行数:41,代码来源:Graph.java

示例6: Graph

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
public Graph(DataTable funcDataTable) {
	setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	setTitle("Graph...");
	setSize(1200, 1200);
	myFuncDataTable = funcDataTable;

	XYPlot plotFull = new XYPlot(myFuncDataTable);
	panel = new InteractivePanel(plotFull);
	getContentPane().add(panel);
	LineRenderer lines = new DefaultLineRenderer2D();
	plotFull.setLineRenderers(funcDataTable, lines);
}
 
开发者ID:Scoutdrago3,项目名称:MusicToGraph,代码行数:13,代码来源:Graph.java

示例7: formatFilledArea

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

示例8: render

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

示例9: testGetLineRenderers

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
@Test
public void testGetLineRenderers() {
	DataSource data = new DummyData(2, 1, 1.0);
	MockXYPlot plot = new MockXYPlot(data);
	LineRenderer renderer = new DefaultLineRenderer2D();
	plot.setLineRenderers(data, renderer);
	assertNotNull(plot.getLineRenderers(new DummyData(4, 2, 0.0)));
	assertNotNull(plot.getLineRenderers(null));

	List<LineRenderer> renderers = plot.getLineRenderers(data);
	assertTrue(renderers.contains(renderer));
	assertEquals(renderers.size(), 1);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:14,代码来源:XYPlotTest.java

示例10: testSetLineRenderers

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
@Test
public void testSetLineRenderers() {
	DataSource data = new DummyData(2, 1, 1.0);
	MockXYPlot plot = new MockXYPlot();
	LineRenderer renderer1 = new DefaultLineRenderer2D();
	LineRenderer renderer2 = new DefaultLineRenderer2D();
	plot.setLineRenderers(data, Arrays.asList(renderer1, renderer2));

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

示例11: formatFilledArea

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

示例12: MultiplePointRenderers

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

示例13: DrawableWriterTest

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public DrawableWriterTest() {
	DataTable data = new DataTable(Double.class, Double.class, Double.class, Double.class);
	data.add(1.0, 4.5, 4.3, 4.0);
	data.add(1.5, 5.5, 5.3, 5.0);
	data.add(3.0, 3.5, 3.7, 4.0);
	data.add(4.0, 4.7, 4.5, 4.3);

	DataSeries s1 = new DataSeries(data, 0, 1);
	DataSeries s2 = new DataSeries(data, 0, 2);
	DataSeries s3 = new DataSeries(data, 0, 3);

	plot = new XYPlot(s1, s2, s3);
	plot.setInsets(new Insets2D.Double(20, 50, 50, 20));

	LineRenderer lr1 = new DefaultLineRenderer2D();
	lr1.setColor(Color.RED);
	plot.setLineRenderers(s1, lr1);

	LineRenderer lr2 = new DefaultLineRenderer2D();
	lr2.setColor(Color.GREEN);
	plot.setLineRenderers(s2, lr2);

	LineRenderer lr3 = new DefaultLineRenderer2D();
	lr3.setColor(Color.BLUE);
	plot.setLineRenderers(s3, lr3);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:28,代码来源:DrawableWriterTest.java

示例14: DrawableWriterTest

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public DrawableWriterTest() {
	data = new DataTable(Double.class, Double.class, Double.class, Double.class);
	data.add(1.0, 4.5, 4.3, 4.0);
	data.add(1.5, 5.5, 5.3, 5.0);
	data.add(3.0, 3.5, 3.7, 4.0);
	data.add(4.0, 4.7, 4.5, 4.3);

	DataSeries s1 = new DataSeries(data, 0, 1);
	DataSeries s2 = new DataSeries(data, 0, 2);
	DataSeries s3 = new DataSeries(data, 0, 3);

	plot = new XYPlot(s1, s2, s3);
	plot.setInsets(new Insets2D.Double(20, 50, 50, 20));

	LineRenderer lr1 = new DefaultLineRenderer2D();
	lr1.setColor(Color.RED);
	plot.setLineRenderer(s1, lr1);

	LineRenderer lr2 = new DefaultLineRenderer2D();
	lr2.setColor(Color.GREEN);
	plot.setLineRenderer(s2, lr2);

	LineRenderer lr3 = new DefaultLineRenderer2D();
	lr3.setColor(Color.BLUE);
	plot.setLineRenderer(s3, lr3);
}
 
开发者ID:arahusky,项目名称:performance_javadoc,代码行数:28,代码来源:DrawableWriterTest.java

示例15: formatFilledArea

import de.erichseifert.gral.plots.lines.DefaultLineRenderer2D; //导入依赖的package包/类
private void formatFilledArea(XYPlot plot, DataSource data, Color color) {
    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:Drusy,项目名称:freebox-v6-monitor,代码行数:11,代码来源:ChartPanel.java


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