What is the best way to have multiple charts in a workbook

I’ve been playing around with trying to create a workbook that would contain multiple grouped bar charts and I’d like to do so in as DRY a manner as possible. One thought was to have a notebook where the last cell contains the D3 import, and the prior cell contains a function for generating the chart that has a single parameter designed to take in the data for the chart.

Is there a cleaner way to approach it than this?

Sounds like a clean approach to me! You could also consider using a higher-level abstraction for visualization such as Vega-Lite, as shown in the Exploring Data with Vega-Lite notebook. But whether you using an existing abstraction, or defining one yourself as a function in your notebook, both approaches should be DRY.

1 Like