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


Java GraphicsUtils.deriveWithAlpha方法代码示例

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


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

示例1: createOverviewPlot

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的package包/类
private InteractivePanel createOverviewPlot() {

		double scale = percent ? 0.2 : 20.0;

		// Create a new xy-plot
		DataSeries series = new DataSeries(dataOverview);
		updateOverviewData();
		final XYPlot plot = new XYPlot(series);

		// Format plot
		plot.setInsets(new Insets2D.Double(20, 80, 60, 20));
		plot.getTitle().setText(param0+" Vs "+param1);

		overviewPlot = plot;

		CustomInteractivePanel panel = new CustomInteractivePanel(plot,this);
		overviewPlotPanel = panel;

		// Format points
		Color color = GraphicsUtils.deriveWithAlpha(Color.RED, 96);
		SizeablePointRenderer pointRenderer = new SizeablePointRenderer();
		pointRenderer.setShape(new Ellipse2D.Double(-0.5*scale, -0.5*scale, scale, scale));  // 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

		configureScatterAxis(control.scatterLog);

		panel.addMouseListener(new MouseAdapter() {
			@Override
			public void mouseClicked(MouseEvent e) {
				Axis axisX = plot.getAxis(XYPlot.AXIS_X);
				Axis axisY = plot.getAxis(XYPlot.AXIS_Y);

				double bestDistance = Double.MAX_VALUE;
				int bestIndex = -1;

				double offX = plot.getPlotArea().getX();
				double offY = plot.getPlotArea().getY();

				double height = plot.getPlotArea().getHeight();

				for (int i = 0; i < results.size(); i++) {
					GridResult r = results.get(i);
					double v0 = Double.parseDouble(r.parameters.get(param0));
					double v1 = Double.parseDouble(r.parameters.get(param1));

					double pixelX = plot.getAxisRenderer(XYPlot.AXIS_X).worldToView(axisX,v0,true);
					double pixelY = plot.getAxisRenderer(XYPlot.AXIS_Y).worldToView(axisY,v1,true);

					pixelX = offX + pixelX;
					pixelY = offY + height - pixelY;

					double dx = pixelX-e.getX();
					double dy = pixelY-e.getY();

					double d = dx*dx + dy*dy;
					if( d < bestDistance ) {
						bestDistance = d;
						bestIndex = i;
					}
				}

				if( bestDistance < maxClickDistance*maxClickDistance && bestIndex != -1 ) {
					focusOnResult(bestIndex);
				}
			}
		});

		return panel;
	}
 
开发者ID:lessthanoptimal,项目名称:DeepBoof,代码行数:72,代码来源:GridParameterResultsApp.java

示例2: SpiralPlot

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的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

示例3: SpiralPlot

import de.erichseifert.gral.util.GraphicsUtils; //导入方法依赖的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


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