Tooltip data link is not showing the right data

Hi !

Using Grafana v10.2.1

I’m graphing a time series and wanted to add a data link to the tool tip. But it looks like the ${__data.fields} and ${__value} variables are not populating the same way as the tooltip itself does.

I’m using the Data links section of the Time Series panel with variables.

Screenshot 2023-12-16 at 7.11.54 PM copy

In the screenshot, the tooltip is for the point at 2023-11-30 23:04:29 for the value 636, but the value used for variable ${__data.fields.Dataset} is 2023-11-05 02:04:05 and ${__value.text} is 98 and I’m not sure why.

I would expect it to be the same as the Tooltip’s values for both axis.

Source is a simple Postgresql query SELECT ts, COUNT(*) ... and in table view, data looks accurate. I do not use the build-in time range.

Would you happen to know what I’m doing wrong and how I could solve this?

If that happens to you, make sure your query do not ORDER BY ts DESC as the component does that for you.

For anyone else googling for this issue – I had the same issue w/ datalinks not aligning with the point clicked on the graph, but the solution was to add an ORDER BY clause to my query (MSSQL server), i.e. opposite of the advice above…