List of usage examples for org.jfree.chart StandardLegend setOutlinePaint
public void setOutlinePaint(Paint paint)
From source file:org.jfree.chart.demo.LegendManiaDemo.java
/** * Creates a sample chart./* ww w.jav a 2 s.c o m*/ * * @param dataset * the dataset. * @return The chart. */ private JFreeChart createChart(final CategoryDataset dataset) { // create the chart... final JFreeChart chart = ChartFactory.createBarChart(CHART_TITLE, // chart title "Activity", // domain axis label "Rate", // range axis label dataset, // data PlotOrientation.VERTICAL, // orientation true, // include legend true, // tooltips? false // URLs? ); // NOW DO SOME OPTIONAL CUSTOMISATION OF THE CHART... // set the background color for the chart... chart.setBackgroundPaint(new Color(255, 255, 180)); // get a reference to the plot for further customisation... final CategoryPlot plot = chart.getCategoryPlot(); plot.setBackgroundPaint(BACKGROUND_PAINT); plot.setDomainGridlinePaint(Color.white); plot.setRangeGridlinePaint(Color.white); // set the range axis to display integers only... final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis(); rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits()); // disable bar outlines... final BarRenderer renderer = (BarRenderer) plot.getRenderer(); renderer.setDrawBarOutline(false); final CategoryAxis domainAxis = plot.getDomainAxis(); domainAxis.setCategoryLabelPositions(CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / 6.0)); final StandardLegend legend = (StandardLegend) chart.getLegend(); legend.setBackgroundPaint(Color.orange); legend.setOutlinePaint(Color.orange); // activate word wrapping when legend is vertical. legend.setPreferredWidth(125); // OPTIONAL CUSTOMISATION COMPLETED. return chart; }