Skip to content

Graph with image + text on the same node ? #524

Answered by dimitri995
dimitri995 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mohidmakhdoomi,

Thank you for your answer. I found a solution with this code by using nodeCanvasObject :

  import jsIcon from './../../assets/javascript-icon.png';
  import javaIcon from './../../assets/jave-icon.png';
  import pythonIcon from './../../assets/python-icon.png';

  ...

    <ForceGraph2D
      ref={fgRef}
      height={600}
      width={2000}
      graphData={graphData}
      cooldownTicks={100}
      onEngineStop={() => fgRef.current.zoomToFit(400)}
      nodeAutoColorBy="group"
      nodeCanvasObject={(node, ctx, globalScale) => {
        if (node.type === 'img') {
          const img = new Image();
          if(node.path.endsWith('package.json')) {
            img.sr…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dimitri995
Comment options

Answer selected by dimitri995
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants