Here's some reusable code to compute and draw a correlation matrix from a set of data in JavaScript. Here's how it works:
https://d3js.org/d3.v4.min.js
https://unpkg.com/jeezy@1.12.11/lib/jeezy.min.js
https://unpkg.com/data2grid@1.0.0/build/data2grid.min.js
https://cdnjs.cloudflare.com/ajax/libs/chroma-js/1.3.5/chroma.min.js