Setting min,max and label from dataset on a report timeseriesChart in a table group

Hi All.

Ignition 8.1.14
Reporting Module 6.1.14
Tag Historian 4.1.14

Having a small annoyance with a time series chart on a report.

The report has a few parameters (start time, end time, CIPRun_ID, Run Duration)

My main data source is an SQL query
I then have 2 nested SQL queries which do pretty much the same thing but from different tables (GetSetParams, GetPathParams) - this returns a list of associated pens, scaling and units
Each of the sub SQL queries has another sub Tag History query to go and get the actual trend data

The report works fine as is, however I would like to be able to set the label, min and max values on the timeseries chart dynamically.

When i look at the chart options I can enable scripting and set the label, min and max to static values but I’m unable to reference the returned values from the dataset (I managed to hook it up to the parameter in one iteration of the code (which I forget what was) but it looks like it sets all the timeseries min, max and label to whatever the 1st trend pens data is).

Some pictures to try and clarify what I’m doing…

As always, any help greatly appreciated.

Regards
Dave