本文整理汇总了Java中de.erichseifert.gral.data.DataTable.getColumnCount方法的典型用法代码示例。如果您正苦于以下问题:Java DataTable.getColumnCount方法的具体用法?Java DataTable.getColumnCount怎么用?Java DataTable.getColumnCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.erichseifert.gral.data.DataTable
的用法示例。
在下文中一共展示了DataTable.getColumnCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillWithEmptyRows
import de.erichseifert.gral.data.DataTable; //导入方法依赖的package包/类
/**
* Utility method that fills a data table with empty rows.
* @param data Data table that should be filled.
* @param count Number of rows that were added.
*/
private static void fillWithEmptyRows(DataTable data, int count) {
while (data.getRowCount() < count) {
Double[] emptyRow = new Double[data.getColumnCount()];
Arrays.fill(emptyRow, 0.0);
data.add(emptyRow);
}
}
示例2: SimpleRasterPlot
import de.erichseifert.gral.data.DataTable; //导入方法依赖的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);
}
示例3: SimpleRasterPlot
import de.erichseifert.gral.data.DataTable; //导入方法依赖的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);
}