Skip to content

Commit

Permalink
add color indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoErmini committed May 24, 2022
1 parent 5e1c686 commit 11c88e3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@tcs-open-source/simple-d3-heatmap",
"version": "1.0.17",
"version": "1.0.19",
"description": "This module allows you to create nicely looking heatmap calendars with ease.",
"main": "simple-d3-heatmap.js",
"files": [
"simple-d3-heatmap.js",
"simple-d3-heatmap.min.js"
],
"scripts": {
"scripts":
"test": "echo \"Error: no test specified\" && exit 1",
"minify": "uglifyjs 'simple-d3-heatmap.js' --compress --mangle --output simple-d3-heatmap.min.js",
"prepack": "npm run minify"
Expand Down
23 changes: 23 additions & 0 deletions simple-d3-heatmap.js
Original file line number Diff line number Diff line change
Expand Up @@ -829,8 +829,31 @@ class SimpleD3Heatmap {
.range([0, 1])
.domain([0, 1]);
break;
case 5:
if (value >= 0 && value < 25){
return "rgb(76, 175, 80)"
// verde
}
if (value >= 25 && value < 50){
// yellow
return "rgb(255, 221, 0)"
}
if (value >= 50 && value < 75){
// orange
return "rgb(255, 165, 0)"
}
if(value >= 75 && value <= 100){
// red
return "#F03E3E"
}
else{
// gray
return "rgb(211, 211, 211)"
}


}
// "rgb (211, 211, 211)"
console.log(colors(value));
return colors(value);
}
Expand Down

0 comments on commit 11c88e3

Please sign in to comment.