Graph -Date on X, value on Y


I’am trying to do the next thing with grafana:

i have a mysql database
In this database i have everytime a date with a value

i would like to create a bar graph with on the x axis the date and on the y axis the value (i only have 1 value for 1 day)

so for example:
30/08/2018 , 500
31/08/2018 , 750
1 /09 /2018 , 600

i would like to visualise this in a bar graph in grafana.
i would like to be able to select the date range what to visualise (like the whole month august, or last 2 monts or just 1 week /last week)

Can someone help me out with this? thanks!

1 Like

Use the graph panel to display the data from your mysql database, then go to the Display tab and select “Bars” under Draw Mode.

And you can change the time range using the time picker in the top right corner of your dashboard
Useful resources:

but i am not able to figure out how to use it:

now i have something like this in ‘metric’:
UNIX_TIMESTAMP(TS) as time_sec,
VS_T2 as value,
‘VS_T2’ as metric
FROM day_report
WHERE $__timeFilter(TS)
order by time_sec

TS is a timestamp but i would prefere to use the collum ‘Datum’ (wich is only the ‘date’ part from the timestamp)

UNIX_DATE ‘Datum’ as Time_day ,

is this possible? the problem with my timestamp TS is that my bars are way to small. and that the bars appear at the time of the timestamp which is at 22:00h (that is the time when the data is logged)

but i want it to be visualized for the day so it would be nice to have them in the center of the day (12:00h) maybe something from 02:00h (2am) till 22:00 (10pm) or something like that

sugestions how i can do this?
(i have very limited sql and grafana skills, so if you say something like: 'use " group by time($__Interval)" … i will need more information, sorry for that But hey, I am learning! :wink: ) i allready tried this but its not working, i made an variable ‘Interval’ of type interval but when i added the group by in my sql querry it didn’t work :s

Thanks for the reply!


I found out how i can change the start of my bar graph.


UNIX_TIMESTAMP(TS) -(3600 * hours) as time_sec,

so subrtact just the number of seconds you want to move it… (kinda logical)

But now my problem is that i dont know how to set the width of the bar…
If someone could please help me out with this! it would help me a lot! Thanks!

Did you ever figure out how to do what you wanted @thomasdc? I’m having the exact same problem. I only want to see data on a per-day basis, but Grafana is showing me times. I’m using Postgres with the Date type. Thanks.