I’m on the journey of switching from Google Data Studio to Observable. So going through the learning curve reading all the guides and tutorials.
Now I’m running into a few basic things to which I can’t seem to find the right examples. Hopefully, someone will be able to point me in the right direction.
Let’s say I want to display a chart that shows the distribution of people in a specific age group (0-10, 10-20, etc). My guess is that I would need to use the bin function for that. Is that correct? And if so, how can I specify the age brackets of the group. Or am I looking in completely the wrong direction?
Another question related to grouping but slightly different. Let’s say I want to group my data into “male”, “female” and “other responses”. My guess here would be that to aggregate “other responses” I should use the transform function, is that correct?
My next challenge is related to filtering. How can I create a filter to only show ages between 18-70 years? Or to exclude anything below 18?
Finally I’m looking into continuous scales. Let’s say I’m plotting the number of records per age and I also want to include the ages on the X-axis that don’t have any records. How do I show those empty values on the X-axis?
Apologies if my questions aren’t completely clear but I’m happy to provide any additional info needed!
On the last point, here is a fork of Fil’s suggestion that demonstrates using a filter transform after binning and stacking. That way the scale domains are not affected by the filter operation.
@Fil Wow! You didn’t only help me to find the answers you also helped me to understand what is going on.
There’s one more thing I’m curious about. How would you create a continuous scale that also shows ages that don’t have a count? In your first chart for example.