I understand that the timestamps should be strings for the panel to work.
So first of all it would be great if it could handle timestamps natively. (I also know that there is the Time Series panel, but it cannot display bars side by side).
Second i could imagine to transform the Time colum to a string column but i dont know how to achieve it…
Is there a solution to this?
Or is there any useful chain of transformations to achieve my goal?
(I also tried the transformation “Series to rows”, but i would end up with the column labels on x axis which is not what i want.)
I am also confused by the documentation, in my case I also have a field which is of string type and even when I do a transformation to rename the string field to Time nothing happens.
Not sure what else to try!
But I have an issue after reduction, my fields are numeric, not string.
With Loki queries, the field always contain the Label, which is quite annoying:
However this lets the graph display as it’s a string.
If I use the Legend field to change this to the field name {{ BotScore }}, it removes the label from the the value, but now the field is numeric, not string, so it won’t graph.
Are there any solutions to this?
I also have a Time Series with 2 values that I need to display as bar side by side.
It’s very annoying that this seems not possible with time.
I have exactly the same problem! Two number values returned from my table along with a date/time value.
If I do a transformation for the time field to a string my labels and up being just numbers.
What is the correct way to use a datetime as time column AND for the label on the X axis?
So it looks like the bar chart requires the first column to be a string and this is used to name the group, then the rest of the columns are the bars for that group.
I was able to get the time to show up properly by jumping through a couple hoops:
I’m using a Loki query (a Loki metric query which has the same result as a Prometheus query) and I’m forcing a large step 7d with a matching range [7d] so that I’m getting weekly summaries with multiple series returned in the result, so first I needed to flatten the multiple series and I did this with an outer join transform on the Time field because my particular query which forces the step and range gives me series with aligned timestamps.
Here’s the magic though, to get the timestamp to show up for the name of the time grouping you have to convert it to a string field:
Excited it worked for you! Thank you for posting this issue with the information you gave, your detailed write up was very helpful to me.
I’ll see if I can get this feedback to the Grafana folks to see what we can do to make it easier to work with timestamps on the X axis and improve some of the documentation around the expected data formatting for bar charts.