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


Java DataTable类代码示例

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


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

示例1: SineGraph

import de.erichseifert.gral.data.DataTable; //导入依赖的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.data.DataTable; //导入依赖的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: setUpBeforeClass

import de.erichseifert.gral.data.DataTable; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
	dataEmpty = new DataTable(Double.class, Double.class, Double.class);
	dataEmpty.add(0.0, 0.0, 0.0); // 0
	dataEmpty.add(0.0, 0.0, 0.0); // 1
	dataEmpty.add(0.0, 0.0, 0.0); // 2

	dataHorizontal = new DataTable(Double.class, Double.class, Double.class);
	dataHorizontal.add(0.0, 0.0, 0.0); // 0
	dataHorizontal.add(1.0, 1.0, 1.0); // 1
	dataHorizontal.add(0.0, 0.0, 0.0); // 2

	dataVertical = new DataTable(Double.class, Double.class, Double.class);
	dataVertical.add(0.0, 1.0, 0.0); // 0
	dataVertical.add(0.0, 1.0, 0.0); // 1
	dataVertical.add(0.0, 1.0, 0.0); // 2

	dataDiagonal = new DataTable(Double.class, Double.class, Double.class);
	dataDiagonal.add(1.0, 0.0, 0.0); // 0
	dataDiagonal.add(0.0, 1.0, 0.0); // 1
	dataDiagonal.add(0.0, 0.0, 1.0); // 2
}
 
开发者ID:eseifert,项目名称:gral,代码行数:24,代码来源:ResizeTest.java

示例4: setUpBeforeClass

import de.erichseifert.gral.data.DataTable; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
	table = new DataTable(Integer.class, Integer.class, Integer.class);
	table.add(1, 3, 5); // 0
	table.add(2, 8, 2); // 1
	table.add(3, 5, 6); // 2
	table.add(4, 6, 2); // 3
	table.add(5, 4, 1); // 4
	table.add(6, 9, 5); // 5
	table.add(7, 8, 7); // 6
	table.add(8, 1, 9); // 7

	series1 = new DataSeries("series1", table, 0, 1);
	series2 = new DataSeries("series2", table, 1, 2);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:17,代码来源:PlotTest.java

示例5: setUpBeforeClass

import de.erichseifert.gral.data.DataTable; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
	table = new DataTable(Integer.class, Integer.class, Integer.class);
	table.add(1, 3, 1);    // 0
	table.add(2, 5, 2);    // 1
	table.add(3, 2, -1);   // 2
	table.add(4, 1, 0);    // 3
	table.add(5, 4, null); // 4

	row = new Row(table, 0);

	axis = new Axis(-1.0, 1.0);
	axisRenderer = new LinearRenderer2D();
	axisRenderer.setShape(new Line2D.Double(-5.0, 0.0, 5.0, 0.0));

	data = new PointData(
		Arrays.asList(null, axis),
		Arrays.asList(null, axisRenderer),
		row, row.getIndex(), 0);

	shape = new Rectangle2D.Double(-5.0, -5.0, 10.0, 10.0);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:24,代码来源:SizeablePointsRendererTest.java

示例6: setUpBeforeClass

import de.erichseifert.gral.data.DataTable; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
	table = new DataTable(Integer.class, String.class);
	table.add(1, "Jan"); // 0
	table.add(2, "Feb"); // 1
	table.add(3, "Mar"); // 2
	table.add(4, "Apr"); // 3
	table.add(5, "May"); // 4
	table.add(6, "Jun"); // 5
	table.add(7, "Jul"); // 6
	table.add(8, "Aug"); // 7

	row = new Row(table, 4);

	axis = new Axis(0.0, 10.0);

	axisRenderer = new LinearRenderer2D();
	axisRenderer.setShape(new Line2D.Double(-5.0, 0.0, 5.0, 0.0));

	data = new PointData(
		Arrays.asList(null, axis),
		Arrays.asList(null, axisRenderer),
		row, row.getIndex(), 0);
}
 
开发者ID:eseifert,项目名称:gral,代码行数:26,代码来源:AbstractPointRendererTest.java

示例7: setUpBeforeClass

import de.erichseifert.gral.data.DataTable; //导入依赖的package包/类
@BeforeClass
@SuppressWarnings("unchecked")
public static void setUpBeforeClass() {
	table = new DataTable(Integer.class, Integer.class, String.class);
	table.add(1, 9, "Jan"); // 0
	table.add(2, 8, "Feb"); // 1
	table.add(3, 7, "Mar"); // 2
	table.add(4, 6, "Apr"); // 3
	table.add(5, 5, "May"); // 4
	table.add(6, 4, "Jun"); // 5
	table.add(7, 3, "Jul"); // 6
	table.add(8, 1, "Aug"); // 7

	row = new Row(table, 4);

	axis = new Axis(0.0, 10.0);

	axisRenderer = new LinearRenderer2D();
	axisRenderer.setShape(new Line2D.Double(-5.0, 0.0, 5.0, 0.0));

	data = new PointData(
		Arrays.asList(null, axis),
		Arrays.asList(null, axisRenderer),
		row, row.getIndex(), 0);

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

示例8: UpdateTask

import de.erichseifert.gral.data.DataTable; //导入依赖的package包/类
public UpdateTask(DataTable data, XYPlot plot, JComponent comp) {
	this.data = data;
	this.plot = plot;
	this.component = comp;

	// Check for VM specific methods getTotalPhysicalMemorySize() and
	// getFreePhysicalMemorySize()
	OperatingSystemMXBean osBean =
		ManagementFactory.getOperatingSystemMXBean();
	try {
		getTotalPhysicalMemorySize = osBean.getClass()
			.getMethod("getTotalPhysicalMemorySize");
		getTotalPhysicalMemorySize.setAccessible(true);
		getFreePhysicalMemorySize = osBean.getClass()
			.getMethod("getFreePhysicalMemorySize");
		getFreePhysicalMemorySize.setAccessible(true);
	} catch (SecurityException | NoSuchMethodException ex) {
	}
}
 
开发者ID:eseifert,项目名称:gral,代码行数:20,代码来源:MemoryUsage.java

示例9: ScatterPlot

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

示例10: ScatterPlot

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

示例11: RealTimePlot

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

示例12: addAzimuthLine

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

示例13: Graph

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

示例14: AreaPlot

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

示例15: SimplePiePlot

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


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