Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to set catories legend
Nhan
Dear all,
Here is my data set:
id name numberOfDeveloper
1 Project A 2
2 Project B 3
3 Project C 4
4 Project A 5
How can I show the pie chart report based on Id (not name field). My request is to display legend with project name. If I set "Categories definition" is row["name"], it will show the wrong report because there are 2 record with the same name "Project A". Could you please help me?
Thanks and regards
Find more posts tagged with
Comments
mwilliams
Ok, so you want the display the be "name", but you want the categories to be separated by "id"? How will you tell them apart in your chart if they have the same name? Would creating an expression that combines the id and name for your category work? Something like:
row["id"].toString() + " - " + row["name"];
?
Let me know if I'm misunderstanding something.
Nhan
It's not exactly I want. If I do like this, the legend will display: id-name. I just want to display name only and the categories is separated by id.
Thanks and regards
mwilliams
You could simply step through the labels in the chart script and remove the "id-" part and you'd have exactly what you want.
Spuri
Hi,<br />
<br />
I am doing something similar in my code.... And i am looking for some help in that:<br />
<br />
I am plotting a pie chart and in that I am grouping a column of a database using "Optional Y axis Grouping"<br />
<br />
Now, if i want to combine two or more values into one group and use this grouping, is it possible?? How can this be done.<br />
<br />
For example: I have a database column storing <strong class='bbc'>names of different cars </strong>. But i want to group the data according to their Brands. Many cars will come under one brand. So how to map that is the question?<br />
<br />
The column Brand is not in the same table. One can assume that this car to Brand mapping is stored in some other sql table. <br />
<br />
<strong class='bbc'>Ultimately, i want the legends of the chart to be Brand names but not car names.....</strong><br />
<br />
Please help.....<br />
<br />
BR<br />
Saurabh
mwilliams
You could write your SQL to include the brand column, or you could bring in the brand mapping into another dataSet and join them. There could be other ways, too. Is there a reason for not writing your query to add the brand? Is it not possible? Let me know.
Spuri
Hi,
Thanks a lot for the reply
It is very much possible to combine two of them but the original table with car names is huge i.e. around 1 cr. lines.. Mapping it further will consume more time.... The mapping table is small ... So if there is any other way we can do it.. Please let me knw.. Thanks
mwilliams
Can you show me a sample of data from both dataSets? The key and the detail? That'll probably help, a lot.
Spuri
The Brand and car was an example.
Following is the actual columns on which i m working
Big table is storing some simulation results with time Stamp and powerTotal column along with device Types
This is the big table.
index1 timeStamp devType powerTotal
1 0-00-00 00:00:00 SR_01 1200
1 0-00-00 00:00:10 SR_02 1300
This is the small table.
devType familiar_devType
SR_01 High RAN site
SR_02 High RAN site
The small table stores the Device Types and there familiar names. Now these familiar names can be same for many device Types. So basically i need to display these familiar names at the report output and also group the bar chart based on this group. But the actual data of sum(powerTotal) is taken from big table.
Query which i m using is:
select devType, sum(powerTotal) from temp where <some other conditions> group by devType;
But i need to do something like
select table2.familiar_devType, table1.sum(powerTotal) from temp where <some other condition> group by table2.familiar_devType
But when i run this it takes infinite time to run this query. I dont knw how to handle this stuff.
May be there is someother way to do rather than changin the query.
BR
Saurabh
mwilliams
Try something like this as your query:
select distinct table2.familiar_devType,
SUM (table1.powerTotal) as familiarPowerTotal
from table1, table2
where table1.devType = table2.devType
group by table2.familiar_devType
There are ways to do it within BIRT by not changing the query, but it'll likely be faster to do the join/group in the query.
Spuri
Hi mwilliams,
Thanks for the solution. It is working but the problem is that joining tables is making the query more slow and it takes approx 20-25 minutes for generation of one report which is really slow and frustrating. Are there some ways in which one can enhance the speed of database fetching and report generation.
One more issue, I didnt find any post for it so i am putting it here:
After report is displayed in report generator, I tried to export the same into a pdf format. But in pdf, the alignment gets disturbed and different report elements overlap... Please help me out with this issue..
Thanks a lot
Saurabh
mwilliams
What is your BIRT version?
Spuri
BIRT version 3.7.23
mwilliams
Maybe something like this will work for you. I bring in the keyDS separate from the mainDS. I put a text box in the report bound to the keyDS to be sure it runs first. In the keyDS onFetch script, I create persistentGlobalVariables to use to map the values to the mainDS. In the mainDS, I create a computed column, grabbing the appropriate pgv based on the shared key value. This is now a column in my mainDS and I can use it to group my table and chart in my layout. Hope this helps.