Jump to content
Changes to the Jaspersoft community edition download ×

Big problem with piechart


AsyNew

Recommended Posts

Hi,

I'am using the ireport 0.5.3.

I want create report that contains a piechart: that is the problem and i don't know why noone never had the same problem.

So to create a pie chart we need to have "a key expression" (like $F{name}) "a value expression" like (like ${number}). According to each name we have a number.

But in my case , i need to represent for exemple for the same 'name' the value of 'number1' and value of 'number2' in a piechart, i really don't how to do.

I hope you will help, you are my last chance, please help!!!

Link to comment
Share on other sites

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

It depends upon on what basis you are taking the number 1 and number 2 values right?? you need to put that expression in the key expression there. Or, if you are saying you need to put the same expression and different values, in the query, put the static value for the field you are selecting.
Link to comment
Share on other sites

It depends upon on what basis you are taking the number 1 and number 2 values right?? you need to put that expression in the key expression there. Or, if you are saying you need to put the same expression and different values, in the query, put the static value for the field you are selecting.
Link to comment
Share on other sites

Well, actually i need two key expression ans two value expression , something like series in the bar chart.

To be more clear, i will show my real sql query:

 

select sum(HN),sum(HS) from table where number="XX"

HN :(official hour)

HS : (non official hour)

 

So in my pie chart i need to represent the value of both sum(HN),sum(HS) .

Link to comment
Share on other sites

Your query is :

 

select sum(HN),sum(HS) from table where number="XX"

 

you need to create a new query like this

 

select TYPE_HOURS,TIME from

(select 'OFFICIAL HOUR' AS TYPE_HOURS,SUM(HN) TIME

FROM TABLE

GROUP BY 'OFFICIAL HOUR'

UNION

SELECT 'REAL HOUR' AS TYPE_HOURS,SUM(HS) TIME

FROM TABLE

GROUP BY 'REAL HOUR')

 

The query will show :

 

Official Hours and the total time

Real Hours and he the total time

 

Then you can make a pie chart which will show for the type of hours the value of each one.

 

 

I hope that this help.

 

Bye

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...