Step1 : create a table and populate required records.
SQL> CREATE TABLE results
( party_name varchar2(30),
scored_percentage number );
SQL> INSERT INTO results VALUES ( 'UNP', 25);
SQL> INSERT INTO results VALUES ( UPFA, 60);
SQL> INSERT INTO results VALUES ( 'JVP', 5);
SQL> INSERT INTO results VALUES ( 'OTHER', 10);
Step2 : Open a new report in Jasper Report.
Step3 : Write the follwing sql query in the "report query"
select *
from results
Step4 : Drag and drop the "chart" on the summary area (i.e just after
the page footer ) and select the pie chart from the chart types.
Step5 : Right click on the chart and select "Chart Data"
set the Key expression as $F{PARTY_NAME}
Value expression as $F{SCORED_PERCENTAGE}
Label expression as
$F{PARTY_NAME}+" "+$F{SCORED_PERCENTAGE}+"%"
Step6 : Now You are done. and you will see the report preview as
Note : I've used iReport 3.1.4 here.
Subscribe to:
Post Comments (Atom)
how to change a alignment of key expression in pie chart and series expression in bar chart.
ReplyDeleteAnd how to add one more key key expression in pie chart and series expression in bar chart.
Very helpful. The one point that had me confused was the instruction to 'drop the "chart" on the summary area'. I didn't see anything that looked like a chart! The problem was that I did not have the Palette window displayed (available in the Window menu).
ReplyDeleteමේක ලන්කාවේ වගෙ නේ??
ReplyDeleteVery useful
chor
ReplyDelete