cytoscape save graph as image by button

后端 未结 2 1154
醉梦人生
醉梦人生 2021-02-09 03:39

I saw in the cytoscape.js tutorial that there are ways to represent the graph as image (png, jpg), but there is a way to represent it as regular graph, and if the user would wan

2条回答
  •  我寻月下人不归
    2021-02-09 04:14

    Improving the answer marked as correct:

    You can use saveAs() directly, simply do:

    import { saveAs } from "file-saver"; //or require
    ...
    saveAs(cy.png(), "graph.png");
    

    No need to handle blob content, same goes for .jpg()

提交回复
热议问题