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)
Pie Chart from Grids
invo
Hello,
I'm new to birt and I'm facing problems with pie charts.
I have calculated two numbers (aggregation, COUNT) that I want to display in a pie chart.
# of Customers from NY | 6
# of Customers from PA | 3
The Pie Chart should have two slices.
The NY-Slice should be 2/3 of the Pie,
the PA-Slice 1/3.
Actually I want to chart a grid.
On the left column there are the categories and on the right there is a value for each category (slice size).
Is this possible?
Find more posts tagged with
Comments
mwilliams
Where does this data come from? A single dataSet? Can you explain more?
invo
I use an aggregation to count how often a process failed:
Aggregation Failed, Function: Countdistinct, Express: row["ID"], Filter: BirtComp.equalTo(dataSetRow["activity"],"failed")
And then I put it into relation with all process:
row["Failed"]/Total.max(dataSetRow["ID"]) (returns e.g. 0.2)
Finally I want to print this value in a pie chart
e.g. 0.2 failed, 0.8 suceeded
Is there an easy way to do this?
mwilliams
I posted this yesterday, but the submit apparently didn't go through.
You could grab the values and create a scripted dataSet with them and use that dataSet for your chart.
invo
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85220" data-time="1321025011" data-date="11 November 2011 - 08:23 AM"><p>
You could grab the values and create a scripted dataSet with them and use that dataSet for your chart.<br /></p></blockquote>
<br />
I know that its possible for POJOs but how do I acces values in a report? I guess there is no wizzard?
invo
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85220" data-time="1321025011" data-date="11 November 2011 - 08:23 AM"><p>
You could grab the values and create a scripted dataSet with them and use that dataSet for your chart.<br /></p></blockquote>
<br />
hi mwilliams,<br />
the value (aggregation) is calculated at runtime. <br />
how do I access the value in a scripted data set?<br />
<br />
My attempt so far:<br />
I created a Scripted DataSet with the following content:<br />
open: countRows = 0;<br />
onfetch: if(countRows < 2){ countRows++; <br />
if(countRows=1){ row[1] = "Failed"; row[2] = AccessDataField that returns 0.2; }<br />
if(countRows=2){ row[1] = "Ok"; row[2] = AccessDataField that returns 0.8; }<br />
return true;<br />
}<br />
else{ return false;}<br />
<br />
<strong class='bbc'>edit: I found a solution that works for me<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/org/forum/index.php/topic/22661-pivoting-a-dataset-after-aggregation/'>http://www.birt-exchange.org/org/forum/index.php/topic/22661-pivoting-a-dataset-after-aggregation/</a><br
/>
Thank you :-)</strong><br />
<br />
But is there an expression to access this without an array?
mwilliams
Sorry for the delay. Glad you found another thread where I showed a sample report on this!
As far as your next question goes, what do you mean to access this without an array? Let me know. If you can show me in a simple example I can run, that might also be helpful!
invo
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85363" data-time="1321388798" data-date="15 November 2011 - 01:26 PM"><p>
what do you mean to access this without an array?<br /></p></blockquote>
I mean to access the data element directy with the variable name (see the dummy code in my previous post). <br />
A wizzard would be great where I can simply select the category definition and the values. Like in Excel. But I guess there is only this workaround with arrays and a scripted dataset?
mwilliams
I could be wrong, but I think the easiest way will be to create a dataSet from the values.