Index: DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java
===================================================================
--- DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java	(revision 1153)
+++ DCWoRMS/branches/coolemall/src/simulator/stats/implementation/DCWormsStatistics.java	(revision 1193)
@@ -2,5 +2,7 @@
 
 import java.awt.Color;
+import java.awt.Font;
 import java.awt.Paint;
+import java.awt.geom.Rectangle2D;
 import java.io.File;
 import java.io.FileOutputStream;
@@ -14,4 +16,5 @@
 import java.util.Date;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -26,7 +29,11 @@
 import org.jfree.chart.ChartUtilities;
 import org.jfree.chart.JFreeChart;
+import org.jfree.chart.LegendItem;
 import org.jfree.chart.axis.AxisLocation;
+import org.jfree.chart.axis.CategoryAxis;
 import org.jfree.chart.axis.DateAxis;
 import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.axis.NumberTickUnit;
+import org.jfree.chart.axis.ValueAxis;
 import org.jfree.chart.encoders.ImageFormat;
 import org.jfree.chart.labels.CategoryItemLabelGenerator;
@@ -41,4 +48,5 @@
 import org.jfree.chart.renderer.category.GanttRenderer;
 import org.jfree.chart.renderer.xy.XYStepAreaRenderer;
+import org.jfree.chart.title.LegendTitle;
 import org.jfree.chart.title.TextTitle;
 import org.jfree.chart.title.Title;
@@ -86,4 +94,5 @@
 import simulator.stats.implementation.out.CoolEmAllStringSerializer;
 import simulator.stats.implementation.out.StringSerializer;
+import test.article.recs.utils.TaskToApp;
 import csiro.mit.utils.jfreechart.timetablechart.TimetableChartFactory;
 import csiro.mit.utils.jfreechart.timetablechart.data.Timetable;
@@ -393,6 +402,6 @@
 						EnergyExtension een = (EnergyExtension)(resource.getExtensionList().getExtension(ExtensionType.ENERGY_EXTENSION));
 						if(resourceController.getComputingResources().contains(resource)) {
-							if( een != null /*&& een.getPp() != null*/ ){
-								accStats.meanAirFlow.add(airFlow.getSumValue());
+							if( een != null && een.getAirFlowProfile() != null &&  een.getPowerProfile().getEnergyEstimationPlugin() != null){
+								accStats.meanAirFlow.add(airFlow.getMeanValue());
 							}
 
@@ -409,5 +418,5 @@
 							}
 							if(top == true){
-								accStats.meanAirFlow.add(airFlow.getSumValue());
+								accStats.meanAirFlow.add(airFlow.getMeanValue());
 							}
 						}
@@ -431,6 +440,6 @@
 						EnergyExtension een = (EnergyExtension)(resource.getExtensionList().getExtension(ExtensionType.ENERGY_EXTENSION));
 						if(resourceController.getComputingResources().contains(resource)) {
-							if( een != null /*&& een.getPp() != null*/ ){
-								accStats.meanTemperature.add(temperature.getSumValue());
+							if( een != null  && een.getThermalProfile() != null &&  een.getPowerProfile().getEnergyEstimationPlugin() != null){
+								accStats.meanTemperature.add(temperature.getMeanValue());
 							}
 
@@ -447,5 +456,5 @@
 							}
 							if(top == true){
-								accStats.meanTemperature.add(temperature.getSumValue());
+								accStats.meanTemperature.add(temperature.getMeanValue());
 							}
 						}
@@ -465,5 +474,5 @@
 		}
 		
-		saveResourceGanttDiagrams();
+		saveResourceUsageDiagrams();
 		createAccumulatedResourceSimulationStatistic();
 		
@@ -559,5 +568,11 @@
 	//change this method to adjust the colors of gantt chart
 	private String getUniqueTaskId(ExecTask execTask){
-		return execTask.getJobId() + "_" + execTask.getId();
+		String taskId = execTask.getJobId() + "_" + execTask.getId();
+		/*if(execTask.getApplicationName() != null){
+			taskId = execTask.getApplicationName();
+		} else {
+			taskId = execTask.getJobId() + "_" + execTask.getId();
+		}*/
+		return taskId;
 	}
 	
@@ -815,5 +830,5 @@
 	}
 
-	private boolean saveResourceGanttDiagrams() {
+	private boolean saveResourceUsageDiagrams() {
 
 		if (!generateDiagrams)
@@ -942,4 +957,25 @@
 
 		CombinedDomainXYPlot cPlot = (CombinedDomainXYPlot) c.getPlot();
+
+		/*Font fontt=new Font("Arial",Font.BOLD,26);
+		
+		c.getTitle().setFont(fontt);
+		Font font=new Font("Arial",0,20);
+		
+		CombinedDomainXYPlot p = (CombinedDomainXYPlot)c.getPlot();
+		ValueAxis daxis = p.getDomainAxis();
+		daxis.setTickLabelFont(font);
+		daxis.setLabelFont(font);
+		
+		font=new Font("Arial",0,20);
+		
+		XYPlot sp= (XYPlot) p.getSubplots().get(0);
+		ValueAxis raxis = sp.getRangeAxis();
+		raxis.setTickLabelFont(font);
+		raxis.setLabelFont(font);
+		
+        NumberAxis range = (NumberAxis) sp.getRangeAxis();
+		range.setTickUnit(new NumberTickUnit(100));*/
+
 		int nPlots = cPlot.getSubplots().size();
 
@@ -1352,4 +1388,23 @@
 		c.setBorderVisible(false);
 
+		/*Font fontt=new Font("Arial",Font.BOLD,26);
+		
+		c.getTitle().setFont(fontt);
+		Font font=new Font("Arial",0,20);
+		
+		CategoryPlot p = (CategoryPlot)c.getPlot();
+		CategoryAxis daxis = p.getDomainAxis();
+		daxis.setTickLabelFont(font);
+		daxis.setLabelFont(font);
+		
+		font=new Font("Arial",0,20);
+		
+		ValueAxis raxis = p.getRangeAxis();
+		raxis.setTickLabelFont(font);
+		raxis.setLabelFont(font);
+
+		font=new Font("Arial",0,20);
+		c.getLegend().setItemFont(font);	*/	
+		
 		CategoryPlot categoryplot = (CategoryPlot) c.getPlot();
 		categoryplot.setDomainGridlinesVisible(true);
