ae3e / ae3e-plotly-panel

Plotly panel for Grafana
Apache License 2.0
97 stars 21 forks source link

Click script example #19

Closed dmfst closed 3 years ago

dmfst commented 3 years ago

Is it possible that the script executed when the chart is clicked to update the object returned by the initial script like changing colors.

ae3e commented 3 years ago

I think you could create a Grafana variable. This variable would store a color and would be used in your script to style a specific element. You could then update this variable when the chart is clicked. Not sure it anwsers the question otherwise you should provide a small example with code...

dmfst commented 3 years ago

I defined a Grafana variable "test" and I can use-it from "Script" section with console.log(variables.test)

From click script section it doesn't work. Can you provide un example with variable update?

ae3e commented 3 years ago

You can try this :

window.updateVariables({query:{'var-yourVariableName':'yourVariableValue'}, partial: true})
dmfst commented 3 years ago

Thank you, it works!