Charts in Report Table Detail Rows - Custom Chart Script

I was able to successfully script nested data to show a dynamic number of charts within a table (one chart per detail row in my case). However, I would like to be able to customize the chart using the chart "edit script" feature. I can get access to the data keys in the report, but unfortunately, I don't know how to get access to the Row that I'm on in the table from within the chart script. Does anyone have any ideas or a workaround? I see there is a built-in key for "Row" but I don't know how to access that from within the chart script.

For example, I'm trying to do something like this in the chart script:

chart.setTitle(data['ChartHistory'].getValueAt(data['Row'],"TagName"))

but I get a key error for "Row". It seems all other parameters and built-in keys work just fine, but Row does not.

Well, my guess is, the Row key is only designed to work directly in the table scope (as the manual mentions). I wonder if because I'm trying to access the key from within the Chart script (even though the chart is located in a table row), if that "connection" back to the Row key is not available. The only workaround I've found is to use the X-Axis label bound to the dynamic Row key, and then access that value from within the chart object.

Something like this works:

	plot = chart.getPlot()
	domain_axis = plot.getDomainAxis()
	if domain_axis is not None:
		Row = domain_axis.getLabel()
		chart.setTitle(data['ChartHistory'].getValueAt(int(Row)-1,"TagName"))

If anyone has a cleaner way of achieving this, let me know! TIA

1 Like