Skip to content

Commit

Permalink
Bucket to Class
Browse files Browse the repository at this point in the history
  • Loading branch information
akshayabali committed Aug 26, 2024
1 parent f6e8a4f commit 674b6e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions table.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ window.field_map = {
"elec" : [16, 17, 18, 19, 20, 21],
"uf" : [22, 23, 24, 25, 26],
"group" : [27],
"bucket" : [28]
"class" : [28]
}

window.field_value_map = {
Expand Down Expand Up @@ -91,7 +91,7 @@ window.field_value_map = {
"Process(uF)" : "uf",
"Scale (uf)" : "uf",
"Group" : "group",
"Bucket" : "bucket"
"Class" : "class"
}

window.current_field_map = field_value_map;
Expand Down Expand Up @@ -360,17 +360,17 @@ function updateTable(rows) {
})
// Add color to the row
.style("background-color", function (d, i) {
if (d[current_field_map["bucket"][0]]) {
if (d[current_field_map["class"][0]]) {
// Reduce opacity for the color
return d3.color(colorscale(mapping[d[current_field_map["bucket"][0]]])).copy({opacity: 0.2});
return d3.color(colorscale(mapping[d[current_field_map["class"][0]]])).copy({opacity: 0.2});

} else {
return "white";
}
})
.attr("own-color", function (d, i) {
if (d[current_field_map["bucket"][0]]) {
return d3.color(colorscale(mapping[d[current_field_map["bucket"][0]]])).copy({opacity: 0.2});
if (d[current_field_map["class"][0]]) {
return d3.color(colorscale(mapping[d[current_field_map["class"][0]]])).copy({opacity: 0.2});
} else {
return "white";
}
Expand Down
2 changes: 1 addition & 1 deletion tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ window.select_dataset = function (id) {
my_dataset = dataset.filter(function (d) {
for (let i = 0; i < id.length; i++) {
var check_id = id[i].replace(" ", "");
if (d[field_map["bucket"][0]].includes(check_id)) {
if (d[field_map["class"][0]].includes(check_id)) {
return true;
}
}
Expand Down

0 comments on commit 674b6e8

Please sign in to comment.