Hi! I’ve connected to a postgres datasource with Grafana, and I wanted to build a time series out of a table using a line plot, not a bar plot.
The table consists of essentially three columns: 1) date_created (timestamp), 2) week (integer) which corresponds positively to date_created, and 3) quantity. My goal is to plot quantitiy in the Y axis with respect to week number as X axis (e.g., instead of 2024-02, 2024-03, 2024-04, …, I have 12, 13, 14, …), but also attach the date created. The query itself is rather simple:
select date_created, quantity from table_data
I’ve seen similar posts but no solution yet…
- X-axis to show week only - Grafana / Configuration - Grafana Labs Community Forums
- How to use calendarweek week(datetime) as time axis? - Grafana / Time Series Panel - Grafana Labs Community Forums
Any advice on how to proceed?
Note on relation between week and date_created: week 0 is some hardcoded date e.g. 1/1/20. Then week 1 is 1/8/20, week 2 is 1/5/20, etc…
After some thought, I think this can be reduced to a formatting question. If I can format the X axis like “Week {week}, {date_created}”, that would also work, or “{date_created}, {date_to_week(date_created)}”.