How to select proper band for chart

hi,
My Query returns some 1000 different rows using group by for different 1000 customer company about 99 pdf pages.

I want to show the pie chart for that distinct 1000 companies in one pages( first page) and the legend(color) for those 1000 companies in another pages
(2 to 3) ............then the datas in table format in another pages(4 to 99)
My chart showing in summary band :


which band i should select or How can i solve it.

alauddin
alauddinctgbd's picture
Joined: Aug 4 2006 - 8:37pm
Last seen: 17 years 1 month ago

1 Answer:

hi alauddin,

your message was notified in my mailer as the message #1000 :-)

You can not split the chart and the chart legend produced by JFreeChart, but you can still create the legend by your self using JasperReports.
So, this is my suggestion:

1. Create a subreport to show the chart and the legend. You have to put your chart in the title band, and set force the title band to be printed in a separate page (report properties window -> Other options tab).
The chart will be without legend (because we will generate it by ourself). Set the chart element to be printed at "report" time (element properties -> evaluation time). The subreport should be filled using the data used to fill the chart. The legend can be created setting some columns for the report (report propeties -> Columns) in orther to have more records on the same row, and the colors used by JFreeChart to create the chart can be found here:

Code:
<br />
<br />
public static Paint[] createDefaultPaintArray() {<br />
<br />
        return new Paint[] {<br />
            new Color(0xFF, 0x55, 0x55),<br />
            new Color(0x55, 0x55, 0xFF),<br />
            new Color(0x55, 0xFF, 0x55),<br />
            new Color(0xFF, 0xFF, 0x55),<br />
            new Color(0xFF, 0x55, 0xFF),<br />
            new Color(0x55, 0xFF, 0xFF),<br />
            Color.pink,<br />
            Color.gray,<br />
            ChartColor.DARK_RED,<br />
            ChartColor.DARK_BLUE,<br />
            ChartColor.DARK_GREEN,<br />
            ChartColor.DARK_YELLOW,<br />
            ChartColor.DARK_MAGENTA,<br />
            ChartColor.DARK_CYAN,<br />
            Color.darkGray,<br />
            ChartColor.LIGHT_RED,<br />
            ChartColor.LIGHT_BLUE,<br />
            ChartColor.LIGHT_GREEN,<br />
            ChartColor.LIGHT_YELLOW,<br />
            ChartColor.LIGHT_MAGENTA,<br />
            ChartColor.LIGHT_CYAN,<br />
            Color.lightGray,<br />
            ChartColor.VERY_DARK_RED,<br />
            ChartColor.VERY_DARK_BLUE,<br />
            ChartColor.VERY_DARK_GREEN,<br />
            ChartColor.VERY_DARK_YELLOW,<br />
            ChartColor.VERY_DARK_MAGENTA,<br />
            ChartColor.VERY_DARK_CYAN,<br />
            ChartColor.VERY_LIGHT_RED,<br />
            ChartColor.VERY_LIGHT_BLUE,<br />
            ChartColor.VERY_LIGHT_GREEN,<br />
            ChartColor.VERY_LIGHT_YELLOW,<br />
            ChartColor.VERY_LIGHT_MAGENTA,<br />
            ChartColor.VERY_LIGHT_CYAN<br />
        };<br />
    }<br />
</td></tr></tbody></table><br />
<br />
In the next version of iReport you will able to define your own colors. For each record, you have to print country, value and a rectangle with the right color (you can use a conditional style based on the REPORT_COUNT variable to set the right color for each entry.<br />
<br />
At this point you should have the first three pages.<br />
Put this report in the title band of a new report, forcing agin the title band on a new page.<br />
The rest of this "master" report can be used to print  the following pages.<br />
<br />
Ragards<br />
<br />
Giulio
giulio's picture
74129
Joined: Jan 2 2007 - 4:15pm
Last seen: 3 days 5 hours ago
Feedback
randomness