Here is an example script that can be attached to a BIRT chart object in order to change the labels on the chart dynamically:
importPackage(Packages.org.eclipse.birt.chart.model.attribute);
importPackage(Packages.com.mm.managev1.report);
function beforeDrawAxisTitle(axis, label, icsc)
{
var title = label.caption.value;
if ("" == title) {
if (axis.orientation === Orientation.get(Orientation.HORIZONTAL)) {
label.caption.value = ReportUtilities.formatLongDate(getParameterValue("fromDate"))
+ " to " + ReportUtilities.formatLongDate(getParameterValue("toDate"));
} else {
label.caption.value = getParameterValue("currencyDesc");
}
}
}
function beforeRendering(gcs, icsc)
{
var chart = gcs.chartModel;
chart.title.label.caption.value = getParameterValue("reportingPeriodDesc") + " Capital Spending";
}