Skip to content

Commit

Permalink
feat: make network chart using the fullscreen feature
Browse files Browse the repository at this point in the history
  • Loading branch information
AlasDiablo committed Mar 21, 2024
1 parent c9352d0 commit 2e4562c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/app/js/formats/chart/network/NetworkView.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ import compose from 'recompose/compose';
import get from 'lodash/get';
import isEqual from 'lodash/isEqual';
import { scaleLinear } from 'd3-scale';
import { StyleSheet, css } from 'aphrodite/no-important';

import injectData from '../../injectData';
import MouseIcon from '../../utils/components/MouseIcon';
import ZoomableFormat from '../../utils/components/ZoomableFormat';

const simulationOptions = {
animate: true,
width: '100%',
height: '100%',
strength: {
charge: ({ radius }) => -radius * 100,
},
Expand All @@ -29,12 +32,17 @@ const labelOffset = {
y: ({ radius }) => radius * Math.sin(Math.PI / 4) + 6,
};

const styles = {
const styles = StyleSheet.create({
container: {
overflow: 'hidden',
userSelect: 'none',
height: '100%',
minHeight: '600px',
},
};
network: {
minHeight: '600px',
},
});

const zoomOptions = { minScale: 0.25, maxScale: 16 };

Expand Down Expand Up @@ -65,7 +73,7 @@ class Network extends Component {

return (
<ZoomableFormat>
<div style={styles.container}>
<div className={css(styles.container)}>
<InteractiveForceGraph
simulationOptions={simulationOptions}
zoom
Expand All @@ -75,6 +83,7 @@ class Network extends Component {
labelOffset={labelOffset}
highlightDependencies
createSimulation={this.createSimulation}
className={css(styles.network)}
>
{nodes.map((node) => (
<ForceGraphNode
Expand Down
8 changes: 6 additions & 2 deletions src/app/js/formats/utils/components/ZoomableFormat.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const ZoomableFormat = ({ children, p }) => {
return (
<>
<div>
{children}
{!open ? children : null}

<Tooltip title={p.t('fullscreen')} placement="left">
<IconButton
onClick={handleClickOpen}
Expand Down Expand Up @@ -57,9 +58,12 @@ const ZoomableFormat = ({ children, p }) => {
style={{
borderRadius: '5px',
margin: '24px',
height: '100%',
maxHeight: 'calc(100% - 48px)',
overflow: 'scroll',
}}
>
{children}
{open ? children : null}
</fieldset>
</DialogContent>
</Dialog>
Expand Down

1 comment on commit 2e4562c

@HeleneCreusot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AlasDiablo dans networkView.js, c'est les height et width avec unité de mesure % qui provoque le bug #2050

Please sign in to comment.