Sharing Interactive Python Charts as HTML II: Where One File Starts to Strain

In the last post a ten-row edge list became an interactive chart in three lines. That might be nice example, but it does not really show us what the powers and limits of D3Blocks are.
Real analyses have timestamps, thousands of rows, and a recipient on a corporate laptop with a strict firewall.
This post pushes on the approach until something gives. We'll try time-based data, run a size experiment, do the offline test we promised, compare against Plotly, embed a chart in Streamlit, and finish with a checklist for deciding when a file stops being enough.

As before, this is not a benchmark. Timings and sizes depend on your machine, your browser, and your data. The point is to learn what to measure, not to crown a winner.
Two Kinds of Time
Time-based data comes in two flavours that people routinely mix up.
A measured value changing over time: temperature, power consumption, a sensor reading.
An entity changing state over time: a job going from queued to running to done.
D3Blocks has a different chart for each, and the difference is worth understanding.
Measured Values: The Time Series
We'll generate a small, plausible dataset: daily consumption for three sectors.
The chart lets a reader zoom into a window, toggle series on and off, and read exact values at a point in time.

That sounds minor, but it changes the conversation. A static image says "consumption peaks in winter". An interactive one lets your colleague check whether transport peaks in winter too, and if the different dates align between the components, without sending you an email.
In this example we would be able to see all three line plots at the same time, without much problem but if we are looking at a dozen different plots, this would be complete mess.
Changing States: Moving Bubbles
Now a different question. Instead of a number changing, an entity moves between categories.
Imagine a batch pipeline where each job passes through stages.
Each bubble is a job. Its position is its current state. Press play and you watch the pipeline breathe. We can only show a frame here as a screenshot, but run it yourself, it does animage nicely

The shape of the data is the hint here: one row per event, with a timestamp, an identifier, and a state. If your data looks like an event log, this chart is worth a try.
A fair warning, though. Animation is great for "where is the bottleneck?" and poor for "exactly how many jobs were in validation at 08:43?". Choose the chart for the question you expect.
Scatter Plots and Projections
One more type, because it raises a subtle point.
The reader can flip between two projections of the same data. That's a nice use of interactivity: the file carries two views, and the recipient chooses. In this example we have pca on the left and tsne on the right

It's also an invitation to over-interpret. Clusters that appear in one projection may vanish in another, and visible separation is not the same as meaningful groups. A chart that makes patterns easy to see also makes spurious ones easy to see.
Weighing the File
Here's the experiment that one probably should run before deciding on any colour and style choices: how big does the file get, and how does it behave?
That tells you two things: how long generation takes and how large the file grows. Neither number tells you the thing that your manager or client care about, which is how it feels to use.
So we have to do the human part manually. Open each file, drag a node, hover, search. Write down the point at which it starts to stutter.
In my case the graph_100.html looks fine and is usable, but even the graph_1000.html stutters a bit on my own laptop and on my work laptop you could at best describe it as a slide show. And the larger ones are an absolute disaster.

Expect a pattern like this: file size grows roughly with the data, but responsiveness degrades earlier than file size suggests, because the browser has to lay out and redraw every element. Dense force-directed networks are especially demanding.
The practical rule: if you need to ask "is this too much data for the browser?", try the smaller version first. A filtered or aggregated chart is often a better analysis anyway. In general this is a package to visualize small datasets where each value has a meaningful impact. If you are applying it to tens of thousands of datapoints, you just have a pretty slide show in a browser at hand.
The Offline Test
In Part 1 we scanned the HTML for external links. Now the real test.
Generate the file.
Copy it to a different folder (or a different machine).
Turn off the network.
Open it.
It works, or it doesn't. If it doesn't, look at the browser's developer console. Failed requests will tell you exactly which resource was missing.
You can automate a rough version of the check:
Treat likely_offline_safe as a hint, not a guarantee. Scripts can load other scripts, and CSS can reference fonts. The browser test is the truth.
Who Can See What
This one is easy to forget because the chart looks so tidy. Open any exported file in a text editor and search for a value from your data. It's there, this can mean that a column you didn't display may still be included.
It sounds trivial, and it is. But it's also the kind of thing that goes wrong precisely because it's trivial. Before sharing, ask:
Does every column in this DataFrame need to be in the file?
Would I be comfortable with the recipient reading the raw data?
Could the file be forwarded?
If the answer to any of these is uncomfortable, a dashboard with access control is solving a real problem, not an imaginary one. Even if the data is not sensitive, perhaps it would be better to not include it to reduce the size and responsiveness of the file when viewed.
A Fair Comparison: What About Plotly?
D3Blocks is not the only tool that exports interactive HTML. Plotly does it, and so does Bokeh. Any honest evaluation should compare.
The same task in Plotly, a Sankey from the same edge list:
Notice the difference in mental model. The output looks as follows

With Plotly you map your data to the chart's structure yourself: build a node index, translate names to integers, assemble the figure. It's more manual, and more flexible.
With D3Blocks you hand over an edge list and the library does the translation. It's less code, and less control.
Then compare the output with the same tools as before:
Compare file size, external dependencies, and the experience of using each. And take note of an important caveat: the Plotly option include_plotlyjs=True embeds the whole library, which makes the file larger but safer offline. "cdn" keeps it small but needs a connection.
That trade-off, size versus self-containment, applies to any HTML exporter. It's a good example of the real difference between tools: not which can draw a Sankey, but what each chooses to optimise.
Question | D3Blocks | Plotly |
Input effort for network data | Low (edge list in, chart out) | Higher (build node index yourself) |
Control over details | Moderate | High |
Variety of chart families | Relationship-heavy | Broad general-purpose |
Offline behaviour | Check your export | Choose include_plotlyjs |
Treat that table as a starting hypothesis to test, not a verdict. Versions change.
Files Inside Dashboards
The file approach and the dashboard approach are not enemies. A generated chart can be embedded in a Streamlit app, let's say app.py.
Run it with streamlit run app.py.
This is a useful pattern. A dashboard can handle data refresh, user selection, and access, while D3Blocks handles one particular visual. Even better, you can regenerate the file based on a widget:
Now the application does the computation and the chart does the interaction. Each is doing what it's best at.
When Does a File Stop Being Enough?
A checklist, roughly in order of how often each one forces the decision.
Move to a dashboard when...
the data must be refreshed automatically
different people must see different data
you need authentication or an audit trail
the chart needs a computation the browser can't reasonably do (querying a database, running a model)
the dataset is too large for the browser to stay responsive
Stay with a file when...
the result is a snapshot for a specific audience or moment
you want to attach it to a report, ticket, or email
recipients are non-technical and just need to explore
you'd otherwise be hosting something purely to show one chart
A simple heuristic: if you're thinking about who is allowed to see it or when it updates, you're describing an application. If you're only thinking about how it looks and behaves, a file is probably fine.
When NOT to Use D3Blocks Specifically
If you need a standard bar, line, or histogram, a general-purpose library will serve you well and has a larger community. D3Blocks earns its place when your data is relational, flow-based, or event-like, and you want an interactive chart with very little code.
And if a chart type exists only because it looks impressive (animated particle text ...), ask whether it helps the reader understand anything. Sometimes the answer is "no, but it's fun", which is a perfectly honest answer.
Wrapping Up
So, how far can one file take you?
Further than most people expect. For snapshots, reports, and exploratory handovers, a single HTML file removes the hosting problem entirely. The recipient gets real interaction, and you keep a plain Python workflow.
But the boundaries are structural, not accidental:
The file is a snapshot, so freshness needs regeneration or an application.
The file contains your data, so privacy is your responsibility.
The browser is doing the work, so scale has a ceiling.
"Self-contained" is a claim to verify, not assume.
The skill worth building isn't mastery of one library. It's the habit of asking, before you share anything, what form should this analysis take? Sometimes the answer is an image. Sometimes a file. Sometimes a dashboard.



Comments