Superset handling missing values in time series - difference between bar chart and line chart

Viewed 712

I'm plotting a time series chart with missing values. The generated query looks like this:

SELECT DATE_TRUNC('day', arrival_time) AS __timestamp,
       COUNT(*) AS count
FROM public.data
GROUP BY DATE_TRUNC('day', arrival_time);

When plotting a time series line chart, values are correctly positioned on the x axis according to their date value: enter image description here On the other hand, when I plot a bar chart, values are positioned by their index in the data, not by their date: enter image description here

I can solve this by using the resample function (pick 1D/asfreq), but I'm still wondering if there is a reason this works out of the box for the line chart but not for the bar chart.

1 Answers

I believe you only need to select the "Sort Bars" toggle on the customize tab. I speculate the reason why it is not sorted is that the bar chart is not time series. There is a time-series bar chart you can use instead if you don't want to toggle this button.

Related