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


Java InteractivePanel.setZoomable方法代码示例

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


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

示例1: 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

示例2: 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

示例3: HistogramPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入方法依赖的package包/类
public HistogramPlot() {
	// Create example data
	Random random = new Random();
	DataTable data = new DataTable(Double.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian());
	}

	// Create histogram from data
	Histogram1D histogram = new Histogram1D(data, Orientation.VERTICAL,
			new Number[] {-4.0, -3.2, -2.4, -1.6, -0.8, 0.0, 0.8, 1.6, 2.4, 3.2, 4.0});
	// Create a second dimension (x axis) for plotting
	DataSource histogram2d = new EnumeratedData(histogram, (-4.0 + -3.2)/2.0, 0.8);

	// Create new bar plot
	BarPlot plot = new BarPlot(histogram2d);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 65.0, 50.0, 40.0));
	plot.getTitle().setText(
			String.format("Distribution of %d random samples", data.getRowCount()));
	plot.setBarWidth(0.78);

	// Format x axis
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickSpacing(0.8);
	plot.getAxisRenderer(BarPlot.AXIS_X).setMinorTicksVisible(false);
	// Format y axis
	plot.getAxis(BarPlot.AXIS_Y).setRange(0.0,
			MathUtils.ceil(histogram.getStatistics().get(Statistics.MAX)*1.1, 25.0));
	plot.getAxisRenderer(BarPlot.AXIS_Y).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setMinorTicksVisible(false);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setIntersection(-4.4);

	// Format bars
	plot.getPointRenderer(histogram2d).setColor(
		GraphicsUtils.deriveWithAlpha(COLOR1, 128));
	plot.getPointRenderer(histogram2d).setValueVisible(true);

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

示例4: HistogramPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public HistogramPlot() {
	// Create example data
	Random random = new Random();
	DataTable data = new DataTable(Double.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian());
	}

	// Create histogram from data
	Histogram2D histogram = new Histogram2D(data, Orientation.VERTICAL,
			new Number[] {-4.0, -3.2, -2.4, -1.6, -0.8, 0.0, 0.8, 1.6, 2.4, 3.6, 4.0});
	// Create a second dimension (x axis) for plotting
	DataSource histogram2d = new EnumeratedData(histogram, (-4.0 + -3.2)/2.0, 0.8);

	// Create new bar plot
	BarPlot plot = new BarPlot(histogram2d);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 65.0, 50.0, 40.0));
	plot.getTitle().setText(
			String.format("Distribution of %d random samples", data.getRowCount()));
	plot.setBarWidth(0.78);

	// Format x axis
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickSpacing(0.8);
	plot.getAxisRenderer(BarPlot.AXIS_X).setMinorTicksVisible(false);
	// Format y axis
	plot.getAxis(BarPlot.AXIS_Y).setRange(0.0,
			MathUtils.ceil(histogram.getStatistics().get(Statistics.MAX)*1.1, 25.0));
	plot.getAxisRenderer(BarPlot.AXIS_Y).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setMinorTicksVisible(false);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setIntersection(-4.4);

	// Format bars
	PointRenderer barRenderer = plot.getPointRenderers(histogram2d).get(0);
	barRenderer.setColor(GraphicsUtils.deriveWithAlpha(COLOR1, 128));
	barRenderer.setValueVisible(true);

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

示例5: HistogramPlot

import de.erichseifert.gral.ui.InteractivePanel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public HistogramPlot() {
	// Create example data
	Random random = new Random();
	DataTable data = new DataTable(Double.class);
	for (int i = 0; i < SAMPLE_COUNT; i++) {
		data.add(random.nextGaussian());
	}

	// Create histogram from data
	Histogram1D histogram = new Histogram1D(data, Orientation.VERTICAL,
			new Number[] {-4.0, -3.2, -2.4, -1.6, -0.8, 0.0, 0.8, 1.6, 2.4, 3.6, 4.0});
	// Create a second dimension (x axis) for plotting
	DataSource histogram2d = new EnumeratedData(histogram, (-4.0 + -3.2)/2.0, 0.8);

	// Create new bar plot
	BarPlot plot = new BarPlot(histogram2d);

	// Format plot
	plot.setInsets(new Insets2D.Double(20.0, 65.0, 50.0, 40.0));
	plot.getTitle().setText(
			String.format("Distribution of %d random samples", data.getRowCount()));
	plot.setBarWidth(0.78);

	// Format x axis
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_X).setTickSpacing(0.8);
	plot.getAxisRenderer(BarPlot.AXIS_X).setMinorTicksVisible(false);
	// Format y axis
	plot.getAxis(BarPlot.AXIS_Y).setRange(0.0,
			MathUtils.ceil(histogram.getStatistics().get(Statistics.MAX)*1.1, 25.0));
	plot.getAxisRenderer(BarPlot.AXIS_Y).setTickAlignment(0.0);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setMinorTicksVisible(false);
	plot.getAxisRenderer(BarPlot.AXIS_Y).setIntersection(-4.4);

	// Format bars
	plot.getPointRenderer(histogram2d).setColor(
		GraphicsUtils.deriveWithAlpha(COLOR1, 128));
	plot.getPointRenderer(histogram2d).setValueVisible(true);

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

示例6: ChartPanel

import de.erichseifert.gral.ui.InteractivePanel; //导入方法依赖的package包/类
public ChartPanel(String headerLabel, Color chartColor, final int offset) {
    initComponents();

    this.chartColor = chartColor;
    this.offset = offset;
    label1.setText(headerLabel);

    data = new DataTable(Double.class, Double.class);
    data.add((double)(new Date().getTime()), 0d);
    plot = new XYPlot(data);

    // Chart spacing
    double insetsTop = 10.0,
            insetsLeft = 60.0,
            insetsBottom = 60.0,
            insetsRight = 10.0;
    plot.setInsets(new Insets2D.Double(
            insetsTop, insetsLeft, insetsBottom, insetsRight));

    // Hide points
    plot.setPointRenderer(data, null);

    // Filled area
    formatFilledArea(plot, data, chartColor);

    // Manage axis Y
    plot.getAxisRenderer(XYPlot.AXIS_Y).setLabel("ko/s");
    plot.getAxisRenderer(XYPlot.AXIS_Y).setTicksVisible(true);
    plot.getAxisRenderer(XYPlot.AXIS_Y).setTickLabelDistance(0.5);
    plot.getAxisRenderer(XYPlot.AXIS_Y).setLabelDistance(1.25);
    plot.getAxis(XYPlot.AXIS_Y).setMin(0);
    plot.getAxis(XYPlot.AXIS_Y).setMax(0);

    // Manage axis X
    plot.getAxisRenderer(XYPlot.AXIS_X).setLabel("time");
    plot.getAxisRenderer(XYPlot.AXIS_X).setTicksVisible(true);
    plot.getAxisRenderer(XYPlot.AXIS_X).setTickLabelDistance(0.5);
    plot.getAxisRenderer(XYPlot.AXIS_X).setLabelDistance(0.75);
    plot.getAxisRenderer(XYPlot.AXIS_X).setTickLabelFormat(new SimpleDateFormat("HH:mm"));

    InteractivePanel interactivePanel = new InteractivePanel(plot);
    interactivePanel.setZoomable(false);
    interactivePanel.setPannable(false);
    mainPanel.add(interactivePanel);

    Style.registerCssClasses(headerPanel, ".header");
}
 
开发者ID:Drusy,项目名称:freebox-v6-monitor,代码行数:48,代码来源:ChartPanel.java


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