Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Add dynamic chart title based on report Parameter
Susmitha
Hi,
I am new to BIRT. I developed a bar chart which takes some report parameters. I wanted to display the Bar chart heading based on selected report parameter. Please let me know how to do it.
Thanks,
Susmitha.
Find more posts tagged with
Comments
mwilliams
Hi Susmitha,
Take a look at this report. I created it with the sample database in BIRT 2.3.1.
vishalkp
Hello,
Actually there are different ways to display the Bar chart heading based on selected report parameter depending upon which version of BIRT you are using?
which tyep of chart you are using (simple chart in BIRT2.1/2.2/2.3 or flash chart in 2.3)?
The reason behind this is that flash chart has no script, so if you want to display bar chart heading based on selected report parameter in
[1.] flash chart follow steps as:
1. In chart's Format Tab, Hide title by unchecking Title. Click on Outline tab, then report_name.rptdesign and click on the script tab and select initailize from the dropdown seen above.
2.Add script as:
reportContext.setPersistentGlobalVariable("Parameter_name",params["Parameter_name"].value);
3. Then add a label to your report above your chart. leave it blank, just change its size , font as required.
4. Click on the label and then on script and select onPrepare event from dropdown above.
5. add script as:
var s = reportContext.getPersistentGlobalVariable("Parameter_name");
if(Parameter_name!=null)
{
this.text='Consignment Value by Facilities of BU: '+s
}
else
{
this.text=' ';
}
thats all, and it will work...
[2.] Normal Charts:
1. Show Title by Checking the Title in chart's format. leave the title text box blank.
2. click on the chart and then on script. select onRender event from dropdown and add script as:
function beforeGeneration(chart, icsc)
{
var title = 'Consignment Value by Facilities of BU: '
title = title+ icsc.getExternalContext().getScriptable().getParameterValue("parameter_name")
chart.getTitle().getLabel().getCaption().setValue(title)
}
thats all, and it will work...
I think you will get through this.
Do reply if any queries.
With Regards,
VishalKP.
Susmitha
Thanks Michael and Vishal. I am able to do it.
I have one more question. I have 3 markers in my chart, low, medium, high. I wanted to color the chart plot area with 3 differnt colors.
0-low range in blue color,
low range - mid range in green clor etc.
Please let me know how can I do it.
Thanks,
Susmitha.