• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java InteractivePanel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SineGraph

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的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: ScatterPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ScatterPlot() {
	// Generate 100,000 data points
	DataTable data = new DataTable(Double.class, Double.class);
	for (int i = 0; i <= SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian()*2.0,  random.nextGaussian()*2.0);
	}

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

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

	// Format points
	plot.getPointRenderer(data).setColor(COLOR1);

	// Add plot to Swing component
	add(new InteractivePanel(plot), BorderLayout.CENTER);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:22,代码来源:ScatterPlot.java


示例3: insertPlotPanel

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
/**
	 * Inserts the plot panel into
	 * this table panel, at the
	 * appropriate position.
	 */
	private void insertPlotPanel()
	{	Column cl = getColumn(COL_PLOT);
		cl.removeAll();
		InteractivePanel tempPanel = new InteractivePanel(plot);
		tempPanel.setPopupMenuEnabled(false);
		tempPanel.setBackground(GuiColorTools.COLOR_COMMON_BACKGROUND);
		Dimension dim = new Dimension(plotWidth,getDataHeight());
		tempPanel.setPreferredSize(dim);
		tempPanel.setMaximumSize(dim);
		tempPanel.setMinimumSize(dim);
		cl.add(tempPanel);
		
		revalidate();
//		repaint();
	}
 
开发者ID:vlabatut,项目名称:totalboumboum,代码行数:21,代码来源:RoundEvolutionSubPanel.java


示例4: ScatterPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ScatterPlot() {
	// Generate 100,000 data points
	DataTable data = new DataTable(Double.class, Double.class);
	for (int i = 0; i <= SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian()*2.0,  random.nextGaussian()*2.0);
	}

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

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

	// Format points
	plot.getPointRenderers(data).get(0).setColor(COLOR1);

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


示例5: ScatterPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public ScatterPlot() {
	// Generate 100,000 data points
	DataTable data = new DataTable(Double.class, Double.class);
	for (int i = 0; i <= SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian()*2.0,  random.nextGaussian()*2.0);
	}

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

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

	// Format points
	plot.getPointRenderer(data).setColor(COLOR1);

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


示例6: RealTimePlot

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


示例7: HistogramPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
/**
 * Performs basic initialization of HistogramPlot for LongArrayList
 */
public HistogramPlot(LongArrayList foregroundList, LongArrayList backgroundList) {
    super(new BorderLayout());
    setPreferredSize(new Dimension(800, 600));
    setBackground(Color.WHITE);

    if(foregroundList.size() > 0)
        foreground = createXYPlot("Foreground", foregroundList, COLOR1, Long.class);

    if(backgroundList.size() > 0)
        background = createXYPlot("Background", backgroundList, COLOR2, Long.class);

    DrawableContainer plots = new DrawableContainer(new TableLayout(1));
    if(foreground != null) plots.add(foreground);
    if(background != null) plots.add(background);

    // Connect the two plots, i.e. user (mouse) actions affect both plots
    //foreground.getNavigator().connect(background.getNavigator());

    // Add plot to Swing component
    InteractivePanel panel = new InteractivePanel(plots);
    add(panel);
    showInFrame();
}
 
开发者ID:fjug,项目名称:IDDEA,代码行数:27,代码来源:HistogramPlot.java


示例8: Graph

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


示例9: Graph

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


示例10: AreaPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
public AreaPlot() {
	// Generate data
	DataTable data = new DataTable(Double.class, Double.class, Double.class, Double.class);
	for (double x = 0.0; x < 50; x ++) {
		double y1 = Double.NaN, y2 = Double.NaN, y3 = Double.NaN;
		y1 = random.nextGaussian();
		y2 = random.nextGaussian();
		y3 = random.nextGaussian();
		data.add(x, y1, y2, y3);
	}

	// Create data series
	DataSeries data1 = new DataSeries("series 1", data, 0, 1);
	DataSeries data2 = new DataSeries("series 2", data, 0, 2);
	DataSeries data3 = new DataSeries("series 3", data, 0, 3);

	// Create new xy-plot
	XYPlot plot = new XYPlot(data1, data2, data3);
	plot.setLegendVisible(true);
	plot.setInsets(new Insets2D.Double(20.0, 40.0, 20.0, 20.0));

	// Format data series
	formatFilledArea(plot, data1, COLOR2);
	formatFilledArea(plot, data2, COLOR1);
	formatLineArea(plot, data3, GraphicsUtils.deriveDarker(COLOR1));

	// Add plot to Swing component
	add(new InteractivePanel(plot));
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:30,代码来源:AreaPlot.java


示例11: SimplePiePlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public SimplePiePlot() {
	// Create data
	DataTable data = new DataTable(Integer.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		int val = random.nextInt(8) + 2;
		data.add((random.nextDouble() <= 0.15) ? -val : val);
	}

	// Create new pie plot
	PiePlot plot = new PiePlot(data);

	// Format plot
	plot.getTitle().setText(getDescription());
	// Change relative size of pie
	plot.setRadius(0.9);
	// Display a legend
	plot.setLegendVisible(true);
	// Add some margin to the plot area
	plot.setInsets(new Insets2D.Double(20.0, 40.0, 40.0, 40.0));

	PieSliceRenderer pointRenderer =
			(PieSliceRenderer) plot.getPointRenderer(data);
	// Change relative size of inner region
	pointRenderer.setInnerRadius(0.4);
	// Change the width of gaps between segments
	pointRenderer.setGap(0.2);
	// Change the colors
	LinearGradient colors = new LinearGradient(COLOR1, COLOR2);
	pointRenderer.setColor(colors);
	// Show labels
	pointRenderer.setValueVisible(true);
	pointRenderer.setValueColor(Color.WHITE);
	pointRenderer.setValueFont(Font.decode(null).deriveFont(Font.BOLD));

	// Add plot to Swing component
	add(new InteractivePanel(plot), BorderLayout.CENTER);
}
 
开发者ID:PacktPublishing,项目名称:Java-Data-Science-Cookbook,代码行数:39,代码来源:SimplePiePlot.java


示例12: SimpleRasterPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
public SimpleRasterPlot() {
	setPreferredSize(new Dimension(600, 600));

	// Create example data
	DataTable raster = new DataTable(SIZE, Double.class);
	for (int rowIndex = 0; rowIndex < raster.getColumnCount(); rowIndex++) {
		Comparable<?>[] row = new Comparable<?>[raster.getColumnCount()];
		double y = ZOOM*rowIndex;
		for (int colIndex = 0; colIndex < row.length; colIndex++) {
			double x = ZOOM*colIndex;
			row[colIndex] =
				Math.cos(Math.hypot(x - ZOOM*SIZE/2.0, y - ZOOM*SIZE/2.0)) *
				Math.cos(Math.hypot(x + ZOOM*SIZE/2.0, y + ZOOM*SIZE/2.0));
		}
		raster.add(row);
	}

	// Convert raster matrix to (x, y, value)
	DataSource valuesByCoord = RasterPlot.createRasterData(raster);

	// Create new bar plot
	RasterPlot plot = new RasterPlot(valuesByCoord);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 60.0, 40.0, 20.0));
	plot.setColors(new LinearGradient(GraphicsUtils.deriveDarker(COLOR1), COLOR1, Color.WHITE));

	// Add plot to Swing component
	InteractivePanel panel = new InteractivePanel(plot);
	panel.setPannable(false);
	panel.setZoomable(false);
	add(panel);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:34,代码来源:SimpleRasterPlot.java


示例13: AreaPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public AreaPlot() {
	// Generate data
	DataTable data = new DataTable(Double.class, Double.class, Double.class, Double.class);
	for (double x=0.0; x<2.5*Math.PI; x+=Math.PI/15.0) {
		double y1 = Double.NaN, y2 = Double.NaN, y3 = Double.NaN;
		if (x>=0.00*Math.PI && x<2.25*Math.PI) {
			y1 = 4.0*Math.sin(x + 0.5*Math.PI) + 0.1*random.nextGaussian();
		}
		if (x>=0.25*Math.PI && x<2.50*Math.PI) {
			y2 = 4.0*Math.cos(x + 0.5*Math.PI) + 0.1*random.nextGaussian();
		}
		if (x>=0.00*Math.PI && x<2.50*Math.PI) {
			y3 = 2.0*Math.sin(2.0*x/2.5)       + 0.1*random.nextGaussian();
		}
		data.add(x, y1, y2, y3);
	}

	// Create data series
	DataSeries data1 = new DataSeries("red", data, 0, 1);
	DataSeries data2 = new DataSeries("blue 1", data, 0, 2);
	DataSeries data3 = new DataSeries("blue 2", data, 0, 3);

	// Create new xy-plot
	XYPlot plot = new XYPlot(data1, data2, data3);
	plot.setLegendVisible(true);
	plot.setInsets(new Insets2D.Double(20.0, 40.0, 20.0, 20.0));

	// Format data series
	formatFilledArea(plot, data1, COLOR2);
	formatFilledArea(plot, data2, COLOR1);
	formatLineArea(plot, data3, GraphicsUtils.deriveDarker(COLOR1));

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


示例14: MultiplePointRenderers

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


示例15: LabelExample

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
public LabelExample() {
	Label label = new Label("TestLabel");
	label.setFont(getFont().deriveFont(20f));
	label.setBackground(new GradientPaint(
		new Point2D.Double(0.0, 0.0), Color.BLACK,
		new Point2D.Double(1.0, 1.0), Color.WHITE
	));

	DrawablePanel panel = new InteractivePanel(label);
	add(panel);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:12,代码来源:LabelExample.java


示例16: DynamicPiePlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public DynamicPiePlot() {
	// Create initial data
	data = new DataTable(Integer.class);
	DataSource pieData = PiePlot.createPieData(data);

	// Create new pie plot
	plot = new PiePlot(pieData);
	// Change relative size of pie
	plot.setRadius(0.9);
	// Change the starting angle of the first pie slice
	plot.setStart(90.0);
	// Add some margin to the plot area
	plot.setInsets(new Insets2D.Double(20.0));

	PieSliceRenderer pointRenderer =
			(PieSliceRenderer) plot.getPointRenderer(pieData);
	// Change the width of gaps between segments
	pointRenderer.setGap(0.2);
	// Change the colors
	LinearGradient colors = new LinearGradient(COLOR1, COLOR2);
	pointRenderer.setColor(colors);

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

	setValueCount(SAMPLE_COUNT);

	// Create a slider to change the number of data values
	valueCountSlider = new JSlider(0, 50, SAMPLE_COUNT);
	valueCountSlider.setBorder(new EmptyBorder(15, 15, 5, 15));
	valueCountSlider.setMajorTickSpacing(10);
	valueCountSlider.setMinorTickSpacing(1);
	valueCountSlider.setSnapToTicks(true);
	valueCountSlider.setPaintTicks(true);
	valueCountSlider.addChangeListener(this);
	add(valueCountSlider, BorderLayout.SOUTH);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:40,代码来源:DynamicPiePlot.java


示例17: SimplePiePlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public SimplePiePlot() {
	// Create data
	DataTable data = new DataTable(Integer.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		int val = random.nextInt(8) + 2;
		data.add((random.nextDouble() <= 0.15) ? -val : val);
	}
	DataSource pieData = PiePlot.createPieData(data);

	// Create new pie plot
	PiePlot plot = new PiePlot(pieData);

	// Format plot
	plot.getTitle().setText(getDescription());
	// Change relative size of pie
	plot.setRadius(0.9);
	// Display a legend
	plot.setLegendVisible(true);
	// Add some margin to the plot area
	plot.setInsets(new Insets2D.Double(20.0, 40.0, 40.0, 40.0));

	PieSliceRenderer pointRenderer =
			(PieSliceRenderer) plot.getPointRenderer(pieData);
	// Change relative size of inner region
	pointRenderer.setInnerRadius(0.4);
	// Change the width of gaps between segments
	pointRenderer.setGap(0.2);
	// Change the colors
	LinearGradient colors = new LinearGradient(COLOR1, COLOR2);
	pointRenderer.setColor(colors);
	// Show labels
	pointRenderer.setValueVisible(true);
	pointRenderer.setValueColor(Color.WHITE);
	pointRenderer.setValueFont(Font.decode(null).deriveFont(Font.BOLD));

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


示例18: SimpleRasterPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
public SimpleRasterPlot(int size, double zoom) {
               SimpleRasterPlot.size = size;
               SimpleRasterPlot.zoom = zoom;
	setPreferredSize(new Dimension(600, 600));

	// Create example data
	DataTable raster = new DataTable(SimpleRasterPlot.size, Double.class);
	for (int rowIndex = 0; rowIndex < raster.getColumnCount(); rowIndex++) {
		Comparable<?>[] row = new Comparable<?>[raster.getColumnCount()];
		double y = SimpleRasterPlot.zoom*rowIndex;
		for (int colIndex = 0; colIndex < row.length; colIndex++) {
			double x = SimpleRasterPlot.zoom*colIndex;
			row[colIndex] =
				Math.cos(Math.hypot(x - SimpleRasterPlot.zoom*SimpleRasterPlot.size/2.0, y - SimpleRasterPlot.zoom*SimpleRasterPlot.size/2.0)) *
				Math.cos(Math.hypot(x + SimpleRasterPlot.zoom*SimpleRasterPlot.size/2.0, y + SimpleRasterPlot.zoom*SimpleRasterPlot.size/2.0));
		}
		raster.add(row);
	}

	// Convert raster matrix to (x, y, value)
	DataSource valuesByCoord = RasterPlot.createRasterData(raster);

	// Create new bar plot
	RasterPlot plot = new RasterPlot(valuesByCoord);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 60.0, 40.0, 20.0));
	plot.setColors(new LinearGradient(GraphicsUtils.deriveDarker(COLOR1), COLOR1, Color.WHITE));

	// Add plot to Swing component
	InteractivePanel panel = new InteractivePanel(plot);
	panel.setPannable(false);
	panel.setZoomable(false);
	add(panel);
}
 
开发者ID:arahusky,项目名称:performance_javadoc,代码行数:36,代码来源:SimpleRasterPlot.java


示例19: DynamicPiePlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public DynamicPiePlot() {
	// Create initial data
	data = new DataTable(Integer.class);

	// Create new pie plot
	plot = new PiePlot(data);
	// Change relative size of pie
	plot.setRadius(0.9);
	// Change the starting angle of the first pie slice
	plot.setStart(90.0);
	// Add some margin to the plot area
	plot.setInsets(new Insets2D.Double(20.0));

	PieSliceRenderer pointRenderer =
			(PieSliceRenderer) plot.getPointRenderer(data);
	// Change the width of gaps between segments
	pointRenderer.setGap(0.2);
	// Change the colors
	LinearGradient colors = new LinearGradient(COLOR1, COLOR2);
	pointRenderer.setColor(colors);

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

	setValueCount(SAMPLE_COUNT);

	// Create a slider to change the number of data values
	valueCountSlider = new JSlider(0, 50, SAMPLE_COUNT);
	valueCountSlider.setBorder(new EmptyBorder(15, 15, 5, 15));
	valueCountSlider.setMajorTickSpacing(10);
	valueCountSlider.setMinorTickSpacing(1);
	valueCountSlider.setSnapToTicks(true);
	valueCountSlider.setPaintTicks(true);
	valueCountSlider.addChangeListener(this);
	add(valueCountSlider, BorderLayout.SOUTH);
}
 
开发者ID:arahusky,项目名称:performance_javadoc,代码行数:39,代码来源:DynamicPiePlot.java


示例20: SimplePiePlot

import de.erichseifert.gral.ui.InteractivePanel; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public SimplePiePlot() {
	// Create data
	DataTable data = new DataTable(Integer.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		int val = random.nextInt(8) + 2;
           int sign = (random.nextDouble() <= 0.15) ? -1 : 1;
           System.out.println("SimplePiePlot.SimplePiePlot(" + val  + ", " + sign + ")");
           data.add(val);
	}

	// Create new pie plot
	PiePlot plot = new PiePlot(data);

	// Format plot
	plot.getTitle().setText(getDescription());
	// Change relative size of pie
	plot.setRadius(0.9);
	// Display a legend
	plot.setLegendVisible(true);
	// Add some margin to the plot area
	plot.setInsets(new Insets2D.Double(20.0, 40.0, 40.0, 40.0));

	PieSliceRenderer pointRenderer =
			(PieSliceRenderer) plot.getPointRenderer(data);
	// Change relative size of inner region
	pointRenderer.setInnerRadius(0.4);
	// Change the width of gaps between segments
	pointRenderer.setGap(0.2);
	// Change the colors
	LinearGradient colors = new LinearGradient(COLOR1, COLOR2);
	pointRenderer.setColor(colors);
	// Show labels
	pointRenderer.setValueVisible(true);
	pointRenderer.setValueColor(Color.WHITE);
	pointRenderer.setValueFont(Font.decode(null).deriveFont(Font.BOLD));

	// Add plot to Swing component
	add(new InteractivePanel(plot), BorderLayout.CENTER);
}
 
开发者ID:Arnauld,项目名称:cucumber-contrib,代码行数:41,代码来源:SimplePiePlot.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ContextTypeRegistry类代码示例发布时间:2022-05-21
下一篇:
Java UUIDType类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap