I have put inside nodes svg files as background-images,
Inside the web browser (Chrome) the quality is good, but after exporting the background image quality degrades significantly.
Using the following callback to generate Image from cytoscape:
@app.callback(
Output("cytoscape", "generateImage"),
[
Input("as-svg-button", "n_clicks"),
Input("as-png-button", "n_clicks"),
])
def get_image(get_svg_clicks,get_png_clicks):
# detect which button was pressed
changed_id = [p['prop_id'] for p in dash.callback_context.triggered][0]
if changed_id == 'as-svg-button.n_clicks':
ftype= "svg"
elif changed_id == 'as-png-button.n_clicks':
ftype= "png"
# File type to output of 'svg, 'png', 'jpg', or 'jpeg' (alias of 'jpg')
#ftype = tab #tab
# 'store': Stores the image data in 'imageData' !only jpg/png are supported
# 'download'`: Downloads the image as a file with all data handling
# 'both'`: Stores image data and downloads image as file.
#action = 'store'
action = 'download'
return {
'type': ftype,
'action': action,
'filename': 'Output_Graph'
}
I have put inside nodes svg files as background-images,
Inside the web browser (Chrome) the quality is good, but after exporting the background image quality degrades significantly.
Using the following callback to generate Image from cytoscape:
Dash version: Dash 2.0.0 Dash Core Components 2.0.0 Dash HTML Components 2.0.0