本文整理汇总了Java中org.jfree.data.category.DefaultCategoryDataset.addValue方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultCategoryDataset.addValue方法的具体用法?Java DefaultCategoryDataset.addValue怎么用?Java DefaultCategoryDataset.addValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.category.DefaultCategoryDataset
的用法示例。
在下文中一共展示了DefaultCategoryDataset.addValue方法的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;
}
示例2: writeRankVSPercentage
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
public static void writeRankVSPercentage(File outputFile, String add, List<ResultList>[] resultsOriginal, List<List<ResultList>>[] resultsDecoy, int length) throws Exception{
for(List<ResultList> o:resultsOriginal){
for(List<List<ResultList>> ds:resultsDecoy){
String name="RankVSpercentage";
if(ds.size()>1)name+="Mean";
Map<String,int[]> numbers=new TreeMap<String,int[]>();
for(List<ResultList> d:ds){
List<ResultList> merged=ResultList.mergeResults(new List[]{o,d});
for(int i=0;i<merged.size();i++){
ResultList rl=merged.get(i);
for(int j=0;j<Math.min(length,rl.results.size());j++){
String key=rl.query.getDB()+"-"+rl.results.get(j).getDB();
if(!numbers.containsKey(key))numbers.put(key, new int[length]);
numbers.get(key)[j]=numbers.get(key)[j]+1;
}
}
}
String fileName="";
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for(Entry<String, int[]> n:numbers.entrySet()){
double all=0;
for(int i=0;i<n.getValue().length;i++){
dataset.addValue(n.getValue()[i], n.getKey(), Integer.toString(i));
}
fileName+=n.getKey()+"---";
}
fileName=fileName.substring(0,fileName.length()-3);
final JFreeChart chart = ChartFactory.createBarChart("Boxplot","Ranks","Percentage",dataset);
ChartUtilities.saveChartAsJPEG(new File(outputFile.getPath()+"\\"+name+"_"+fileName+add+".jpg"), chart, Math.min(2000,length*100), 1000);
}
}
}
示例3: 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;
}
示例4: 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;
}
示例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);
}
示例6: testAddValue
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
/**
* Some checks for the addValue() method.
*/
public void testAddValue() {
DefaultCategoryDataset d1 = new DefaultCategoryDataset();
d1.addValue(null, "R1", "C1");
assertNull(d1.getValue("R1", "C1"));
d1.addValue(new Double(1.0), "R2", "C1");
assertEquals(new Double(1.0), d1.getValue("R2", "C1"));
boolean pass = false;
try {
d1.addValue(new Double(1.1), null, "C2");
}
catch (IllegalArgumentException e) {
pass = true;
}
assertTrue(pass);
}
示例7: createCategoryDataset2
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
/**
* Creates a dataset for testing.
*
* @return A dataset.
*/
private CategoryDataset createCategoryDataset2() {
DefaultCategoryDataset result = new DefaultCategoryDataset();
result.addValue(1.0, "R0", "C0");
result.addValue(-2.0, "R1", "C0");
result.addValue(2.0, "R0", "C1");
result.addValue(-1.0, "R1", "C1");
return result;
}
示例8: createDayOfWeekBreakageDistributionChart
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
public static void createDayOfWeekBreakageDistributionChart(final SortedMap stats, final String categoryLabel, final OutputStream out) throws IOException {
final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
for (final Iterator iter = stats.entrySet().iterator(); iter.hasNext();) {
final Map.Entry entry = (Map.Entry) iter.next();
final Integer dayOfWeek = (Integer) entry.getKey();
final BuildStatistics bst = (BuildStatistics) entry.getValue();
dataset.addValue(new Integer(bst.getFailedBuilds()), "Failed builds", new ComparableDayOfWeek(dayOfWeek));
}
// create the chart object
// This generates a stacked bar - more suitable
final JFreeChart chart = ChartFactory.createStackedBarChart(null,
categoryLabel, "Builds", dataset,
PlotOrientation.VERTICAL,
true, false, false);
chart.setBackgroundPaint(Color.white);
// change the auto tick unit selection to integer units only
final CategoryPlot plot = chart.getCategoryPlot();
final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
// set bar colors
final BarRenderer bar = (BarRenderer) plot.getRenderer();
bar.setItemMargin(0); // reduce the width between the bars.
bar.setSeriesPaint(0, Color.RED); // first bar
// write to reposnce
final ChartRenderingInfo info = new ChartRenderingInfo(new StandardEntityCollection());
ChartUtilities.writeChartAsPNG(out, chart, IMG_WIDTH, IMG_HEIGHT, info);
}
示例9: testMinMaxRange
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
/**
* A quick test of the min and max range value methods.
*/
public void testMinMaxRange() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(100.0, "Series 1", "Type 1");
dataset.addValue(101.1, "Series 1", "Type 2");
Number min = DatasetUtilities.findMinimumRangeValue(dataset);
assertTrue(min.doubleValue() < 100.1);
Number max = DatasetUtilities.findMaximumRangeValue(dataset);
assertTrue(max.doubleValue() > 101.0);
}
示例10: extraerSerieRescatesPorRobotOrdAsigVict
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
public DefaultCategoryDataset extraerSerieRescatesPorRobotOrdAsigVict(String tituloSerie, InfoCasoSimulacion infoCaso){
DefaultCategoryDataset serieAconstruir = new DefaultCategoryDataset();
int numRobots=0;
long tiempoSerie=0, tiempoReportado=0,tiempoUltimaVictima=0;
long tiempoInicialDeLaSimulacion = infoCaso.getTiempoInicioEnvioPeticiones();
Collection<InfoRescateVictima> rescateVictimas;
rescateVictimas=(Collection<InfoRescateVictima>)infoCaso.getInfoRescateVictimas().values();
Map<String,VictimasSalvadas> tablaVictimasSalvadas = infoCaso.getRobotRescateVictimas();
Object[] identsRobots = (Object[])tablaVictimasSalvadas.keySet().toArray();
long[] ultimosvaloresRobotAlmcenados = new long[identsRobots.length];
Iterator<InfoRescateVictima> iter = rescateVictimas.iterator();
int i=1;
String idRobotRescatador;
InfoRescateVictima infoRescVict;
while (iter.hasNext()){
infoRescVict=iter.next();
if(tituloSerie.equals(ConstructorSeriesDatosParaVisualizar.SerieTiempoPeticion))tiempoReportado = infoRescVict.getTiempoPeticion();
else if (tituloSerie.equals(ConstructorSeriesDatosParaVisualizar.SerieTiempoAsignacion))tiempoReportado = infoRescVict.getTiempoAsignacion();
else if (tituloSerie.equals(ConstructorSeriesDatosParaVisualizar.SerieTiempoRescate))tiempoReportado = infoRescVict.getTiempoRescate();
idRobotRescatador=infoRescVict.getRobotRescatadorId();
int j=0; boolean encontrado=false;
while (j<identsRobots.length&&!encontrado){
if(identsRobots[j].equals(idRobotRescatador)) encontrado=true;
else j++;
}
tiempoReportado= tiempoReportado-tiempoInicialDeLaSimulacion;
tiempoSerie=tiempoReportado-ultimosvaloresRobotAlmcenados[j];
serieAconstruir.addValue((Number)tiempoSerie,idRobotRescatador,infoRescVict.getvictimaId());
ultimosvaloresRobotAlmcenados[j]=tiempoReportado;
}
return serieAconstruir;
}
示例11: createDataset
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
/**
* Returns a sample dataset.
*
* @return The dataset.
*/
private static CategoryDataset createDataset() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(7445, "JFreeSVG", "Warm-up");
dataset.addValue(24448, "Batik", "Warm-up");
dataset.addValue(4297, "JFreeSVG", "Test");
dataset.addValue(21022, "Batik", "Test");
return dataset;
}
示例12: extraerDataSetCosteRescateVictimas
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
public DefaultCategoryDataset extraerDataSetCosteRescateVictimas(String tituloSerie,InfoCasoSimulacion infoCaso){
// String tituloSerieLlegadaVictimas = "Notification Time";
// int indexSerieLlegadaVictimas = 1;
// String tituloSerieasignacionVictimas = "Assignment Time";
// int indexSerieasignacionVictimas = 2;
// aniadirSerieAVisorGraficaEstadisticas(tituloSerieLlegadaVictimas, indexSerieLlegadaVictimas, llegada);
// aniadirSerieAVisorGraficaEstadisticas(tituloSerieasignacionVictimas, indexSerieasignacionVictimas, asignacion);
// String tituloSerieRescateVictimas = "Rescue Time";
// int indexSerieRescateVictimas = 3;
// aniadirSerieAVisorGraficaEstadisticas(tituloSerieRescateVictimas, indexSerieRescateVictimas, rescate);
// ArrayList<PuntoEstadistica> serieRescateVictimas = new ArrayList<PuntoEstadistica>();
DefaultCategoryDataset serieAconstruir = new DefaultCategoryDataset();
int numVictimas=0;
long tiempoNotificacion=0, tiempoReportado=0;
long tiempoInicialDeLaSimulacion = infoCaso.getTiempoInicioEnvioPeticiones();
Collection<InfoRescateVictima> rescateVictimas;
rescateVictimas=(Collection<InfoRescateVictima>)infoCaso.getInfoRescateVictimas().values();
Iterator<InfoRescateVictima> iter = rescateVictimas.iterator();
int i=1;
InfoRescateVictima infoRescVict;
while (iter.hasNext()){
infoRescVict=iter.next();
numVictimas++;
serieAconstruir.addValue(infoRescVict.getcosteRescate(), infoRescVict.getRobotRescatadorId(),infoRescVict.getvictimaId());
}
return serieAconstruir;
}
示例13: testCumulativeRange1
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
/**
* A simple test for the cumulative range calculation. The sequence of
* "cumulative" values are considered to be { 0.0, 10.0, 25.0, 18.0 } so
* the range should be 0.0 -> 25.0.
*/
public void testCumulativeRange1() {
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
dataset.addValue(10.0, "Series 1", "Start");
dataset.addValue(15.0, "Series 1", "Delta 1");
dataset.addValue(-7.0, "Series 1", "Delta 2");
Range range = DatasetUtilities.findCumulativeRangeBounds(dataset);
assertEquals(0.0, range.getLowerBound(), 0.00000001);
assertEquals(25.0, range.getUpperBound(), 0.00000001);
}
示例14: DefaultCategoryDataset
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
public DefaultCategoryDataset getUmidità(){
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
synchronized (this){
Iterator<Calendar> i = data.keySet().iterator();
while(i.hasNext()){
Calendar d = i.next();
Pacchetto p = this.data.get(d);
dataset.addValue(p.getUmidita(), "umidità", d.getTime().toString());
}
}
return dataset;
}
示例15: createDataset2
import org.jfree.data.category.DefaultCategoryDataset; //导入方法依赖的package包/类
/**
* Creates a dataset.
*
* @return A dataset.
*/
public CategoryDataset createDataset2() {
DefaultCategoryDataset result = new DefaultCategoryDataset();
// row keys...
String series1 = "Third";
String series2 = "Fourth";
// column keys...
String type1 = "Type 1";
String type2 = "Type 2";
String type3 = "Type 3";
String type4 = "Type 4";
String type5 = "Type 5";
String type6 = "Type 6";
String type7 = "Type 7";
String type8 = "Type 8";
result.addValue(11.0, series1, type1);
result.addValue(14.0, series1, type2);
result.addValue(13.0, series1, type3);
result.addValue(15.0, series1, type4);
result.addValue(15.0, series1, type5);
result.addValue(17.0, series1, type6);
result.addValue(17.0, series1, type7);
result.addValue(18.0, series1, type8);
result.addValue(15.0, series2, type1);
result.addValue(17.0, series2, type2);
result.addValue(16.0, series2, type3);
result.addValue(18.0, series2, type4);
result.addValue(14.0, series2, type5);
result.addValue(14.0, series2, type6);
result.addValue(12.0, series2, type7);
result.addValue(11.0, series2, type8);
return result;
}