This is my latest effort:
importPackage(Packages.org.eclipse.birt.chart.model.data.impl);
function beforeGeneration( chart, icsc )
{
/* This script will change the Min and Max value of the X axis based on the value
for the Start and End date parameters.
NB: In order to work, make sure to turn OFF the "Is Category Axis" attribute
in the X-Axis properties screen
*/
/* Get the start and end dates from the parameters */
start_time_p = icsc.getExternalContext().getScriptable().getParameterValue("start_time");
finish_time_p = icsc.getExternalContext().getScriptable().getParameterValue("finish_time");
start_time = new Date( (start_time_p.getHours() + 1) + ":" + start_time_p.getMinutes() + ":" + start_time_p.getSeconds() );
/* Get the X-Axis object */
xAxisArray = chart.getBaseAxes();
/* Set the Min and Max values */
xAxisArray[0].getScale().setMin(DateTimeDataElementImpl.create(start_time));
}
But I understand that the constructor of a date object requires a long integer, which is probably why I get this error:
Cannot convert Invalid Date to java.lang.Long at line 34 of chart script:'' (Element ID:71)
Any help getting this working will be very much appreciated,
Thanks,
Stephen






MultiQuote








