List of usage examples for org.jfree.chart.plot XYPlot setOrientation
public void setOrientation(PlotOrientation orientation)
From source file:org.drools.planner.benchmark.statistic.calculatecount.CalculateCountStatistic.java
private CharSequence writeGraphStatistic(File solverStatisticFilesDirectory, String baseName) { XYSeriesCollection seriesCollection = new XYSeriesCollection(); for (Map.Entry<String, CalculateCountStatisticListener> listenerEntry : statisticListenerMap.entrySet()) { String configName = listenerEntry.getKey(); XYSeries series = new XYSeries(configName); List<CalculateCountStatisticPoint> statisticPointList = listenerEntry.getValue() .getStatisticPointList(); for (CalculateCountStatisticPoint statisticPoint : statisticPointList) { long timeMillisSpend = statisticPoint.getTimeMillisSpend(); long calculateCountPerSecond = statisticPoint.getCalculateCountPerSecond(); series.add(timeMillisSpend, calculateCountPerSecond); }//w ww.j a va2s . co m seriesCollection.addSeries(series); } NumberAxis xAxis = new NumberAxis("Time millis spend"); xAxis.setNumberFormatOverride(new MillisecondsSpendNumberFormat()); NumberAxis yAxis = new NumberAxis("Calculate count per second"); yAxis.setAutoRangeIncludesZero(false); XYItemRenderer renderer = new XYLineAndShapeRenderer(); XYPlot plot = new XYPlot(seriesCollection, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart(baseName + " calculate count statistic", JFreeChart.DEFAULT_TITLE_FONT, plot, true); BufferedImage chartImage = chart.createBufferedImage(1024, 768); File graphStatisticFile = new File(solverStatisticFilesDirectory, baseName + "CalculateCountStatistic.png"); OutputStream out = null; try { out = new FileOutputStream(graphStatisticFile); ImageIO.write(chartImage, "png", out); } catch (IOException e) { throw new IllegalArgumentException("Problem writing graphStatisticFile: " + graphStatisticFile, e); } finally { IOUtils.closeQuietly(out); } return " <img src=\"" + graphStatisticFile.getName() + "\"/>\n"; }
From source file:org.drools.planner.benchmark.statistic.memoryuse.MemoryUseStatistic.java
private CharSequence writeGraphStatistic(File solverStatisticFilesDirectory, String baseName) { XYSeriesCollection seriesCollection = new XYSeriesCollection(); for (Map.Entry<String, MemoryUseStatisticListener> listenerEntry : statisticListenerMap.entrySet()) { String configName = listenerEntry.getKey(); XYSeries usedSeries = new XYSeries(configName + " used"); XYSeries maxSeries = new XYSeries(configName + " max"); List<MemoryUseStatisticPoint> statisticPointList = listenerEntry.getValue().getStatisticPointList(); for (MemoryUseStatisticPoint statisticPoint : statisticPointList) { long timeMillisSpend = statisticPoint.getTimeMillisSpend(); MemoryUseMeasurement memoryUseMeasurement = statisticPoint.getMemoryUseMeasurement(); usedSeries.add(timeMillisSpend, memoryUseMeasurement.getUsedMemory()); maxSeries.add(timeMillisSpend, memoryUseMeasurement.getMaxMemory()); }/* w ww . jav a 2 s . com*/ seriesCollection.addSeries(usedSeries); seriesCollection.addSeries(maxSeries); } NumberAxis xAxis = new NumberAxis("Time millis spend"); xAxis.setNumberFormatOverride(new MillisecondsSpendNumberFormat()); NumberAxis yAxis = new NumberAxis("Memory"); yAxis.setAutoRangeIncludesZero(false); XYItemRenderer renderer = new XYAreaRenderer2(); XYPlot plot = new XYPlot(seriesCollection, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart(baseName + " memory use statistic", JFreeChart.DEFAULT_TITLE_FONT, plot, true); BufferedImage chartImage = chart.createBufferedImage(1024, 768); File graphStatisticFile = new File(solverStatisticFilesDirectory, baseName + "MemoryUseStatistic.png"); OutputStream out = null; try { out = new FileOutputStream(graphStatisticFile); ImageIO.write(chartImage, "png", out); } catch (IOException e) { throw new IllegalArgumentException("Problem writing graphStatisticFile: " + graphStatisticFile, e); } finally { IOUtils.closeQuietly(out); } return " <img src=\"" + graphStatisticFile.getName() + "\"/>\n"; }
From source file:org.optaplanner.benchmark.impl.statistic.movecountperstep.MoveCountPerStepProblemStatistic.java
@Override public void writeGraphFiles(BenchmarkReport benchmarkReport) { Locale locale = benchmarkReport.getLocale(); NumberAxis xAxis = new NumberAxis("Time spent"); xAxis.setNumberFormatOverride(new MillisecondsSpentNumberFormat(locale)); NumberAxis yAxis = new NumberAxis("Accepted/selected moves per step"); yAxis.setNumberFormatOverride(NumberFormat.getInstance(locale)); XYPlot plot = new XYPlot(null, xAxis, yAxis, null); DrawingSupplier drawingSupplier = new DefaultDrawingSupplier(); plot.setOrientation(PlotOrientation.VERTICAL); int seriesIndex = 0; for (SingleBenchmarkResult singleBenchmarkResult : problemBenchmarkResult.getSingleBenchmarkResultList()) { XYSeries acceptedSeries = new XYSeries( singleBenchmarkResult.getSolverBenchmarkResult().getNameWithFavoriteSuffix() + " accepted"); XYSeries selectedSeries = new XYSeries( singleBenchmarkResult.getSolverBenchmarkResult().getNameWithFavoriteSuffix() + " selected"); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); if (singleBenchmarkResult.isSuccess()) { MoveCountPerStepSingleStatistic singleStatistic = (MoveCountPerStepSingleStatistic) singleBenchmarkResult .getSingleStatistic(problemStatisticType); for (MoveCountPerStepStatisticPoint point : singleStatistic.getPointList()) { long timeMillisSpent = point.getTimeMillisSpent(); long acceptedMoveCount = point.getMoveCountPerStepMeasurement().getAcceptedMoveCount(); long selectedMoveCount = point.getMoveCountPerStepMeasurement().getSelectedMoveCount(); acceptedSeries.add(timeMillisSpent, acceptedMoveCount); selectedSeries.add(timeMillisSpent, selectedMoveCount); }//from ww w. j a va 2 s . c o m } XYSeriesCollection seriesCollection = new XYSeriesCollection(); seriesCollection.addSeries(acceptedSeries); seriesCollection.addSeries(selectedSeries); plot.setDataset(seriesIndex, seriesCollection); if (singleBenchmarkResult.getSolverBenchmarkResult().isFavorite()) { // Make the favorite more obvious renderer.setSeriesStroke(0, new BasicStroke(2.0f)); // Dashed line for selected move count renderer.setSeriesStroke(1, new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f)); } else { // Dashed line for selected move count renderer.setSeriesStroke(1, new BasicStroke(1.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, new float[] { 2.0f, 6.0f }, 0.0f)); } // Render both lines in the same color Paint linePaint = drawingSupplier.getNextPaint(); renderer.setSeriesPaint(0, linePaint); renderer.setSeriesPaint(1, linePaint); plot.setRenderer(seriesIndex, renderer); seriesIndex++; } JFreeChart chart = new JFreeChart(problemBenchmarkResult.getName() + " move count per step statistic", JFreeChart.DEFAULT_TITLE_FONT, plot, true); graphFile = writeChartToImageFile(chart, problemBenchmarkResult.getName() + "MoveCountPerStepStatistic"); }
From source file:org.drools.planner.benchmark.statistic.BestScoreStatistic.java
private CharSequence writeGraphStatistic(File solverStatisticFilesDirectory, String baseName) { XYSeriesCollection seriesCollection = new XYSeriesCollection(); for (Map.Entry<String, BestScoreStatisticListener> listenerEntry : bestScoreStatisticListenerMap .entrySet()) {//from w ww . j a va 2 s. c om String configName = listenerEntry.getKey(); XYSeries configSeries = new XYSeries(configName); List<BestScoreStatisticPoint> statisticPointList = listenerEntry.getValue() .getBestScoreStatisticPointList(); for (BestScoreStatisticPoint statisticPoint : statisticPointList) { long timeMillisSpend = statisticPoint.getTimeMillisSpend(); Score score = statisticPoint.getScore(); Double scoreGraphValue = scoreDefinition.translateScoreToGraphValue(score); if (scoreGraphValue != null) { configSeries.add(timeMillisSpend, scoreGraphValue); } } seriesCollection.addSeries(configSeries); } NumberAxis xAxis = new NumberAxis("Time millis spend"); xAxis.setNumberFormatOverride(new MillisecondsSpendNumberFormat()); NumberAxis yAxis = new NumberAxis("Score"); yAxis.setAutoRangeIncludesZero(false); XYItemRenderer renderer = new XYStepRenderer(); XYPlot plot = new XYPlot(seriesCollection, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart(baseName + " best score statistic", JFreeChart.DEFAULT_TITLE_FONT, plot, true); BufferedImage chartImage = chart.createBufferedImage(1024, 768); File graphStatisticFile = new File(solverStatisticFilesDirectory, baseName + "Statistic.png"); OutputStream out = null; try { out = new FileOutputStream(graphStatisticFile); ImageIO.write(chartImage, "png", out); } catch (IOException e) { throw new IllegalArgumentException("Problem writing graphStatisticFile: " + graphStatisticFile, e); } finally { IOUtils.closeQuietly(out); } return " <img src=\"" + graphStatisticFile.getName() + "\"/>\n"; }
From source file:PlotsBuilding.PlotPanel.java
private JFreeChart createChart(XYDataset xyDataset, ArrayList<Integer> seriesCount, double y1, double y2) { NumberAxis domainAxis = new NumberAxis("x"); domainAxis.setAutoRangeIncludesZero(false); domainAxis.setPositiveArrowVisible(true); NumberAxis rangeAxis = new NumberAxis("y"); rangeAxis.setRange(y1, y2);/*from w w w. j a v a 2 s . c o m*/ rangeAxis.setPositiveArrowVisible(true); XYItemRenderer renderer = new XYLineAndShapeRenderer(true, false); int start = 0; int color = 50; for (Object series : seriesCount) { for (int i = start; i < start + (int) series; i++) { Color s = new Color(color); renderer.setSeriesPaint(i, s); renderer.setSeriesVisibleInLegend(i, false); renderer.setSeriesVisibleInLegend(start, true); } start = start + (int) series; color *= 100; } renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); XYPlot plot = new XYPlot(xyDataset, domainAxis, rangeAxis, renderer); PlotOrientation orientation = PlotOrientation.VERTICAL; plot.setOrientation(orientation); plot.setBackgroundPaint(Color.white); chart = new JFreeChart(plot); chart.setBackgroundPaint(Color.white); chart.getLegend().setPosition(RectangleEdge.RIGHT); chart.getLegend().setVerticalAlignment(VerticalAlignment.TOP); return chart; }
From source file:org.jfree.chart.demo.XYTickLabelDemo.java
/** * Creates the demo chart./*from w w w .ja va 2 s . c o m*/ * * @return The chart. */ private JFreeChart createChart() { // create some sample data final XYSeries series1 = new XYSeries("Something"); series1.add(0.0, 30.0); series1.add(1.0, 10.0); series1.add(2.0, 40.0); series1.add(3.0, 30.0); series1.add(4.0, 50.0); series1.add(5.0, 50.0); series1.add(6.0, 70.0); series1.add(7.0, 70.0); series1.add(8.0, 80.0); final XYSeriesCollection dataset1 = new XYSeriesCollection(); dataset1.addSeries(series1); final XYSeries series2 = new XYSeries("Something else"); series2.add(0.0, 5.0); series2.add(1.0, 4.0); series2.add(2.0, 1.0); series2.add(3.0, 5.0); series2.add(4.0, 0.0); final XYSeriesCollection dataset2 = new XYSeriesCollection(); dataset2.addSeries(series2); // create the chart final JFreeChart result = ChartFactory.createXYLineChart("Tick Label Demo", "Domain Axis 1", "Range Axis 1", dataset1, PlotOrientation.VERTICAL, false, true, false); result.setBackgroundPaint(Color.white); final XYPlot plot = result.getXYPlot(); plot.setOrientation(PlotOrientation.VERTICAL); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // plot.setAxisOffset(new Spacer(Spacer.ABSOLUTE, 5.0, 5.0, 5.0, 5.0)); final StandardXYItemRenderer renderer = (StandardXYItemRenderer) plot.getRenderer(); renderer.setPaint(Color.black); // DOMAIN AXIS 2 final NumberAxis xAxis2 = new NumberAxis("Domain Axis 2"); xAxis2.setAutoRangeIncludesZero(false); plot.setDomainAxis(1, xAxis2); // RANGE AXIS 2 final DateAxis yAxis1 = new DateAxis("Range Axis 1"); plot.setRangeAxis(yAxis1); final DateAxis yAxis2 = new DateAxis("Range Axis 2"); plot.setRangeAxis(1, yAxis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, dataset2); plot.mapDatasetToDomainAxis(1, 1); plot.mapDatasetToRangeAxis(1, 1); return result; }
From source file:ste.travian.world.WorldChart.java
/** * Create the JFreeChart world chart//from w w w . j a va 2 s .com * * @param title world title * @param dataset world data set * */ private void createWorldPlot(String title, XYDataset dataset) { NumberAxis xAxis = new NumberAxis(LABEL_X_AXIS); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis(LABEL_Y_AXIS); yAxis.setAutoRangeIncludesZero(false); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, null); TileRenderer renderer = new TileRenderer(3, 3); renderer.setBaseToolTipGenerator(new TileToolTipGenerator()); plot.setRenderer(renderer); plot.setOrientation(PlotOrientation.VERTICAL); chart = new JFreeChart(title, JFreeChart.DEFAULT_TITLE_FONT, plot, true); }
From source file:com.itemanalysis.jmetrik.graph.itemmap.ItemMapPanel.java
public void setGraph() { HistogramChartDataset personDataset = null; HistogramChartDataset itemData = null; try {/*from w w w . j a v a 2 s . com*/ //get titles String chartTitle = command.getFreeOption("title").getString(); String chartSubtitle = command.getFreeOption("subtitle").getString(); PlotOrientation itemMapOrientation = PlotOrientation.HORIZONTAL; //create common x-axis NumberAxis domainAxis = new NumberAxis(); domainAxis.setLabel("Logits"); //create histogram personDataset = new HistogramChartDataset(); ValueAxis rangeAxis = new NumberAxis("Person Density"); if (itemMapOrientation == PlotOrientation.HORIZONTAL) rangeAxis.setInverted(true); XYBarRenderer renderer = new XYBarRenderer(); renderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); renderer.setURLGenerator(new StandardXYURLGenerator()); renderer.setDrawBarOutline(true); renderer.setShadowVisible(false); XYPlot personPlot = new XYPlot(personDataset, null, rangeAxis, renderer); personPlot.setOrientation(PlotOrientation.HORIZONTAL); //create scatterplot of item difficulty itemData = new HistogramChartDataset(); NumberAxis itemRangeAxis = new NumberAxis("Item Frequency"); if (itemMapOrientation == PlotOrientation.VERTICAL) { itemRangeAxis.setInverted(true); } XYBarRenderer itemRenderer = new XYBarRenderer(); itemRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator()); itemRenderer.setURLGenerator(new StandardXYURLGenerator()); itemRenderer.setDrawBarOutline(true); itemRenderer.setShadowVisible(false); XYPlot itemPlot = new XYPlot(itemData, null, itemRangeAxis, itemRenderer); itemPlot.setOrientation(PlotOrientation.HORIZONTAL); //combine the two charts CombinedDomainXYPlot cplot = new CombinedDomainXYPlot(domainAxis); cplot.add(personPlot, 3); cplot.add(itemPlot, 2); cplot.setGap(8.0); cplot.setDomainGridlinePaint(Color.white); cplot.setDomainGridlinesVisible(true); cplot.setOrientation(itemMapOrientation); // //next four lines are temp setting for book // //these four lines will create a histogram with white bars so it appears as just the bar outline // renderer.setBarPainter(new StandardXYBarPainter()); // renderer.setSeriesPaint(0, Color.white); // itemRenderer.setBarPainter(new StandardXYBarPainter()); // itemRenderer.setSeriesPaint(0, Color.white); chart = new JFreeChart(chartTitle, JFreeChart.DEFAULT_TITLE_FONT, cplot, false); chart.setBackgroundPaint(Color.white); if (chartSubtitle != null && !"".equals(chartSubtitle)) { chart.addSubtitle(new TextTitle(chartSubtitle)); } ChartPanel panel = new ChartPanel(chart); panel.getPopupMenu().addSeparator(); this.addJpgMenuItem(this, panel.getPopupMenu()); panel.setPreferredSize(new Dimension(width, height)); // //temp setting for book // this.addLocalEPSMenuItem(this, panel.getPopupMenu(), chart);//remove this line for public release versions chart.setPadding(new RectangleInsets(20.0, 5.0, 20.0, 5.0)); this.setBackground(Color.WHITE); this.add(panel); } catch (IllegalArgumentException ex) { logger.fatal(ex.getMessage(), ex); this.firePropertyChange("error", "", "Error - Check log for details."); } }
From source file:com.seagate.kinetic.monitor.view.KineticSpecifiedNodeView.java
private void createStatChart() { TimeSeriesCollection putOpsTsc = new TimeSeriesCollection(putOpsTs); TimeSeriesCollection putTrgTsc = new TimeSeriesCollection(putTrgTs); TimeSeriesCollection getOpsTsc = new TimeSeriesCollection(getOpsTs); TimeSeriesCollection getTrgTsc = new TimeSeriesCollection(getTrgTs); TimeSeriesCollection deleteOpsTsc = new TimeSeriesCollection(deleteOpsTs); TimeSeriesCollection deleteTrgTsc = new TimeSeriesCollection(deleteTrgTs); statChart = ChartFactory.createTimeSeriesChart("", "Time", "put kvop/s", putOpsTsc, true, true, false); XYPlot xyplot = (XYPlot) statChart.getPlot(); xyplot.setOrientation(PlotOrientation.VERTICAL); xyplot.setDomainPannable(true);/* w w w . ja va 2s . co m*/ xyplot.setRangePannable(true); ValueAxis yAxis = xyplot.getDomainAxis(); yAxis.setAutoRange(true); yAxis.setFixedAutoRange(60000.0); NumberAxis numberaxis1 = new NumberAxis("get kvop/s"); xyplot.setRangeAxis(1, numberaxis1); xyplot.setDataset(1, getOpsTsc); xyplot.mapDatasetToRangeAxis(1, 1); StandardXYItemRenderer standardxyitemrenderer1 = new StandardXYItemRenderer(); xyplot.setRenderer(1, standardxyitemrenderer1); NumberAxis numberaxis2 = new NumberAxis("delete kvop/s"); numberaxis2.setAutoRangeIncludesZero(false); xyplot.setRangeAxis(2, numberaxis2); xyplot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_LEFT); xyplot.setDataset(2, deleteOpsTsc); xyplot.mapDatasetToRangeAxis(2, 2); StandardXYItemRenderer standardxyitemrenderer2 = new StandardXYItemRenderer(); xyplot.setRenderer(2, standardxyitemrenderer2); NumberAxis numberaxis3 = new NumberAxis("put MB/s"); xyplot.setRangeAxis(3, numberaxis3); xyplot.setDataset(3, putTrgTsc); xyplot.mapDatasetToRangeAxis(3, 3); StandardXYItemRenderer standardxyitemrenderer3 = new StandardXYItemRenderer(); xyplot.setRenderer(3, standardxyitemrenderer3); NumberAxis numberaxis4 = new NumberAxis("get MB/s"); numberaxis4.setAutoRangeIncludesZero(false); xyplot.setRangeAxis(4, numberaxis4); xyplot.setRangeAxisLocation(2, AxisLocation.BOTTOM_OR_LEFT); xyplot.setDataset(4, getTrgTsc); xyplot.mapDatasetToRangeAxis(4, 4); StandardXYItemRenderer standardxyitemrenderer4 = new StandardXYItemRenderer(); xyplot.setRenderer(4, standardxyitemrenderer4); NumberAxis numberaxis5 = new NumberAxis("delete MB/s"); xyplot.setRangeAxis(5, numberaxis5); xyplot.setDataset(5, deleteTrgTsc); xyplot.mapDatasetToRangeAxis(5, 5); StandardXYItemRenderer standardxyitemrenderer5 = new StandardXYItemRenderer(); xyplot.setRenderer(5, standardxyitemrenderer5); ChartUtilities.applyCurrentTheme(statChart); xyplot.getRenderer().setSeriesPaint(0, Color.black); standardxyitemrenderer1.setSeriesPaint(0, Color.red); numberaxis1.setLabelPaint(Color.red); numberaxis1.setTickLabelPaint(Color.red); standardxyitemrenderer2.setSeriesPaint(0, Color.green); numberaxis2.setLabelPaint(Color.green); numberaxis2.setTickLabelPaint(Color.green); standardxyitemrenderer3.setSeriesPaint(0, Color.orange); numberaxis3.setLabelPaint(Color.orange); numberaxis3.setTickLabelPaint(Color.orange); standardxyitemrenderer4.setSeriesPaint(0, Color.blue); numberaxis4.setLabelPaint(Color.blue); numberaxis4.setTickLabelPaint(Color.blue); standardxyitemrenderer5.setSeriesPaint(0, Color.cyan); numberaxis5.setLabelPaint(Color.cyan); numberaxis5.setTickLabelPaint(Color.cyan); final JPanel main = new JPanel(new BorderLayout()); final JPanel optionsPanel = new JPanel(); String[] options = { SYSTEM_TOTAL_IOPS_AND_THROUGHPUT_STATISTICS }; this.orientationComboBox = new JComboBox<String>(options); this.orientationComboBox.setSize(600, 50); this.orientationComboBox.addActionListener(this); optionsPanel.add(this.orientationComboBox); chartPanel = new ChartPanel(statChart); chartPanel.setMouseWheelEnabled(false); chartPanel.setPreferredSize(new Dimension(900, 450)); chartPanel.setDomainZoomable(true); chartPanel.setRangeZoomable(true); main.add(optionsPanel, BorderLayout.NORTH); main.add(this.chartPanel); setContentPane(main); }
From source file:com.sonyericsson.jenkins.plugins.bfa.graphs.TimeSeriesChart.java
@Override protected JFreeChart createGraph() { TimeTableXYDataset dataset = createDataset(); ValueAxis xAxis = new DateAxis(); xAxis.setLowerMargin(0.0);//from w ww. ja va 2 s .c o m xAxis.setUpperMargin(0.0); Calendar lowerBound = getLowerGraphBound(); xAxis.setRange(lowerBound.getTimeInMillis(), Calendar.getInstance().getTimeInMillis()); NumberAxis yAxis = new NumberAxis(Y_AXIS_LABEL); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); StackedXYBarRenderer renderer = new StackedXYBarRenderer(); renderer.setBaseToolTipGenerator(new XYToolTipGenerator() { @Override public String generateToolTip(XYDataset dataset, int series, int item) { String seriesKey = dataset.getSeriesKey(series).toString(); StringBuilder sb = new StringBuilder(); if (seriesKey.equals(GRAPH_OTHERS)) { long timeInMillis = dataset.getX(series, item).longValue(); Date time = new Date(timeInMillis); TimePeriod period = null; if (intervalSize == Calendar.DATE) { period = new Day(time); } else if (intervalSize == Calendar.HOUR_OF_DAY) { period = new Hour(time); } else if (intervalSize == Calendar.MONTH) { period = new Month(time); } List<FailureCauseTimeInterval> excludedDataList = excludedDataForPeriod.get(period); if (excludedDataList != null) { Collections.sort(excludedDataList, new Comparator<FailureCauseTimeInterval>() { @Override public int compare(FailureCauseTimeInterval o1, FailureCauseTimeInterval o2) { return o2.getNumber() - o1.getNumber(); } }); for (FailureCauseTimeInterval excludedData : excludedDataList) { sb.append(excludedData).append(" \n"); } } } else { int number = dataset.getY(series, item).intValue(); sb.append(seriesKey).append(": ").append(number); } return sb.toString(); } }); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeAxis(yAxis); JFreeChart chart = new JFreeChart(graphTitle, JFreeChart.DEFAULT_TITLE_FONT, plot, true); return chart; }