'vega-lite show all x-axis values

I have a vega-lite bar chart with years as the x-axis (counts as the y). The user selects a range of years to show. When the data is sparse, some years have a 0 count and are not showing on the chart. How do I get all years in the range to show up?



Solution 1:[1]

I got this to work by first setting my measure to be [computation] + 0. This then caused everything to show. Thus, I added a transform filter to the vega-lite to only include when the measure > 0.

"filter": "datum.countOf > 0"

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Pat