You can change type of chart from bar to pie in CanvasJS by just changing type property from ‘bar’ to ‘pie’.

We don’t see code that includes CanvasJS in the snippet that you have shared. If you are still facing any issue in changing chart-type in CanvasJS, kindly create JSFiddle reproducing the issue you are facing and share it with us so that we can look into the code, understand the scenario better and help you out.