I have recently been exploring the different options for displaying charts in a browser.
I have tried using the d3js
library, google charts, java applets an
The simple answer is that you can't. The code is run directly by the browser, so the user can see it, and the same for the data.
The slightly more complicated answer is that you could try to encrypt/obfuscate your data, but even then the user will be able to get to it with some effort, as the same comment I've made above still applies.
In short, if you don't want the user to see it, don't send it to the browser. You could, for example, generate visualisations as images on the server and have the browser download only the image.