List of usage examples for org.jfree.chart.axis CategoryAxis CategoryAxis
public CategoryAxis(String label)
From source file:org.drools.planner.benchmark.core.statistic.PlannerStatistic.java
private void writeBestScoreSummaryChart() { DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (SolverBenchmark solverBenchmark : plannerBenchmark.getSolverBenchmarkList()) { ScoreDefinition scoreDefinition = solverBenchmark.getSolverConfig().getScoreDirectorFactoryConfig() .buildScoreDefinition(); for (SingleBenchmark singleBenchmark : solverBenchmark.getSingleBenchmarkList()) { if (singleBenchmark.isSuccess()) { Score score = singleBenchmark.getScore(); Double scoreGraphValue = scoreDefinition.translateScoreToGraphValue(score); String solverLabel = solverBenchmark.getName(); if (solverBenchmark.isRankingBest()) { solverLabel += " (winner)"; }//from w w w.j a v a 2 s. c om String planningProblemLabel = singleBenchmark.getProblemBenchmark().getName(); dataset.addValue(scoreGraphValue, solverLabel, planningProblemLabel); } } } CategoryAxis xAxis = new CategoryAxis("Data"); xAxis.setCategoryMargin(0.40); NumberAxis yAxis = new NumberAxis("Score"); BarRenderer renderer = new BarRenderer(); ItemLabelPosition positiveItemLabelPosition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE12, TextAnchor.BOTTOM_CENTER); renderer.setBasePositiveItemLabelPosition(positiveItemLabelPosition); ItemLabelPosition negativeItemLabelPosition = new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_CENTER); renderer.setBaseNegativeItemLabelPosition(negativeItemLabelPosition); renderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelsVisible(true); CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); JFreeChart chart = new JFreeChart("Best score summary (higher score is better)", JFreeChart.DEFAULT_TITLE_FONT, plot, true); BufferedImage chartImage = chart.createBufferedImage(1024, 768); bestScoreSummaryFile = new File(plannerBenchmark.getBenchmarkReportDirectory(), "bestScoreSummary.png"); OutputStream out = null; try { out = new FileOutputStream(bestScoreSummaryFile); ImageIO.write(chartImage, "png", out); } catch (IOException e) { throw new IllegalArgumentException("Problem writing bestScoreSummaryFile: " + bestScoreSummaryFile, e); } finally { IOUtils.closeQuietly(out); } }
From source file:GenAppStoreSales.java
/** * Creates a chart./* ww w . jav a 2 s .c o m*/ * * @return A chart. */ private static JFreeChart createChart(ArrayList<String> cLabels, ArrayList<ArrayList<Integer>> cUnits) { CategoryDataset dataset1 = createDataset1(cLabels, cUnits); NumberAxis rangeAxis1 = new NumberAxis("Value"); rangeAxis1.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); CategoryPlot subplot1 = new CategoryPlot(dataset1, null, rangeAxis1, renderer1); subplot1.setDomainGridlinesVisible(true); CategoryDataset dataset2 = createDataset2(cLabels, cUnits); NumberAxis rangeAxis2 = new NumberAxis("Value"); rangeAxis2.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); CategoryPlot subplot2 = new CategoryPlot(dataset2, null, rangeAxis2, renderer2); subplot2.setDomainGridlinesVisible(true); CategoryAxis domainAxis = new CategoryAxis("Time"); CombinedCategoryPlot plot = new CombinedCategoryPlot(domainAxis, new NumberAxis("Units")); plot.add(subplot1, 2); plot.add(subplot2, 1); JFreeChart result = new JFreeChart(chartTitle, new Font("SansSerif", Font.BOLD, 22), plot, true); return result; }
From source file:it.eng.spagobi.engines.chart.bo.charttypes.barcharts.LinkableBar.java
/** * Inherited by IChart.//w w w . j a v a2s . c om * * @param chartTitle the chart title * @param dataset the dataset * * @return the j free chart */ public JFreeChart createChart(DatasetMap datasets) { logger.debug("IN"); CategoryDataset dataset = (CategoryDataset) datasets.getDatasets().get("1"); CategoryAxis categoryAxis = new CategoryAxis(categoryLabel); ValueAxis valueAxis = new NumberAxis(valueLabel); if (rangeIntegerValues == true) { valueAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); } org.jfree.chart.renderer.category.BarRenderer renderer = new org.jfree.chart.renderer.category.BarRenderer(); renderer.setToolTipGenerator(new StandardCategoryToolTipGenerator()); // renderer.setBaseItemLabelFont(new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize())); // renderer.setBaseItemLabelPaint(styleValueLabels.getColor()); if (showValueLabels) { renderer.setBaseItemLabelsVisible(true); renderer.setBaseItemLabelGenerator(new FilterZeroStandardCategoryItemLabelGenerator()); renderer.setBaseItemLabelFont( new Font(styleValueLabels.getFontName(), Font.PLAIN, styleValueLabels.getSize())); renderer.setBaseItemLabelPaint(styleValueLabels.getColor()); } if (maxBarWidth != null) { renderer.setMaximumBarWidth(maxBarWidth.doubleValue()); } boolean document_composition = false; if (mode.equalsIgnoreCase(SpagoBIConstants.DOCUMENT_COMPOSITION)) document_composition = true; MyCategoryUrlGenerator mycatUrl = new MyCategoryUrlGenerator(rootUrl); mycatUrl.setDocument_composition(document_composition); mycatUrl.setCategoryUrlLabel(categoryUrlName); mycatUrl.setSerieUrlLabel(serieUrlname); mycatUrl.setDrillDocTitle(drillDocTitle); mycatUrl.setTarget(target); renderer.setItemURLGenerator(mycatUrl); /* } else{ renderer.setItemURLGenerator(new StandardCategoryURLGenerator(rootUrl)); }*/ CategoryPlot plot = new CategoryPlot((CategoryDataset) dataset, categoryAxis, valueAxis, renderer); plot.setOrientation(PlotOrientation.VERTICAL); if (horizontalView) { plot.setOrientation(PlotOrientation.HORIZONTAL); } JFreeChart chart = new JFreeChart(name, JFreeChart.DEFAULT_TITLE_FONT, plot, legend); TextTitle title = setStyleTitle(name, styleTitle); chart.setTitle(title); if (subName != null && !subName.equals("")) { TextTitle subTitle = setStyleTitle(subName, styleSubTitle); chart.addSubtitle(subTitle); } // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(color); // get a reference to the plot for further customisation... //CategoryPlot plot = (CategoryPlot) chart.getPlot(); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); NumberFormat nf = NumberFormat.getNumberInstance(locale); // set the range axis to display integers only... NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize())); rangeAxis.setLabelPaint(styleXaxesLabels.getColor()); rangeAxis .setTickLabelFont(new Font(styleXaxesLabels.getFontName(), Font.PLAIN, styleXaxesLabels.getSize())); rangeAxis.setTickLabelPaint(styleXaxesLabels.getColor()); rangeAxis.setNumberFormatOverride(nf); if (rangeAxisLocation != null) { if (rangeAxisLocation.equalsIgnoreCase("BOTTOM_OR_LEFT")) { plot.setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_LEFT); } else if (rangeAxisLocation.equalsIgnoreCase("BOTTOM_OR_RIGHT")) { plot.setRangeAxisLocation(0, AxisLocation.BOTTOM_OR_RIGHT); } else if (rangeAxisLocation.equalsIgnoreCase("TOP_OR_RIGHT")) { plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_RIGHT); } else if (rangeAxisLocation.equalsIgnoreCase("TOP_OR_LEFT")) { plot.setRangeAxisLocation(0, AxisLocation.TOP_OR_LEFT); } } // disable bar outlines... //BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); /* if(currentSeries!=null && colorMap!=null){ //for each serie selected int j=0; for (Iterator iterator = currentSeries.iterator(); iterator.hasNext();) { String s = (String) iterator.next(); Integer position=(Integer)seriesNumber.get(s); // check if for that position a value is defined if(colorMap.get("color"+position.toString())!=null){ Color col= (Color)colorMap.get("color"+position); renderer.setSeriesPaint(j, col); } j++; } // close for on series } // close case series selcted and color defined else{ if(colorMap!=null){ // if series not selected check color each one for (Iterator iterator = colorMap.keySet().iterator(); iterator.hasNext();) { String key = (String) iterator.next(); Color col= (Color)colorMap.get(key); String keyNum=key.substring(5, key.length()); int num=Integer.valueOf(keyNum).intValue(); num=num-1; renderer.setSeriesPaint(num, col); } } }*/ int seriesN = dataset.getRowCount(); if (orderColorVector != null && orderColorVector.size() > 0) { logger.debug("color serie by SERIES_ORDER_COLORS template specification"); for (int i = 0; i < seriesN; i++) { if (orderColorVector.get(i) != null) { Color color = orderColorVector.get(i); renderer.setSeriesPaint(i, color); } } } else if (colorMap != null) { for (int i = 0; i < seriesN; i++) { String serieName = (String) dataset.getRowKey(i); Color color = (Color) colorMap.get(serieName); if (color != null) { renderer.setSeriesPaint(i, color); } } } CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); domainAxis.setLabelFont(new Font(styleYaxesLabels.getFontName(), Font.PLAIN, styleYaxesLabels.getSize())); domainAxis.setLabelPaint(styleYaxesLabels.getColor()); domainAxis .setTickLabelFont(new Font(styleYaxesLabels.getFontName(), Font.PLAIN, styleYaxesLabels.getSize())); domainAxis.setTickLabelPaint(styleYaxesLabels.getColor()); if (legend == true) drawLegend(chart); logger.debug("OUT"); return chart; }
From source file:playground.yu.utils.charts.DoubleBarChart.java
/** * @param args/*from ww w . j a v a 2 s.c o m*/ */ public static void run0(String[] args) { String chartFilename = "../matsimTests/charts/barChart.png"; BarChart chartA = new BarChart("", "", "Wegdistanz - MZ05", new String[] { "Arbeit (work)", "Rueckkehr nach Hause bzw. auswaertige Unterkunft (home)", "Freizeit (leisure)", "Einkauf (shopping)", "Ausbildung/Schule (education)", "Andere", "Geschaeftliche Taetigkeit und Dienstfahrt", "Service- und Begleitwege", "total" }); chartA.addSeries("MIV (car)", new double[] { 9.04, 33.90, 12.20, 7.15, 6.83, 6.28, 14.39, 4.48, 10.16 }); chartA.addSeries("OeV (pt)", new double[] { 10.86, 36.80, 15.04, 5.67, 10.06, 54.11, 33.04, 9.02, 12.19 }); chartA.addSeries("LV (walk)", new double[] { 1.19, 0.24, 0.81, 0.70, 2.17, 0.57, 1.93, 0.75, 1.04 }); chartA.addSeries("Andere (others)", new double[] { 18.16, 22.23, 10.78, 5.19, 0.84, 12.97, 44.90, 3.7, 11.76 }); CategoryPlot subplotA = chartA.getChart().getCategoryPlot(); BarChart chartB = new BarChart("", "", "Wegdistanz - Matsim-run698", new String[] { "Arbeit (work)", "Rueckkehr nach Hause bzw. auswaertige Unterkunft (home)", "Freizeit (leisure)", "Einkauf (shopping)", "Ausbildung/Schule (education)", "Andere", "Geschaeftliche Taetigkeit und Dienstfahrt", "Service- und Begleitwege", "total" }); chartB.addSeries("MIV (car)", new double[] { 10.71, 7.79, 6.28, 5.77, 6.65, 0, 0, 0, 8.05 }); chartB.addSeries("OeV (pt)", new double[] { 6.37, 6.10, 4.10, 4.10, 4.64, 0, 0, 0, 5.44 }); chartB.addSeries("LV (walk)", new double[] { 0.88, 0.85, 0.75, 0.75, 0.81, 0, 0, 0, 0.81 }); chartB.addSeries("Andere (others)", new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 0 }); CategoryPlot subplotB = chartB.getChart().getCategoryPlot(); final CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot( new CategoryAxis("Verkehrszwecke/ travel destinations")); plot.add(subplotA, 1); plot.add(subplotB, 1); final JFreeChart result = new JFreeChart("MZ05 vs MATSim - mittlere Wegdistanz", JFreeChart.DEFAULT_TITLE_FONT, plot, true); try { ChartUtilities.saveChartAsPNG(new File(chartFilename), result, 1024, 768, null, true, 9); } catch (IOException e) { e.printStackTrace(); } // chartA.saveAsPng(chartFilename, 800, 600); }
From source file:edu.ucla.stat.SOCR.chart.demo.BoxAndWhiskerChartDemo2.java
/** * Creates a sample chart.//from w w w . ja v a 2 s . c o m * * @param dataset the dataset. * * @return The chart. */ protected JFreeChart createChart(BoxAndWhiskerCategoryDataset dataset) { CategoryAxis domainAxis = new CategoryAxis(null); NumberAxis rangeAxis = new NumberAxis(rangeLabel); BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); CategoryPlot plot = new CategoryPlot(dataset, domainAxis, rangeAxis, renderer); JFreeChart chart = new JFreeChart(chartTitle, plot); plot.setOrientation(PlotOrientation.HORIZONTAL); chart.setBackgroundPaint(Color.white); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setDomainGridlinesVisible(true); plot.setRangeGridlinePaint(Color.white); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); renderer.setLegendItemLabelGenerator( new SOCRCategoryCellLabelGenerator(dataset, values_storage, SERIES_COUNT, CATEGORY_COUNT)); //columnCount -- category count //RowCount -- serie count domainAxis.setLowerMargin(0.44); domainAxis.setUpperMargin(0.44); if (dataset.getColumnCount() == 1) renderer.setItemMargin(0.5); // domainAxis.setCategoryMargin(domainAxis.getCategoryMargin()*2); /* System.out.println("1lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ renderer.setItemMargin(renderer.getItemMargin() * 2); /*System.out.println("2lowerMargin="+domainAxis.getLowerMargin()); System.out.println("ItemMargin="+renderer.getItemMargin()); System.out.println("CategoryMargin="+domainAxis.getCategoryMargin());*/ return chart; }
From source file:scheduler.benchmarker.manager.CreateCombinedCategoryPlot.java
public ChartPanel createChartPanel() { CustomBarRenderer renderer = new CustomBarRenderer(pluginColors); CategoryPlot subplot1 = new CategoryPlot(createDataset1(), new CategoryAxis("Category"), new NumberAxis("Value"), renderer); subplot1.setDomainGridlinesVisible(true); CategoryPlot subplot2 = new CategoryPlot(createDataset2(), new CategoryAxis("Category"), new NumberAxis("Value"), renderer); subplot2.setDomainGridlinesVisible(true); final CategoryAxis domainAxis = new CategoryAxis("Category"); final CombinedDomainCategoryPlot plot = new CombinedDomainCategoryPlot(domainAxis); plot.add(subplot1, 1);/*from www . java 2 s . c o m*/ plot.add(subplot2, 1); plot.setOrientation(PlotOrientation.HORIZONTAL); plot.setFixedLegendItems(createCustomLegend()); plot.setRenderer(renderer); subplot1.setBackgroundPaint(new Color(246, 244, 242)); subplot2.setBackgroundPaint(new Color(246, 244, 242)); subplot1.addRangeMarker(generateMarker("CLASSIFICATION FINISH FOR '" + schedNames[0] + "'", dataSource[0].getSumTotalTime()), Layer.FOREGROUND); subplot2.addRangeMarker(generateMarker("CLASSIFICATION FINISH FOR '" + schedNames[1] + "'", dataSource[1].getSumTotalTime()), Layer.FOREGROUND); final JFreeChart result = new JFreeChart(title, new Font("SansSerif", Font.BOLD, 12), plot, true); cPanel = new ChartPanel(result); cPanel.setForeground(new Color(76, 76, 76)); cPanel.setBackground(new Color(246, 244, 242)); return cPanel; }
From source file:org.jfree.chart.demo.CombinedCategoryPlotDemo2.java
/** * Creates a chart.// ww w .ja v a 2 s .c om * * @return A chart. */ private JFreeChart createChart() { final CategoryDataset dataset1 = createDataset1(); final CategoryAxis domainAxis1 = new CategoryAxis("Class 1"); domainAxis1.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // domainAxis1.setMaxCategoryLabelWidthRatio(5.0f); final LineAndShapeRenderer renderer1 = new LineAndShapeRenderer(); renderer1.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); final CategoryPlot subplot1 = new CategoryPlot(dataset1, domainAxis1, null, renderer1); subplot1.setDomainGridlinesVisible(true); final CategoryDataset dataset2 = createDataset2(); final CategoryAxis domainAxis2 = new CategoryAxis("Class 2"); domainAxis2.setCategoryLabelPositions(CategoryLabelPositions.UP_45); // domainAxis2.setMaxCategoryLabelWidthRatio(5.0f); final BarRenderer renderer2 = new BarRenderer(); renderer2.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator()); final CategoryPlot subplot2 = new CategoryPlot(dataset2, domainAxis2, null, renderer2); subplot2.setDomainGridlinesVisible(true); final ValueAxis rangeAxis = new NumberAxis("Value"); final CombinedRangeCategoryPlot plot = new CombinedRangeCategoryPlot(rangeAxis); plot.add(subplot1, 3); plot.add(subplot2, 2); plot.setOrientation(PlotOrientation.HORIZONTAL); final JFreeChart result = new JFreeChart("Combined Range Category Plot Demo", new Font("SansSerif", Font.BOLD, 12), plot, true); // result.getLegend().setAnchor(Legend.SOUTH); return result; }
From source file:org.jfree.chart.demo.DualAxisDemo5.java
/** * Creates a chart.// w w w. ja v a 2 s . c o m * * @param dataset1 the first dataset. * @param dataset2 the second dataset. * * @return A chart. */ private JFreeChart createChart(final CategoryDataset dataset1, final CategoryDataset dataset2) { final CategoryAxis domainAxis = new CategoryAxis("Category"); final NumberAxis rangeAxis = new NumberAxis("Value"); final BarRenderer renderer1 = new BarRenderer(); final CategoryPlot plot = new CategoryPlot(dataset1, domainAxis, rangeAxis, renderer1) { /** * Override the getLegendItems() method to handle special case. * * @return the legend items. */ public LegendItemCollection getLegendItems() { final LegendItemCollection result = new LegendItemCollection(); final CategoryDataset data = getDataset(); if (data != null) { final CategoryItemRenderer r = getRenderer(); if (r != null) { final LegendItem item = r.getLegendItem(0, 0); result.add(item); } } // the JDK 1.2.2 compiler complained about the name of this // variable final CategoryDataset dset2 = getDataset(1); if (dset2 != null) { final CategoryItemRenderer renderer2 = getRenderer(1); if (renderer2 != null) { final LegendItem item = renderer2.getLegendItem(1, 1); result.add(item); } } return result; } }; final JFreeChart chart = new JFreeChart("Dual Axis Bar Chart", plot); chart.setBackgroundPaint(Color.white); // chart.getLegend().setAnchor(Legend.SOUTH); plot.setBackgroundPaint(new Color(0xEE, 0xEE, 0xFF)); plot.setDomainAxisLocation(AxisLocation.BOTTOM_OR_RIGHT); plot.setDataset(1, dataset2); plot.mapDatasetToRangeAxis(1, 1); final ValueAxis axis2 = new NumberAxis("Secondary"); plot.setRangeAxis(1, axis2); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); final BarRenderer renderer2 = new BarRenderer(); plot.setRenderer(1, renderer2); return chart; }
From source file:org.gephi.ui.utils.ChartsUtils.java
/** * Build a new box-plot from an array of numbers using a default title and yLabel. * String dataName will be used for xLabel. * @param numbers Numbers for building box-plot * @param dataName Name of the numbers data * @return Prepared box-plot//from w w w . j a v a2 s . com */ public static JFreeChart buildBoxPlot(final Number[] numbers, final String dataName) { if (numbers == null || numbers.length == 0) { return null; } DefaultBoxAndWhiskerCategoryDataset dataset = new DefaultBoxAndWhiskerCategoryDataset(); final ArrayList<Number> list = new ArrayList<Number>(); list.addAll(Arrays.asList(numbers)); final String valuesString = getMessage("ChartsUtils.report.box-plot.values"); dataset.add(list, valuesString, ""); final BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer(); renderer.setMeanVisible(false); renderer.setFillBox(false); renderer.setMaximumBarWidth(0.5); final CategoryAxis xAxis = new CategoryAxis(dataName); final NumberAxis yAxis = new NumberAxis(getMessage("ChartsUtils.report.box-plot.values-range")); yAxis.setAutoRangeIncludesZero(false); renderer.setBaseToolTipGenerator(new BoxAndWhiskerToolTipGenerator()); final CategoryPlot plot = new CategoryPlot(dataset, xAxis, yAxis, renderer); plot.setRenderer(renderer); JFreeChart boxPlot = new JFreeChart(getMessage("ChartsUtils.report.box-plot.title"), plot); return boxPlot; }
From source file:playground.dgrether.analysis.categoryhistogram.CategoryHistogramWriter.java
public JFreeChart getGraphic(final CategoryHistogram histo, final String modeName) { this.checkIndex(histo); final XYSeriesCollection xyData = new XYSeriesCollection(); final XYSeries departuresSerie = new XYSeries(this.departuresName, false, true); final XYSeries arrivalsSerie = new XYSeries(this.arrivalsName, false, true); final XYSeries onRouteSerie = new XYSeries(this.enRouteName, false, true); Integer enRoute = 0;//w w w . ja v a2 s.c o m for (int i = histo.getFirstIndex() - 2; i <= histo.getLastIndex() + 2; i++) { int departures = histo.getDepartures(modeName, i); int arrivals = histo.getArrivals(modeName, i); int stuck = histo.getAbort(modeName, i); enRoute = enRoute + departures - arrivals - stuck; double hour = i * histo.getBinSizeSeconds() / 60.0 / 60.0; departuresSerie.add(hour, departures); arrivalsSerie.add(hour, arrivals); onRouteSerie.add(hour, enRoute); } xyData.addSeries(departuresSerie); xyData.addSeries(arrivalsSerie); xyData.addSeries(onRouteSerie); final JFreeChart chart = ChartFactory.createXYStepChart( this.title + ", " + modeName + ", " + "it." + histo.getIteration(), "time [h]", yTitle, xyData, PlotOrientation.VERTICAL, true, // legend false, // tooltips false // urls ); XYPlot plot = chart.getXYPlot(); final CategoryAxis axis1 = new CategoryAxis("hour"); axis1.setTickLabelFont(new Font("SansSerif", Font.PLAIN, 7)); plot.setDomainAxis(new NumberAxis("time")); plot.getRenderer().setSeriesStroke(0, new BasicStroke(1.0f)); plot.getRenderer().setSeriesStroke(1, new BasicStroke(1.0f)); plot.getRenderer().setSeriesStroke(2, new BasicStroke(1.0f)); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.gray); plot.setDomainGridlinePaint(Color.gray); return chart; }