I am looking for a plugin or some code, in which I have an array with prices, and paint a table with a color from green to red, depending on the cheapest and most expensive prices. The colors would not be degraded in the table, but would depend on the value of the price.
The maximum and minimum of the array are removed
var valores = [192.10,192.5,192.3];
console.log(Math.min.apply(null, valores));
console.log(Math.max.apply(null, valores));
But I can not find a way to make them paint a color, depending on of whether the price is more expensive or cheaper. I can not put code because everything I've done is useless, but not to leave the question very open, I put as far as I've come (Although I say it is completely wrong):
prices.sort()
$.each(prices, function(i, e) {
$('#grid').append("<div class='grisha' style='background-color:hsl(" + i * multiplier % 360 + ", 100%, 70%);color:"+color+";'><div class='results'>"+e.min+"<br><small><i>"+previous+"</i></small></div></div>");
});
Any plugin or code would help me start something.