Editing & Styling
You'll need to be logged into Datapane.com or your Teams instance to use this feature - it is not currently supported on the open-source version.
‌One of the challenges of building reports is the dependence on a Python environment. Datapane now allows you to create and edit reports directly on our server, meaning it's much easier to onboard non-technical users and make small changes to existing reports.
Our web editor can be used on any of your existing reports - just click 'Edit' and you'll see a side-by-side view with the left hand side showing the report XML structure, and the right hand side showing a report preview. You can then edit the XML to update the report.
You can also create a report directly on Datapane.com by clicking the 'Create Report' button.

Inserting blocks

You can enrich your report by adding special blocks (click 'Insert Blocks'). For example, clicking on the Formula block will insert the following snippet into the web editor:
1
<Formula>[[x^2 + y^2 = z^2]]</Formula>
Copied!
When you click 'Preview', you'll see this display as follows:
You can edit the content inside the blocks to add additional parameters like name,as well as block-specific parameters. For example, here's a group with 2 columns:
1
<Group columns="2", label="My_group">
2
...
3
</Group>
Copied!

Empty block

If you need a placeholder for a chart that you'll upload from Python later, use the empty block. The editor will auto-generate a name which you can modify, and then push up assets to from Python (see next section).

Uploading Blocks from Python

Once you've created a report, you'll probably want to add some interactive plots and data from Python. You'll need the reportID, which you can find in the URL or in the editor bar by clicking Insert Assets from Python:
There are two ways to push up assets to an existing report from Python:

1. report.upload

This does a full refresh of everything in your report, overwriting any changes you may have made in the web editor - here's an example:
1
import datapane as dp
2
import altair as alt
3
from vega_datasets import data
4
5
source = data.cars()
6
7
plot1 = alt.Chart(source).mark_circle(size=60).encode(
8
x='Horsepower',
9
y='Miles_per_Gallon',
10
color='Origin',
11
tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon']
12
).interactive()
13
14
15
report = dp.Report(
16
dp.Text("## Simple Datapane Report with plot and table"),
17
dp.Plot(plot1),
18
dp.DataTable(source)
19
)
20
21
report.upload(id="XXXXXX")
Copied!
Be careful when using this option as you will lose any changes you've made on the web editor.
2. report.update_assets
This does a selective update of particular assets after you have already created a report. You'll need to give these assets a name and then pass them into a call to report.update_assets as follows:
1
import datapane as dp
2
import altair as alt
3
from vega_datasets import data
4
5
source = data.cars()
6
7
plot1 = alt.Chart(source).mark_circle(size=60).encode(
8
x='Horsepower',
9
y='Miles_per_Gallon',
10
color='Origin',
11
tooltip=['Name', 'Origin', 'Horsepower', 'Miles_per_Gallon']
12
).interactive()
13
14
report = dp.Report(
15
dp.Text("## Simple Datapane Report with plot and table"),
16
dp.Plot(plot1, name="plot1"),
17
dp.DataTable(source, name="source_df")
18
)
19
20
# First report upload
21
report.upload(name="Hello world")
22
23
# Make some changes to the datatable and update it selectively
24
source=source[source.Origin=="USA"]
25
report.update_assets(source_df=source)
Copied!