Example usage for org.jfree.chart.title LegendTitle getBackgroundPaint

List of usage examples for org.jfree.chart.title LegendTitle getBackgroundPaint

Introduction

In this page you can find the example usage for org.jfree.chart.title LegendTitle getBackgroundPaint.

Prototype

public Paint getBackgroundPaint() 

Source Link

Document

Returns the background paint.

Usage

From source file:net.sf.dynamicreports.test.jasper.chart.ChartTest.java

@Override
public void test() {
    super.test();

    numberOfPagesTest(1);//from w w w .ja  v  a 2s . co  m

    chartCountTest("summary.chart1", 1);
    JFreeChart chart = getChart("summary.chart1", 0);

    TextTitle title = chart.getTitle();
    Assert.assertEquals("title", "title", title.getText());
    Assert.assertEquals("title color", Color.BLUE, title.getPaint());
    Assert.assertEquals("title font", new Font("Arial", Font.BOLD, 10), title.getFont());
    Assert.assertEquals("title position", RectangleEdge.RIGHT, title.getPosition());

    TextTitle subtitle = (TextTitle) chart.getSubtitle(1);
    Assert.assertEquals("subtitle", "subtitle", subtitle.getText());
    Assert.assertEquals("subtitle color", Color.CYAN, subtitle.getPaint());
    Assert.assertEquals("subtitle font", new Font("Arial", Font.PLAIN, 10), subtitle.getFont());

    LegendTitle legend = (LegendTitle) chart.getSubtitle(0);
    Assert.assertEquals("legend color", Color.BLUE, legend.getItemPaint());
    Assert.assertEquals("legend backgroundcolor", Color.LIGHT_GRAY, legend.getBackgroundPaint());
    Assert.assertEquals("legend font", new Font("Courier New", Font.PLAIN, 10), legend.getItemFont());
    Assert.assertEquals("legend position", RectangleEdge.LEFT, legend.getPosition());

    chartCountTest("summary.chart2", 1);
    chart = getChart("summary.chart2", 0);
    Assert.assertNull("legend", chart.getLegend());
    Assert.assertEquals("plot orientation", PlotOrientation.HORIZONTAL,
            chart.getCategoryPlot().getOrientation());
    Assert.assertEquals("plot series colors", Color.BLUE, chart.getPlot().getDrawingSupplier().getNextPaint());
    Assert.assertEquals("plot series colors", Color.GREEN, chart.getPlot().getDrawingSupplier().getNextPaint());
    Assert.assertEquals("plot series colors", Color.RED, chart.getPlot().getDrawingSupplier().getNextPaint());
}