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
You could look for a method of encoding the data so it is not plain text. However, an experienced JavaScript programmer can decode the data without issue. The same goes for flash and java also. Anything on the front end exposes your data. There are backend libraries for displaying charts I know for a fact php has lots of them, Other languages should have them too. A backend solution would make it so the only way to get your data is to pull it from the image either manually or with line detection.
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.