I wrote a blog post for packtpub describing the K-means clustering procedure. The codes I provided were written in R, I also pointed to another blog post of mine where I use python to explain this algotithm. I decided to write a D3 visualization of the clusters.
Modified http://d3js.org/d3.v3.min.js to a secure url
https://d3js.org/d3.v3.min.js