add a function for creating the chart