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)
Bar Chart - Group by Count
SNX2012
Hey there,
ive got a question. I?ll created a bar chart and pie chart and ive got a very huge number of values into the charts. Into the pie chart ive got the option to group values to one if i use "Format Chart" --> "Category Series" --> "Minimum Slice". Ive got numeric values in the Charts so i group all values wich are less then 0,2 to one group called "others". I want to do the same in the bar chart, but i can?t find the option to do it. Is it possible to do that in the Bar Chart too?
Thanks SNX2013
Find more posts tagged with
Comments
mwilliams
Create a new binding in the chart that passes through your category column, if it's above your threshold. If it's below the value you want to add the the "other" bar, pass the value "other".
Hope this helps.
SNX2012
Did you ever tryed somethink like this? The problem i see is, how can delete the other values.
For example i want to see car sells after one year. so i use the cars as category an the count of sells as vale. now i want to combine all carsells less then 5 selled cars to one bar in the bar chart.
so how can i "delete" the bars <5, how can i add a bar after render (others) after render?
tanks for replying
mwilliams
Can you show me what some sample data looks like? This way I can make a report with your data? Thanks!
SNX2012
By the Querry I just get 2 values. The name of the Tool and a count, how often this tool is assigned to a product or with other words, how often the tool is used. out of that data i cri8 a bar chart like that (see pic). now i want to delete all bars wich count is less then 5 or 6 and add them to a single bar called "others"
thanks for help
mwilliams
So, each tool is only listed once, along with its total count? There are no repeats of a tool that are aggregated in the chart? That was why I wanted to see data.
Let me know!
SNX2012
yes youre right, the data is gouped by toolID so you can see every tool just one time and the count of usage like you see in the screen
mwilliams
If you have your data grouped in your SQL, so each value only appears once in your result set, you can simply add a computed column to your dataSet that gives a value of "Other" to any row where the count is below your threshold. If it's not below your threshold, you return the normal axis value. Let me know if this works for you or not.
SNX2012
can u give me a simple example how to create such a computed column? ive never done somethink like that
mwilliams
What's your BIRT version? I'll make you an example that creates a chart like you're wanting, in your version.
SNX2012
My Version is 3.7.2 thanks for help!
mwilliams
Ok. Take a look at this report. To get numbers just like yours, I used a scripted dataSet, but it'll be really similar. The first chart shows without using the "computed column". The second shows with. If you look at the fetch script of my scripted dataSet, you'll see where I did my computed column. In your report, if you're not using a scripted dataSet, you'll make your computed column differently. You'll open your dataSet editor and you'll see a section in the list to the left called computed columns. You'll click on this and choose to add a computed column. Then, you'll use an expression similar to the one that you see in my "fetch" script. Hopefully this helps. If not, I'll make this into a csv dataSet and add a computed column in the editor. Let me know!
SNX2012
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="100436" data-time="1337101253" data-date="15 May 2012 - 10:00 AM"><p>
Ok. Take a look at this report. To get numbers just like yours, I used a scripted dataSet, but it'll be really similar. The first chart shows without using the "computed column". The second shows with. If you look at the fetch script of my scripted dataSet, you'll see where I did my computed column. In your report, if you're not using a scripted dataSet, you'll make your computed column differently. You'll open your dataSet editor and you'll see a section in the list to the left called computed columns. You'll click on this and choose to add a computed column. Then, you'll use an expression similar to the one that you see in my "fetch" script. Hopefully this helps. If not, I'll make this into a csv dataSet and add a computed column in the editor. Let me know!<br /></p></blockquote>
<br />
Iam sorry for answering this late but I was on a longer trip, so I cant look into the Forum. Ive looked at your example but if i click the Dataset and switch to script mode and go to "onFetch" theres nothing. Maybe i don?t understand correctly where you?ve entered your script but i thought it must be there right? i can?t find it.<br />
<br />
tanks for help
mwilliams
There is a "fetch" script and an "onFetch" script in a scripted dataSet. You need to look at the "fetch" script.
SNX2012
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="104619" data-time="1340115801" data-date="19 June 2012 - 07:23 AM"><p>
There is a "fetch" script and an "onFetch" script in a scripted dataSet. You need to look at the "fetch" script.<br /></p></blockquote>
<br />
I can?t find what you say. I think iam looking on the wrong side. Can you help me?
mwilliams
That's not the example I posted. If you look at the example I posted, the fetch script will be there and you'll see the "computed column" I created. In your report, you'll use a similar script as I did in my fetch script in a computed column created in your dataSet editor, in the computed column section. If you don't have the "OthersBarInChart.rptdesign" report design file, then redownload it above and take a look.
SNX2012
Iam so sorry, I really don?t know where this example is from. ive Downloaded your one again and now I find it. I will try it and post results. Thanks for help and sorry for my mistake, iam really confused about it.
mwilliams
It's quite alright. Just let me know!