List of usage examples for org.jfree.chart JFreeChart createBufferedImage
public BufferedImage createBufferedImage(int width, int height)
From source file:lenscorrection.Distortion_Correction.java
public void evaluateCorrection(final List<List<PointMatch>> inliers) { IJ.showStatus("Evaluating Distortion Correction"); final double[][] original = new double[sp.numberOfImages][2]; final double[][] corrected = new double[sp.numberOfImages][2]; for (int i = sp.firstImageIndex; i < sp.numberOfImages; i++) { original[i] = evaluateCorrectionXcorr(i, sp.source_dir); corrected[i] = evaluateCorrectionXcorr(i, sp.target_dir); }/*from w w w. java 2s.c o m*/ final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); final DefaultCategoryDataset datasetGain = new DefaultCategoryDataset(); final DefaultCategoryDataset datasetGrad = new DefaultCategoryDataset(); for (int i = 0; i < (original.length); ++i) { dataset.setValue(Math.abs(original[i][0]), "before", "image" + i); dataset.setValue(Math.abs(corrected[i][0]), "after", "image" + i); datasetGrad.setValue(Math.abs(original[i][1]), "before", "image" + i); datasetGrad.setValue(Math.abs(corrected[i][1]), "after", "image" + i); datasetGain.setValue(Math.abs(corrected[i][0]) - Math.abs(original[i][0]), "gray", "image" + i); datasetGain.setValue(Math.abs(corrected[i][1]) - Math.abs(original[i][1]), "grad", "image" + i); } final JFreeChart chart = ChartFactory.createBarChart("Xcorr before and after correction", "ImageNumber", "Xcorr", dataset, PlotOrientation.VERTICAL, false, true, false); final ImagePlus imp = new ImagePlus("Xcorr before and after correction Plot", chart.createBufferedImage(500, 300)); imp.show(); final JFreeChart chartGrad = ChartFactory.createBarChart("XcorrGradient before and after correction", "ImageNumber", "Xcorr", datasetGrad, PlotOrientation.VERTICAL, false, true, false); final ImagePlus impGrad = new ImagePlus("XcorrGradient before and after correction Plot", chartGrad.createBufferedImage(500, 300)); impGrad.show(); final JFreeChart chartGain = ChartFactory.createBarChart("Gain in Xcorr", "ImageNumber", "Xcorr", datasetGain, PlotOrientation.VERTICAL, false, true, false); final ImagePlus impGain = new ImagePlus("Gain in Xcorr Plot", chartGain.createBufferedImage(500, 300)); impGain.show(); visualizePoints(inliers); //write xcorr data to file String original0 = "", original1 = "", corrected0 = "", corrected1 = "", gain0 = "", gain1 = ""; for (int i = 0; i < (original.length); ++i) { original0 = original0 + Double.toString(original[i][0]) + "; "; original1 = original1 + Double.toString(original[i][1]) + "; "; corrected0 = corrected0 + Double.toString(corrected[i][0]) + "; "; corrected1 = corrected1 + Double.toString(corrected[i][1]) + "; "; gain0 = gain0 + Double.toString(Math.abs(corrected[i][0]) - Math.abs(original[i][0])) + "; "; gain1 = gain1 + Double.toString(Math.abs(corrected[i][1]) - Math.abs(original[i][1])) + "; "; } try { final BufferedWriter out = new BufferedWriter(new FileWriter(sp.source_dir + "xcorrData.log")); out.write(original0); out.newLine(); out.newLine(); out.write(original1); out.newLine(); out.newLine(); out.write(corrected0); out.newLine(); out.newLine(); out.write(corrected1); out.newLine(); out.newLine(); out.write(gain0); out.newLine(); out.newLine(); out.write(gain1); out.newLine(); out.close(); } catch (final Exception e) { System.err.println("Error: " + e.getMessage()); } ; }
From source file:net.sourceforge.atunes.kernel.modules.statistics.StatsDialogController.java
/** * Puts image with chart in given label, with title and data provided * // www . j ava 2s .c o m * @param data * @param titleKey * @param chartLabel */ private void setChart(final List<?> data, final String titleKey, final JLabel chartLabel) { DefaultCategoryDataset dataset = getDataSet(data); JFreeChart chart = ChartFactory.createStackedBarChart3D(I18nUtils.getString(titleKey), null, null, dataset, PlotOrientation.HORIZONTAL, false, false, false); chart.setBackgroundPaint(Color.WHITE); chart.setPadding(new RectangleInsets(5, 0, 0, 0)); NumberAxis axis = new NumberAxis(); axis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); chart.setBackgroundPaint(GuiUtils.getBackgroundColor()); chart.getTitle().setPaint(GuiUtils.getForegroundColor()); chart.getCategoryPlot().setRangeAxis(axis); chart.getCategoryPlot().setForegroundAlpha(1f); chart.getCategoryPlot().getRenderer().setSeriesPaint(0, Color.GREEN); chart.getCategoryPlot().getDomainAxis().setTickLabelPaint(GuiUtils.getForegroundColor()); chart.getCategoryPlot().getRangeAxis().setTickLabelPaint(GuiUtils.getForegroundColor()); chart.getPlot().setBackgroundPaint(GuiUtils.getBackgroundColor()); chartLabel.setIcon(new ImageIcon(chart.createBufferedImage(710, 250))); }
From source file:net.sourceforge.atunes.kernel.modules.statistics.StatsDialogController.java
/** * Sets the general chart./*w w w . j a v a2s . co m*/ */ private void setGeneralChart() { DefaultPieDataset dataset = new DefaultPieDataset(); int different = this.statisticsHandler.getDifferentAudioObjectsPlayed(); int total = this.repositoryHandler.getAudioFilesList().size(); dataset.setValue(I18nUtils.getString("SONGS_PLAYED"), different); dataset.setValue(I18nUtils.getString("SONGS_NEVER_PLAYED"), total - different); JFreeChart chart = ChartFactory.createPieChart3D(I18nUtils.getString("SONGS_PLAYED"), dataset, false, false, false); chart.setBackgroundPaint(GuiUtils.getBackgroundColor()); chart.getTitle().setPaint(GuiUtils.getForegroundColor()); chart.setPadding(new RectangleInsets(5, 0, 0, 0)); DefaultDrawingSupplier drawingSupplier = new DefaultDrawingSupplier( new Paint[] { new Color(0, 1, 0, 0.6f), new Color(1, 0, 0, 0.6f) }, new Paint[] { new Color(0, 1, 0, 0.4f), new Color(1, 0, 0, 0.4f) }, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); chart.getPlot().setDrawingSupplier(drawingSupplier); ((PiePlot3D) chart.getPlot()).setOutlineVisible(false); ((PiePlot3D) chart.getPlot()).setBackgroundPaint(GuiUtils.getBackgroundColor()); getComponentControlled().getGeneralChart().setIcon(new ImageIcon(chart.createBufferedImage(710, 250))); }
From source file:weka.gui.beans.JFreeChartOffscreenChartRenderer.java
/** * Render an XY scatter plot//from w w w. j ava2 s . c om * * @param width the width of the resulting chart in pixels * @param height the height of the resulting chart in pixels * @param series a list of Instances - one for each series to be plotted * @param xAxis the name of the attribute for the x-axis (all series Instances * are expected to have an attribute of the same type with this name) * @param yAxis the name of the attribute for the y-axis (all series Instances * are expected to have an attribute of the same type with this name) * @param optionalArgs optional arguments to the renderer (may be null) * * @return a BufferedImage containing the chart * @throws Exception if there is a problem rendering the chart */ public BufferedImage renderXYScatterPlot(int width, int height, List<Instances> series, String xAxis, String yAxis, List<String> optionalArgs) throws Exception { String plotTitle = "Scatter Plot"; String userTitle = getOption(optionalArgs, "-title"); plotTitle = (userTitle != null) ? userTitle : plotTitle; String colorAtt = getOption(optionalArgs, "-color"); if (series.size() == 1 && colorAtt != null && colorAtt.length() > 0) { int colIndex = getIndexOfAttribute(series.get(0), colorAtt); if (colIndex >= 0 && series.get(0).attribute(colIndex).isNominal()) { // split single series out into multiple instances objects - one // per class series = splitToClasses(series.get(0), colIndex); for (Instances insts : series) { insts.setClassIndex(colIndex); } } } Instances masterInstances = series.get(0); int xAx = getIndexOfAttribute(masterInstances, xAxis); int yAx = getIndexOfAttribute(masterInstances, yAxis); if (xAx < 0) { xAx = 0; } if (yAx < 0) { yAx = 0; } // Set the axis names just in case we've been supplied with // /first, /last or /<num> xAxis = masterInstances.attribute(xAx).name(); yAxis = masterInstances.attribute(yAx).name(); // look for an additional attribute that stores the // shape sizes - could be either nominal or numeric errors. // We only use numeric error information String shapeSize = getOption(optionalArgs, "-shapeSize"); boolean nominalClass = (masterInstances.classIndex() >= 0 && masterInstances.classAttribute().isNominal()); int shapeSizeI = -1; if (shapeSize != null && shapeSize.length() > 0) { shapeSizeI = getIndexOfAttribute(masterInstances, shapeSize); } AbstractIntervalXYDataset xyDataset = null; if (shapeSizeI < 0 || nominalClass) { xyDataset = new XYSeriesCollection(); } else { xyDataset = new XYIntervalSeriesCollection(); } // add master series Series master = null; if (shapeSizeI < 0 || nominalClass) { master = new XYSeries(masterInstances.relationName()); } else { master = new XYIntervalSeries(masterInstances.relationName()); } AttributeStats xStats = masterInstances.attributeStats(xAx); AttributeStats yStats = masterInstances.attributeStats(yAx); double sizeRange = 0; double sizeMin = 0; if (shapeSizeI >= 0 && !nominalClass) { AttributeStats sStats = masterInstances.attributeStats(shapeSizeI); sizeRange = sStats.numericStats.max - sStats.numericStats.min; sizeMin = sStats.numericStats.min; } double xRange = 0; if (masterInstances.attribute(xAx).isNominal()) { xRange = masterInstances.attribute(xAx).numValues(); } else { xRange = xStats.numericStats.max - xStats.numericStats.min; } double yRange = 0; if (masterInstances.attribute(yAx).isNominal()) { xRange = masterInstances.attribute(yAx).numValues(); } else { yRange = yStats.numericStats.max - yStats.numericStats.min; } for (int i = 0; i < masterInstances.numInstances(); i++) { Instance inst = masterInstances.instance(i); if (!inst.isMissing(xAx) && !inst.isMissing(yAx)) { if (shapeSizeI < 0 || nominalClass) { ((XYSeries) master).add(inst.value(xAx), inst.value(yAx)); } else { double xBar = (inst.value(shapeSizeI) - sizeMin) / sizeRange; xBar *= (xRange / 5.0); // max of 1/5th the x range double yBar = (inst.value(shapeSizeI) - sizeMin) / sizeRange; yBar *= (yRange / 5.0); double x = inst.value(xAx); double y = inst.value(yAx); ((XYIntervalSeries) master).add(x, x - (xBar / 2.0), x + (xBar / 2.0), y, y - (yBar / 2.0), y + (yBar / 2.0)); } } } if (shapeSizeI < 0 || nominalClass) { ((XYSeriesCollection) xyDataset).addSeries((XYSeries) master); } else { ((XYIntervalSeriesCollection) xyDataset).addSeries((XYIntervalSeries) master); } // remaining series for (int i = 1; i < series.size(); i++) { Instances aSeriesI = series.get(i); Series aSeriesJ = null; if (shapeSizeI < 0 || nominalClass) { aSeriesJ = new XYSeries(aSeriesI.relationName()); } else { aSeriesJ = new XYIntervalSeries(aSeriesI.relationName()); } for (int j = 0; j < aSeriesI.numInstances(); j++) { Instance inst = aSeriesI.instance(j); if (!inst.isMissing(xAx) && !inst.isMissing(yAx)) { if (shapeSizeI < 0 || nominalClass) { ((XYSeries) aSeriesJ).add(inst.value(xAx), inst.value(yAx)); } else { double xBar = (inst.value(shapeSizeI) - sizeMin) / sizeRange; xBar *= (xRange / 5.0); // max of 1/10th the x range double yBar = (inst.value(shapeSizeI) - sizeMin) / sizeRange; yBar *= (yRange / 5.0); double x = inst.value(xAx); double y = inst.value(yAx); ((XYIntervalSeries) aSeriesJ).add(x, x - (xBar / 2.0), x + (xBar / 2.0), y, y - (yBar / 2.0), y + (yBar / 2.0)); } } } if (shapeSizeI < 0 || nominalClass) { ((XYSeriesCollection) xyDataset).addSeries((XYSeries) aSeriesJ); } else { ((XYIntervalSeriesCollection) xyDataset).addSeries((XYIntervalSeries) aSeriesJ); } } JFreeChart chart = ChartFactory.createXYLineChart(plotTitle, xAxis, yAxis, xyDataset, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(java.awt.Color.white); XYPlot plot = (XYPlot) chart.getPlot(); if (shapeSizeI < 0 || nominalClass) { XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(false, true); renderer.setBaseShapesFilled(false); plot.setRenderer(renderer); } else { XYErrorRenderer renderer = new XYErrorRenderer(); renderer.setDrawXError(true); renderer.setDrawYError(true); renderer.setBaseLinesVisible(false); plot.setRenderer(renderer); } BufferedImage image = chart.createBufferedImage(width, height); return image; }
From source file:net.sourceforge.atunes.kernel.controllers.stats.StatsDialogController.java
private void setGeneralChart() { DefaultPieDataset dataset = new DefaultPieDataset(); int different = HandlerProxy.getRepositoryHandler().getDifferentSongsPlayed(); int total = HandlerProxy.getRepositoryHandler().getSongs().size(); dataset.setValue(LanguageTool.getString("SONGS_PLAYED"), different); dataset.setValue(LanguageTool.getString("SONGS_NEVER_PLAYED"), total - different); JFreeChart chart = ChartFactory.createPieChart3D(LanguageTool.getString("SONGS_PLAYED"), dataset, false, false, false);//from w w w . ja va 2 s .c om chart.getTitle().setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 11)); chart.setBackgroundPaint(new GradientPaint(0, 0, ColorDefinitions.GENERAL_NON_PANEL_TOP_GRADIENT_COLOR, 0, 200, ColorDefinitions.GENERAL_NON_PANEL_BOTTOM_GRADIENT_COLOR)); chart.setPadding(new RectangleInsets(5, 0, 0, 0)); chart.getPlot() .setBackgroundPaint(new GradientPaint(0, 0, ColorDefinitions.GENERAL_NON_PANEL_TOP_GRADIENT_COLOR, 0, 200, ColorDefinitions.GENERAL_NON_PANEL_BOTTOM_GRADIENT_COLOR)); DefaultDrawingSupplier drawingSupplier = new DefaultDrawingSupplier( new Paint[] { new Color(0, 1, 0, 0.6f), new Color(1, 0, 0, 0.6f) }, new Paint[] { new Color(0, 1, 0, 0.4f), new Color(1, 0, 0, 0.4f) }, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_STROKE_SEQUENCE, DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE); chart.getPlot().setDrawingSupplier(drawingSupplier); ((StatsDialog) frameControlled).getGeneralChart() .setIcon(new ImageIcon(chart.createBufferedImage(710, 250))); }
From source file:org.jgrasstools.gears.utils.images.LineChartGenerator.java
/** * Creates the chart image and dumps it to file. * /*from www .j av a2 s . c o m*/ * @param chartFile the file to which to write to. * @param autoRange flag to define if to auto define the range from the bounds. * @param withLegend flag to define the legend presence. * @param imageWidth the output image width (if -1 default is used). * @param imageHeight the output image height (if -1 default is used). * @throws IOException */ @SuppressWarnings("nls") public void dumpChart(File chartFile, boolean autoRange, boolean withLegend, int imageWidth, int imageHeight) throws IOException { JFreeChart chart = ChartFactory.createXYLineChart(title, xLabel, yLabel, collection, PlotOrientation.VERTICAL, withLegend, false, false); XYPlot plot = (XYPlot) chart.getPlot(); // plot.setDomainPannable(true); // plot.setRangePannable(true); // plot.setForegroundAlpha(0.85f); NumberAxis yAxis = (NumberAxis) plot.getRangeAxis(); yAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits()); if (autoRange) { double delta = (max - min) * 0.1; yAxis.setRange(min - delta, max + delta); yAxis.setMinorTickCount(4); yAxis.setMinorTickMarksVisible(true); } // ValueAxis xAxis = plot.getDomainAxis(); // xAxis.setStandardTickUnits(NumberAxis.createStandardTickUnits(Locale.US)); // XYItemRenderer renderer = plot.getRenderer(); // renderer.setDrawBarOutline(false); // // flat bars look best... // renderer.setBarPainter(new StandardXYBarPainter()); // renderer.setShadowVisible(false); if (!chartFile.getName().endsWith(".png")) { chartFile = FileUtilities.substituteExtention(chartFile, "png"); } if (imageWidth == -1) { imageWidth = IMAGEWIDTH; } if (imageHeight == -1) { imageHeight = IMAGEHEIGHT; } BufferedImage bufferedImage = chart.createBufferedImage(imageWidth, imageHeight); ImageIO.write(bufferedImage, "png", chartFile); }
From source file:org.perfrepo.web.controller.reports.testgroup.TestGroupChartBean.java
public void drawChart(OutputStream out, Object data) throws IOException { if (data instanceof ChartData) { ChartData chartData = (ChartData) data; JFreeChart chart = ChartFactory.createBarChart(chartData.getTitle(), "Test", "%", processDataSet(chartData), PlotOrientation.HORIZONTAL, false, true, false); chart.addSubtitle(new TextTitle("Comparison", new Font("Dialog", Font.ITALIC, 10))); chart.setBackgroundPaint(Color.white); CategoryPlot plot = (CategoryPlot) chart.getPlot(); CustomRenderer renderer = new CustomRenderer(); plot.setBackgroundPaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT); renderer.setBaseItemLabelGenerator( new StandardCategoryItemLabelGenerator("{2}%", NumberFormat.getInstance())); renderer.setBaseItemLabelsVisible(true); renderer.setDrawBarOutline(false); renderer.setMaximumBarWidth(1d / (chartData.getTests().length + 4.0)); plot.setRenderer(renderer);/* w w w. j a v a 2 s . c om*/ CategoryAxis categoryAxis = plot.getDomainAxis(); categoryAxis.setCategoryMargin(0.1); categoryAxis.setUpperMargin(0.1); categoryAxis.setLowerMargin(0.1); NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); rangeAxis.setUpperMargin(0.10); BufferedImage buffImg = chart.createBufferedImage(640, chartData.getTests().length * 100 + 100); ImageIO.write(buffImg, "gif", out); } }
From source file:adams.flow.sink.JFreeChartFileWriter.java
/** * Executes the flow item.//from w w w .j ava 2 s . co m * * @return null if everything is fine, otherwise error message */ @Override protected String doExecute() { String result; SpreadSheet sheet; Dataset dataset; JFreeChart jfreechart; BufferedImage image; BufferedImageContainer cont; Shape shape; XYPlot plot; result = null; try { sheet = (SpreadSheet) m_InputToken.getPayload(); dataset = m_Dataset.generate(sheet); jfreechart = m_Chart.generate(dataset); shape = m_Shape.generate(); jfreechart.getPlot().setBackgroundPaint(Color.WHITE); if (jfreechart.getPlot() instanceof XYPlot) { plot = (XYPlot) jfreechart.getPlot(); plot.setDomainGridlinesVisible(true); plot.setDomainGridlinePaint(Color.GRAY); plot.setRangeGridlinesVisible(true); plot.setRangeGridlinePaint(Color.GRAY); plot.getRenderer().setSeriesPaint(0, m_PlotColor); if (plot.getSeriesCount() > 1) plot.getRenderer().setSeriesPaint(1, m_DiagonalColor); if (shape != null) plot.getRenderer().setSeriesShape(0, shape); } image = jfreechart.createBufferedImage(m_Width, m_Height); cont = new BufferedImageContainer(); cont.setImage(image); m_Writer.write(m_OutputFile, cont); } catch (Exception e) { result = handleException("Failed to generate plot!", e); } return result; }
From source file:org.cerberus.refactor.LineChart.java
public BufferedImage bi(CategoryDataset categorydataset, String name, int count) { BufferedImage bi = null;//from w ww . j a v a 2s. c om JFreeChart jfreechart = ChartFactory.createLineChart(name, "Category", "Count", categorydataset, PlotOrientation.VERTICAL, true, true, false); CategoryPlot categoryplot = (CategoryPlot) jfreechart.getPlot(); NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); Shape point = ShapeUtilities.createDiagonalCross(1, 1); //TODO check this - seriesColors never used // String[] seriesColors = {"#FF0000", "#D7D6F6", "#0F07F3", "#EEFFBD", "#75C53E", "#FED7BA", "#FE6F01"}; // String[] seriesColors2 = {"#D7D6F6", "#0F07F3", "#EEFFBD", "#75C53E", "#FED7BA", "#FE6F01"}; LineAndShapeRenderer lineandshaperenderer = (LineAndShapeRenderer) categoryplot.getRenderer(); lineandshaperenderer.setBaseShapesVisible(true); lineandshaperenderer.setBaseShapesFilled(true); for (int a = 0; a < count; a++) { lineandshaperenderer.setSeriesShapesVisible(a, true); lineandshaperenderer.setSeriesLinesVisible(a, true); lineandshaperenderer.setSeriesStroke(a, new BasicStroke(1.0F)); lineandshaperenderer.setSeriesShape(a, point); } lineandshaperenderer.setDrawOutlines(true); lineandshaperenderer.setUseFillPaint(true); lineandshaperenderer.setBaseFillPaint(Color.white); //DateAxis dateaxis = (DateAxis)xyplot.getDomainAxis(); //dateaxis.setDateFormatOverride(new SimpleDateFormat("hh:mm")); bi = jfreechart.createBufferedImage(500, 270); return bi; }
From source file:org.cerberus.refactor.LineChart.java
public BufferedImage bi(TimeSeriesCollection timeseriescollection, String xname, String name, int count) { BufferedImage bi = null;//from w w w. ja v a2s . c o m boolean fc = false; XYDataset xydataset = timeseriescollection; JFreeChart jfreechart = ChartFactory.createTimeSeriesChart(name, xname, name, xydataset, true, true, false); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(false); XYItemRenderer xyitemrenderer = xyplot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { Shape point = ShapeUtilities.createDiagonalCross(1, 1); String[] seriesColors = { "#FF0000", "#D7D6F6", "#0F07F3", "#EEFFBD", "#75C53E", "#FED7BA", "#FE6F01" }; String[] seriesColors2 = { "#D7D6F6", "#0F07F3", "#EEFFBD", "#75C53E", "#FED7BA", "#FE6F01" }; XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); for (int a = 0; a < count; a++) { xylineandshaperenderer.setSeriesShape(a, point); xyitemrenderer.setSeriesStroke(a, new BasicStroke(1.0F)); //TODO check this - fc is always false if (fc) { xylineandshaperenderer.setSeriesPaint(a, Color.decode(seriesColors[count - a - 1])); } else { xylineandshaperenderer.setSeriesPaint(a, Color.decode(seriesColors2[count - a - 1])); } } } DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); dateaxis.setDateFormatOverride(new SimpleDateFormat("hh:mm")); bi = jfreechart.createBufferedImage(500, 270); return bi; }