Dynamic Chart title fails in BIRT 4.3.1, but worked great in 3.7.1

wwilliams
edited February 11, 2022 in Analytics #1

onRender
/**
* Called before generation of chart model to GeneratedChartState.
*
* @param chart
* Chart
* @param icsc
* IChartScriptContext
*/

function beforeGeneration( chart, icsc )
{
var myTitle = chart.getTitle().getLabel().getCaption().getValue();
var title = icsc.getExternalContext().getScriptable().getPersistentGlobalVariable("title")
chart.getTitle().getLabel().getCaption().setValue( BirtDateTime.year(BirtDateTime.today())+ " " + title +" " + myTitle)
}

It appears getPersistentGlobalVariable() is no longer a choice

Comments

  • well it looks like it doesn't like setValue( BirtDateTime.year(BirtDateTime.today())

  • I tested your code in 4.8 and it works correctly. If possible, try upgrading. If upgrading is not an option, you might be able to work around the issue using the JavaScript date methods.

    Warning No formatter is installed for the format ipb