• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java XYPlotArea2D类的典型用法和代码示例

java 1次浏览

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

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

示例1: testPunch

点赞 3

import de.erichseifert.gral.plots.XYPlot.XYPlotArea2D; //导入依赖的package包/类
@Test
public void testPunch() {
	XYPlot plot = new XYPlot();
	Axis axisX = plot.getAxis(XYPlot.AXIS_X);
	Axis axisY = plot.getAxis(XYPlot.AXIS_Y);
	AxisRenderer axisRendererX = plot.getAxisRenderer(XYPlot.AXIS_X);
	AxisRenderer axisRendererY = plot.getAxisRenderer(XYPlot.AXIS_Y);
	PointData data = new PointData(
			Arrays.asList(axisX, axisY),
			Arrays.asList(axisRendererX, axisRendererY),
			null, 0, 0);


	Shape line = new Line2D.Double(-1.0, -1.0, 2.0, 2.0);
	List<DataPoint> points = Arrays.asList(
			new DataPoint(data, new PointND<>(0.0, 0.0)),
			new DataPoint(data, new PointND<>(1.0, 1.0))
	);

	XYPlotArea2D plotArea = (XYPlotArea2D) plot.getPlotArea();
	Shape punchShape = new Ellipse2D.Double(-0.25, -0.25, 0.50, 0.50);
	Shape punched = plotArea.punch(line, points, Arrays.asList(punchShape, punchShape), 1.0, false);
	assertNotSame(line, punched);
}
 

开发者ID:eseifert,
项目名称:gral,
代码行数:25,
代码来源:XYPlotTest.java

示例2: setUp

点赞 2

import de.erichseifert.gral.plots.XYPlot.XYPlotArea2D; //导入依赖的package包/类
@Before
public void setUp() {
	DataSource data = new DummyData(2, 2, 1.0);

	plots = new LinkedList<>();
	MockXYPlot plot;

	// XYPlot with all options turned on
	plot = new MockXYPlot(data);
	plot.getTitle().setText("foobar");
	XYPlotArea2D plotArea = (XYPlotArea2D) plot.getPlotArea();
	plotArea.setMajorGridX(true);
	plotArea.setMajorGridY(true);
	plotArea.setMajorGridColor(Color.BLUE);
	plotArea.setMinorGridX(true);
	plotArea.setMinorGridY(true);
	plotArea.setMinorGridColor(Color.BLUE);
	plot.setLegendVisible(true);
	plot.setLegendLocation(Location.SOUTH);
	plot.setLegendDistance(2.0);
	plot.setBorderColor(Color.RED);
	plot.setBorderStroke(new BasicStroke(1.5f));
	plot.getAxisRenderer(XYPlot.AXIS_X).setTickSpacing(0.2);
	plot.getAxisRenderer(XYPlot.AXIS_Y).setTickSpacing(0.2);
	plots.add(plot);

	plot = new MockXYPlot(data);
	plot.getTitle().setText(null);
	((XYPlotArea2D) plot.getPlotArea()).setMajorGridX(false);
	((XYPlotArea2D) plot.getPlotArea()).setMinorGridX(false);
	plot.setLegendVisible(false);
	plot.setBorderColor(null);
	plot.getAxisRenderer(XYPlot.AXIS_X).setTickSpacing(0.0);
	plot.getAxisRenderer(XYPlot.AXIS_Y).setTickSpacing(0.0);
	plots.add(plot);
}
 

开发者ID:eseifert,
项目名称:gral,
代码行数:37,
代码来源:XYPlotTest.java

示例3: testPlotAreaSerialization

点赞 2

import de.erichseifert.gral.plots.XYPlot.XYPlotArea2D; //导入依赖的package包/类
private static void testPlotAreaSerialization(PlotArea originalPlotArea, PlotArea deserializedPlotArea) {
	XYPlotArea2D original = (XYPlotArea2D) originalPlotArea;
	XYPlotArea2D deserialized = (XYPlotArea2D) deserializedPlotArea;

	assertEquals(original.isMajorGridX(), deserialized.isMajorGridX());
	assertEquals(original.isMajorGridY(), deserialized.isMajorGridY());
	assertEquals(original.getMajorGridColor(), deserialized.getMajorGridColor());
	assertEquals(original.isMinorGridX(), deserialized.isMinorGridX());
	assertEquals(original.isMinorGridY(), deserialized.isMinorGridY());
	assertEquals(original.getMinorGridColor(), deserialized.getMinorGridColor());
}
 

开发者ID:eseifert,
项目名称:gral,
代码行数:12,
代码来源:XYPlotTest.java

示例4: SpiralPlot

点赞 2

import de.erichseifert.gral.plots.XYPlot.XYPlotArea2D; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public SpiralPlot() {
	setPreferredSize(new Dimension(600, 600));

	// Generate data
	DataTable data = new DataTable(Double.class, Double.class, Double.class);
	for (double alpha = 0.0, r = 0.0; r <= 10.0; alpha -= 1.0, r += 0.05) {
		double x = r*Math.cos(alpha);
		double y = r*Math.sin(alpha);
		double z = 3.0 + 4.0*r;
		data.add(x, y, z);
	}

	// Create a new data series (optional)
	DataSeries series = new DataSeries("Spiral", data);

	// Create a new xy-plot
	XYPlot plot = new XYPlot(series);

	// Format plot
	plot.setInsets(new Insets2D.Double(40.0));  // Add a margin to the plot
	plot.setBackground(new Color(0.75f, 0.75f, 0.75f));

	// Format plot area
	XYPlotArea2D plotArea = (XYPlotArea2D) plot.getPlotArea();
	plotArea.setBorderColor(null);   // Remove border of plot area
	plotArea.setMajorGridX(false);   // Disable vertical grid
	plotArea.setMajorGridY(false);   // Disable horizontal grid
	plotArea.setClippingArea(null);  // Disable clipping

	// Format axes
	plot.getAxisRenderer(XYPlot.AXIS_X).setShapeVisible(false);  // Disable x axis
	plot.getAxisRenderer(XYPlot.AXIS_X).setTicksVisible(false);  // Disable tick marks on x axis
	plot.getAxisRenderer(XYPlot.AXIS_Y).setShapeVisible(false);  // Disable y axis
	plot.getAxisRenderer(XYPlot.AXIS_Y).setTicksVisible(false);  // Disable tick marks on y axis
	plot.getAxis(XYPlot.AXIS_X).setRange(-10.0, 10.0);  // Scale x axis from -10 to 10
	plot.getAxis(XYPlot.AXIS_Y).setRange(-10.0, 10.0);  // Scale y axis from -10 to 10

	// Format data series
	Color color = GraphicsUtils.deriveWithAlpha(COLOR1, 96);
	SizeablePointRenderer pointRenderer = new SizeablePointRenderer();
	pointRenderer.setShape(new Ellipse2D.Double(-0.5, -0.5, 1.0, 1.0));  // shape of data points
	pointRenderer.setColor(color);  // color of data points
	pointRenderer.setColumn(2);  // data column which determines the scaling of data point shapes
	plot.setPointRenderers(series, pointRenderer);  // Assign the point renderer to the data series

	add(new InteractivePanel(plot), BorderLayout.CENTER);  // Add the plot to the Swing component
}
 

开发者ID:eseifert,
项目名称:gral,
代码行数:49,
代码来源:SpiralPlot.java

示例5: SpiralPlot

点赞 2

import de.erichseifert.gral.plots.XYPlot.XYPlotArea2D; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public SpiralPlot() {
	setPreferredSize(new Dimension(600, 600));

	// Generate data
	DataTable data = new DataTable(Double.class, Double.class, Double.class);
	for (double alpha = 0.0, r = 0.0; r <= 10.0; alpha -= 1.0, r += 0.05) {
		double x = r*Math.cos(alpha);
		double y = r*Math.sin(alpha);
		double z = 3.0 + 4.0*r;
		data.add(x, y, z);
	}

	// Create a new data series (optional)
	DataSeries series = new DataSeries("Spiral", data);

	// Create a new xy-plot
	XYPlot plot = new XYPlot(series);

	// Format plot
	plot.setInsets(new Insets2D.Double(40.0));  // Add a margin to the plot
	plot.setBackground(new Color(0.75f, 0.75f, 0.75f));

	// Format plot area
	XYPlotArea2D plotArea = (XYPlotArea2D) plot.getPlotArea();
	plotArea.setBorderColor(null);   // Remove border of plot area
	plotArea.setMajorGridX(false);   // Disable vertical grid
	plotArea.setMajorGridY(false);   // Disable horizontal grid
	plotArea.setClippingArea(null);  // Disable clipping

	// Format axes
	plot.getAxisRenderer(XYPlot.AXIS_X).setShapeVisible(false);  // Disable x axis
	plot.getAxisRenderer(XYPlot.AXIS_X).setTicksVisible(false);  // Disable tick marks on x axis
	plot.getAxisRenderer(XYPlot.AXIS_Y).setShapeVisible(false);  // Disable y axis
	plot.getAxisRenderer(XYPlot.AXIS_Y).setTicksVisible(false);  // Disable tick marks on y axis
	plot.getAxis(XYPlot.AXIS_X).setRange(-10.0, 10.0);  // Scale x axis from -10 to 10
	plot.getAxis(XYPlot.AXIS_Y).setRange(-10.0, 10.0);  // Scale y axis from -10 to 10

	// Format data series
	Color color = GraphicsUtils.deriveWithAlpha(COLOR1, 96);
	SizeablePointRenderer pointRenderer = new SizeablePointRenderer();
	pointRenderer.setShape(new Ellipse2D.Double(-0.5, -0.5, 1.0, 1.0));  // shape of data points
	pointRenderer.setColor(color);  // color of data points
	pointRenderer.setColumn(2);  // data column which determines the scaling of data point shapes
	plot.setPointRenderer(series, pointRenderer);  // Assign the point renderer to the data series

	add(new InteractivePanel(plot), BorderLayout.CENTER);  // Add the plot to the Swing component
}
 

开发者ID:arahusky,
项目名称:performance_javadoc,
代码行数:49,
代码来源:SpiralPlot.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)