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


Java DatasetUtilities.createCategoryDataset方法代码示例

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


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

示例1: createLineChart3D

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

    // 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.createLineChart3D(
        "Line Chart",
        "Domain", "Range",
        dataset,
        PlotOrientation.HORIZONTAL,
        true,     // include legend
        true,
        true
    );

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

示例2: 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,  // include legend
        true,
        false
    );

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

示例3: 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);
    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,代码来源:BarChartTests.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: testCreateCategoryDataset2

import org.jfree.data.general.DatasetUtilities; //导入方法依赖的package包/类
/**
 * Test the creation of a dataset from an array.  This time is should fail because
 * the array dimensions are around the wrong way.
 */
public void testCreateCategoryDataset2() {
    boolean pass = false;
    final String[] rowKeys = {"R1", "R2", "R3"};
    final String[] columnKeys = {"C1", "C2"};
    final double[][] data = new double[2][];
    data[0] = new double[] {1.1, 1.2, 1.3};
    data[1] = new double[] {2.1, 2.2, 2.3};
    CategoryDataset dataset = null;
    try {
        dataset = DatasetUtilities.createCategoryDataset(
           rowKeys, columnKeys, data
        );
    }
    catch (IllegalArgumentException e) {
        pass = true;  // got it!
    }
    assertTrue(pass);
    assertTrue(dataset == null);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:DatasetUtilitiesTests.java

示例8: 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

示例9: 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

示例10: 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

示例11: createLineChart

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

    // 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.createLineChart(
        "Line Chart",
        "Domain", "Range",
        dataset,
        PlotOrientation.HORIZONTAL,
        true,     // include legend
        true,
        true
    );

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

示例12: 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.createStackedBarChart(
        "Stacked Bar Chart",  // chart title
        "Domain", "Range",
        dataset,      // data
        PlotOrientation.HORIZONTAL,
        true,         // include legend
        true,
        true
    );

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

示例13: createWaterfallChart

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

    // 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.createWaterfallChart(
        "Waterfall Chart",
        "Domain", "Range",
        dataset,
        PlotOrientation.HORIZONTAL,
        true,     // include legend
        true,
        true
    );

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

示例14: 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() {
    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,代码行数:25,代码来源:AreaChartTests.java

示例15: 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.createStackedAreaChart(
        "Stacked Area Chart",  // chart title
        "Domain", "Range",
        dataset,      // data
        PlotOrientation.HORIZONTAL,
        true,         // include legend
        true,
        true
    );

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


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