From f19e002a6c07a0d6912a0ecdcd6ad2415141bea6 Mon Sep 17 00:00:00 2001 From: Jamie Waese Date: Wed, 3 Jan 2024 21:31:20 -0500 Subject: [PATCH] prettier EFP tooltip --- Eplant/View/viewData.ts | 1 + Eplant/views/eFP/Tooltips/EFPTooltip.tsx | 103 ++++++++--------------- 2 files changed, 35 insertions(+), 69 deletions(-) diff --git a/Eplant/View/viewData.ts b/Eplant/View/viewData.ts index 948ede94..25d1e62f 100644 --- a/Eplant/View/viewData.ts +++ b/Eplant/View/viewData.ts @@ -87,6 +87,7 @@ export function useViewData( const id = (view?.id ?? 'generic-view') + '-' + useViewID() const [viewData, setViewData] = useAtom(getViewAtom(key)) const [viewState, setViewState] = useAtom(getViewStateAtom(id)) + // console.log(viewData) // If there is no cached viewData then load it using the view's loader React.useEffect(() => { diff --git a/Eplant/views/eFP/Tooltips/EFPTooltip.tsx b/Eplant/views/eFP/Tooltips/EFPTooltip.tsx index 9325ddcf..531eedda 100644 --- a/Eplant/views/eFP/Tooltips/EFPTooltip.tsx +++ b/Eplant/views/eFP/Tooltips/EFPTooltip.tsx @@ -31,6 +31,30 @@ export const setStroke = ( } } +function KeyValueRow(props: { + label: string, + value: string | number +}) { + + return + ({ + color: theme.palette.text.secondary, + textAlign: 'left', + border: 'none', + })} + > + {props.label} + + ({ + color: theme.palette.text.primary, + textAlign: 'right', + border: 'none' + })}>{props.value} + +} + function SVGTooltip(props: { el: SVGElement | null group: EFPGroup @@ -75,78 +99,19 @@ function SVGTooltip(props: { > - - - Sample name - - {props.tissue.name} - - - - Level - - - {props.tissue.mean.toFixed(2)}±{props.tissue.std.toFixed(2)} + + + {props.tissue.name} - {props.state.colorMode == 'relative' ? ( - <> - - - Samples - - {props.tissue.samples} - - - - Log2 fold change vs control - - - {Math.log2( + + - - - ) : ( - <> - - - Samples - - - {props.tissue.samples} - - - - )} + ).toFixed(2)}/>