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)
Generate Chart Dynamically
charmi
Hello All,<br />
<br />
I have a dataset which have fruits price according to city.Say data should be something like below in data set.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
Fruit City Price
Apple Ahmedabad 100
Apple Baroda 105
Apple Bharuch 95
Kiwi Ahmedabad 200
Kiwi Baroda 250
Kiwi Bharuch 300
</pre>
<br />
I need to draw different chart for apple that will show City -> Price and different chart for Banana that will show City -> Price. I don't know about how many fruits will be their so for different fruits need to generate seperate chart.Any Idea how to achieve this?<br />
<br />
Thank You
Find more posts tagged with
Comments
Yogesh Maharwade
Hi Charmi,
to Do this, in edit chart there is optional grouping property,in that you have to add column binding like FRUIT,then only you will get different chart for different fruit.
charmi
<blockquote class='ipsBlockquote' data-author="'piwya'" data-cid="93927" data-time="1326287938" data-date="11 January 2012 - 06:18 AM"><p>
Hi Charmi,<br />
to Do this, in edit chart there is optional grouping property,in that you have to add column binding like FRUIT,then only you will get different chart for different fruit.<br /></p></blockquote>
<br />
Hi Piwya,<br />
<br />
Thanks for reply.But I think you misundersttod my question. I had uploaded images that I want to generate from 1 dataset different "Charts" in one report.<br />
<br />
Thanks
Hans_vd
Hi Piwya,
Try this:
- create a table on your report and bind it to your dataset
- create a grouping on Fruit
- create the chart in the group header line
- you might want to remove detail row, group footer, table header and table footer
This will generate a chart for every fruit.
Hope this helps
Hans
Yogesh Maharwade
Hi HANS_vd
exactly.But for Break the chart group vise
- select the chart and in filter add expression - row["fruit"] equal to row._outer["fruit"].
Hope both post helps to charmi.
Thanks
charmi
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="93977" data-time="1326370743" data-date="12 January 2012 - 05:19 AM"><p>
Hi Piwya,<br />
<br />
Try this:<br />
- create a table on your report and bind it to your dataset<br />
- create a grouping on Fruit<br />
- create the chart in the group header line<br />
- you might want to remove detail row, group footer, table header and table footer<br />
<br />
This will generate a chart for every fruit.<br />
<br />
Hope this helps<br />
Hans<br /></p></blockquote>
<br />
Hi HANS_vd,<br />
Thanks for reply but I am new in BIRT and I had tried as your explanation but I got weird output.And how to create group for header of table because I need to keep chart in header and the group I am inserting on table is for table row not for table header.Even in chart that I made in header row of table,is disabling "group and sorting" on x-axis.So can you please give me an example report or can you please give some more detailed elaboration.<br />
<br />
Thank You
charmi
<blockquote class='ipsBlockquote' data-author="'piwya'" data-cid="93979" data-time="1326371534" data-date="12 January 2012 - 05:32 AM"><p>
Hi HANS_vd<br />
<br />
exactly.But for Break the chart group vise<br />
- select the chart and in filter add expression - row["fruit"] equal to row._outer["fruit"].<br />
<br />
Hope both post helps to charmi.<br />
<br />
<br />
Thanks<br /></p></blockquote>
<br />
Hi Piwya,<br />
Thanks for reply but filters, parameters and databinding tabs are also disabled in chart.<br />
<br />
Thank you
Hans_vd
Hi Charmi,
I built a report on the sample database that reproduces what you want. It shows a chart for each year that appears in the orders table.
I couldn't get it to work unless I did the grouping calculation in my query.
Take a look at the report and let me know if it helps.
There is no need to use a filter.
Regards
Hans
charmi
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="94035" data-time="1326446534" data-date="13 January 2012 - 02:22 AM"><p>
Hi Charmi,<br />
<br />
I built a report on the sample database that reproduces what you want. It shows a chart for each year that appears in the orders table.<br />
I couldn't get it to work unless I did the grouping calculation in my query.<br />
Take a look at the report and let me know if it helps.<br />
<br />
There is no need to use a filter.<br />
<br />
Regards<br />
Hans<br /></p></blockquote>
<br />
Hi Hans <br />
Thanks for the report.I had tried it.It worked but I need to add grouping on x-axis.Is that possible?I got report as below.In report below 450 is coming twice on x-axis, is it possible that it will display as in normal chart(2nd chart)?Grouping(optional) Axis is not displaying all 3 quality it is displaying result for only 1 Quality.<br />
<br />
Thank You
Hans_vd
Charmi,
Did you do the grouping in the query, like I did?
Regards
Hans
Hans_vd
Charmi,
I'm sorry. I didn't immediately see what your problem was.
This needs a different approach.
I rebuild my report to be just like yours. This is what I did:
- in the grouping header of the table, I created a new table on the same dataset
- I set a filter like this (like Piwya mentioned before): row["ORDER_YEAR"] Equal to row._outer["ORDER_YEAR"]
- in the chart, on the Select Data tab, choose "Use data from [your_data_set here]" instead of "Inherit data from Container"
Success!
Hans
charmi
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="94239" data-time="1326699919" data-date="16 January 2012 - 12:45 AM"><p>
Charmi,<br />
<br />
Did you do the grouping in the query, like I did?<br />
<br />
Regards<br />
Hans<br /></p></blockquote>
<br />
Hi Hans<br />
Yes I had tried grouping on city,quality and fruitName.This is the query <pre class='_prettyXprint _lang-auto _linenums:0'>select FruitName,Quality,Price,City,1 as count1
from tablename12 group by FruitName, city, Quality</pre>
<br />
Thanks.
Hans_vd
Hi Charmi,
Just so you know: the grouping in the query is not required in the latest solution I provided.
Regards
Hans
charmi
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="94242" data-time="1326702820" data-date="16 January 2012 - 01:33 AM"><p>
Hi Charmi,<br />
<br />
Just so you know: the grouping in the query is not required in the latest solution I provided.<br />
<br />
Regards<br />
Hans<br /></p></blockquote>
<br />
<br />
Hi Hans,<br />
<br />
Thanks actually I missed one statement of your post to use original dataset instead of container's dataset.That solved my problem.<br />
<br />
Thank You.
Hans_vd
You're welcome
Yogesh Maharwade
Hi hans,
I take a look at your attached report. but i noticed that its not working perfectly.
In report data set values and output are mismatch like there are 3 status for year 2003-Shipped ,cancelled and resolved but output shows all the status for 2003 year.
I just modify the report . please check the attached rptdesign.
Regards
Hans_vd
Hi Piwya,
For some reason I can't open the report you attached, but I see what you mean:
the filter was on the table, but then the chart is directly bound to the data set, so the filter is needed on the chart itself.
Thanks
Hans
Yogesh Maharwade
Hi hans,
Exactly. i put filter on chart.
Regards
Piwya
charmi
Hi Hans & Piwya,<br />
<br />
I need to show different charts on user demand so previously I am using below script but it is not working with this dynamically generated chart.<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
document.getElementById("Chart3").style.display="none";
</pre>
On click of radio Button I am making that chart invisible.Now I had made 3 different charts in different column of table and now If I click on bar chart then next consecutive chart open will be bar.But in same chart if I need to change chart type then is there any script that will make table column invisible?<br />
<br />
Thanks
Yogesh Maharwade
Hi charmi,
Take a look at the report,I Hope attached rptdesign will help you.
Regards