- To draw circles with gradient translucency, use radial gradients.
- To position them, use
position: absolute
andleft: x
,top: y
(make sure to omit the radius).
Knowing these two CSS features, you can just iterate over the JSON, creating DOM–elements (div
will do) and modifying their style
property.
Schematically:
data.forEach(function (point) {
var div = document.createElement('div');
div.style.background = generateGradient(point.temperature);
div.style.left = point.x - radius;
div.style.top = point.y - radius;
container.appendChild(div);
});
The same is achievable with Canvas and SVG, but that's a longer story.