Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click script example #19

Closed
dmfst opened this issue Feb 3, 2021 · 4 comments
Closed

Click script example #19

dmfst opened this issue Feb 3, 2021 · 4 comments

Comments

@dmfst
Copy link

dmfst commented Feb 3, 2021

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
Copy link
Owner

ae3e commented Feb 19, 2021

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
Copy link
Author

dmfst commented Feb 20, 2021

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
Copy link
Owner

ae3e commented Feb 23, 2021

You can try this :

window.updateVariables({query:{'var-yourVariableName':'yourVariableValue'}, partial: true})

@dmfst
Copy link
Author

dmfst commented Feb 24, 2021

Thank you, it works!

@dmfst dmfst closed this as completed Feb 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants