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


Java DefaultTableXYDataset.setAutoWidth方法代码示例

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


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

示例1: testAddSeries

import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
 * This is a test for bug 1312066 - adding a new series should trigger a
 * recalculation of the interval width, if it is being automatically
 * calculated.
 */
public void testAddSeries() {
    DefaultTableXYDataset d1 = new DefaultTableXYDataset();
    d1.setAutoWidth(true);
    XYSeries s1 = new XYSeries("Series 1", true, false);
    s1.add(3.0, 1.1);
    s1.add(7.0, 2.2);
    d1.addSeries(s1);
    assertEquals(3.0, d1.getXValue(0, 0), EPSILON);
    assertEquals(7.0, d1.getXValue(0, 1), EPSILON);
    assertEquals(1.0, d1.getStartXValue(0, 0), EPSILON);
    assertEquals(5.0, d1.getStartXValue(0, 1), EPSILON);
    assertEquals(5.0, d1.getEndXValue(0, 0), EPSILON);
    assertEquals(9.0, d1.getEndXValue(0, 1), EPSILON);

    // now add another series
    XYSeries s2 = new XYSeries("Series 2", true, false);
    s2.add(7.5, 1.1);
    s2.add(9.0, 2.2);       
    d1.addSeries(s2);
 
    assertEquals(3.0, d1.getXValue(1, 0), EPSILON);
    assertEquals(7.0, d1.getXValue(1, 1), EPSILON);
    assertEquals(7.5, d1.getXValue(1, 2), EPSILON);
    assertEquals(9.0, d1.getXValue(1, 3), EPSILON);
    
    assertEquals(7.25, d1.getStartXValue(1, 2), EPSILON);
    assertEquals(8.75, d1.getStartXValue(1, 3), EPSILON);
    assertEquals(7.75, d1.getEndXValue(1, 2), EPSILON);
    assertEquals(9.25, d1.getEndXValue(1, 3), EPSILON);

    // and check the first series too...
    assertEquals(2.75, d1.getStartXValue(0, 0), EPSILON);
    assertEquals(6.75, d1.getStartXValue(0, 1), EPSILON);
    assertEquals(3.25, d1.getEndXValue(0, 0), EPSILON);
    assertEquals(7.25, d1.getEndXValue(0, 1), EPSILON);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:42,代码来源:DefaultTableXYDatasetTests.java

示例2: testAddSeries

import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
/**
 * This is a test for bug 1312066 - adding a new series should trigger a
 * recalculation of the interval width, if it is being automatically
 * calculated.
 */
public void testAddSeries() {
    DefaultTableXYDataset d1 = new DefaultTableXYDataset();
    d1.setAutoWidth(true);
    XYSeries s1 = new XYSeries("Series 1", true, false);
    s1.add(3.0, 1.1);
    s1.add(7.0, 2.2);
    d1.addSeries(s1);
    assertEquals(3.0, d1.getXValue(0, 0), EPSILON);
    assertEquals(7.0, d1.getXValue(0, 1), EPSILON);
    assertEquals(1.0, d1.getStartXValue(0, 0), EPSILON);
    assertEquals(5.0, d1.getStartXValue(0, 1), EPSILON);
    assertEquals(5.0, d1.getEndXValue(0, 0), EPSILON);
    assertEquals(9.0, d1.getEndXValue(0, 1), EPSILON);

    // now add another series
    XYSeries s2 = new XYSeries("Series 2", true, false);
    s2.add(7.5, 1.1);
    s2.add(9.0, 2.2);
    d1.addSeries(s2);

    assertEquals(3.0, d1.getXValue(1, 0), EPSILON);
    assertEquals(7.0, d1.getXValue(1, 1), EPSILON);
    assertEquals(7.5, d1.getXValue(1, 2), EPSILON);
    assertEquals(9.0, d1.getXValue(1, 3), EPSILON);

    assertEquals(7.25, d1.getStartXValue(1, 2), EPSILON);
    assertEquals(8.75, d1.getStartXValue(1, 3), EPSILON);
    assertEquals(7.75, d1.getEndXValue(1, 2), EPSILON);
    assertEquals(9.25, d1.getEndXValue(1, 3), EPSILON);

    // and check the first series too...
    assertEquals(2.75, d1.getStartXValue(0, 0), EPSILON);
    assertEquals(6.75, d1.getStartXValue(0, 1), EPSILON);
    assertEquals(3.25, d1.getEndXValue(0, 0), EPSILON);
    assertEquals(7.25, d1.getEndXValue(0, 1), EPSILON);
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:42,代码来源:DefaultTableXYDatasetTests.java

示例3: createDefaultTableXYDataset

import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
public static DefaultTableXYDataset createDefaultTableXYDataset(ValueSource valueSource, PlotInstance plotInstance) throws ChartPlottimeException {
	ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
	assertMaxValueCountNotExceededOrThrowException(valueSourceData);
	GroupCellSeriesData dataForAllGroupCells = valueSourceData.getSeriesDataForAllGroupCells();
	DefaultTableXYDataset dataset = new DefaultTableXYDataset();

	// Loop all group cells and add data to dataset
	for (GroupCellKeyAndData groupCellKeyAndData : dataForAllGroupCells) {
		GroupCellKey groupCellKey = groupCellKeyAndData.getKey();
		GroupCellData groupCellData = groupCellKeyAndData.getData();

		Map<PlotDimension, double[]> dataForUsageType = groupCellData.getDataForUsageType(SeriesUsageType.MAIN_SERIES);
		double[] xValues = dataForUsageType.get(PlotDimension.DOMAIN);
		double[] yValues = dataForUsageType.get(PlotDimension.VALUE);
		int rowCount = xValues.length;

		String seriesName = generateSeriesName(valueSource, groupCellKey, plotInstance.getCurrentPlotConfigurationClone());

		XYSeries series = new XYSeries(seriesName, false, false);

		// Loop all rows and add data to series
		double x;
		double y;
		for (int row = 0; row < rowCount; ++row) {
			x = xValues[row];
			y = yValues[row];
			try {
				if (!Double.isNaN(x)) {
					series.add(x, y, false); // false means: do not notify. Since we are currently initializing, this is not necessary and saves us some fractions of a second
				}
			} catch (SeriesException e) {
				throw new ChartPlottimeException("duplicate_value", valueSource.toString(), PlotDimension.DOMAIN.getName());
			}
		}
		dataset.addSeries(series);
	}
	dataset.setAutoWidth(true);
	return dataset;
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:40,代码来源:ChartDatasetFactory.java

示例4: createDefaultTableXYDataset

import org.jfree.data.xy.DefaultTableXYDataset; //导入方法依赖的package包/类
public static DefaultTableXYDataset createDefaultTableXYDataset(ValueSource valueSource, PlotInstance plotInstance)
		throws ChartPlottimeException {
	ValueSourceData valueSourceData = plotInstance.getPlotData().getValueSourceData(valueSource);
	assertMaxValueCountNotExceededOrThrowException(valueSourceData);
	GroupCellSeriesData dataForAllGroupCells = valueSourceData.getSeriesDataForAllGroupCells();
	DefaultTableXYDataset dataset = new DefaultTableXYDataset();

	// Loop all group cells and add data to dataset
	for (GroupCellKeyAndData groupCellKeyAndData : dataForAllGroupCells) {
		GroupCellKey groupCellKey = groupCellKeyAndData.getKey();
		GroupCellData groupCellData = groupCellKeyAndData.getData();

		Map<PlotDimension, double[]> dataForUsageType = groupCellData.getDataForUsageType(SeriesUsageType.MAIN_SERIES);
		double[] xValues = dataForUsageType.get(PlotDimension.DOMAIN);
		double[] yValues = dataForUsageType.get(PlotDimension.VALUE);
		int rowCount = xValues.length;

		String seriesName = generateSeriesName(valueSource, groupCellKey,
				plotInstance.getCurrentPlotConfigurationClone());

		XYSeries series = new XYSeries(seriesName, false, false);

		// Loop all rows and add data to series
		double x;
		double y;
		for (int row = 0; row < rowCount; ++row) {
			x = xValues[row];
			y = yValues[row];
			try {
				if (!Double.isNaN(x)) {
					series.add(x, y, false); // false means: do not notify. Since we are
												// currently initializing, this is not necessary
												// and saves
												// us some fractions of a second
				}
			} catch (SeriesException e) {
				throw new ChartPlottimeException("duplicate_value", valueSource.toString(),
						PlotDimension.DOMAIN.getName());
			}
		}
		dataset.addSeries(series);
	}
	dataset.setAutoWidth(true);
	return dataset;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:46,代码来源:ChartDatasetFactory.java


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