Number slider-plugin

I work with grafana
I created a query type variable that returns numbers
And I want a number indicator to open for me where the minimum value is 1 and the maximum is the number taken from the variable
And when you move the slider, it saves the number you’re standing on in another variable
I tried to use the data manipulation plugin, but in the MAX field you cannot enter a variable, only a number
And I can’t take the data from the slider
I also thought of going in the direction of a variable design in the form of a number slider
Does grafana have such an option?

1 Like

@shoolamitmints Max field does not support variable, that’s correct. We can look into supporting it if you open an issues in the GitHub repository.

Slider for the variable can be an interesting feature for the Variable panel. You are welcome to open an GitHub issue to implement it in future versions.

@mikhailvolkov Thank you for your reference,
I will open an issue,
Where should I open it?
In Grafane feature request issues?
Or in the volkovlabs-form-panel issues?
But maybe you have an idea for another Grafana feature that can help me?
Because I need a contemporary solution And I’m not savvy enough…

@shoolamitmints Issues should be opened in the Data Manipulation and Variables panels GitHub repository. It’s a community plugins and not a part of the Grafana Core.

Immediate solution will be to use Data Manipulation panel with a Slider and set Max value in the Initial Request from dashboard variables:

onChange(elements.map((element) => {
  return element.id === 'slider' ? { ...element, max: Number($max) } : element
}));

Panel:

Initial Request:
Screenshot 2024-02-19 at 10.02.07 AM

Elements:

1 Like

@mikhailvolkov I tried the code and it works fine
Thanks !!!
Now I need to know what number I stand on the slider
I want the number to be saved as a variable in Grafana
and then
Or it will change automatically every time there is movement on the slider
Or I can by pressing SUBMIT save the data NEW VALUE in this variable

1 Like

@shoolamitmints Values can be saved by pressing Submit button or at every change using one of the latest feature Event Change code.

@mikhailvolkov First of all, thank you for wanting to help
But maybe my question wasn’t clear enough
I am indeed in update request
There I wrote the following code:

elements.map((element) => {
 console.log(element.value)
});

I have a grafana variable named NUM
Now I want console.log(element.value) instead of the code I wrote
It says that element.value = $NUM
And if, for example, I stand at 2 in the slider
So when I click send I will see in the variable NUM the value 2 etc.
What type to create the NUM variable?
And how can I really change it in the code - because I can’t find the correct syntax

@mikhailvolkov Sorry for the many questions…
The truth is that I researched again how to update a grafana variable
And I did not find such an option
Actually right now I have the value element.value
which expresses the place I stand on in the slider
And I want to use this value in a query unrelated to the plugin
How can I do that?
Or do you know an option to export the data to a SQL table
Then I can take the data from this table
Or any other way…