Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to export the dash layout as an html? #145

Closed
diego-ardila-alvarez opened this issue Oct 16, 2017 · 4 comments
Closed

Is there a way to export the dash layout as an html? #145

diego-ardila-alvarez opened this issue Oct 16, 2017 · 4 comments

Comments

@diego-ardila-alvarez
Copy link

Is there a way to export the dash layout as an html?

I am familiar with:

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()
...
app.run_server()

In order to render the html output in a browser. Is there a way to directly export the html output into a file? With plotly objects for example, I use,

plot(figure, output_type='div')

To export a single plot as a div. But I would like to combine plots and html components (text, list, etc..) into a single html.

@ned2
Copy link
Contributor

ned2 commented Nov 2, 2017

The Dash server sends the remote client a JSON serialised representation of the layout tree which is hydrated into HTML by React in the browser. It wouldn't take much to write an HTML export function for a Python layout tree consisting only of the HTML components, however the Dash core components correspond to Dash/React components so the potentially complex custom HTML generation logic for these is handled on the client side -- so server side HTML export doesn't really make sense.

You can however open up the developer tools and copy the HTML contents of nodes in the DOM that you're after.

@chriddyp
Copy link
Member

chriddyp commented Nov 2, 2017

You could also try to save the file in your browser as an HTML file.
save-file

This isn't available programatically yet - we would need to somehow render the Dash app in the web browser and then download it (using electron or selenium)

Also note that if you save the file this way as an HTML file, any of the interactivity in your code that use app.callback won't work in a standalone HTML file - app.callback requires a python server. We may add client-side (JS) built-in interactivity in the future through some type of declarative API (see plotly/dash-renderer#7) but that isn't available yet.

@ned2
Copy link
Contributor

ned2 commented Nov 3, 2017

Ah yeah saving as HTML in browser works too. View source just shows the initial skeleton HTML so had assumed the same would apply to saving as HTML.

@AveryData
Copy link

any new features making the export as HTML possible? Looking to have a button to save as PDF.

HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 22, 2021
HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 28, 2021
HammadTheOne pushed a commit to HammadTheOne/dash that referenced this issue May 28, 2021
* refactor styling api

* update table props

* fix test regressions

* remove column width/maxWidth/minWidth

* fix lint in test

* update test column widths api usage

* update test column widths api usage

* update test column widths api usage

* fix tests

* use snake case

* styling examples

* - improve discoverability (table, cells, headers, and cells_and_headers are top level props)
- isolate conditionals in 'if' property
- add style calc and apply for headers

* fix visual regressions

* revert visual test breaking change

* update styling api usage

* update copy/paste test

* test delta

* test delta

* test delta

* test delta

* test delta

* test delta

* fix test regression

* fix test regression

* remove .only

* update filtering interface to be more intuitive / flexible

* styling refactoring - phase 2

- nomenclature stabilization
- style filters

* refactor dataframe -> data
HammadTheOne pushed a commit that referenced this issue Jul 23, 2021
* refactor styling api

* update table props

* fix test regressions

* remove column width/maxWidth/minWidth

* fix lint in test

* update test column widths api usage

* update test column widths api usage

* update test column widths api usage

* fix tests

* use snake case

* styling examples

* - improve discoverability (table, cells, headers, and cells_and_headers are top level props)
- isolate conditionals in 'if' property
- add style calc and apply for headers

* fix visual regressions

* revert visual test breaking change

* update styling api usage

* update copy/paste test

* test delta

* test delta

* test delta

* test delta

* test delta

* test delta

* fix test regression

* fix test regression

* remove .only

* update filtering interface to be more intuitive / flexible

* styling refactoring - phase 2

- nomenclature stabilization
- style filters

* refactor dataframe -> data
HammadTheOne pushed a commit that referenced this issue Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants