當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。