I’m trying to get the results of a MongoDB query to work as the source of a data visualization in Grafana. The query results are not in a format that Grafana will accept for a visualization. I’ve tried modifying the query and using Grafana transformations, but neither have succeeded.
The query results are two arrays of values that I want to use for an xy plot. These are straight float values in an array, no key-value pairs.
Y-values X-values
[y0, y1, y2, …, yn] [x0, x1, x2, …, xn]
I’ve tried an aggregate query to unwind the arrays but they don’t come out in the correct order (y0, y1, etc), so that’s no good for a plot.
No Grafana transformations seem to work. The closest I’ve gotten is the Extract, using Auto option, but that’s not right, for instance the first element is [y0.
What can I do with either a query or a transformation to get this data into a format that Grafana will accept for a 2D line plot?
JasonJ55 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.