本文整理汇总了Java中org.jfree.data.DataUtilities类的典型用法代码示例。如果您正苦于以下问题:Java DataUtilities类的具体用法?Java DataUtilities怎么用?Java DataUtilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataUtilities类属于org.jfree.data包,在下文中一共展示了DataUtilities类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getPreviousHeight
import org.jfree.data.DataUtilities; //导入依赖的package包/类
/**
* Calculates the stacked value of the all series up to, but not including
* <code>series</code> for the specified category, <code>category</code>.
* It returns 0.0 if <code>series</code> is the first series, i.e. 0.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param series the series.
* @param category the category.
*
* @return double returns a cumulative value for all series' values up to
* but excluding <code>series</code> for Object
* <code>category</code>.
*/
protected double getPreviousHeight(CategoryDataset dataset,
int series, int category) {
double result = 0.0;
Number n;
double total = 0.0;
if (this.renderAsPercentages) {
total = DataUtilities.calculateColumnTotal(dataset, category);
}
for (int i = 0; i < series; i++) {
n = dataset.getValue(i, category);
if (n != null) {
double v = n.doubleValue();
if (this.renderAsPercentages) {
v = v / total;
}
result += v;
}
}
return result;
}
示例2: createItemArray
import org.jfree.data.DataUtilities; //导入依赖的package包/类
/**
* Creates the array of items that can be passed to the
* {@link MessageFormat} class for creating labels.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param row the row index (zero-based).
* @param column the column index (zero-based).
*
* @return The items (never <code>null</code>).
*/
protected Object[] createItemArray(CategoryDataset dataset,
int row, int column) {
Object[] result = new Object[4];
result[0] = dataset.getRowKey(row).toString();
result[1] = dataset.getColumnKey(column).toString();
Number value = dataset.getValue(row, column);
if (value != null) {
if (this.numberFormat != null) {
result[2] = this.numberFormat.format(value);
}
else if (this.dateFormat != null) {
result[2] = this.dateFormat.format(value);
}
}
else {
result[2] = this.nullValueString;
}
if (value != null) {
double total = DataUtilities.calculateColumnTotal(dataset, column);
double percent = value.doubleValue() / total;
result[3] = this.percentFormat.format(percent);
}
return result;
}
示例3: testCloning
import org.jfree.data.DataUtilities; //导入依赖的package包/类
/**
* Confirm that cloning works.
*/
@Test
public void testCloning() throws CloneNotSupportedException {
double[] starts_S1 = new double[] {0.1, 0.2, 0.3};
double[] starts_S2 = new double[] {0.3, 0.4, 0.5};
double[] ends_S1 = new double[] {0.5, 0.6, 0.7};
double[] ends_S2 = new double[] {0.7, 0.8, 0.9};
double[][] starts = new double[][] {starts_S1, starts_S2};
double[][] ends = new double[][] {ends_S1, ends_S2};
DefaultIntervalCategoryDataset d1 = new DefaultIntervalCategoryDataset(
new Comparable[] {"Series 1", "Series 2"},
new Comparable[] {"Category 1", "Category 2", "Category 3"},
DataUtilities.createNumberArray2D(starts),
DataUtilities.createNumberArray2D(ends));
DefaultIntervalCategoryDataset d2 = null;
d2 = (DefaultIntervalCategoryDataset) d1.clone();
assertTrue(d1 != d2);
assertTrue(d1.getClass() == d2.getClass());
assertTrue(d1.equals(d2));
// check that the clone doesn't share the same underlying arrays.
d1.setStartValue(0, "Category 1", new Double(0.99));
assertFalse(d1.equals(d2));
d2.setStartValue(0, "Category 1", new Double(0.99));
assertTrue(d1.equals(d2));
}
示例4: getPreviousHeight
import org.jfree.data.DataUtilities; //导入依赖的package包/类
/**
* Calculates the stacked value of the all series up to, but not including
* <code>series</code> for the specified category, <code>category</code>.
* It returns 0.0 if <code>series</code> is the first series, i.e. 0.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param series the series.
* @param category the category.
*
* @return double returns a cumulative value for all series' values up to
* but excluding <code>series</code> for Object
* <code>category</code>.
*
* @deprecated As of 1.0.13, as the method is never used internally.
*/
protected double getPreviousHeight(CategoryDataset dataset,
int series, int category) {
double result = 0.0;
Number n;
double total = 0.0;
if (this.renderAsPercentages) {
total = DataUtilities.calculateColumnTotal(dataset, category);
}
for (int i = 0; i < series; i++) {
n = dataset.getValue(i, category);
if (n != null) {
double v = n.doubleValue();
if (this.renderAsPercentages) {
v = v / total;
}
result += v;
}
}
return result;
}
示例5: createItemArray
import org.jfree.data.DataUtilities; //导入依赖的package包/类
/**
* Creates the array of items that can be passed to the
* {@link MessageFormat} class for creating labels.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param row the row index (zero-based).
* @param column the column index (zero-based).
*
* @return The items (never <code>null</code>).
*/
protected Object[] createItemArray(CategoryDataset dataset,
int row, int column) {
Object[] result = new Object[4];
result[0] = dataset.getRowKey(row).toString();
result[1] = dataset.getColumnKey(column).toString();
Number value = dataset.getValue(row, column);
if (value != null) {
if (this.numberFormat != null) {
result[2] = this.numberFormat.format(value);
}
else if (this.dateFormat != null) {
result[2] = this.dateFormat.format(value);
}
}
else {
result[2] = this.nullValueString;
}
if (value != null) {
double total = DataUtilities.calculateColumnTotal(dataset, column);
double percent = value.doubleValue() / total;
result[3] = this.percentFormat.format(percent);
}
return result;
}
示例6: getPreviousHeight
import org.jfree.data.DataUtilities; //导入依赖的package包/类
/**
* Calculates the stacked value of the all series up to, but not including
* <code>series</code> for the specified category, <code>category</code>.
* It returns 0.0 if <code>series</code> is the first series, i.e. 0.
*
* @param dataset the dataset (<code>null</code> not permitted).
* @param series the series.
* @param category the category.
*
* @return double returns a cumulative value for all series' values up to
* but excluding <code>series</code> for Object
* <code>category</code>.
*/
protected double getPreviousHeight(CategoryDataset dataset,
int series, int category) {
double result = 0.0;
Number n;
double total = 0.0;
if (this.renderAsPercentages) {
total = DataUtilities.calculateColumnTotal(dataset, category);
}
for (int i = 0; i < series; i++) {
n = dataset.getValue(i, category);
if (n != null) {
double v = n.doubleValue();
if (this.renderAsPercentages) {
v = v / total;
}
result += v;
}
}
return result;
}
示例7: testClone
import org.jfree.data.DataUtilities; //导入依赖的package包/类
/**
* Some tests for the clone() method.
*/
public void testClone() {
double[][] a = new double[1][];
double[][] b = DataUtilities.clone(a);
assertTrue(DataUtilities.equal(a, b));
a[0] = new double[] { 3.0, 4.0 };
assertFalse(DataUtilities.equal(a, b));
b[0] = new double[] { 3.0, 4.0 };
assertTrue(DataUtilities.equal(a, b));
a = new double[2][3];
a[0][0] = 1.23;
a[1][1] = Double.NaN;
b = DataUtilities.clone(a);
assertTrue(DataUtilities.equal(a, b));
a[0][0] = 99.9;
assertFalse(DataUtilities.equal(a, b));
b[0][0] = 99.9;
assertTrue(DataUtilities.equal(a, b));
}