plotly / dash-cytoscape

Interactive network visualization in Python and Dash, powered by Cytoscape.js
https://dash.plot.ly/cytoscape
MIT License
600 stars 119 forks source link

[Bug ]demo usage-image-export.py results in Invalid argument error #215

Open bfr42 opened 5 months ago

bfr42 commented 5 months ago

Description

I downloaded github.com/plotly/dash-cytoscape/blob/main/demos/usage-image-export.py and executed it using python 3.12.3. It normally starts, but in the browser I get the bellow error. Tested with Chrome, Firefox, Edge browser under Windows. I would like to use the export in my own Dash Cytoscape application.

Invalid argument `generateImage.type` passed into Cytoscape with ID "cytoscape".
Expected one of ["svg","png","jpg","jpeg"].

(This error originated from the built-in JavaScript code that runs Dash apps. Click to see the full stack trace or open your browser's console.)
Error: Invalid argument `generateImage.type` passed into Cytoscape with ID "cytoscape".

Expected one of ["svg","png","jpg","jpeg"].

    at propTypeErrorHandler (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_16_1m1712603851.dev.js:8118:9)

    at CheckedComponent (http://127.0.0.1:8050/_dash-component-suites/dash/dash-renderer/build/dash_renderer.v2_16_1m1712603851.dev.js:3729:70)

    at renderWithHooks (http://127.0.0.1:8050/_dash-component-suites/dash/deps/react-dom@16.v2_16_1m1712603851.14.0.js:14938:20)

    at updateFunctionComponent (http://127.0.0.1:8050/_dash-component-suites/dash/deps/react-dom@16.v2_16_1m1712603851.14.0.js:17169:22)

    at beginWork (http://127.0.0.1:8050/_dash-component-suites/dash/deps/react-dom@16.v2_16_1m1712603851.14.0.js:18745:18)

    at HTMLUnknownElement.callCallback (http://127.0.0.1:8050/_dash-component-suites/dash/deps/react-dom@16.v2_16_1m1712603851.14.0.js:182:16)

    at Object.invokeGuardedCallbackDev (http://127.0.0.1:8050/_dash-component-suites/dash/deps/react-dom@16.v2_16_1m1712603851.14.0.js:231:18)

    at invokeGuardedCallback (http://127.0.0.1:8050/_dash-component-suites/dash/deps/react-dom@16.v2_16_1m1712603851.14.0.js:286:33)

    at beginWork$1 (http://127.0.0.1:8050/_dash-component-suites/dash/deps/react-dom@16.v2_16_1m1712603851.14.0.js:23338:9)

    at performUnitOfWork (http://127.0.0.1:8050/_dash-component-suites/dash/deps/react-dom@16.v2_16_1m1712603851.14.0.js:22292:14)

Steps/Code to Reproduce

python github.com/plotly/dash-cytoscape/blob/main/demos/usage-image-export.py

Versions

Dash 2.16.1 Dash Cytoscape 1.0.0

FredBill1 commented 5 months ago

Adding a value=None, here seems to fix it.

https://github.com/plotly/dash-cytoscape/blob/be60394916f01c6de82f9816f09ab318b5f0f2da/demos/usage-image-export.py#L120-L126

dcc.Tabs( 
    id="tabs", 
    children=[ 
        dcc.Tab(label="generate jpg", value="jpg"), 
        dcc.Tab(label="generate png", value="png"), 
    ], 
    value=None,
),