plotly / react-cytoscapejs

React component for Cytoscape.js network visualisations
MIT License
480 stars 68 forks source link

how to use cytoscape-sbgn-stylesheet in CytoscapeComponent? #85

Open doudou673 opened 3 years ago

doudou673 commented 3 years ago

I want to use sbgn-stylesheet in my react app, but it doesn't work image

borivojevic commented 2 years ago

You can use cy prop to access the Cytoscape API directly.

For example:

import cytoscape from "cytoscape";

import CytoscapeComponent from "react-cytoscapejs";
import sbgnStylesheet from "cytoscape-sbgn-stylesheet";

export default function App() {
  const cyStylesheet = sbgnStylesheet(cytoscape);
  return (
      <CytoscapeComponent
        elements={CytoscapeComponent.normalizeElements(elements)}
        cy={(cy) => cy.style(cyStylesheet)}
      />
  );
}