Bedsore prevention mat
Heatmap
- How to get started
- install Node.js
- install heatmap.js with bower
> npm install -g bower > bower install -g heatmap.js-amd
Start a webserver
> cd bower_components\heatmap.js-amd > python -m SimpleHTTPServer 1337 &
Then browse to http://localhost:1337/examples/
- Coding
- Javascript
window.onload = function() { function generateRandomData(len) { var points = []; var max = 0; var width = 840; var height = 400; var len = 200; while(len--) { var val = Math.floor(Math.random()*100); max = Math.max(max, val); var point = { x: Math.floor(Math.random()*width), y: Math.floor(Math.random()*height), value: val }; points.push(point); } var data = {max:max, data: points}; return data; } var heatmapInstance = h337.create({ container: document.querySelector('.heatmap') }); var data = generateRandomData(200); heatmapInstance.setData(data); }
- Result
- Demo