Home
Analytics
Setting Legend Title from report parameters
system_migrated
Good day
I'm trying to create a reports that includes some multi-line charts
What I'm trying to do is to use some report parameter as values for the legend title . In example: each chart has several lines, each one representing the performance of a LAN switch port. Each port correspond to a report parameter . I' ld like to make this report portable and hence I' ld like the legend title to be taken by the report parameter .
I've tried to use an event handler like the following one in the chart :
function beforeDrawLegendItem( lerh, bounds, icsc )
{
if (lerh.getLabel().getCaption().getValue() == "1"){
lerh.getLabel().getCaption().setValue("pippo");
}
if (lerh.getLabel().getCaption().getValue() == "2"){
lerh.getLabel().getCaption().setValue("pluto");
}
if (lerh.getLabel().getCaption().getValue() == "3"){
lerh.getLabel().getCaption().setValue("paperino");
}
}
where "1","2","3" are the value used in 'Format Chart' wizard as Series Title.
It work as long as i use strings in the setValue() , but it fail if I try to use a report parameter instead . Can anybody help me ? Thanks for your time
Find more posts tagged with
Comments
mwilliams
Hi Ruggero,
Try storing your report parameters in persistentGlobalVariables outside the chart, then call them in your chart script with icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("varName").
charmi
if(lerh.getLabel().getCaption().getValue() == "19")
lerh.getLabel().getCaption().setValue("Test1");
This worked for me.