List of usage examples for org.jfree.chart JFreeChart setTitle
public void setTitle(String text)
From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java
private static JFreeChart createMultiplePieChart3D_2(CategoryDataset dataset) { MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(TableOrder.BY_ROW); plot.setBackgroundPaint(null);//from w ww .j a v a 2 s . c o m plot.setOutlineStroke(null); JFreeChart pieChart = new JFreeChart(new PiePlot3D(null)); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); pieChart.setTitle(seriesTitle); pieChart.removeLegend(); pieChart.setBackgroundPaint(null); plot.setPieChart(pieChart); if (tooltips) { PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); } if (urls) { PieURLGenerator urlGenerator = new StandardPieURLGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setURLGenerator(urlGenerator); } JFreeChart chart = new JFreeChart("MultiplePie Chart 3D Demo 2", JFreeChart.DEFAULT_TITLE_FONT, plot, legend); chart.setBackgroundPaint(Color.white); return chart; }
From source file:org.hxzon.demo.jfreechart.CategoryDatasetDemo2.java
private static JFreeChart createMultiplePieChart3D(CategoryDataset dataset) { MultiplePiePlot plot = new MultiplePiePlot(dataset); plot.setDataExtractOrder(TableOrder.BY_COLUMN); plot.setBackgroundPaint(null);/*from w w w . j a va 2 s . c o m*/ plot.setOutlineStroke(null); JFreeChart pieChart = new JFreeChart(new PiePlot3D(null)); TextTitle seriesTitle = new TextTitle("Series Title", new Font("SansSerif", Font.BOLD, 12)); seriesTitle.setPosition(RectangleEdge.BOTTOM); pieChart.setTitle(seriesTitle); pieChart.removeLegend(); pieChart.setBackgroundPaint(null); plot.setPieChart(pieChart); if (tooltips) { PieToolTipGenerator tooltipGenerator = new StandardPieToolTipGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setToolTipGenerator(tooltipGenerator); } if (urls) { PieURLGenerator urlGenerator = new StandardPieURLGenerator(); PiePlot pp = (PiePlot) plot.getPieChart().getPlot(); pp.setURLGenerator(urlGenerator); } JFreeChart chart = new JFreeChart("MultiplePie Chart 3D Demo 1", JFreeChart.DEFAULT_TITLE_FONT, plot, legend); chart.setBackgroundPaint(Color.white); PiePlot piePlot = (PiePlot) pieChart.getPlot(); GradientPaint gp0 = new GradientPaint(0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color(0, 0, 64)); GradientPaint gp1 = new GradientPaint(0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color(0, 64, 0)); GradientPaint gp2 = new GradientPaint(0.0f, 0.0f, Color.red, 0.0f, 0.0f, new Color(64, 0, 0)); piePlot.setSectionPaint("First", gp0); piePlot.setSectionPaint("Second", gp1); piePlot.setSectionPaint("Third", gp2); return chart; }
From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java
public static void customizeChart(JFreeChart jfchart, ChartParams params) { // title/*from w ww. j a va 2s . c om*/ if (params.get(ChartParams.TITLE_PREFIX + ChartParams.TITLE_SUFFIX) != null) { TextTitle title = new TextTitle(params.getString(ChartParams.TITLE_PREFIX + ChartParams.TITLE_SUFFIX)); customizeTitle(title, params, ChartParams.TITLE_PREFIX); jfchart.setTitle(title); } // subtitle if (params.get(ChartParams.SUBTITLE_PREFIX + ChartParams.TITLE_SUFFIX) != null) { TextTitle subtitle = new TextTitle( params.getString(ChartParams.SUBTITLE_PREFIX + ChartParams.TITLE_SUFFIX)); customizeTitle(subtitle, params, ChartParams.SUBTITLE_PREFIX); jfchart.addSubtitle(subtitle); } // legend LegendTitle legend = jfchart.getLegend(); customizeLegend(legend, params); // anti-alias if (params.get(ChartParams.ANTI_ALIAS) != null) { jfchart.setAntiAlias(params.getBoolean(ChartParams.ANTI_ALIAS).booleanValue()); } // background color if (params.get(ChartParams.BACKGROUND_COLOR) != null) { jfchart.setBackgroundPaint(params.getColor(ChartParams.BACKGROUND_COLOR)); } // border if (params.get(ChartParams.BORDER_VISIBLE) != null && params.getBoolean(ChartParams.BORDER_VISIBLE).booleanValue()) { jfchart.setBorderVisible(true); if (params.get(ChartParams.BORDER_COLOR) != null) { jfchart.setBorderPaint(params.getColor(ChartParams.BORDER_COLOR)); } if (params.get(ChartParams.BORDER_STROKE) != null) { jfchart.setBorderStroke(params.getStroke(ChartParams.BORDER_STROKE)); } } }
From source file:nl.ctmm.trait.proteomics.qcviewer.utils.ReportPDFExporter.java
/** * Create image of the TIC Chart./* ww w . ja va 2s . c o m*/ * * @param reportUnit Report unit for which to create TIC chart image. * @return TIC Chart image. */ private static Image createTICChartImage(final ReportUnit reportUnit) { /*Reference: http://vangjee.wordpress.com/2010/11/03/how-to-use-and-not-use-itext-and-jfreechart/ * Apache License, Version 2.0 */ JFreeChart ticChart = null; try { ticChart = (JFreeChart) reportUnit.getChartUnit().getTicChart().clone(); } catch (final CloneNotSupportedException e) { logger.log(Level.SEVERE, String.format(CLONE_EXCEPTION_MESSAGE, reportUnit.getMsrunName()), e); } final String titleString = String.format(TIC_GRAPH_TITLE, reportUnit.getMsrunName(), reportUnit.getChartUnit().getMaxTicIntensityString()); final TextTitle newTitle = new TextTitle(titleString, Constants.PDF_CHART_TITLE_FONT); newTitle.setPaint(Color.red); if (ticChart != null) { ticChart.setTitle(newTitle); } Image chartImage = null; try { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); if (ticChart != null) { ChartUtilities.writeChartAsPNG(byteArrayOutputStream, ticChart, CHART_IMAGE_WIDTH, CHART_IMAGE_HEIGHT, new ChartRenderingInfo()); } chartImage = Image.getInstance(byteArrayOutputStream.toByteArray()); byteArrayOutputStream.close(); } catch (final BadElementException | IOException e) { // TODO Explain when these exception can occur. /* * IOException occurs in case PDF file can not be created. * e.g. PDF file with same name exist in the PDF directory and it is open. * In this case, the PDF file can not be overwritten. * BadElementException Signals an attempt to create an Element that hasn't got the right form. */ logger.log(Level.SEVERE, PDF_EXPORT_EXCEPTION_MESSAGE, e); } if (chartImage != null) { chartImage.setAlignment(Element.ALIGN_CENTER); } return chartImage; }
From source file:net.sf.jasperreports.components.spiderchart.SpiderChartDesignEvaluator.java
/** * /*from w w w . j a v a 2 s. c om*/ */ public static JRRenderable evaluateRenderer(ReportConverter reportConverter, JRComponentElement element) { SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent(); ChartSettings chartSettings = chartComponent.getChartSettings(); SpiderPlot plot = chartComponent.getPlot(); SpiderWebPlot spiderWebPlot = new SpiderWebPlot(getSampleDataset()); if (plot.getAxisLineColor() != null) { spiderWebPlot.setAxisLinePaint(plot.getAxisLineColor()); } if (plot.getAxisLineWidth() != null) { spiderWebPlot.setAxisLineStroke(new BasicStroke(plot.getAxisLineWidth())); } if (plot.getBackcolor() != null) { spiderWebPlot.setBackgroundPaint(plot.getBackcolor()); } if (plot.getBackgroundAlpha() != null) { spiderWebPlot.setBackgroundAlpha(plot.getBackgroundAlpha()); } if (plot.getForegroundAlpha() != null) { spiderWebPlot.setForegroundAlpha(plot.getForegroundAlpha()); } if (plot.getHeadPercent() != null) { spiderWebPlot.setHeadPercent(plot.getHeadPercent()); } if (plot.getInteriorGap() != null) { spiderWebPlot.setInteriorGap(plot.getInteriorGap()); } if (plot.getLabelColor() != null) { spiderWebPlot.setLabelPaint(plot.getLabelColor()); } if (plot.getLabelFont() != null) { spiderWebPlot.setLabelFont(JRFontUtil.getAwtFont(plot.getLabelFont(), Locale.getDefault())); } if (plot.getLabelGap() != null) { spiderWebPlot.setAxisLabelGap(plot.getLabelGap()); } spiderWebPlot.setMaxValue(MAX_VALUE); if (plot.getRotation() != null) { spiderWebPlot.setDirection(plot.getRotation().getRotation()); } if (plot.getStartAngle() != null) { spiderWebPlot.setStartAngle(plot.getStartAngle()); } if (plot.getTableOrder() != null) { spiderWebPlot.setDataExtractOrder(plot.getTableOrder().getOrder()); } if (plot.getWebFilled() != null) { spiderWebPlot.setWebFilled(plot.getWebFilled()); } spiderWebPlot.setToolTipGenerator(new StandardCategoryToolTipGenerator()); spiderWebPlot.setLabelGenerator(new StandardCategoryItemLabelGenerator()); String titleText = JRExpressionUtil.getExpressionText(chartSettings.getTitleExpression()); Font titleFont = chartSettings.getTitleFont() != null ? JRFontUtil.getAwtFont(chartSettings.getTitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT; JFreeChart jfreechart = new JFreeChart(titleText, titleFont, spiderWebPlot, true); if (chartSettings.getBackcolor() != null) { jfreechart.setBackgroundPaint(chartSettings.getBackcolor()); } RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP); if (titleText != null) { TextTitle title = jfreechart.getTitle(); title.setText(titleText); if (chartSettings.getTitleColor() != null) { title.setPaint(chartSettings.getTitleColor()); } title.setFont(titleFont); title.setPosition(titleEdge); jfreechart.setTitle(title); } String subtitleText = JRExpressionUtil.getExpressionText(chartSettings.getSubtitleExpression()); if (subtitleText != null) { TextTitle subtitle = new TextTitle(subtitleText); subtitle.setText(subtitleText); if (chartSettings.getSubtitleColor() != null) { subtitle.setPaint(chartSettings.getSubtitleColor()); } if (chartSettings.getSubtitleColor() != null) { Font subtitleFont = chartSettings.getSubtitleFont() != null ? JRFontUtil.getAwtFont(chartSettings.getSubtitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT; subtitle.setFont(subtitleFont); } subtitle.setPosition(titleEdge); jfreechart.addSubtitle(subtitle); } // Apply all of the legend formatting options LegendTitle legend = jfreechart.getLegend(); if (legend != null) { legend.setVisible((chartSettings.getShowLegend() == null || chartSettings.getShowLegend())); if (legend.isVisible()) { if (chartSettings.getLegendColor() != null) { legend.setItemPaint(chartSettings.getLegendColor()); } if (chartSettings.getLegendBackgroundColor() != null) { legend.setBackgroundPaint(chartSettings.getLegendBackgroundColor()); } if (chartSettings.getLegendFont() != null) { legend.setItemFont(JRFontUtil.getAwtFont(chartSettings.getLegendFont(), Locale.getDefault())); } legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM)); } } Rectangle2D rectangle = new Rectangle2D.Double(0, 0, element.getWidth(), element.getHeight()); String renderType = chartSettings.getRenderType(); if (renderType == null) { renderType = JRProperties.getProperty(reportConverter.getReport(), JRChart.PROPERTY_CHART_RENDER_TYPE); } return ChartUtil.getChartRendererFactory(renderType).getRenderer(jfreechart, null, rectangle); }
From source file:fr.gouv.diplomatie.applitutoriel.utility.Graphique.java
/** * Creer camember3 d.//from ww w. j a v a 2 s . co m * * @param title * the title * @param dataset * the dataset * @param legend * the legend * @param tooltips * the tooltips * @param urls * the urls * @return the j free chart * @throws FontFormatException * the font format exception * @throws IOException * Signals that an I/O exception has occurred. */ public static JFreeChart creerCamember3D(final String title, final DefaultPieDataset dataset, final boolean legend, final boolean tooltips, final boolean urls) throws FontFormatException, IOException { dataset.sortByValues(SortOrder.DESCENDING); final JFreeChart jfreeChart = ChartFactory.createPieChart3D(title, dataset, legend, tooltips, urls); jfreeChart.setBackgroundPaint(Color.white); jfreeChart.setBorderVisible(true); jfreeChart.getLegend().setPosition(RectangleEdge.LEFT); final GraphicsEnvironment graph = GraphicsEnvironment.getLocalGraphicsEnvironment(); final InputStream inputStream = Thread.currentThread().getContextClassLoader() .getResourceAsStream("hornet/framework/font/LiberationSans-Bold.ttf"); final Font font = Font.createFont(Font.TRUETYPE_FONT, inputStream); graph.registerFont(font); jfreeChart.getLegend().setItemFont(new Font("Liberation Sans", Font.BOLD, 11)); jfreeChart.getLegend().setHeight(400); jfreeChart.getLegend().setBorder(0, 0, 0, 0); jfreeChart.setTitle(new TextTitle(title, new Font("Liberation Sans", Font.BOLD, 16))); final PiePlot piePlot = (PiePlot) jfreeChart.getPlot(); final int nbData = dataset.getItemCount(); int cptColor = 0; for (int x = 0; x < nbData; x++) { if (cptColor >= listColor.size()) { cptColor = 0; } piePlot.setSectionPaint(dataset.getKey(x), listColor.get(cptColor)); cptColor++; } piePlot.setForegroundAlpha(0.5f); piePlot.setLabelFont(new Font("Liberation Sans", Font.BOLD, 12)); piePlot.setLabelOutlineStroke(null); piePlot.setLabelLinkStroke(new BasicStroke(0.4f)); piePlot.setLabelBackgroundPaint(Color.WHITE); piePlot.setLabelLinkStyle(PieLabelLinkStyle.STANDARD); piePlot.setBackgroundAlpha(0); piePlot.setOutlineVisible(false); piePlot.setForegroundAlpha(1); // transparence piePlot.setInteriorGap(0); // le camembert occupe plus de place piePlot.setLabelGenerator(new StandardPieSectionLabelGenerator("{1}")); piePlot.setStartAngle(70); piePlot.setCircular(true); // force pour avoir un cercle et pas un oval piePlot.setMaximumLabelWidth(0.20); piePlot.setBaseSectionOutlinePaint(Color.BLACK); // bordure du camembert return jfreeChart; }
From source file:org.eumetsat.metop.visat.MhsInfoView.java
@Override protected void configureSpectrumChart(JFreeChart chart) { super.configureSpectrumChart(chart); chart.setTitle("MHS IFOV Spectrum"); }
From source file:net.sf.jasperreports.components.spiderchart.SpiderChartRendererEvaluator.java
/** * //from ww w .ja v a 2 s. c o m */ public static Renderable evaluateRenderable(JasperReportsContext jasperReportsContext, JRComponentElement element, SpiderChartSharedBean spiderchartBean, ChartCustomizer chartCustomizer, String defaultRenderType, String datasetType) { SpiderChartComponent chartComponent = (SpiderChartComponent) element.getComponent(); ChartSettings chartSettings = chartComponent.getChartSettings(); SpiderPlot plot = (SpiderPlot) chartComponent.getPlot(); DefaultCategoryDataset dataset = null; StandardCategoryItemLabelGenerator labelGenerator = null; if (FILL_DATASET.equals(datasetType)) { dataset = ((FillSpiderDataset) spiderchartBean.getDataset()).getCustomDataset(); labelGenerator = ((FillSpiderDataset) spiderchartBean.getDataset()).getLabelGenerator(); } else { dataset = getSampleDataset(); labelGenerator = new StandardCategoryItemLabelGenerator(); } SpiderWebPlot spiderWebPlot = new SpiderWebPlot(dataset); if (plot.getAxisLineColor() != null) { spiderWebPlot.setAxisLinePaint(plot.getAxisLineColor()); } if (plot.getAxisLineWidth() != null) { spiderWebPlot.setAxisLineStroke(new BasicStroke(plot.getAxisLineWidth())); } if (plot.getBackcolor() != null) { spiderWebPlot.setBackgroundPaint(plot.getBackcolor()); } if (plot.getBackgroundAlpha() != null) { spiderWebPlot.setBackgroundAlpha(plot.getBackgroundAlpha()); } if (plot.getForegroundAlpha() != null) { spiderWebPlot.setForegroundAlpha(plot.getForegroundAlpha()); } if (plot.getHeadPercent() != null) { spiderWebPlot.setHeadPercent(plot.getHeadPercent()); } if (plot.getInteriorGap() != null) { spiderWebPlot.setInteriorGap(plot.getInteriorGap()); } if (plot.getLabelColor() != null) { spiderWebPlot.setLabelPaint(plot.getLabelColor()); } if (plot.getLabelFont() != null) { spiderWebPlot.setLabelFont(FontUtil.getInstance(jasperReportsContext).getAwtFont(plot.getLabelFont(), Locale.getDefault())); } if (plot.getLabelGap() != null) { spiderWebPlot.setAxisLabelGap(plot.getLabelGap()); } if (spiderchartBean.getMaxValue() != null) { spiderWebPlot.setMaxValue(spiderchartBean.getMaxValue()); } if (plot.getRotation() != null) { spiderWebPlot.setDirection(plot.getRotation().getRotation()); } if (plot.getStartAngle() != null) { spiderWebPlot.setStartAngle(plot.getStartAngle()); } if (plot.getTableOrder() != null) { spiderWebPlot.setDataExtractOrder(plot.getTableOrder().getOrder()); } if (plot.getWebFilled() != null) { spiderWebPlot.setWebFilled(plot.getWebFilled()); } spiderWebPlot.setToolTipGenerator(new StandardCategoryToolTipGenerator()); spiderWebPlot.setLabelGenerator(labelGenerator); Font titleFont = chartSettings.getTitleFont() != null ? FontUtil.getInstance(jasperReportsContext) .getAwtFont(chartSettings.getTitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT; String titleText = spiderchartBean.getTitleText(); JFreeChart jfreechart = new JFreeChart(titleText, titleFont, spiderWebPlot, true); Color backcolor = chartSettings.getBackcolor() != null ? chartSettings.getBackcolor() : element.getBackcolor(); if (backcolor != null) { jfreechart.setBackgroundPaint(backcolor); } RectangleEdge titleEdge = getEdge(chartSettings.getTitlePosition(), RectangleEdge.TOP); if (titleText != null) { TextTitle title = jfreechart.getTitle(); title.setText(titleText); if (chartSettings.getTitleColor() != null) { title.setPaint(chartSettings.getTitleColor()); } title.setFont(titleFont); title.setPosition(titleEdge); jfreechart.setTitle(title); } String subtitleText = spiderchartBean.getSubtitleText(); if (subtitleText != null) { TextTitle subtitle = new TextTitle(subtitleText); subtitle.setText(subtitleText); if (chartSettings.getSubtitleColor() != null) { subtitle.setPaint(chartSettings.getSubtitleColor()); } if (chartSettings.getSubtitleColor() != null) { Font subtitleFont = chartSettings.getSubtitleFont() != null ? FontUtil.getInstance(jasperReportsContext).getAwtFont(chartSettings.getSubtitleFont(), Locale.getDefault()) : TextTitle.DEFAULT_FONT; subtitle.setFont(subtitleFont); } subtitle.setPosition(titleEdge); jfreechart.addSubtitle(subtitle); } // Apply all of the legend formatting options LegendTitle legend = jfreechart.getLegend(); if (legend != null) { legend.setVisible((chartSettings.getShowLegend() == null || chartSettings.getShowLegend())); if (legend.isVisible()) { if (chartSettings.getLegendColor() != null) { legend.setItemPaint(chartSettings.getLegendColor()); } if (chartSettings.getLegendBackgroundColor() != null) { legend.setBackgroundPaint(chartSettings.getLegendBackgroundColor()); } if (chartSettings.getLegendFont() != null) { legend.setItemFont(FontUtil.getInstance(jasperReportsContext) .getAwtFont(chartSettings.getLegendFont(), Locale.getDefault())); } legend.setPosition(getEdge(chartSettings.getLegendPosition(), RectangleEdge.BOTTOM)); } } String renderType = chartSettings.getRenderType() == null ? defaultRenderType : chartSettings.getRenderType(); Rectangle2D rectangle = new Rectangle2D.Double(0, 0, element.getWidth(), element.getHeight()); if (chartCustomizer != null) { chartCustomizer.customize(jfreechart, chartComponent); } return ChartUtil.getInstance(jasperReportsContext).getChartRenderableFactory(renderType) .getRenderable(jasperReportsContext, jfreechart, spiderchartBean.getHyperlinkProvider(), rectangle); }
From source file:org.eumetsat.metop.visat.AmsuInfoView.java
@Override protected void configureSpectrumChart(final JFreeChart chart) { super.configureSpectrumChart(chart); chart.setTitle("AMSU IFOV Spectrum"); }
From source file:com.insa.tp3g1.esbsimulator.view.OverlaidBarChart.java
/** * Default constructor./* w w w. j a va 2 s . com*/ * * @param title the frame title. * @param result */ public OverlaidBarChart(final String title, Result result) { super(title); // create the first dataset... DefaultCategoryDataset dataset1 = new DefaultCategoryDataset(); LinkConsumerProvider[] linkConsProv = result.getLinksConsumerProvider(); for (LinkConsumerProvider linkConsProv1 : linkConsProv) { dataset1.addValue(Integer.parseInt(linkConsProv1.getAverageResponseTime()), average, link + linkConsProv1.getConsumerId()); } // create the first renderer... // final CategoryLabelGenerator generator = new StandardCategoryLabelGenerator(); final CategoryItemRenderer renderer = new BarRenderer(); // renderer.setLabelGenerator(generator); renderer.setItemLabelsVisible(true); final CategoryPlot plot = new CategoryPlot(); plot.setDataset(dataset1); plot.setRenderer(renderer); plot.setDomainAxis(new CategoryAxis("Category")); plot.setRangeAxis(new NumberAxis("Value (ms)")); plot.setOrientation(PlotOrientation.VERTICAL); plot.setRangeGridlinesVisible(true); plot.setDomainGridlinesVisible(true); // now create the second dataset and renderer... DefaultCategoryDataset dataset2 = new DefaultCategoryDataset(); for (LinkConsumerProvider linkConsProv1 : linkConsProv) { dataset2.addValue(Integer.parseInt(result.getTotalResult().getResponseTime().getMinResponseTime()), min, link + linkConsProv1.getConsumerId()); } final CategoryItemRenderer renderer2 = new LineAndShapeRenderer(); plot.setDataset(1, dataset2); plot.setRenderer(1, renderer2); // create the third dataset and renderer... final ValueAxis rangeAxis2 = new NumberAxis("value (ms)"); plot.setRangeAxis(1, rangeAxis2); DefaultCategoryDataset dataset3 = new DefaultCategoryDataset(); for (LinkConsumerProvider linkConsProv1 : linkConsProv) { dataset3.addValue(Integer.parseInt(result.getTotalResult().getResponseTime().getMaxResponseTime()), max, link + linkConsProv1.getConsumerId()); } plot.setDataset(2, dataset3); final CategoryItemRenderer renderer3 = new LineAndShapeRenderer(); plot.setRenderer(2, renderer3); plot.mapDatasetToRangeAxis(2, 1); // change the rendering order so the primary dataset appears "behind" the // other datasets... plot.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD); plot.getDomainAxis().setCategoryLabelPositions(CategoryLabelPositions.UP_45); final JFreeChart chart = new JFreeChart(plot); chart.setTitle("Response Time Chart"); // chart.setLegend(new StandardLegend()); // add the chart to a panel... final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 270)); setContentPane(chartPanel); }