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


Java DefaultCategoryDataset类代码示例

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


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

示例1: createCategoryDataset

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
/**
 * Creates a {@link CategoryDataset} that contains a copy of the data in an
 * array (instances of <code>Double</code> are created to represent the 
 * data items).
 * <p>
 * Row and column keys are created by appending 0, 1, 2, ... to the 
 * supplied prefixes.
 *
 * @param rowKeyPrefix  the row key prefix.
 * @param columnKeyPrefix  the column key prefix.
 * @param data  the data.
 *
 * @return The dataset.
 */
public static CategoryDataset createCategoryDataset(String rowKeyPrefix,
                                                    String columnKeyPrefix,
                                                    double[][] data) {

    DefaultCategoryDataset result = new DefaultCategoryDataset();
    for (int r = 0; r < data.length; r++) {
        String rowKey = rowKeyPrefix + (r + 1);
        for (int c = 0; c < data[r].length; c++) {
            String columnKey = columnKeyPrefix + (c + 1);
            result.addValue(new Double(data[r][c]), rowKey, columnKey);
        }
    }
    return result;

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

示例2: testGetColumnCount

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
/**
 * Some tests for the getColumnCount() method.
 */
public void testGetColumnCount() {
    DefaultCategoryDataset d = new DefaultCategoryDataset();
    assertTrue(d.getColumnCount() == 0);
    
    d.addValue(1.0, "R1", "C1");
    assertTrue(d.getColumnCount() == 1);
    
    d.addValue(1.0, "R1", "C2");
    assertTrue(d.getColumnCount() == 2);
    
    d.addValue(2.0, "R1", "C2");
    assertTrue(d.getColumnCount() == 2);
    
    // a column of all null values is still counted...
    d.setValue(null, "R1", "C2");
    assertTrue(d.getColumnCount() == 2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:DefaultCategoryDatasetTests.java

示例3: readCategoryDataset

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
/**
 * Reads a {@link CategoryDataset} from a CSV file or input source.
 * 
 * @param in  the input source.
 * 
 * @return A category dataset.
 * 
 * @throws IOException if there is an I/O problem.
 */
public CategoryDataset readCategoryDataset(Reader in) throws IOException {
    
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    BufferedReader reader = new BufferedReader(in);
    List columnKeys = null;
    int lineIndex = 0;
    String line = reader.readLine();
    while (line != null) {
        if (lineIndex == 0) {  // first line contains column keys
            columnKeys = extractColumnKeys(line);
        }
        else {  // remaining lines contain a row key and data values
            extractRowKeyAndData(line, dataset, columnKeys);
        }
        line = reader.readLine();
        lineIndex++;
    }
    return dataset;     
     
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:CSV.java

示例4: testGetRowCount

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
/**
 * Some tests for the getRowCount() method.
 */
public void testGetRowCount() {
    DefaultCategoryDataset d = new DefaultCategoryDataset();
    assertTrue(d.getRowCount() == 0);
    
    d.addValue(1.0, "R1", "C1");
    assertTrue(d.getRowCount() == 1);
    
    d.addValue(1.0, "R2", "C1");
    assertTrue(d.getRowCount() == 2);
    
    d.addValue(2.0, "R2", "C1");
    assertTrue(d.getRowCount() == 2);
    
    // a row of all null values is still counted...
    d.setValue(null, "R2", "C1");
    assertTrue(d.getRowCount() == 2);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:DefaultCategoryDatasetTests.java

示例5: generateTimeoutPerformChart

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
public static void generateTimeoutPerformChart(String dbName,long performBatchId,String path,LoadTypeEnum loadTypeEnum){
		DefaultCategoryDataset values = new DefaultCategoryDataset();   
	    List<Map<String, Object>> list = BizDBUtils.selectListBySqlAndParam("select target_times,timeout_max,timeout_min,timeout_avg,timeout_th50,timeout_th95 from ts_timeout_perform where  perform_batch_id=? and load_type=?",performBatchId,loadTypeEnum.getId());
	    System.out.println(list);
	    if(list!=null&&list.size()>0){
	    	for(int i=0;i<list.size();i++){
	    		Map<String, Object> map = list.get(i);
	    		values.addValue(((Number)map.get("timeout_max")).doubleValue(),dbName,"timeout_max");
	    		values.addValue(((Number)map.get("timeout_min")).doubleValue(),dbName,"timeout_min");
	    		values.addValue(((Number)map.get("timeout_avg")).doubleValue(),dbName,"timeout_avg");
	    		values.addValue(((Number)map.get("timeout_th95")).doubleValue(),dbName,"timeout_th95");
	    		values.addValue(((Number)map.get("timeout_th50")).doubleValue(),dbName,"timeout_th50");
	    	}
	    }
	    JFreeChart mChart = createBarChart("写入延迟对比图",  "性能指标","延迟时间", values);
//	    JFreeChart mChart= createXYLineChart("数据导入速度折线图", "导入次数","导入速度",mCollection);
	    saveAsFile(mChart,path, 2400, 800);
	}
 
开发者ID:dbiir,项目名称:ts-benchmark,代码行数:19,代码来源:ChartBizUtil.java

示例6: generateThroughRequestsBar

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
/**
 * 请求吞吐量 直方图
 * @param dbs
 */
private static void generateThroughRequestsBar(List<String> dbs) {
	DefaultCategoryDataset values = new DefaultCategoryDataset();   
	String sql="SELECT perform_batch.id, perform_batch.db db, sum(ttp.success_times) / ( sum(ttp.timeout_avg) / 1000000.0 ) AS avg, sum(ttp.success_times) / ( sum(ttp.timeout_min) / 1000000.0 ) AS max, sum(ttp.success_times) / ( sum(ttp.timeout_max) / 1000000.0 ) AS min FROM ts_timeout_perform ttp, ( SELECT batch.db db, max(tpb.id) id FROM ts_perform_batch tpb, ( SELECT max(id) id, target_db db FROM ts_load_batch tlb WHERE data_status = 1 GROUP BY target_db ) batch WHERE batch.id = tpb.load_batch_id GROUP BY tpb.load_batch_id ) perform_batch WHERE ttp.perform_batch_id = perform_batch.id AND ttp.load_type = 99 GROUP BY perform_batch.db";
    List<Map<String, Object>> list = BizDBUtils.selectListBySqlAndParam(sql);
    if(list!=null&&list.size()>0){
    	for(int i=0;i<list.size();i++){
    		Map<String, Object> map = list.get(i);
    		values.addValue(((Number)map.get("max")).doubleValue(),getDBName(map.get("db").toString()),"max");
    		values.addValue(((Number)map.get("min")).doubleValue(),getDBName(map.get("db").toString()),"min");
    		values.addValue(((Number)map.get("avg")).doubleValue(),getDBName(map.get("db").toString()),"avg");
    	}
    }
    JFreeChart mChart = createBarChart("数据库吞吐量对比图",  "性能指标","speed(requests/sec)", values);
    String path=getChartRootPath("throughput_perform_requests_bar");
    saveAsFile(mChart,path, 1200, 800);
}
 
开发者ID:dbiir,项目名称:ts-benchmark,代码行数:21,代码来源:ChartBizUtil.java

示例7: generateThroughPointsBar

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
private static void generateThroughPointsBar(List<String> dbs) {
	DefaultCategoryDataset values = new DefaultCategoryDataset();   
	String sql="SELECT batch.db db, sum(load_points)/(sum(load_cost_time)/1000.0)  avg, max(pps) max, min(pps) min FROM ts_load_record tlr, ( SELECT max(id) id, target_db db FROM ts_load_batch tlb WHERE data_status = 1 GROUP BY target_db ) batch WHERE batch.id = tlr.load_batch_id GROUP BY load_batch_id";
    List<Map<String, Object>> list = BizDBUtils.selectListBySqlAndParam(sql);
    if(list!=null&&list.size()>0){
    	for(int i=0;i<list.size();i++){
    		Map<String, Object> map = list.get(i);
    		values.addValue(Double.parseDouble(df.format(((Number)map.get("max")).doubleValue())),getDBName(map.get("db").toString()),"max");
    		values.addValue(Double.parseDouble(df.format(((Number)map.get("min")).doubleValue())),getDBName(map.get("db").toString()),"min");
    		values.addValue(Double.parseDouble(df.format(((Number)map.get("avg")).doubleValue())),getDBName(map.get("db").toString()),"avg");
    	}
    }
    JFreeChart mChart = createBarChart("import_speed_comparison",  "性能指标","speed(points/s)", values);
    String path=getChartRootPath("import_points_speed_comparison_line");
    saveAsFile(mChart,path, 1200, 800);
}
 
开发者ID:dbiir,项目名称:ts-benchmark,代码行数:17,代码来源:ChartBizUtil.java

示例8: generateThroughSizeBar

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
private static void generateThroughSizeBar(List<String> dbs) {
	DefaultCategoryDataset values = new DefaultCategoryDataset();   
	String sql="SELECT batch.db db, sum(load_size/1024.0/1024)/(sum(load_cost_time)/1000.0) avg, max(sps) max, min(sps) min FROM ts_load_record tlr, ( SELECT max(id) id, target_db db FROM ts_load_batch tlb WHERE data_status = 1 GROUP BY target_db ) batch WHERE batch.id = tlr.load_batch_id GROUP BY load_batch_id";
    List<Map<String, Object>> list = BizDBUtils.selectListBySqlAndParam(sql);
    if(list!=null&&list.size()>0){
    	for(int i=0;i<list.size();i++){
    		Map<String, Object> map = list.get(i);
    		values.addValue(Double.parseDouble(df.format(((Number)map.get("max")).doubleValue())),getDBName(map.get("db").toString()),"max");
    		values.addValue(Double.parseDouble(df.format(((Number)map.get("min")).doubleValue())),getDBName(map.get("db").toString()),"min");
    		values.addValue(Double.parseDouble(df.format(((Number)map.get("avg")).doubleValue())),getDBName(map.get("db").toString()),"avg");
    	}
    }
    JFreeChart mChart = createBarChart("import_speed_comparison",  "性能指标","speed(MB/s)", values);
    String path=getChartRootPath("import_size_speed_comparison_line");
    saveAsFile(mChart,path, 1200, 800);
}
 
开发者ID:dbiir,项目名称:ts-benchmark,代码行数:17,代码来源:ChartBizUtil.java

示例9: createDataset

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
private CategoryDataset createDataset(String type) {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    List<User> users = securityService.getAllUsers();
    for (User user : users) {
        double value;
        if ("stream".equals(type)) {
            value = user.getBytesStreamed();
        } else if ("download".equals(type)) {
            value = user.getBytesDownloaded();
        } else if ("upload".equals(type)) {
            value = user.getBytesUploaded();
        } else if ("total".equals(type)) {
            value = user.getBytesStreamed() + user.getBytesDownloaded() + user.getBytesUploaded();
        } else {
            throw new RuntimeException("Illegal chart type: " + type);
        }

        value /= BYTES_PER_MB;
        dataset.addValue(value, "Series", user.getUsername());
    }

    return dataset;
}
 
开发者ID:airsonic,项目名称:airsonic,代码行数:24,代码来源:UserChartController.java

示例10: getDataSet

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
private static CategoryDataset getDataSet() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.addValue(100, "北京", "苹果");
    dataset.addValue(100, "上海", "苹果");
    dataset.addValue(100, "广州", "苹果");
    dataset.addValue(200, "北京", "梨子");
    dataset.addValue(200, "上海", "梨子");
    dataset.addValue(200, "广州", "梨子");
    dataset.addValue(300, "北京", "葡萄");
    dataset.addValue(300, "上海", "葡萄");
    dataset.addValue(300, "广州", "葡萄");
    dataset.addValue(400, "北京", "香蕉");
    dataset.addValue(400, "上海", "香蕉");
    dataset.addValue(400, "广州", "香蕉");
    dataset.addValue(500, "北京", "荔枝");
    dataset.addValue(500, "上海", "荔枝");
    dataset.addValue(500, "广州", "荔枝");
    return dataset;
}
 
开发者ID:leon66666,项目名称:financehelper,代码行数:20,代码来源:BarChart.java

示例11: extraerSeriesRescateVictimas

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
public  DefaultCategoryDataset  extraerSeriesRescateVictimas( InfoCasoSimulacion infoCaso){
         // Extreaemos una matriz con  3 series 
         DefaultCategoryDataset serieAconstruir = new DefaultCategoryDataset();
      int numRobots=0;
      long tiempoNotificacion=0;
      Number valorReportado=0;
      long tiempoInicialDeLaSimulacion = infoCaso.getTiempoInicioEnvioPeticiones();
      int numVictimas=0;
      InfoRescateVictima infoRescVict;
       ArrayList<String> identsVictimasRescatadas =(ArrayList<String>) infoCaso.getIdentsVictimasRescatadas().getVictimas();
      for (int i=0; i< identsVictimasRescatadas.size();i++){
          infoRescVict = infoCaso.getInfoRescateVictima(identsVictimasRescatadas.get(i));
          numVictimas++;
           serieAconstruir.addValue((Number)(infoRescVict.getTiempoPeticion()-tiempoInicialDeLaSimulacion),
                   ConstructorSeriesDatosParaVisualizar.SerieTiempoPeticion,infoRescVict.getvictimaId());
           serieAconstruir.addValue((Number)(infoRescVict.getTiempoAsignacion()-tiempoInicialDeLaSimulacion),
                   ConstructorSeriesDatosParaVisualizar.SerieTiempoAsignacion,infoRescVict.getvictimaId());
           serieAconstruir.addValue((Number)(infoRescVict.getTiempoRescate()-tiempoInicialDeLaSimulacion),
                   ConstructorSeriesDatosParaVisualizar.SerieTiempoRescate,infoRescVict.getvictimaId());
//           serieAconstruir.addValue((Number)infoRescVict.getcosteRescate(),
//                   ConstructorSeriesDatosParaVisualizar.SerieEnergiaConsumida,infoRescVict.getvictimaId());
              }
         return serieAconstruir;
    }
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:25,代码来源:ConstructorSeriesDatosParaVisualizar.java

示例12: testAutoRange1

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
/**
 * A simple test for the auto-range calculation.
 */
public void testAutoRange1() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(100.0, "Row 1", "Column 1");
    dataset.setValue(200.0, "Row 1", "Column 2");
    JFreeChart chart = ChartFactory.createBarChart(
        "Test", 
        "Categories",
        "Value",
        dataset,
        PlotOrientation.VERTICAL,
        false, 
        false,
        false
    );
    NumberAxis axis = (NumberAxis) chart.getCategoryPlot().getRangeAxis();
    // range should be 0.0 - 210.0
    assertTrue(same(axis.getLowerBound(), 0.0, 0.00001));    
    assertTrue(same(axis.getUpperBound(), 210.0, 0.00001));    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:23,代码来源:NumberAxisTests.java

示例13: testAutoRange2

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
/**
 * A simple test for the auto-range calculation.
 */
public void testAutoRange2() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    dataset.setValue(100.0, "Row 1", "Column 1");
    dataset.setValue(200.0, "Row 1", "Column 2");
    JFreeChart chart = ChartFactory.createBarChart(
        "Test", 
        "Categories",
        "Value",
        dataset,
        PlotOrientation.VERTICAL,
        false, 
        false,
        false
    );
    NumberAxis axis = (NumberAxis) chart.getCategoryPlot().getRangeAxis();
    axis.setAutoRangeIncludesZero(false);
    // range should be 100.0 - 205.0
    assertTrue(same(axis.getLowerBound(), 95.0, 0.00001));    
    assertTrue(same(axis.getUpperBound(), 205.0, 0.00001));    
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:NumberAxisTests.java

示例14: testCumulativeRange2

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的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

示例15: testGetIndex

import org.jfree.data.category.DefaultCategoryDataset; //导入依赖的package包/类
/**
 * Some checks for the getIndex() method.
 */
public void testGetIndex() {
    DefaultCategoryDataset underlying = new DefaultCategoryDataset();
    underlying.addValue(1.1, "R1", "C1");
    underlying.addValue(2.2, "R1", "C2");
    CategoryToPieDataset d1 = new CategoryToPieDataset(underlying, 
            TableOrder.BY_ROW, 0);
    assertEquals(0, d1.getIndex("C1"));
    assertEquals(1, d1.getIndex("C2"));
    assertEquals(-1, d1.getIndex("XX"));
    
    // try null
    boolean pass = false;
    try {
        d1.getIndex(null);
    }
    catch (IllegalArgumentException e) {
        pass = true;
    }
    assertTrue(pass);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:24,代码来源:CategoryToPieDatasetTests.java


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