@@ -23,6 +23,8 @@ export const Graph3D: React.FC = () => {
2323 const [ message , setMessage ] = useState ( '' ) ;
2424 const navigate = useNavigate ( ) ;
2525 const location = useLocation ( ) ;
26+ const [ colorByOption , setColorByOption ] = useState < 'cell_line' | 'assay' > ( 'cell_line' ) ;
27+
2628
2729 useEffect ( ( ) => {
2830 const queryParams = new URLSearchParams ( location . search ) ;
@@ -84,10 +86,41 @@ export const Graph3D: React.FC = () => {
8486 links : [ ] ,
8587 } ;
8688
89+ const toggleColorBy = ( ) => {
90+ setColorByOption ( prev => prev === 'cell_line' ? 'assay' : 'cell_line' ) ;
91+ } ;
92+
8793 return (
8894 < div >
8995
9096 < div className = "z-1 position-absolute p-1 rounded-3" >
97+ < div className = "d-flex mb-2" >
98+ < div className = "btn-group w-100" role = "group" aria-label = "Color by option" >
99+ < input
100+ type = "radio"
101+ className = "btn-check"
102+ name = "colorByOptions"
103+ id = "colorByCell"
104+ checked = { colorByOption === 'cell_line' }
105+ onChange = { ( ) => setColorByOption ( 'cell_line' ) }
106+ />
107+ < label className = "btn btn-outline-primary" htmlFor = "colorByCell" >
108+ Cell Line
109+ </ label >
110+
111+ < input
112+ type = "radio"
113+ className = "btn-check"
114+ name = "colorByOptions"
115+ id = "colorByAssay"
116+ checked = { colorByOption === 'assay' }
117+ onChange = { ( ) => setColorByOption ( 'assay' ) }
118+ />
119+ < label className = "btn btn-outline-primary" htmlFor = "colorByAssay" >
120+ Assay
121+ </ label >
122+ </ div >
123+ </ div >
91124 < div className = "d-flex" >
92125 < input
93126 type = "text"
@@ -104,6 +137,7 @@ export const Graph3D: React.FC = () => {
104137 Search
105138 </ button >
106139 </ div >
140+
107141 < div className = "z-2 position-absolute p-1 text-white p-3" >
108142 { message && < p className = "z-2" > { message } </ p > }
109143 </ div >
@@ -115,7 +149,7 @@ export const Graph3D: React.FC = () => {
115149 nodeLabel = { ( node : GraphNode ) => (
116150 `<div><b>${ node . id } </b><br/>cell_line: ${ node . cell_line } <br/>assay: ${ node . assay } <br/>${ node . description } </div>`
117151 ) }
118- nodeAutoColorBy = "cell_line"
152+ nodeAutoColorBy = { colorByOption }
119153 nodeRelSize = { 60 }
120154 enableNodeDrag = { false }
121155 onNodeClick = { ( node : GraphNode ) => {
0 commit comments