Skip to content

Commit 60ca8a8

Browse files
authored
Merge pull request #4719 from solgenomics/topic/fixing_histogram
fixing histogram when management factors are present
2 parents de28d94 + b244d81 commit 60ca8a8

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

js/source/legacy/d3/graphers/stackedObservationPhenotypeHistogram.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,24 @@
3535
}
3636
var histLoc = d3.select(loc);
3737
var header = data[0];
38-
var traitName = header[header.length-(header[header.length-1]!="notes"?1:2)];
38+
39+
// var traitName = header[header.length-(header[header.length-1]!="notes"?1:2)];
40+
41+
// Find the index of the "notes" column
42+
var notesIndex = header.indexOf("notes");
43+
44+
if (notesIndex !== -1 && notesIndex > 0) {
45+
// Get the column before "notes"
46+
var traitName = header[notesIndex - 1];
47+
} else {
48+
// Handle the case where "notes" is the first column or not found
49+
var traitName = null; // You can use a default value or handle this case as needed
50+
}
51+
52+
53+
// The `traitName` variable contains the column before "notes" or null if "notes" is the first column or not found
54+
console.log(traitName);
55+
3956

4057
var observations = data.slice(1).map(function(d){
4158
var o = {};

0 commit comments

Comments
 (0)