List of usage examples for org.jfree.chart.plot XYPlot setBackgroundPaint
public void setBackgroundPaint(Paint paint)
From source file:org.jfree.chart.demo.RelativeDateFormatDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Exercise Chart", "Elapsed Time", "Beats Per Minute", xydataset, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); }/*from w w w . j a va 2 s. c o m*/ DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); Minute minute = new Minute(0, 9, 1, 10, 2006); RelativeDateFormat relativedateformat = new RelativeDateFormat(minute.getFirstMillisecond()); relativedateformat.setSecondFormatter(new DecimalFormat("00")); dateaxis.setDateFormatOverride(relativedateformat); return jfreechart; }
From source file:org.jfree.chart.demo.CrosshairDemo4.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYLineChart("Crosshair Demo 4", "X", "Y", xydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyplot.getRenderer(); xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); NumberAxis numberaxis = (NumberAxis) xyplot.getRangeAxis(); numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); return jfreechart; }
From source file:org.jfree.chart.demo.VectorPlotDemo1.java
private static JFreeChart createChart(VectorXYDataset dataset) { NumberAxis xAxis = new NumberAxis("X"); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); xAxis.setLowerMargin(0.01D);/*from ww w.ja va 2 s . c o m*/ xAxis.setUpperMargin(0.01D); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis("Y"); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); yAxis.setLowerMargin(0.01D); yAxis.setUpperMargin(0.01D); yAxis.setAutoRangeIncludesZero(false); // VectorRenderer renderer = new VectorRenderer(); renderer.setSeriesPaint(0, Color.blue); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); plot.setOutlinePaint(Color.black); JFreeChart chart = new JFreeChart("Vector Plot Demo 1", plot); chart.setBackgroundPaint(Color.white); return chart; }
From source file:org.jfree.chart.demo.VectorRendererDemo1.java
private static JFreeChart createChart(VectorXYDataset dataset) { NumberAxis xAxis = new NumberAxis("X"); xAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); xAxis.setLowerMargin(0.01D);/* w w w. jav a 2 s .c o m*/ xAxis.setUpperMargin(0.01D); xAxis.setAutoRangeIncludesZero(false); NumberAxis yAxis = new NumberAxis("Y"); yAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); yAxis.setLowerMargin(0.01D); yAxis.setUpperMargin(0.01D); yAxis.setAutoRangeIncludesZero(false); // VectorRenderer renderer = new VectorRenderer(); renderer.setSeriesPaint(0, Color.blue); XYPlot plot = new XYPlot(dataset, xAxis, yAxis, renderer); plot.setBackgroundPaint(Color.lightGray); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); plot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); plot.setOutlinePaint(Color.black); JFreeChart chart = new JFreeChart("Vector Renderer Demo 1", plot); chart.setBackgroundPaint(Color.white); return chart; }
From source file:org.jfree.chart.demo.PeriodAxisDemo3.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart("Maximum Temperature", "Day", true, "Temperature", intervalxydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); PeriodAxis periodaxis = new PeriodAxis("Day"); periodaxis.setAutoRangeTimePeriodClass(org.jfree.data.time.Day.class); PeriodAxisLabelInfo aperiodaxislabelinfo[] = new PeriodAxisLabelInfo[3]; aperiodaxislabelinfo[0] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("d")); aperiodaxislabelinfo[1] = new PeriodAxisLabelInfo(org.jfree.data.time.Day.class, new SimpleDateFormat("E"), new RectangleInsets(2D, 2D, 2D, 2D), new Font("SansSerif", 1, 10), Color.blue, false, new BasicStroke(0.0F), Color.lightGray); aperiodaxislabelinfo[2] = new PeriodAxisLabelInfo(org.jfree.data.time.Month.class, new SimpleDateFormat("MMM")); periodaxis.setLabelInfo(aperiodaxislabelinfo); xyplot.setDomainAxis(periodaxis);/*from w w w .j a v a2 s . co m*/ return jfreechart; }
From source file:org.jfree.chart.demo.XYAreaChartDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createXYAreaChart("XY Area Chart Demo", "Domain (X)", "Range (Y)", xydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setForegroundAlpha(0.65F);//from w ww. j av a 2 s . c om xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); ValueAxis valueaxis = xyplot.getDomainAxis(); valueaxis.setTickMarkPaint(Color.black); valueaxis.setLowerMargin(0.0D); valueaxis.setUpperMargin(0.0D); ValueAxis valueaxis1 = xyplot.getRangeAxis(); valueaxis1.setTickMarkPaint(Color.black); XYPointerAnnotation xypointerannotation = new XYPointerAnnotation("Test", 5D, -500D, 2.3561944901923448D); xypointerannotation.setTipRadius(0.0D); xypointerannotation.setBaseRadius(35D); xypointerannotation.setFont(new Font("SansSerif", 0, 9)); xypointerannotation.setPaint(Color.blue); xypointerannotation.setTextAnchor(TextAnchor.HALF_ASCENT_RIGHT); xyplot.addAnnotation(xypointerannotation); return jfreechart; }
From source file:org.jfree.chart.demo.XYErrorRendererDemo1.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { NumberAxis numberaxis = new NumberAxis("X"); NumberAxis numberaxis1 = new NumberAxis("Y"); XYErrorRenderer xyerrorrenderer = new XYErrorRenderer(); XYPlot xyplot = new XYPlot(intervalxydataset, numberaxis, numberaxis1, xyerrorrenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); JFreeChart jfreechart = new JFreeChart("XYErrorRenderer Demo 1", xyplot); jfreechart.setBackgroundPaint(Color.white); return jfreechart; }
From source file:org.jfree.chart.demo.XYErrorRendererDemo2.java
private static JFreeChart createChart(IntervalXYDataset intervalxydataset) { NumberAxis numberaxis = new NumberAxis("X"); NumberAxis numberaxis1 = new NumberAxis("Y"); XYErrorRenderer xyerrorrenderer = new XYErrorRenderer(); xyerrorrenderer.setBaseLinesVisible(true); xyerrorrenderer.setBaseShapesVisible(false); XYPlot xyplot = new XYPlot(intervalxydataset, numberaxis, numberaxis1, xyerrorrenderer); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); JFreeChart jfreechart = new JFreeChart("XYErrorRenderer Demo 2", xyplot); jfreechart.setBackgroundPaint(Color.white); return jfreechart; }
From source file:org.jfree.chart.demo.ClusteredXYBarRendererDemo1.java
private static JFreeChart createChart(String s, IntervalXYDataset intervalxydataset) { JFreeChart jfreechart = ChartFactory.createXYBarChart(s, null, true, "Y", intervalxydataset, PlotOrientation.VERTICAL, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); ClusteredXYBarRenderer clusteredxybarrenderer = new ClusteredXYBarRenderer(0.20000000000000001D, false); xyplot.setRenderer(clusteredxybarrenderer); return jfreechart; }
From source file:org.jfree.chart.demo.TimeSeriesDemo1.java
private static JFreeChart createChart(XYDataset xydataset) { JFreeChart jfreechart = ChartFactory.createTimeSeriesChart("Legal & General Unit Trust Prices", "Date", "Price Per Unit", xydataset, true, true, false); jfreechart.setBackgroundPaint(Color.white); XYPlot xyplot = (XYPlot) jfreechart.getPlot(); xyplot.setBackgroundPaint(Color.lightGray); xyplot.setDomainGridlinePaint(Color.white); xyplot.setRangeGridlinePaint(Color.white); xyplot.setAxisOffset(new RectangleInsets(5D, 5D, 5D, 5D)); xyplot.setDomainCrosshairVisible(true); xyplot.setRangeCrosshairVisible(true); org.jfree.chart.renderer.xy.XYItemRenderer xyitemrenderer = xyplot.getRenderer(); if (xyitemrenderer instanceof XYLineAndShapeRenderer) { XYLineAndShapeRenderer xylineandshaperenderer = (XYLineAndShapeRenderer) xyitemrenderer; xylineandshaperenderer.setBaseShapesVisible(true); xylineandshaperenderer.setBaseShapesFilled(true); }//from w w w . j av a 2 s. c o m DateAxis dateaxis = (DateAxis) xyplot.getDomainAxis(); dateaxis.setDateFormatOverride(new SimpleDateFormat("MMM-yyyy")); return jfreechart; }