How to share interactive Plotly charts with a link

Guides ·

A screenshot of a Plotly figure loses the interactions that made the chart useful. An HTML export can keep hover labels, zooming and legend controls, and Publidock can give that export a browser URL your team can open.

This works for a saved figure. A Dash application with Python callbacks needs a running application server; uploading its source files does not turn it into a static website.

Export a self-contained HTML file

Here is a small example with synthetic data:

import plotly.express as px

fig = px.bar(
    x=["North", "South", "West"],
    y=[18, 25, 21],
    labels={"x": "Region", "y": "Orders"},
    title="Example orders by region",
)
fig.write_html("orders.html", include_plotlyjs=True, full_html=True)

Open orders.html locally and check its interactions. include_plotlyjs=True includes the chart library in the export. The file is larger, but the chart does not need a separate request to a Plotly JavaScript CDN. full_html=True produces a complete page rather than a fragment that needs a surrounding template.

If you also want to share the surrounding analysis, the Jupyter notebook guide covers exporting a complete report with saved outputs.

Plotly also supports smaller exports that load the library externally. That can be useful, but it adds another service that every viewer must be able to reach. For a first share, a self-contained export is easier to test. The Plotly HTML export documentation explains the tradeoff.

Review the data inside the chart

The exported file carries the figure's data. A chart hidden behind company sign-in still gives an authorized viewer access to those bytes. Remove columns, hover fields or individual records that the audience should not receive before exporting.

A static HTML chart cannot enforce row-level access to data already embedded in the file. If each viewer needs a different dataset, use a backend that enforces those permissions. Publidock's sharing rule controls who can open the artifact; it does not rewrite the data for each person.

Publish the export

Sign in to Publidock and upload orders.html. For a report containing several charts, write an HTML report that includes them, or publish a folder with an entry page and links to each exported figure. Keep supporting files and relative paths together.

New sites use link sharing by default. In the browser publishing flow, check the preview and choose the audience before Go Live. With an automated upload that publishes immediately, configure the sharing rule before uploading confidential content. Company-domain, named-people and password options depend on the plan. The HTML report guide walks through the audience check.

Once the upload is live, open its URL as a viewer. Check hover labels, zoom, legend clicks and the layout on a narrow screen. Those checks test the artifact your colleague receives, rather than the chart still running inside your notebook.

Refresh the figure at the same address

Generate the next export from your updated dataset and publish it as a new version of the existing site. Its address and sharing rule stay in place. Check the live version before telling the team that the numbers have changed.

If you automate this step, use Publidock's CLI or HTTP API to publish the exported file or ZIP. Keep credentials outside the HTML and use a publishing token with the permissions the job needs.

Know when an export is enough

A saved chart is a good fit when viewers need to explore a snapshot of the data using the controls already in the figure. Export another version when that snapshot changes.

If a control must run a new Python calculation, query a private database or apply per-user permissions, you need a hosted application. The static export and the application solve different parts of the workflow.

Publish a chart, or read the file formats and publishing documentation before combining several exports into a report.

Publish a file · All posts