On a lot of my charts, I see dates being skipped. The bar for the date is present but the date label skips on the x-axis. Anyone know how to get around this
I switched the scale to be Ordinal and that seemed to fix it. I need to read up on what Ordinal means and if I should use that for time series
You could try to convert your dimension to a date and then use Time.. The advantage is then that you can use different timeframes and the x-axis responds better to that type of data. Ordinal will not fill in any dates as it takes the raw data at its "face value", whereas for Time series, you could fill the dates within the visualisation layer.
In Looker, when date labels on the x-axis are skipped, it’s usually because there isn’t enough space to display all of them. To fix this, you can adjust the label density in the x-axis settings, rotate the labels (e.g., 45° or 90°), or make the chart wider. These changes help ensure that more dates are shown without skipping.
The field that I am using is a dimension_group and has date and time as timeframes. Is that what you are saying ?
And I do agree with you on not using ordinal for x-axis for time series
In this case it's good to use Time for x-axis.. and if by skipping you mean that it's not displayed then as @Appyb rightly said, it would be because of the calculation of space needed to show the label and space available. Which means depending on the rendered size of your visualisation, you would get different number of labels.
Now that Chart Config Editor is available, you could force the labels to show up:
xAxis: {
tickInterval: 1, // Set the interval between ticks
labels: {
rotation: -45, // Rotate labels for better readability
autoHide: false // Prevent automatic hiding of labels
}
},
Here's an example on one of my graphs, here is automatic labelling:
And since my data is Monthly, then tick interval becomes each month and applying the above settings would yield this:
I did try rotating the axis to 45 & 90 but that did not help. When I zoom out, I do see all the dates which validates your point of not having enough space to display data. Thank you for helping
btw, I tried adding the code to the chart config editor (thanks for the suggestion) but the dates now repeast twice
Of course they might be repeated because it depends on the granularity of your data and the labels you want. My data is monthly so adding ticks per 1 Interval gives me each month, but if my data was daily, and I did labels with 14-day interval but only display Month name, then of course I would 2-3 labels
The granularity of my data is daily and I am using the Date timeframe from the dimension_group. My interval is set to 1. I was expecting the date to show just once
That's a valid conclusion, in this case there must be something else at play here but can't venture a guess without seeing your data table and setting you applied
Sure. Posted a screenshot. Ignore the 100% for all. Thats made up data.
This is the config editor setting
{
chart: {},
series: [{
name: 'XXX'
}],
xAxis: {
tickInterval: 1, // Set the interval between ticks
labels: {
rotation: -45, // Rotate labels for better readability
autoHide: false // Prevent automatic hiding of labels
}
},
}
That's interesting.. okay I will test it on my side and see if I can replicate this issue.. Is your x-axis type still ordinal or time?
X-axis is Automatic Based on Data
it works for me
Can you change the X-axis to Time and make sure you don't have any value formatting for the x-axis?
I changed it to time and remove all formatting. Now it looks more wierd
Btw - I appreciate your patience in helping me out
Your data column - is it a dimension_group or string, or string but with data type "date"?
It is dimension_group
dimension_group: created {
label: "Created"
type: time
timeframes: [
raw,
hour_of_day,
day_of_week,
day_of_week_index,
time,
date,
week,
month,
quarter,
year
]
sql: ${TABLE}."COLUMN_NAME" ;;
Can you re-create this explore and just use the dimension and measure, without the table calculation - just to start with something simple? And order the data table as well just to test if there are really no repeated dates in the result
Recreated the explore. Removed table calc and reference line. Still facing the same issue. Tried removing/changing the label rotation and time format but it does not help
Strange indeed, don't know if it's something about the data that makes this duplication. I can't replicate it with Ordinal or Automatic axis type or anything else. In this case only Support may be able to help since I can't see your underlying data
Thank you. I will follow up with support. Once again, thanks for your help. I learnt something new about using chart config editor.