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)
Setting Chart Title based on Field in the dataset
chavez_ant
How do I set the Chart title to be based on a row in a data set. I've got a data set called 'ReportName' that has the value I want to use in it (fieldname DEMONAME). I have researched and have not yet found an answer, so I thought I'd sent a quick question over here.
I have done the following, below my signature. I'm assuming I have to declare the Global Variable to use the ReportName.DemoName field, but how do I modify the script to do this? Or is there a better way? Thanks in advance for helping a newbie (in the scripting department at least)
Thanks,
A.C.
I have been able to dynamically set up a chart title based on a Parameter by running this script (beforeFactory):
reportContext.setPersistentGlobalVariable("Demographic", params["DemographicSelect"]);
Then running the script in the chart (onRender)
function beforeGeneration( chart, icsc )
{
title = "Demographic Trending by " + icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("Demographic") + " and Period";
chart.getTitle().getLabel().getCaption().setValue(title);
}
Find more posts tagged with
Comments
johnw
The easiest way is to set a persistent global variable in the onFetch event of your data set, or in the row or data element expression of your table. You would just need to make sure that table is opened and called before you generate your chart.
John
chavez_ant
Thanks, that worked! Just in case someone runs across this thread later on, here's some more info. I used this syntax in the script for the onFetch event of the dataset:
reportContext.setPersistentGlobalVariable("Demographic", row["DEMONAME"]);
Then used the same script mentioned above for onRender in the chart.