本文整理汇总了Java中de.erichseifert.gral.data.DataSource.getColumn方法的典型用法代码示例。如果您正苦于以下问题:Java DataSource.getColumn方法的具体用法?Java DataSource.getColumn怎么用?Java DataSource.getColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类de.erichseifert.gral.data.DataSource
的用法示例。
在下文中一共展示了DataSource.getColumn方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: revalidateAxisExtrema
import de.erichseifert.gral.data.DataSource; //导入方法依赖的package包/类
/**
* Rebuilds cached plot data.
*/
private void revalidateAxisExtrema() {
synchronized (this) {
for (Entry<DataSource, Map<Integer, String>> entryByDataSource : columnToAxisMappingByDataSource.entrySet()) {
DataSource dataSource = entryByDataSource.getKey();
Map<Integer, String> columnToAxisMapping = entryByDataSource.getValue();
for (Entry<Integer, String> entry : columnToAxisMapping.entrySet()) {
Integer colIndex = entry.getKey();
String axisName = entry.getValue();
Column<?> col = dataSource.getColumn(colIndex);
Double min = axisMin.get(axisName);
Double max = axisMax.get(axisName);
if (min == null || max == null) {
min = col.getStatistics(Statistics.MIN);
max = col.getStatistics(Statistics.MAX);
} else {
min = Math.min(min, col.getStatistics(Statistics.MIN));
max = Math.max(max, col.getStatistics(Statistics.MAX));
}
axisMin.put(axisName, min);
axisMax.put(axisName, max);
}
}
}
}
示例2: createBoxData
import de.erichseifert.gral.data.DataSource; //导入方法依赖的package包/类
/**
* Extracts statistics from the columns of an data source that are commonly
* used for box-and-whisker plots. The result is a new data source
* containing <i>column index</i>, <i>median</i>, <i>mininum</i>, <i>first
* quartile</i>, <i>third quartile</i>, and <i>maximum</i> for each column.
* @param data Original data source
* @return New data source with (columnIndex, median, min, quartile1,
* quartile3, max)
*/
@SuppressWarnings("unchecked")
public static DataSource createBoxData(DataSource data) {
if (data == null) {
throw new NullPointerException(
"Cannot extract statistics from null data source.");
}
DataTable stats = new DataTable(Integer.class, Double.class,
Double.class, Double.class, Double.class, Double.class);
// Generate statistical values for each column
for (int c = 0; c < data.getColumnCount(); c++) {
Column col = data.getColumn(c);
if (!col.isNumeric()) {
continue;
}
stats.add(
c + 1,
col.getStatistics(Statistics.MEDIAN),
col.getStatistics(Statistics.MIN),
col.getStatistics(Statistics.QUARTILE_1),
col.getStatistics(Statistics.QUARTILE_3),
col.getStatistics(Statistics.MAX)
);
}
return stats;
}
示例3: getColumnTypesFor
import de.erichseifert.gral.data.DataSource; //导入方法依赖的package包/类
private List<Class<? extends Comparable<?>>> getColumnTypesFor(DataSource data) {
List<Class<? extends Comparable<?>>> columnTypes = new LinkedList<>();
for (int colIndex = 0; colIndex < data.getColumnCount(); colIndex++) {
Column<?> column = data.getColumn(colIndex);
if (column.isNumeric()) {
columnTypes.add(Double.class);
columnTypes.add(Double.class);
columnTypes.add(Boolean.class);
} else {
columnTypes.add(column.getType());
}
}
return columnTypes;
}
示例4: testCreatePieDatasBooleanColumnContainsFalseForEveryNegativeInputValue
import de.erichseifert.gral.data.DataSource; //导入方法依赖的package包/类
@Test
public void testCreatePieDatasBooleanColumnContainsFalseForEveryNegativeInputValue() {
DataTable data = new DataTable(Integer.class);
data.add(2);
data.add(-5);
data.add(0);
DataSource pieData = PiePlot.createPieData(data);
Column<Boolean> visibilityColumn = (Column<Boolean>) pieData.getColumn(2);
assertThat(visibilityColumn.get(1), is(false));
}
示例5: testCreatePieDatasBooleanColumnContainsTrueForEveryPositiveInputValue
import de.erichseifert.gral.data.DataSource; //导入方法依赖的package包/类
@Test
public void testCreatePieDatasBooleanColumnContainsTrueForEveryPositiveInputValue() {
DataTable data = new DataTable(Integer.class);
data.add(2);
data.add(-5);
data.add(0);
DataSource pieData = PiePlot.createPieData(data);
Column<Boolean> visibilityColumn = (Column<Boolean>) pieData.getColumn(2);
assertThat(visibilityColumn.get(0), is(true));
}