List of usage examples for org.jfree.chart.plot XYPlot setBackgroundImageAlignment
public void setBackgroundImageAlignment(int alignment)
From source file:org.ramadda.data.services.PointFormHandler.java
/** * create jfree chart/*from ww w. ja v a 2 s . c o m*/ * * @param request the request * @param entry The entry * @param dataset the dataset * @param backgroundImage background image * * @return the chart */ public static JFreeChart createTimeseriesChart(Request request, Entry entry, XYDataset dataset, Image backgroundImage) { JFreeChart chart = ChartFactory.createXYLineChart("", // chart title "", // x axis label "Height", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); DateAxis timeAxis = new DateAxis("Time", request.getRepository().TIMEZONE_UTC); NumberAxis valueAxis = new NumberAxis("Data"); valueAxis.setAutoRangeIncludesZero(true); XYPlot plot = new XYPlot(dataset, timeAxis, valueAxis, null); chart = new JFreeChart("", JFreeChart.DEFAULT_TITLE_FONT, plot, true); chart.setBackgroundPaint(Color.white); if (backgroundImage != null) { plot.setBackgroundImage(backgroundImage); plot.setBackgroundImageAlignment(org.jfree.ui.Align.TOP_LEFT); } plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setInsets(new RectangleInsets(0, 0, 0, 0)); plot.setAxisOffset(new RectangleInsets(5, 0, 5, 0)); return chart; }