Pass In Parameters/Data to the Report Chart Script

I’m trying to do some “funky” things with the charts in a report to get them exactly how I was requested to make them. This requires that I fine tune the Range Axis on a chart when it loads. I’m trying to update the range axis inside the script using “range_axis.setLowerBound()” and “range_axis.setUpperBound()”, but the values I need for these to functions are coming from a SQL query. I can get the functions to work with constants, but I can’t figure out a way to pass in a parameter, dataset, or SQL query. Is it possible to pass anything into the Chart Script besides the “chart”?

Any pointers would be greatly appreciated.

Thanks,
-Will

You can’t add any other parameters, but you do have access to any Gateway scoped scripting functions, which means you can access tags and do sql queries in the script, and you have access to the chart’s data through the JFreeChart API.

Thanks Kathy! I was trying to use a SQL query and couldn’t get it to work, so I figured that it wasn’t allowed in the Chart Scripts. But then I realized I had a typo in the query… :blush: … Sorry about that!

Not sure if this is already on the path forward, but adding a feature to be able to pass in other parameters to the Chart Scripts would be super helpful. The SQL query will do the trick for now though.

Thanks again,
-Will

Apologies for digging up such an old topic, but I just wanted to check if this is still not possible? I thought I remember reading somewhere that parameters were being made accessible in the chart scripts but can’t find where I saw that (…or if I just dreamt it). I’m trying to setup dynamic pen names in the chart. I could do it through a tag but I’d like to avoid it if I can, since there will be many of these reports sending out in a short time and I don’t want to accidentally over write the tag before the prior report finishes executing (end up with two reports having the same pen names).

configureChart scripts in reporting do have access to other data keys on the report, yes - as of 7.9.7. Just use the same data['key'] syntax you would in a script datasource.

1 Like