User-Driven Programming Support for Rapid Visualization Authoring in D3

Hannah K. Bako, Alisha Varma, Anuoluwapo Faboro, Mahreen Haider, Favour Nerrise, John P. Dickerson, Leilani Battle

Introduction

D3.js remains the industry standard for web-based data visualization due to its immense flexibility. However, this power comes at the cost of a steep learning curve. Implementing even standard interactive features, such as brushing or zooming, requires sophisticated state management and deep API knowledge. While template-based tools attempt to lower this barrier, they often create "rigid artifacts" that break when users customize the underlying code. To address this, we present Mirny, a prototyping environment designed to provide resilient, automated support for D3 authoring through intelligent recommendations and automated code augmentation.

The Mirny System

Mirny bridges the gap between restrictive templates and manual coding through two primary technical innovations: an MDP-based recommendation engine and an automated "Code Fitter."

The Mirny interface includes a chart type selector (A), code editor (B), visualization output (C), and an interaction recommendation panel (D).

MDP-Based Recommendation Engine

To assist users in the design process, Mirny models visualization authoring as a Markov Decision Process (MDP). The system predicts the most likely next interaction a user might need (e.g., adding a tooltip or a zoom behavior) based on a model trained on a corpus of 2,500 real-world D3 examples. This engine is dynamic, adapting its suggestions based on whether a user accepts, ignores, or undoes a recommendation.

Automated Code Augmentation

When a user selects a recommended interaction, the "Code Fitter" uses the Babel compiler to parse the user's script into an Abstract Syntax Tree (AST). Unlike simple snippet insertion, the system identifies specific variables and "anchor points" within the user's unique code structure. It then stitches the interaction logic directly into the existing script, ensuring the new functionality respects the user's specific data mappings and variable names.

Data-Driven Insights

Our development of Mirny was informed by an extensive analysis of 2,500 D3 examples scraped from GitHub, Bl.ocks.org, and Observable. This preliminary study revealed that the vast majority of online visualizations are concentrated within a few specific categories.

Frequency of visualization types across major D3 hosting platforms, highlighting the dominance of a few core chart types.

We identified the "Big Five" of D3: Bar charts, Geomaps, Line charts, Scatterplots, and Force-Directed Graphs. Together, these account for approximately 80% of the visualizations in our corpus. This finding suggests that a tool focusing on high-quality, resilient support for these core types can satisfy the majority of user needs while allowing for the iterative, non-linear nature of the design process.

Evaluation and Results

We evaluated Mirny through a user study involving 20 participants with varying levels of D3 expertise. Participants performed tasks using standard datasets such as Palmer Penguins and Iris. The results demonstrated significant improvements in both efficiency and design exploration:

  • 3.2x Speedup: Participants implemented interactions in an average of 5 minutes with Mirny, compared to 16 minutes in the manual baseline.
  • Increased Complexity: Users implemented nearly two additional interactions per visualization when supported by recommendations, suggesting that lower friction leads to richer designs.
  • Reduced Sunk Cost: By making implementation nearly instantaneous, Mirny allows users to "fail fast" and iterate through multiple design alternatives rather than settling for their first functional draft.

Discussion and Future Work

While Mirny significantly lowers the barrier to entry for interactive D3, it currently faces limitations regarding syntactic sensitivity; the AST-based augmentation requires valid, error-free code to function. Future work will explore the integration of Large Language Models (LLMs) to provide even more robust, context-aware support and the development of modular templates that allow users to pick and choose specific components like axes or legends. Ultimately, Mirny demonstrates that treating code as a dynamic, malleable structure—rather than a static template—is key to supporting the creative flow of visualization authoring.

Summary updated

BibTeX
@inproceedings{bako2023user,
  author = {Hannah K. Bako and Alisha Varma and Anuoluwapo Faboro and Mahreen Haider and Favour Nerrise and John P. Dickerson and Leilani Battle},
  title = {{User-Driven Programming Support for Rapid Visualization Authoring in D3}},
  booktitle = {IUI},
  year = {2023},
  doi = {10.1145/3581641.3584041},
}
Figure