Question

Line Chart

  • 18 November 2021
  • 3 replies
  • 24 views

Hello,

 

Given a Line Chart showing data for the current week, with the x-axis being the date, is it in any way possible to display the entire week in the chart, if data is present only until the middle of the week? Specifically, how could I force the graph’s x-axis to span Monday through Sunday, if the data itself only goes up to, e.g. Thursday?

By default, Looker auto-adjusts the x-axis date width to go up to the latest date in the data, in my example, terminating at Thursday. My goal is to add on empty placeholders for the remaining days of the week, so that the graph always spans the full week.

 

Thank you very much for the help!


 

 


3 replies

You could try to use the fill in date option. https://docs.looker.com/exploring-data/visualizing-query-results

Unfortunately, the Fill in Missing Dates option will only interpolate dates in between matched data rows. E.g. if the latest data row is for 11/22, it will not fill in any dates after 11/22. Please correct me if I’m wrong in my understanding. 

Ah, I see the problem now. I’d do a sql statement in the lookml to add dates based on the current day of week. So, I’d so something like this (based on snowflake sql):

select dateadd('day',-1,(dateadd('week',1,date_trunc('week',current_date)))) from dual

 

Reply