Jump to content
We've recently updated our Privacy Statement, available here ×

How to select proper band for chart


alauddinctgbd

Recommended Posts

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

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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:


public static Paint[] createDefaultPaintArray() {

return new Paint[] {
new Color(0xFF, 0x55, 0x55),
new Color(0x55, 0x55, 0xFF),
new Color(0x55, 0xFF, 0x55),
new Color(0xFF, 0xFF, 0x55),
new Color(0xFF, 0x55, 0xFF),
new Color(0x55, 0xFF, 0xFF),
Color.pink,
Color.gray,
ChartColor.DARK_RED,
ChartColor.DARK_BLUE,
ChartColor.DARK_GREEN,
ChartColor.DARK_YELLOW,
ChartColor.DARK_MAGENTA,
ChartColor.DARK_CYAN,
Color.darkGray,
ChartColor.LIGHT_RED,
ChartColor.LIGHT_BLUE,
ChartColor.LIGHT_GREEN,
ChartColor.LIGHT_YELLOW,
ChartColor.LIGHT_MAGENTA,
ChartColor.LIGHT_CYAN,
Color.lightGray,
ChartColor.VERY_DARK_RED,
ChartColor.VERY_DARK_BLUE,
ChartColor.VERY_DARK_GREEN,
ChartColor.VERY_DARK_YELLOW,
ChartColor.VERY_DARK_MAGENTA,
ChartColor.VERY_DARK_CYAN,
ChartColor.VERY_LIGHT_RED,
ChartColor.VERY_LIGHT_BLUE,
ChartColor.VERY_LIGHT_GREEN,
ChartColor.VERY_LIGHT_YELLOW,
ChartColor.VERY_LIGHT_MAGENTA,
ChartColor.VERY_LIGHT_CYAN
};
}

 

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.

 

At this point you should have the first three pages.

Put this report in the title band of a new report, forcing agin the title band on a new page.

The rest of this "master" report can be used to print the following pages.

 

Ragards

 

Giulio

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...