本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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;
}