- What Grafana version and what operating system are you using?
- Grafana v11.1.0
- Windows 10
- What are you trying to achieve?
- I am trying to get the the time of the x-axis into a Data Link so I can make a drill down of the specific Category.
- How are you trying to achieve it?
- I tried using the variable ${__value.time} but on some of the Bar chart Elements (e.g. on the first I get the Time but on the third element top 2024-06-26 I get NaN and on the bottom one I get the correct Time Value. Is there a way to get the time of the Tool tip somehow?
(I cant upload any images due to the security in our company I hope that some of you can imagine what I mean)
I would just need the date (YYYY-MM-DD).
Thanks in advance
You need these two variables in your Data-link.
&from=${__from}&to=${__to}
This allows you to take over the values of the time picker.
Jo
Hi,
I tried already with from=${__from} and to=${__to} but this didn’t work either.
I’ve managed to upload the Image so that it would be easier to understand.
Would it somehow be possible to create a Datalink with a link to a table Panel (same dashboard) and extract the Time of the bar itself (for example 2024-07-08) and save it into a variable? With a Tag I already achived it with this URL
https://grafana-URL/d/${__dashboard.uid}/myDashboard?orgId=2&from=${__from}&to=${__to}&var-category=${__series.name}
I already tried to extract the Time field with this Datalink URL:
https://grafana-URL/d/${__dashboard.uid}/myDashboard?orgId=2&from=${__from}&to=${__to}&var-category=${__series.name}}&var-labelTime=${__field.labels.time}&var-valueTime=${__value.time}
but on some of the Bars I get a timestamp back, but a wrong one. an on some of them I get NaN.
I hope this makes it a bit clearer.
Thanks in Advance
Hello Felix,
I need to understand again…
You want to click on a bar and then jump to the time window of the bar via a link?
But you only have one time, that of the bar. You don’t have an end time.
And the time value of ${__value.time} is not displayed at every data point?
Is the behaviour the same if you remove the stacking of the bars?
Jo
Hello Jo,
Kind of, I want to click on a bar and then set a variable to the date of the bar and use this date to display the changed Programs of the Day. So the end time would be the start time + 24h.
And the time value of ${__value.time} is not displayed at every data point even when the bars are not stacked. the first one of the group works just fine. but on the second, third… i get NaN. And I take the Category of the bar itself (which works fine) to decide which programs should be displayed.
Felix
Hallo Felix,
I dont know why you have got problems with the $value.time funktion.
but here is what I found out for the timerange.
I have generated two variables…one to store the new starttime. And the other to store the new endtime. (starttime + 24h).
Here is my Testtable with the Links on the timefield
and here is the data-link to the same dashboard:
d/heun0kp…/new-dashboard?var-NEUESTARTZEIT= ${__value.time}&from=${NEUESTARTZEIT}&to=${NEUEENDZEIT}
!! Problem !! you have to click this link twice
and then it jumpes in the timerange you selected.
sorry, think I cant help you
Jo
Hallo Jo,
yes with a table I’ve got no problem at all with the time, but with the bar chart it doesn’t work with the $value.time variable.
Try converting your table Panel to a barchart. and try it again
Thanks
Felix
works as barchart as well…
when I use the same data-link on the value
I really don’t understand it. I tried now with all that I know could work
But what I get is this URL:
d/dd…/test-datalinks?var-NEUSTARTZEIT=&from=&to=
without any time what so ever:
if I use the table (as I tried previuosly)
But with the Barchart I don’t get any time value. I’ve tried the query with influxQL and Flux, nothing.
I think this variable modification is only possible with …sql query as Data source.
In the Data links?
But if thats the case then it’s not possible for our usecase.
Thanks anyways
last chance do it with Transformations, totaly without variables…
then you have got two new variables you can work with…
&from=${__data.fields.STARTZEIT}&to=${__data.fields.ENDZEIT}
you can hide them in the graph.
OK
happy weekend