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


Java DataSource.getColumn方法代码示例

本文整理汇总了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);
			}
		}
	}
}
 
开发者ID:eseifert,项目名称:gral,代码行数:29,代码来源:AbstractPlot.java

示例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;
}
 
开发者ID:eseifert,项目名称:gral,代码行数:37,代码来源:BoxPlot.java

示例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;
}
 
开发者ID:eseifert,项目名称:gral,代码行数:15,代码来源:PiePlot.java

示例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));
}
 
开发者ID:eseifert,项目名称:gral,代码行数:13,代码来源:PiePlotTest.java

示例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));
}
 
开发者ID:eseifert,项目名称:gral,代码行数:13,代码来源:PiePlotTest.java


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