List of usage examples for org.jfree.chart.plot XYPlot setQuadrantPaint
public void setQuadrantPaint(int index, Paint paint)
From source file:org.jfree.chart.demo.PlotOrientationDemo.java
/** * Creates a new demo instance.// w ww. ja v a 2s . c om * * @param title the frame title. */ public PlotOrientationDemo(String title) { super(title); JPanel panel = new JPanel(new GridLayout(2, 4)); for (int i = 0; i < CHART_COUNT; i++) { this.datasets[i] = createDataset(i); this.charts[i] = createChart(i, this.datasets[i]); XYPlot plot = this.charts[i].getXYPlot(); XYShapeAnnotation a1 = new XYShapeAnnotation(new Rectangle2D.Double(1.0, 2.0, 2.0, 3.0), new BasicStroke(1.0f), Color.blue); XYLineAnnotation a2 = new XYLineAnnotation(0.0, -5.0, 10.0, -5.0); XYImageAnnotation a3 = new XYImageAnnotation(5.0, 2.0, JFreeChart.INFO.getLogo()); plot.addAnnotation(a1); plot.addAnnotation(a2); plot.addAnnotation(a3); plot.setQuadrantPaint(0, new Color(230, 230, 255)); plot.setQuadrantPaint(1, new Color(230, 255, 230)); plot.setQuadrantPaint(2, new Color(255, 230, 230)); plot.setQuadrantPaint(3, new Color(255, 230, 255)); this.panels[i] = new ChartPanel(this.charts[i]); } this.charts[1].getXYPlot().getDomainAxis().setInverted(true); this.charts[2].getXYPlot().getRangeAxis().setInverted(true); this.charts[3].getXYPlot().getDomainAxis().setInverted(true); this.charts[3].getXYPlot().getRangeAxis().setInverted(true); this.charts[5].getXYPlot().getDomainAxis().setInverted(true); this.charts[6].getXYPlot().getRangeAxis().setInverted(true); this.charts[4].getXYPlot().getDomainAxis().setInverted(true); this.charts[4].getXYPlot().getRangeAxis().setInverted(true); this.charts[4].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL); this.charts[5].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL); this.charts[6].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL); this.charts[7].getXYPlot().setOrientation(PlotOrientation.HORIZONTAL); panel.add(this.panels[0]); panel.add(this.panels[1]); panel.add(this.panels[4]); panel.add(this.panels[5]); panel.add(this.panels[2]); panel.add(this.panels[3]); panel.add(this.panels[6]); panel.add(this.panels[7]); panel.setPreferredSize(new Dimension(800, 600)); setContentPane(panel); }
From source file:com.xpn.xwiki.plugin.charts.ChartCustomizer.java
public static void customizeXYPlot(XYPlot plot, ChartParams params) { customizePlot(plot, params);//from w w w. java 2s .com if (params.get(ChartParams.XYPLOT_ORIENTATION) != null) { plot.setOrientation(params.getPlotOrientation(ChartParams.XYPLOT_ORIENTATION)); } if (params.get(ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_VISIBLE_SUFFIX) != null) { if (params.getBoolean(ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_VISIBLE_SUFFIX) .booleanValue()) { plot.setDomainGridlinesVisible(true); if (params.get( ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_COLOR_SUFFIX) != null) { plot.setDomainGridlinePaint(params.getColor( ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_COLOR_SUFFIX)); } if (params.get( ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_STROKE_SUFFIX) != null) { plot.setDomainGridlineStroke(params.getStroke( ChartParams.AXIS_DOMAIN_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_STROKE_SUFFIX)); } } else { plot.setDomainGridlinesVisible(false); } } if (params.get(ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_VISIBLE_SUFFIX) != null) { if (params.getBoolean(ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_VISIBLE_SUFFIX) .booleanValue()) { plot.setRangeGridlinesVisible(true); if (params.get( ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_COLOR_SUFFIX) != null) { plot.setRangeGridlinePaint(params.getColor( ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_COLOR_SUFFIX)); } if (params.get( ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_STROKE_SUFFIX) != null) { plot.setRangeGridlineStroke(params.getStroke( ChartParams.AXIS_RANGE_PREFIX + ChartParams.PLOTXY_AXIS_GRIDLINE_STROKE_SUFFIX)); } } else { plot.setRangeGridlinesVisible(false); } } if (params.get(ChartParams.XYPLOT_QUADRANT_ORIGIN) != null) { plot.setQuadrantOrigin(params.getPoint2D(ChartParams.XYPLOT_QUADRANT_ORIGIN)); } if (params.get(ChartParams.XYPLOT_QUADRANT_COLORS) != null) { List colors = params.getList(ChartParams.XYPLOT_QUADRANT_COLORS); for (int i = 0; i < 4 && i < colors.size(); i++) { if (colors.get(i) != null) { plot.setQuadrantPaint(i, (Color) colors.get(i)); } } } }