Non time data plotting Histogram

Hello Team ,

I am using Grafana version 7.1.5

This is the case :

We were given a mysql db and had non timeseries related data .
The “time” was weeks (week 30, week 31, week 32 etc).
Can I use graph visualization in some way with X-axis the week filed and Y-axis a range of numbers?

Thanks in advance

If you have a “year” field as well (without which a ‘week’ identifier is quite
ambiguous) try something like:

select ((year-1970)*52 + week)*604800 as time,X,Y,Z from table where…

If you do not have a “year” field then simply use instead:

select (2652 + week)*604800 as time,X,Y,Z from table where…

In case you wonder where those numbers come from, 604800 is the number of
seconds in one week (you need the “time” value to come out in seconds since
Jan 1st 1970, the Unix Epoch), and 2652 is the current year 2021 converted to
weeks (2021-1970)*52.

Grafana will never show you the week number on the X-axis; it will always show
the date.

Hope that helps,

Antony.

1 Like