Global Layout Variable for Charts

Hello everyone,

I was wondering if is there a way to set a variable that is going to be used to as the Layout JSON and pass some dynamic parameters to it. For example, I have multiple charts that shows some data and all of them have the same JSON Layout code apart form the title. When I want to apply a modification I have to go through every single chart and apply them. Would be great to change that just in one place and be able to render a different title based, for example, on which chart is the title being rendered on. Thank you very much for your help!!

Hi there, welcome to the forum

Yea that's perfectly possible and very sensible approach to managing common data in this way.
If you're using the charts in a single app I'd suggest you create a variable in that app that contains the boilerplate/template JSON object - if you're using it across multiple apps you can set this as a global variable in your configuration variables (in retool settings)

When you're coming to use it in your app you can set your chart to use the JSON and replace the title property on the fly inline or through a , eg something like {{Object.assign(mytemplate.value, {title:"some title"})}}

1 Like

Thank you very much, that was the perfect solution!

1 Like