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)
Dynamic Report with many charts, with same layout design
mh10
Hi,
i have to create one report, which will have more than one chart.
but all these chart will have same layout design, only data provided to each chart
will change each time as the value for one parameter in sql query change.
Any suggestion?
Thanks
Find more posts tagged with
Comments
mwilliams
Hi mh10,
Can you explain a little further? Do the column names change in your dataset with this parameter? etc.
mh10
Hi Michael,<br />
no columns will not change, everything will be same, layout and query.<br />
<br />
Only the dataset will return different data values for each chart depend on one parameter value given to the query.<br />
<br />
so i want to design one chart...and then using this chart create remaining charts dynamically.<br />
<br />
<br />
Thanks<br />
<br />
<br />
<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>Hi mh10,<br />
<br />
Can you explain a little further? Do the column names change in your dataset with this parameter? etc.</p></blockquote>
mwilliams
mh10,
As long as it's only the data values changing and not the column names or anything like that, designing one chart should be fine. What issues are you having when the parameter changes?
mh10
in this report, i have to show data for each different cities.<br />
Query for data set is like this.<br />
<br />
select col1, col2, col3, col3 from city_info where city_name in (?);<br />
<br />
i don't know for how many cities i have to display the information.<br />
it could be 10, 50, 100.<br />
<br />
so this one report may consist 10 or 50 or 100 charts per city.<br />
<br />
so i want to design one chart and this chart design will repeat dynamically depends on city_name values<br />
<br />
<br />
<br />
Thanks<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>mh10,<br />
<br />
As long as it's only the data values changing and not the column names or anything like that, designing one chart should be fine. What issues are you having when the parameter changes?</p></blockquote>
mwilliams
mh10,
You can create a group on your table where you group by city. This will separate your data in your table by city and you can place the chart in the group footer. Then, you only have to make one chart that will only take the data from the current group, giving you your chart for each city. Groups are dynamic depending on the number of cities, therefore, your number of charts would be dynamic as well. Let me know if I didn't answer your question.
mh10
Hi Michael,<br />
can you explain me more about this<br />
<br />
1) I have created dataset so that it will return data for all cities, data returned has grouped by city name <br />
<br />
next<br />
2)as you said "place the chart in the group footer" --- what exactly now i have to do this?<br />
<br />
3) Then I have to make one chart that will only take the data from the current group, --- what exactly i have to here, how can i assign current group?<br />
<br />
<br />
I would be great if you give these step by step in detail instrucions<br />
<br />
<br />
<br />
Thanks<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>mh10,<br />
<br />
You can create a group on your table where you group by city. This will separate your data in your table by city and you can place the chart in the group footer. Then, you only have to make one chart that will only take the data from the current group, giving you your chart for each city. Groups are dynamic depending on the number of cities, therefore, your number of charts would be dynamic as well. Let me know if I didn't answer your question.</p></blockquote>
mwilliams
mh10,
What version of BIRT are you using again? I'll make an example with the sample database.
mh10
BIRT 2.3.2 <br />
<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>mh10,<br />
<br />
What version of BIRT are you using again? I'll make an example with the sample database.</p></blockquote>
mwilliams
mh10,
Take a look at this report design. It groups the customers by country in the table and there is a chart that show's the credit limit of each customer for that country in the group footer. Let me know if this helps.
mh10
Hi Michael,<br />
your given example has helped me in what i am expecting. Great!!!!. Thanks for it.<br />
However, I have one more thing to add in this dynamic Report, <br />
<br />
I want to add Image on each chart page related to each city.<br />
<br />
If city1 then it will show Image1.jpg belows its related graph<br />
If city2 then then Image2.jps...........so on.<br />
<br />
<br />
Any suggestions?<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>mh10,<br />
<br />
Take a look at this report design. It groups the customers by country in the table and there is a chart that show's the credit limit of each customer for that country in the group footer. Let me know if this helps.</p></blockquote>
mh10
Any suggestions on dynamic images in table group
mwilliams
mh10,<br />
<br />
Sorry for the delay. Check out this <a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/324-birt-dynamic-image-examples/#description'>example</a>
; from the devShare.
mh10
Hi,
Going further Now i am looking to display one value from each group in its Legend
e.g.
id -- city -- code
1 -- ABC -- 1245
1 -- ABC -- 1334
1 -- ABC -- 1426 ***
1 -- ABC -- 1576
1 -- ABC -- 1648
this is one group, and i want to get 3rd row 'CODE' value in variable so that i can use it in beforeDrawLegendItem()
it has to be happen for each available group with its related 3rd row value.
I tried with onCreate() and setPersistentGlobalVariable, but in onRender() of chart it is giving me only one value for all city location chart.
Any suggestion?
Thanks
mwilliams
mh10,
Can you post the script you're using to get the value?
mh10
I tried with two ways, added Rownum colum as i wanted 3rd row value<br />
<br />
1)<br />
set global variable<br />
initialize()<br />
pvar = 0;<br />
<br />
onCreate()<br />
<br />
temp = this.getRowData().getColumnValue("ROWNUM");<br />
if (temp == 3)<br />
{<br />
var tempCLm = this.getRowData().getColumnValue("CODE"); <br />
reportContext.setPersistentGlobalVariable("pvar", tempCLm.toString());<br />
<br />
}<br />
<br />
<br />
onRender()<br />
<br />
function beforeDrawLegendItem( lerh, bounds, icsc )<br />
{<br />
<br />
var vpvar = icsc.getExternalContext().getScriptable().getParameterValue("pvar");<br />
<br />
label1 = "city code: "+vpvar;<br />
<br />
if( lerh.getLabel().getCaption().getValue().compareToIgnoreCase("Series 1") == 0 ){<br />
<br />
bounds.setHeight(2);<br />
bounds.setWidth(2);<br />
lerh.getLabel().setVisible(true);<br />
lerh.getLabel().getCaption().setValue(label2);<br />
<br />
}<br />
<br />
This first way is showing same code value to all city graphs<br />
<br />
<br />
2)Now i tried with getting code values in onRender() using<br />
<br />
var vgb = 0;<br />
<br />
function afterDataSetFilled( series, dataSet, icsc )<br />
{<br />
if( series.getSeriesIdentifier() == "Series 1"){<br />
var list = dataSet.getValues();<br />
<br />
for ( i=0; i < list.length; i=i+1)<br />
{ <br />
list[3] = vgb;
as i want 3rd value<br />
}<br />
<br />
}<br />
<br />
function beforeDrawLegendItem( lerh, bounds, icsc )<br />
{<br />
<br />
var vpvar = icsc.getExternalContext().getScriptable().getParameterValue("pvar");<br />
<br />
label1 = "city code: "+vgb;<br />
<br />
if( lerh.getLabel().getCaption().getValue().compareToIgnoreCase("Series 1") == 0 ){<br />
<br />
bounds.setHeight(2);<br />
bounds.setWidth(2);<br />
lerh.getLabel().setVisible(true);<br />
lerh.getLabel().getCaption().setValue(label2);<br />
<br />
}<br />
<br />
here i am getting city code: 0...which is set value-- var vgb = 0; so<br />
list[3] = vgb is not assigning value to it OR that function i am not defining correctly<br />
<br />
<br />
<br />
any suggestions?<br />
<br />
Thanks <br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>mh10,<br />
<br />
Can you post the script you're using to get the value?</p></blockquote>
mwilliams
mh10,
The first way looks like you're close. If you change the pgv names to something associated with the city name, rather than just 'pvar', you'll probably get the correct values for each city. If you can make this in a report using the sample db, I can help even more being able to see the setup.
For the second one, I'm not sure I'm understanding. If you set vgb to 0, then say list[3] = vgb, you should get 0 when you call vgb.
vgb = 0;
list[3] = vgb;
This should set list[3] to 0, not set vgb to list[3]'s value. If I'm understanding your approach here, you may want to reverse that to say vgb = list[3].
If this doesn't help, you can set up a report with the sample database that uses this code and I'll try to help you modify it to make it work correctly.
mh10
Yes Michael,<br />
I reveresed<br />
list[3] = vgb; to vgb = list[3]; (actually i accidently changed this order and i saw numbers on graph.......then i read your reply....:)..)<br />
<br />
it is giving me what i am expecting but the the number which this 'vgb' is giving is in different format<br />
<br />
the statment is label1 = "CODE: "+vgb;<br />
<br />
from database i am getting 18228080000 while on graph it is showing <br />
CODE: 1.822808E9<br />
<br />
this is happening for all numbers even for small 2-3 digit numbers also<br />
<br />
<br />
Any suggestions?<br />
<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>mh10,<br />
<br />
The first way looks like you're close. If you change the pgv names to something associated with the city name, rather than just 'pvar', you'll probably get the correct values for each city. If you can make this in a report using the sample db, I can help even more being able to see the setup.<br />
<br />
For the second one, I'm not sure I'm understanding. If you set vgb to 0, then say list[3] = vgb, you should get 0 when you call vgb.<br />
<br />
vgb = 0;<br />
list[3] = vgb;<br />
<br />
This should set list[3] to 0, not set vgb to list[3]'s value. If I'm understanding your approach here, you may want to reverse that to say vgb = list[3].<br />
<br />
If this doesn't help, you can set up a report with the sample database that uses this code and I'll try to help you modify it to make it work correctly.
</p></blockquote>
mwilliams
mh10,<br />
<br />
You may try formatting the number. See the following devShare post.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/711-birt-dynamic-number-formatting/#description'>BIRT
Dynamic Number Formatting - Tips & Tricks - BIRT Exchange</a>
mh10
HI Michael,<br />
Number formating is Ok ..Thanks...<br />
<br />
Now i am trying to place dynamic image in the group footer of chart, <br />
i saw your suggested example of it <br />
<a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/324-birt-dynamic-image-examples/#description'>BIRT
: Dynamic Image Examples - Designs & Code - BIRT Exchange</a><br />
<br />
as per it, i have two images, i placed them under Embedded images dropdown<br />
<br />
then in onrender()<br />
if(row["COL1"] == "SMALL")<br />
this.file = this.file.replace("Large", "Small");<br />
<br />
BUT THIS IS GIVING ME AN ERROR: can not call method 'replace' of null<br />
<br />
where exactly i have to place these images?<br />
<br />
<br />
<br />
Thanks<br />
<br />
<br />
<br />
<blockquote class='ipsBlockquote' data-author="mwilliams"><p>mh10,<br />
<br />
You may try formatting the number. See the following devShare post.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.com/devshare/designing-birt-reports/711-birt-dynamic-number-formatting/#description'>BIRT
Dynamic Number Formatting - Tips & Tricks - BIRT Exchange</a></p></blockquote>
mh10
Hi Michael,
Now i tried with
this.imageName = "small.jpg";
it showed me expected image
Great!!!!!!!!!!
Thanks