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


Java DatasetUtilities类代码示例

本文整理汇总了Java中org.jfree.data.general.DatasetUtilities的典型用法代码示例。如果您正苦于以下问题:Java DatasetUtilities类的具体用法?Java DatasetUtilities怎么用?Java DatasetUtilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: testReplaceDataset

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Replaces the dataset and checks that the data range is as expected.
 */
public void testReplaceDataset() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data);

    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    this.chart.getCategoryPlot().setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = this.chart.getCategoryPlot().getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
               + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
               + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:BarChart3DTests.java

示例2: createItemArray

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Creates the array of items that can be passed to the 
 * {@link MessageFormat} class for creating labels.  The returned array
 * contains four values:
 * <ul>
 * <li>result[0] = the section key converted to a <code>String</code>;</li>
 * <li>result[1] = the formatted data value;</li>
 * <li>result[2] = the formatted percentage (of the total);</li>
 * <li>result[3] = the formatted total value.</li>
 * </ul>
 *
 * @param dataset  the dataset (<code>null</code> not permitted).
 * @param key  the key (<code>null</code> not permitted).
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(PieDataset dataset, Comparable key) {
    Object[] result = new Object[4];
    double total = DatasetUtilities.calculatePieDatasetTotal(dataset);
    result[0] = key.toString();
    Number value = dataset.getValue(key);
    if (value != null) {
        result[1] = this.numberFormat.format(value);  
    }
    else {
        result[1] = "null";
    }
    double percent = 0.0;
    if (value != null) {
        double v = value.doubleValue();
        if (v > 0.0) {
            percent = v / total; 
        }
    }       
    result[2] = this.percentFormat.format(percent);
    result[3] = this.numberFormat.format(total);
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:39,代码来源:AbstractPieItemLabelGenerator.java

示例3: testReplaceDataset

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Replaces the dataset and checks that it has changed as expected.
 */
public void testReplaceDataset() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data);

    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    this.chart.getCategoryPlot().setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = this.chart.getCategoryPlot().getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
                + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
               + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:StackedBarChartTests.java

示例4: createChart

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Create a horizontal bar chart with sample data in the range -3 to +3.
 *
 * @return the chart.
 */
private static JFreeChart createChart() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-3), new Integer(-2)},
         {new Integer(-1), new Integer(1)},
         {new Integer(2), new Integer(3)}};

    CategoryDataset dataset = DatasetUtilities.createCategoryDataset("S", "C", data);

    // create the chart...
    return ChartFactory.createStackedBarChart(
        "Stacked Bar Chart",  // chart title
        "Domain", "Range",
        dataset,      // data
        PlotOrientation.HORIZONTAL,
        true,         // include legend
        true,
        false
    );

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:StackedBarChartTests.java

示例5: testReplaceDataset

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Replaces the chart's dataset and then checks that the new dataset is OK.
 */
public void testReplaceDataset() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", "C", data);

    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    this.chart.getCategoryPlot().setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = this.chart.getCategoryPlot().getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
               + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
               + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:BarChartTests.java

示例6: createBarChart

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Create a horizontal bar chart with sample data in the range -3 to +3.
 *
 * @return the chart.
 */
private static JFreeChart createBarChart() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-3), new Integer(-2)},
         {new Integer(-1), new Integer(1)},
         {new Integer(2), new Integer(3)}};

    CategoryDataset dataset = DatasetUtilities.createCategoryDataset("S", "C", data);

    // create the chart...
    return ChartFactory.createBarChart(
        "Horizontal Bar Chart",
        "Domain", "Range",
        dataset,
        PlotOrientation.HORIZONTAL,
        true,     // include legend
        true,
        false
    );

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:BarChartTests.java

示例7: render

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Draws a representation of the data within the dataArea region, using the
 * current m_Renderer.
 *
 * @param g2  the graphics device.
 * @param dataArea  the region in which the data is to be drawn.
 * @param info  an optional object for collection dimension 
 *              information (<code>null</code> permitted).
 */
public void render(Graphics2D g2,
                   Rectangle2D dataArea,
                   PlotRenderingInfo info) {
  
    // now get the data and plot it (the visual representation will depend
    // on the m_Renderer that has been set)...
    if (!DatasetUtilities.isEmptyOrNull(this.dataset)) {
        int seriesCount = this.dataset.getSeriesCount();
        for (int series = 0; series < seriesCount; series++) {
            this.renderer.drawSeries(
                g2, dataArea, info, this, this.dataset, series
            );
        }
    }
    else {
        drawNoDataMessage(g2, dataArea);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:PolarPlot.java

示例8: getDataRange

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Returns the range for an axis.
 *
 * @param axis  the axis.
 *
 * @return The range for an axis.
 */
public Range getDataRange(ValueAxis axis) {

    if (this.dataset == null) {
        return null;
    }

    Range result = null;

    if (axis == getDomainAxis()) {
        result = DatasetUtilities.findDomainExtent(this.dataset);
    }
    else if (axis == getRangeAxis()) {
        result = DatasetUtilities.findRangeExtent(this.dataset);
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:ContourPlot.java

示例9: createItemArray

import org.jfree.data.general.DatasetUtilities; //导入依赖的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 key  the key.
 *
 * @return The items (never <code>null</code>).
 */
protected Object[] createItemArray(PieDataset dataset, Comparable key) {
    Object[] result = new Object[3];
    result[0] = key.toString();
    Number value = dataset.getValue(key);
    result[1] = this.numberFormat.format(value);  
    double percent = 0.0;
    if (value != null) {
        double v = value.doubleValue();
        if (v > 0.0) {
            percent = v / DatasetUtilities.calculatePieDatasetTotal(dataset); 
        }
    }       
    result[2] = this.percentFormat.format(percent);
    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:StandardPieItemLabelGenerator.java

示例10: getDataRange

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Returns the range for an axis.
 *
 * @param axis  the axis.
 *
 * @return The range for an axis.
 */
public Range getDataRange(ValueAxis axis) {

    if (this.dataset == null) {
        return null;
    }

    Range result = null;

    if (axis == getDomainAxis()) {
        result = DatasetUtilities.findDomainBounds(this.dataset);
    }
    else if (axis == getRangeAxis()) {
        result = DatasetUtilities.findRangeBounds(this.dataset);
    }

    return result;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:26,代码来源:ContourPlot.java

示例11: testCumulativeRange2

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * A further test for the cumulative range calculation.
 */
public void testCumulativeRange2() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(-21.4, "Series 1", "Start Value");
    dataset.addValue(11.57, "Series 1", "Delta 1");
    dataset.addValue(3.51, "Series 1", "Delta 2");
    dataset.addValue(-12.36, "Series 1", "Delta 3");
    dataset.addValue(3.39, "Series 1", "Delta 4");
    dataset.addValue(38.68, "Series 1", "Delta 5");
    dataset.addValue(-43.31, "Series 1", "Delta 6");
    dataset.addValue(-29.59, "Series 1", "Delta 7");
    dataset.addValue(35.30, "Series 1", "Delta 8");
    dataset.addValue(5.0, "Series 1", "Delta 9");
    Range range = DatasetUtilities.findCumulativeRangeExtent(dataset);
    assertTrue(NumberUtils.equal(range.getLowerBound(), -49.51));
    assertTrue(NumberUtils.equal(range.getUpperBound(), 23.39));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:DatasetUtilitiesTests.java

示例12: testReplaceDataset

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Replaces the dataset and checks that it has changed as expected.
 */
public void testReplaceDataset() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", 
            "C", data);

    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
    plot.setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
                + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
               + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:StackedBarChart3DTests.java

示例13: createChart

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Create a stacked bar chart with sample data in the range -3 to +3.
 *
 * @return The chart.
 */
private static JFreeChart createChart() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-3), new Integer(-2)},
         {new Integer(-1), new Integer(1)},
         {new Integer(2), new Integer(3)}};

    CategoryDataset dataset = DatasetUtilities.createCategoryDataset("S", 
            "C", data);

    // create the chart...
    return ChartFactory.createStackedBarChart3D(
        "Stacked Bar Chart 3D",  // chart title
        "Domain", "Range",
        dataset,      // data
        PlotOrientation.HORIZONTAL,
        true,         // include legend
        true,
        true
    );

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:StackedBarChart3DTests.java

示例14: testReplaceDataset

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Replaces the dataset and checks that the data range is as expected.
 */
public void testReplaceDataset() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-30), new Integer(-20)},
         {new Integer(-10), new Integer(10)},
         {new Integer(20), new Integer(30)}};

    CategoryDataset newData = DatasetUtilities.createCategoryDataset("S", 
            "C", data);

    LocalListener l = new LocalListener();
    this.chart.addChangeListener(l);
    CategoryPlot plot = (CategoryPlot) this.chart.getPlot();
    plot.setDataset(newData);
    assertEquals(true, l.flag);
    ValueAxis axis = plot.getRangeAxis();
    Range range = axis.getRange();
    assertTrue("Expecting the lower bound of the range to be around -30: "
            + range.getLowerBound(), range.getLowerBound() <= -30);
    assertTrue("Expecting the upper bound of the range to be around 30: "
            + range.getUpperBound(), range.getUpperBound() >= 30);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:BarChart3DTests.java

示例15: createBarChart3D

import org.jfree.data.general.DatasetUtilities; //导入依赖的package包/类
/**
 * Create a horizontal bar chart with sample data in the range -3 to +3.
 *
 * @return The chart.
 */
private static JFreeChart createBarChart3D() {

    // create a dataset...
    Number[][] data = new Integer[][]
        {{new Integer(-3), new Integer(-2)},
         {new Integer(-1), new Integer(1)},
         {new Integer(2), new Integer(3)}};

    CategoryDataset dataset = DatasetUtilities.createCategoryDataset("S", 
            "C", data);

    // create the chart...
    return ChartFactory.createBarChart3D("Bar Chart 3D", "Domain", "Range",
            dataset, PlotOrientation.HORIZONTAL, true, true, true);

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:BarChart3DTests.java


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