List of usage examples for org.jfree.data.xy XYSeries isEmpty
public boolean isEmpty()
true
if the series contains no data items, and false
otherwise. From source file:mil.tatrc.physiology.utilities.csv.plots.CSVPlotTool.java
public void createGraph(String toDir, Paint color, String title, String XAxisLabel, String YAxisLabel, XYSeries... xyData) {// w w w. j a va2 s .com new File(toDir).mkdir(); Log.info("Creating Graph " + toDir + "/" + title); double resMin0 = 1.e6; double resMax0 = -1.e6; double resMin1 = 1.e6; double resMax1 = -1.e6; XYSeriesCollection dataSet = new XYSeriesCollection(); for (XYSeries data : xyData) { if (data != null && !data.isEmpty()) dataSet.addSeries(data); } JFreeChart chart = ChartFactory.createXYLineChart(title, // chart title XAxisLabel, // x axis label YAxisLabel, // y axis label dataSet, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips false // urls ); XYPlot plot = (XYPlot) chart.getPlot(); /* I have residual and error plots turned off, there are some plots that contain these names in their title, and I don't want this code running, need a better way to see if we are doing a special plot rather than title contents if(title.contains("Residual")) { // Make plot symmetric about x axis resMax0 = xyData[0].getMaxY(); resMin0 = xyData[0].getMinY(); if (Math.abs(xyData[0].getMinY()) > Math.abs(xyData[0].getMaxY())) resMax0 = Math.abs(resMin0); if (Math.abs(xyData[0].getMaxY()) > Math.abs(xyData[0].getMinY())) resMin0 = -1.0*Math.abs(resMax0); if((resMin0==0.0) && (resMax0==0.0)) { resMin0 = -0.00001; resMax0 = 0.00001; } ValueAxis yAxis = plot.getRangeAxis(); yAxis.setRange(resMin0 + 0.05*resMin0, resMax0 + 0.05*resMax0);//5% buffer so we can see top and bottom clearly } else if(title.contains("Error")) { // Make plot symmetric about x axis resMax0 = xyData[0].getMaxY(); resMin0 = xyData[0].getMinY(); if((resMin0==0.0) && (resMax0==0.0)) { resMin0 = -0.00001; resMax0 = 0.00001; } if(resMin0>=0.0) resMin0 = -0.01; ValueAxis yAxis = plot.getRangeAxis(); yAxis.setRange(resMin0 + 0.05*resMin0, resMax0 + 0.05*resMax0);//5% buffer so we can see top and bottom clearly /* yAxis.setTickLabelPaint(new Color(1,0,0)); yAxis.setTickMarkPaint(new Color(1,0,0)); yAxis.setAxisLinePaint(new Color(1,0,0)); yAxis.setLabelPaint(new Color(1,0,0)); ValueAxis xAxis = plot.getDomainAxis(); xAxis.setTickLabelPaint(new Color(1,0,0)); xAxis.setTickMarkPaint(new Color(1,0,0)); yAxis.setAxisLinePaint(new Color(1,0,0)); yAxis.setLabelPaint(new Color(1,0,0)); * } else */ { if (title.indexOf("Hemoglobin-GlomerularFilterability") > -1) System.out.println("stop"); if (xyData.length > 1) { // Make plot symmetric about x axis resMax0 = xyData[0].getMaxY(); resMin0 = xyData[0].getMinY(); resMax1 = xyData[1].getMaxY(); resMin1 = xyData[1].getMinY(); if (resMin1 < resMin0) resMin0 = resMin1; if (resMax1 > resMax0) resMax0 = resMax1; if (DoubleUtils.isZero(resMin0)) resMin0 = -0.001; if (DoubleUtils.isZero(resMax0)) resMax0 = 0.001; if (resMin0 >= 0.0) resMin0 = -0.01; if (YAxisLabel.indexOf("PlasmaConcentration") > -1) plot.setRangeAxis(new LogarithmicAxis("Log(" + YAxisLabel + ")")); else { ValueAxis yAxis = plot.getRangeAxis(); yAxis.setRange(resMin0 + 0.05 * resMin0, resMax0 + 0.15 * Math.abs(resMax0));//5% buffer so we can see top and bottom clearly } String NaNCheck = ""; if (Double.isNaN(resMax0) || Double.isNaN(resMin0)) NaNCheck += "Expected is NaN "; if (Double.isNaN(resMax1) || Double.isNaN(resMin1)) NaNCheck += "Computed is NaN "; if (!NaNCheck.isEmpty()) plot.getDomainAxis().setLabel(NaNCheck); } else { // Make plot symmetric about x axis resMax0 = xyData[0].getMaxY(); resMin0 = xyData[0].getMinY(); if (Double.isNaN(resMax0) || Double.isNaN(resMin0)) plot.getDomainAxis().setLabel("Computed is NaN"); if (DoubleUtils.isZero(resMin0)) resMin0 = -0.001; if (DoubleUtils.isZero(resMax0)) resMax0 = 0.001; if (resMin0 >= 0.0) resMin0 = -0.01; if (YAxisLabel.indexOf("PlasmaConcentration") > -1) plot.setRangeAxis(new LogarithmicAxis("Log(" + YAxisLabel + ")")); else { ValueAxis yAxis = plot.getRangeAxis(); yAxis.setRange(resMin0 + 0.05 * resMin0, resMax0 + 0.15 * Math.abs(resMax0));//5% buffer so we can see top and bottom clearly } } } formatXYPlot(chart, color); //Changing line widths and colors XYItemRenderer r = plot.getRenderer(); BasicStroke wideLine = new BasicStroke(lineWidth); r.setSeriesStroke(0, wideLine); r.setSeriesStroke(1, wideLine); XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) plot.getRenderer(); if (xyData.length > 1) { renderer.setSeriesStroke(//makes a dashed line 0, //argument below float[]{I,K} -> alternates between solid and opaque (solid for I, opaque for K) new BasicStroke(lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 15.0f, 30.0f }, 0.0f)); renderer.setDrawSeriesLineAsPath(true); renderer.setUseFillPaint(true); } renderer.setBaseShapesVisible(false); renderer.setSeriesFillPaint(0, expectedLineColor); renderer.setSeriesFillPaint(1, computedLineColor); renderer.setSeriesPaint(0, expectedLineColor); renderer.setSeriesPaint(1, computedLineColor); try { if (toDir == null || toDir.isEmpty()) toDir = "."; File JPGFile = new File(toDir + "/" + MakeFileName(title) + ".jpg"); ChartUtilities.saveChartAsJPEG(JPGFile, chart, 1600, 800); } catch (IOException e) { Log.error(e.getMessage()); } }
From source file:com.naval.gui.Gui.java
private void update() { Coordonnees coords = partie.coords;/*from w w w .j a v a 2 s.co m*/ XYSeriesCollection dataset = new XYSeriesCollection(); for (Navire n : partie.navires) { XYSeries series = new XYSeries(n.nom); for (int m = 0; m < partie.minute; m++) { Donnees d = coords.donneesPour(m); series.add(d.xs[n.id], d.ys[n.id]); } if (series.isEmpty() && partie.minute == 0) { series.add(n.x, n.y); } dataset.addSeries(series); } JFreeChart chart = ChartFactory.createXYLineChart( "Map turn " + partie.getHeureMinute() + " visibilite:" + partie.visibilite + "%", // Title "x-axis", // x-axis Label "y-axis", // y-axis Label dataset, // Dataset PlotOrientation.VERTICAL, // Plot Orientation true, // Show Legend true, // Use tooltips false // Configure chart to generate URLs? ); XYPlot plot = chart.getXYPlot(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.black); plot.setDomainGridlinePaint(Color.black); final XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(1, true); plot.setRenderer(renderer); if (cPanel != null) { remove(cPanel); cPanel = new ChartPanel(chart); add(cPanel, BorderLayout.CENTER); } else { cPanel = new ChartPanel(chart); add(cPanel, BorderLayout.CENTER); } frame.validate(); }
From source file:com.griddynamics.jagger.monitoring.reporting.SystemUnderTestPlotsProvider.java
public Map<String, List<MonitoringReporterData>> createTaskPlots() { log.info("BEGIN: Create task plots"); Map<String, List<MonitoringReporterData>> taskPlots = new LinkedHashMap<String, List<MonitoringReporterData>>(); DetailStatistics detailStatistics = getStatistics(); for (String taskId : detailStatistics.findTaskIds()) { log.info(" Create task plots for task '{}'", taskId); List<MonitoringReporterData> plots = new LinkedList<MonitoringReporterData>(); for (GroupKey groupName : plotGroups.getPlotGroups().keySet()) { log.info(" Create task plots for group '{}'", groupName); if (showPlotsByGlobal) { log.info(" Create global task plots"); XYSeriesCollection chartsCollection = new XYSeriesCollection(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create global task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); List<MonitoringStatistics> statistics = detailStatistics.findGlobalStatistics(taskId, param);/*from www . j a v a 2 s. c om*/ if (!statistics.isEmpty()) { XYSeries values = new XYSeries(param.getDescription()); for (MonitoringStatistics monitoringStatistics : statistics) { values.add(monitoringStatistics.getTime(), monitoringStatistics.getAverageValue()); } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, null); chartsCollection = pair.getSecond(); if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 3, 2, ChartHelper.ColorTheme.LIGHT); MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(groupName.getUpperName()); monitoringReporterData.setTitle(groupName.getUpperName()); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } } if (showPlotsByBox) { log.info(" Create box task plots"); for (String boxIdentifier : detailStatistics.findBoxIdentifiers(taskId)) { log.info(" Create box task plots for box '{}'", boxIdentifier); XYSeriesCollection chartsCollection = new XYSeriesCollection(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create box task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); List<MonitoringStatistics> statistics = detailStatistics.findBoxStatistics(taskId, param, boxIdentifier); if (!statistics.isEmpty()) { XYSeries values = new XYSeries(param.getDescription()); for (MonitoringStatistics monitoringStatistics : statistics) { values.add(monitoringStatistics.getTime(), monitoringStatistics.getAverageValue()); } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, null); chartsCollection = pair.getSecond(); if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 3, 2, ChartHelper.ColorTheme.LIGHT); MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(groupName.getUpperName()); monitoringReporterData.setTitle(groupName.getUpperName() + " on " + boxIdentifier); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } } } if (showPlotsBySuT) { log.info(" Create sut task plots"); for (String sutUrl : detailStatistics.findSutUrls(taskId)) { log.info(" Create sut task plots for sut '{}'", sutUrl); XYSeriesCollection chartsCollection = new XYSeriesCollection(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create sut task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); List<MonitoringStatistics> statistics = detailStatistics.findSutStatistics(taskId, param, sutUrl); if (!statistics.isEmpty()) { XYSeries values = new XYSeries(param.getDescription()); for (MonitoringStatistics monitoringStatistics : statistics) { values.add(monitoringStatistics.getTime(), monitoringStatistics.getAverageValue()); } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, null); chartsCollection = pair.getSecond(); if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 3, 2, ChartHelper.ColorTheme.LIGHT); MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(groupName.getUpperName()); monitoringReporterData.setTitle(groupName.getUpperName() + " on " + sutUrl); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } } } } taskPlots.put(taskId, plots); } clearStatistics(); log.info("END: Create task plots"); return taskPlots; }
From source file:edu.msu.cme.rdp.classifier.train.validation.distance.TaxaSimilarityMain.java
public void createPlot(String plotTitle, File outdir) throws IOException { XYSeriesCollection dataset = new XYSeriesCollection(); DefaultBoxAndWhiskerCategoryDataset scatterDataset = new DefaultBoxAndWhiskerCategoryDataset(); PrintStream boxchart_dataStream = new PrintStream(new File(outdir, plotTitle + ".boxchart.txt")); boxchart_dataStream.println(/*from ww w . ja v a2 s.co m*/ "#\tkmer" + "\trank" + "\t" + "max" + "\t" + "avg" + "\t" + "min" + "\t" + "Q1" + "\t" + "median" + "\t" + "Q3" + "\t" + "98Pct" + "\t" + "2Pct" + "\t" + "comparisons" + "\t" + "sum"); for (int i = 0; i < ranks.size(); i++) { long[] countArray = sabCoutMap.get(ranks.get(i)); if (countArray == null) continue; double sum = 0.0; int max = 0; int min = 100; double mean = 0; int Q1 = -1; int median = -1; int Q3 = -1; int pct_98 = -1; int pct_2 = -1; long comparisons = 0; int minOutlier = 0; // we don't care about the outliers int maxOutlier = 0; // XYSeries series = new XYSeries(ranks.get(i)); for (int c = 0; c < countArray.length; c++) { if (countArray[c] == 0) continue; comparisons += countArray[c]; sum += countArray[c] * c; if (c < min) { min = c; } if (c > max) { max = c; } } // create series double cum = 0; for (int c = 0; c < countArray.length; c++) { if (countArray[c] == 0) continue; cum += countArray[c]; int pct = (int) Math.floor(100 * cum / comparisons); series.add(c, pct); if (pct_2 == -1 && pct >= 5) { pct_2 = c; } if (Q3 == -1 && pct >= 25) { Q3 = c; } if (median == -1 && pct >= 50) { median = c; } if (Q1 == -1 && pct >= 75) { Q1 = c; } if (pct_98 == -1 && pct >= 98) { pct_98 = c; } } if (!series.isEmpty()) { dataset.addSeries(series); BoxAndWhiskerItem item = new BoxAndWhiskerItem(sum / comparisons, median, Q1, Q3, pct_2, pct_98, minOutlier, maxOutlier, new ArrayList()); scatterDataset.add(item, ranks.get(i), ""); boxchart_dataStream.println("#\t" + GoodWordIterator.getWordsize() + "\t" + ranks.get(i) + "\t" + max + "\t" + format.format(sum / comparisons) + "\t" + min + "\t" + Q1 + "\t" + median + "\t" + Q3 + "\t" + pct_98 + "\t" + pct_2 + "\t" + comparisons + "\t" + sum); } } boxchart_dataStream.close(); Font lableFont = new Font("Helvetica", Font.BOLD, 28); JFreeChart chart = ChartFactory.createXYLineChart(plotTitle, "Similarity%", "Percent Comparisions", dataset, PlotOrientation.VERTICAL, true, true, false); ((XYPlot) chart.getPlot()).getRenderer().setStroke(new BasicStroke(2.0f)); chart.getLegend().setItemFont(new Font("Helvetica", Font.BOLD, 24)); chart.getTitle().setFont(lableFont); ((XYPlot) chart.getPlot()).getDomainAxis().setLabelFont(lableFont); ((XYPlot) chart.getPlot()).getDomainAxis().setTickLabelFont(lableFont); ValueAxis rangeAxis = ((XYPlot) chart.getPlot()).getRangeAxis(); rangeAxis.setRange(0, 100); rangeAxis.setTickLabelFont(lableFont); rangeAxis.setLabelFont(lableFont); ((NumberAxis) rangeAxis).setTickUnit(new NumberTickUnit(5)); ChartUtilities.writeScaledChartAsPNG(new PrintStream(new File(outdir, plotTitle + ".linechart.png")), chart, 800, 1000, 3, 3); BoxPlotUtils.createBoxplot(scatterDataset, new PrintStream(new File(outdir, plotTitle + ".boxchart.png")), plotTitle, "Rank", "Similarity%", lableFont); }
From source file:com.griddynamics.jagger.monitoring.reporting.SystemUnderTestPlotsGeneralProvider.java
public Map<String, List<MonitoringReporterData>> createTaskPlots() { log.info("BEGIN: Create general task plots"); Map<String, List<MonitoringReporterData>> taskPlots = new LinkedHashMap<String, List<MonitoringReporterData>>(); GeneralStatistics generalStatistics = getStatistics(); Set<String> taskIds = generalStatistics.findTaskIds(); Set<String> boxIdentifiers = generalStatistics.findBoxIdentifiers(); Set<String> sutUrls = generalStatistics.findSutUrls(); for (GroupKey groupName : plotGroups.getPlotGroups().keySet()) { log.info(" Create general task plots for group '{}'", groupName); if (showPlotsByGlobal) { log.info(" Create general global task plots"); List<MonitoringReporterData> plots = new LinkedList<MonitoringReporterData>(); XYSeriesCollection chartsCollection = new XYSeriesCollection(); LinkedHashMap<String, IntervalMarker> markers = new LinkedHashMap<String, IntervalMarker>(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create general global task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); if (generalStatistics.hasGlobalStatistics(param)) { XYSeries values = new XYSeries(param.getDescription()); long timeShift = 0; int taskNum = 0; for (String taskId : taskIds) { log.info(" Create general global task plots for task '{}'", taskId); long maxTime = 0; for (MonitoringStatistics monitoringStatistics : generalStatistics .findGlobalStatistics(taskId, param)) { long time = monitoringStatistics.getTime(); double t = timeShift + time; values.add(t, monitoringStatistics.getAverageValue()); if (time > maxTime) { maxTime = time; }/*from ww w. j a v a 2 s.c o m*/ if (showNumbers) { IntervalMarker marker = markers.get(taskId); if (marker == null) { marker = new IntervalMarker(t, t); marker.setLabel(monitoringStatistics.getTaskData().getNumber().toString()); marker.setAlpha((taskNum % 2 == 0) ? 0.2f : 0.4f); int mod = taskNum % 3; if (mod == 0) { marker.setLabelAnchor(RectangleAnchor.CENTER); } else if (mod == 1) { marker.setLabelAnchor(RectangleAnchor.TOP); } else if (mod == 2) { marker.setLabelAnchor(RectangleAnchor.BOTTOM); } marker.setLabelFont( marker.getLabelFont().deriveFont(10.0f).deriveFont(Font.BOLD)); markers.put(taskId, marker); } else { if (t < marker.getStartValue()) { marker.setStartValue(t); } if (t > marker.getEndValue()) { marker.setEndValue(t); } } } } timeShift += maxTime; taskNum++; } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, markers.values()); chartsCollection = pair.getSecond(); String name = groupName.getUpperName(); if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 0, 1, ChartHelper.ColorTheme.LIGHT); XYPlot plot = (XYPlot) chart.getPlot(); for (IntervalMarker marker : markers.values()) { plot.addDomainMarker(marker); } MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(name); monitoringReporterData.setTitle(name); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } if (!plots.isEmpty()) { taskPlots.put(name, plots); } } if (showPlotsByBox) { log.info(" Create general box task plots"); for (String boxIdentifier : boxIdentifiers) { log.info(" Create general box task plots for box '{}'", boxIdentifier); List<MonitoringReporterData> plots = new LinkedList<MonitoringReporterData>(); XYSeriesCollection chartsCollection = new XYSeriesCollection(); LinkedHashMap<String, IntervalMarker> markers = new LinkedHashMap<String, IntervalMarker>(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create general box task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); if (generalStatistics.hasBoxStatistics(param, boxIdentifier)) { XYSeries values = new XYSeries(param.getDescription()); long timeShift = 0; int taskNum = 0; for (String taskId : taskIds) { log.info(" Create general box task plots for task '{}'", taskId); long maxTime = 0; for (MonitoringStatistics monitoringStatistics : generalStatistics .findBoxStatistics(taskId, param, boxIdentifier)) { long time = monitoringStatistics.getTime(); double t = timeShift + time; values.add(t, monitoringStatistics.getAverageValue()); if (time > maxTime) { maxTime = time; } if (showNumbers) { IntervalMarker marker = markers.get(taskId); if (marker == null) { marker = new IntervalMarker(t, t); marker.setLabel( monitoringStatistics.getTaskData().getNumber().toString()); marker.setAlpha((taskNum % 2 == 0) ? 0.2f : 0.4f); int mod = taskNum % 3; if (mod == 0) { marker.setLabelAnchor(RectangleAnchor.CENTER); } else if (mod == 1) { marker.setLabelAnchor(RectangleAnchor.TOP); } else if (mod == 2) { marker.setLabelAnchor(RectangleAnchor.BOTTOM); } marker.setLabelFont( marker.getLabelFont().deriveFont(10.0f).deriveFont(Font.BOLD)); markers.put(taskId, marker); } else { if (t < marker.getStartValue()) { marker.setStartValue(t); } if (t > marker.getEndValue()) { marker.setEndValue(t); } } } } timeShift += maxTime; taskNum++; } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, markers.values()); chartsCollection = pair.getSecond(); String name = groupName.getUpperName() + " on " + boxIdentifier; if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 0, 1, ChartHelper.ColorTheme.LIGHT); XYPlot plot = (XYPlot) chart.getPlot(); for (IntervalMarker marker : markers.values()) { plot.addDomainMarker(marker); } MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(name); monitoringReporterData.setTitle(name); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } if (!plots.isEmpty()) { taskPlots.put(name, plots); } } } if (showPlotsBySuT) { log.info(" Create general sut task plots"); for (String sutUrl : sutUrls) { log.info(" Create general sut task plots for sut '{}'", sutUrl); List<MonitoringReporterData> plots = new LinkedList<MonitoringReporterData>(); XYSeriesCollection chartsCollection = new XYSeriesCollection(); LinkedHashMap<String, IntervalMarker> markers = new LinkedHashMap<String, IntervalMarker>(); for (MonitoringParameter parameterId : plotGroups.getPlotGroups().get(groupName)) { log.info(" Create general sut task plots for parameter '{}'", parameterId); MonitoringParameterBean param = MonitoringParameterBean.copyOf(parameterId); if (generalStatistics.hasSutStatistics(param, sutUrl)) { XYSeries values = new XYSeries(param.getDescription()); long timeShift = 0; int taskNum = 0; for (String taskId : taskIds) { log.info(" Create general sut task plots for task '{}'", taskId); long maxTime = 0; for (MonitoringStatistics monitoringStatistics : generalStatistics .findSutStatistics(taskId, param, sutUrl)) { long time = monitoringStatistics.getTime(); double t = timeShift + time; values.add(t, monitoringStatistics.getAverageValue()); if (time > maxTime) { maxTime = time; } if (showNumbers) { IntervalMarker marker = markers.get(taskId); if (marker == null) { marker = new IntervalMarker(t, t); marker.setLabel( monitoringStatistics.getTaskData().getNumber().toString()); marker.setAlpha((taskNum % 2 == 0) ? 0.2f : 0.4f); int mod = taskNum % 3; if (mod == 0) { marker.setLabelAnchor(RectangleAnchor.CENTER); } else if (mod == 1) { marker.setLabelAnchor(RectangleAnchor.TOP); } else if (mod == 2) { marker.setLabelAnchor(RectangleAnchor.BOTTOM); } marker.setLabelFont( marker.getLabelFont().deriveFont(10.0f).deriveFont(Font.BOLD)); markers.put(taskId, marker); } else { if (t < marker.getStartValue()) { marker.setStartValue(t); } if (t > marker.getEndValue()) { marker.setEndValue(t); } } } } timeShift += maxTime; taskNum++; } if (values.isEmpty()) { values.add(0, 0); } chartsCollection.addSeries(values); } } log.debug("group name \n{} \nparams {}]\n", groupName, Lists.newArrayList(plotGroups.getPlotGroups().get(groupName))); Pair<String, XYSeriesCollection> pair = ChartHelper.adjustTime(chartsCollection, markers.values()); chartsCollection = pair.getSecond(); String name = groupName.getUpperName() + " on " + sutUrl; if (chartsCollection.getSeriesCount() > 0) { JFreeChart chart = ChartHelper.createXYChart(null, chartsCollection, "Time (" + pair.getFirst() + ")", groupName.getLeftName(), 0, 1, ChartHelper.ColorTheme.LIGHT); XYPlot plot = (XYPlot) chart.getPlot(); for (IntervalMarker marker : markers.values()) { plot.addDomainMarker(marker); } MonitoringReporterData monitoringReporterData = new MonitoringReporterData(); monitoringReporterData.setParameterName(name); monitoringReporterData.setTitle(name); monitoringReporterData.setPlot(new JCommonDrawableRenderer(chart)); plots.add(monitoringReporterData); } if (!plots.isEmpty()) { taskPlots.put(name, plots); } } } } clearStatistics(); log.info("END: Create general task plots"); return taskPlots; }