File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
js/source/legacy/d3/graphers Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 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 = { } ;
You can’t perform that action at this time.
0 commit comments