Skip to content

Commit

Permalink
graph style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
evc29 committed Jul 30, 2024
1 parent ee6f914 commit 04133ab
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions src/components/Graph/ControlPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ const ControlPanel: React.FC<ControlPanelProps> = ({
justifyContent: 'center',
alignItems: 'center',
display: 'inline-block',
fontFamily: 'Roboto',
}}
>
Controls
Expand Down
10 changes: 6 additions & 4 deletions src/components/Graph/Graph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const Graph: React.FC<GraphProps> = ({
legendNodeLabel,
legendEdgeLabel,
order,
fontFamily = 'Roboto',
}) => {
const cyRef = useRef<Core | null>(null);

Expand Down Expand Up @@ -280,7 +281,7 @@ const Graph: React.FC<GraphProps> = ({
fontSize: '12px',
borderWidth: '2px',
borderColor: 'black',
fontFamily: 'Roboto',
fontFamily: fontFamily,
backgroundFit: 'contain',
backgroundClip: 'none',
backgroundImage: `url(${starSVGURL})`,
Expand All @@ -303,7 +304,7 @@ const Graph: React.FC<GraphProps> = ({
: elements[i].id
: '',
fontSize: '12px',
fontFamily: 'Roboto',
fontFamily: fontFamily,
},
});
}
Expand Down Expand Up @@ -359,7 +360,7 @@ const Graph: React.FC<GraphProps> = ({
}

content.style.fontSize = '12px';
content.style.fontFamily = 'Roboto';
content.style.fontFamily = fontFamily;
const tip = popperFactory(ref, content, {});
node.on('mouseover', () => tip.show());
node.on('mouseout', () => tip.hide());
Expand Down Expand Up @@ -394,7 +395,7 @@ const Graph: React.FC<GraphProps> = ({
}

content.style.fontSize = '12px';
content.style.fontFamily = 'Roboto';
content.style.fontFamily = fontFamily;
const tip = popperFactory(ref, content, {});
edge.on('mouseover', () => tip.show());
edge.on('mouseout', () => tip.hide());
Expand Down Expand Up @@ -474,6 +475,7 @@ const Graph: React.FC<GraphProps> = ({
marginLeft: '3px',
fontSize: '18px',
fontWeight: 'bold',
fontFamily: fontFamily,
}}
>
{title}
Expand Down
11 changes: 9 additions & 2 deletions src/components/Graph/Legend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ const Legend: React.FC<LegendProps> = ({
padding: '5px',
}}
>
<Typography style={{ fontSize: '18px', margin: '3px' }}>
<Typography
style={{ fontSize: '18px', margin: '3px', fontFamily: 'Roboto' }}
>
{legendNodeLabel ? legendNodeLabel : 'Node Type'}
</Typography>
{uniqueCat
Expand Down Expand Up @@ -106,6 +108,7 @@ const Legend: React.FC<LegendProps> = ({
marginLeft: '4px',
cursor: 'pointer',
fontSize: '14px',
fontFamily: 'Roboto',
}}
onClick={() => onToggle(category)}
>
Expand Down Expand Up @@ -154,6 +157,7 @@ const Legend: React.FC<LegendProps> = ({
marginLeft: '4px',
cursor: 'pointer',
fontSize: '14px',
fontFamily: 'Roboto',
}}
onClick={() => onToggle(category)}
>
Expand All @@ -167,7 +171,9 @@ const Legend: React.FC<LegendProps> = ({

{edgeType && edgeTypes !== null ? (
<div>
<Typography style={{ fontSize: '18px', margin: '3px' }}>
<Typography
style={{ fontSize: '18px', margin: '3px', fontFamily: 'Roboto' }}
>
{legendEdgeLabel ? legendEdgeLabel : 'Edge Type'}
</Typography>
{edgeTypes.map((category) => {
Expand Down Expand Up @@ -208,6 +214,7 @@ const Legend: React.FC<LegendProps> = ({
marginLeft: '4px',
cursor: 'pointer',
fontSize: '14px',
fontFamily: 'Roboto',
}}
onClick={() => onToggle(category)}
>
Expand Down
8 changes: 6 additions & 2 deletions src/components/Graph/ScaleLegend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const ScaleLegend: React.FC<ScaleProps> = ({ scales, width }) => {
style={{
margin: '3px 0',
fontSize: '16px',
fontWeight: 'bold',
fontFamily: 'Roboto',
}}
>
Edge Weight Scale:
Expand All @@ -60,7 +60,7 @@ const ScaleLegend: React.FC<ScaleProps> = ({ scales, width }) => {
style={{
margin: '3px 0',
fontSize: '14px',
fontWeight: 'bold',
fontFamily: 'Roboto',
}}
>
{scaleFormula}
Expand Down Expand Up @@ -88,6 +88,7 @@ const ScaleLegend: React.FC<ScaleProps> = ({ scales, width }) => {
style={{
marginLeft: '10px',
fontSize: '14px',
fontFamily: 'Roboto',
}}
>
{min.toFixed(2)}
Expand All @@ -107,6 +108,7 @@ const ScaleLegend: React.FC<ScaleProps> = ({ scales, width }) => {
style={{
marginLeft: '10px',
fontSize: '14px',
fontFamily: 'Roboto',
}}
>
{mid1.toFixed(2)}
Expand All @@ -126,6 +128,7 @@ const ScaleLegend: React.FC<ScaleProps> = ({ scales, width }) => {
style={{
marginLeft: '10px',
fontSize: '14px',
fontFamily: 'Roboto',
}}
>
{mid2.toFixed(2)}
Expand All @@ -145,6 +148,7 @@ const ScaleLegend: React.FC<ScaleProps> = ({ scales, width }) => {
style={{
marginLeft: '10px',
fontSize: '14px',
fontFamily: 'Roboto',
}}
>
{max.toFixed(2)}
Expand Down
1 change: 1 addition & 0 deletions src/components/Graph/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface Edge {
legendNodeLabel?: string,
legendEdgeLabel?: string,
order?: string[],
fontFamily?: string,
}


Expand Down
1 change: 1 addition & 0 deletions stories/Graph.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ PilotDataWithCentered.args = {
'TF',
'Low DNase',
],
fontFamily: 'Times New Roman',
};

export const FiftyPercent = Template.bind({});
Expand Down

0 comments on commit 04133ab

Please sign in to comment.