MobileVisFixer: Tailoring Web Visualizations for Mobile Phones Leveraging an Explainable Reinforcement Learning Framework

Aoyu Wu, Wai Tong, Tim Dwyer, Bongshin Lee, Petra Isenberg, Huamin Qu

TL;DR

MobileVisFixer is an automated framework that uses explainable reinforcement learning (RL) to redesign desktop-centric web visualizations for mobile screens. By deconstructing SVG charts into a declarative format and applying learned layout policies, it fixes common readability issues—like tiny text and overlapping labels—while strictly preserving the underlying data integrity.

What Problem Does This Paper Address?

Most data visualizations on the web are "desktop-first." When viewed on a smartphone, these charts often become unusable: text becomes microscopic, labels overlap into an illegible mess, or the chart simply bleeds off the edge of the screen.

Current solutions are lackluster. Developers usually have to manually tweak CSS and SVG attributes for different screen sizes, which is tedious and error-prone. Existing automated tools often rely on rigid, rule-based logic (e.g., "if text is too long, use an ellipsis"). As the authors demonstrate, these rules are brittle; they often hide critical information or create new layout "bugs" because they don't understand the holistic context of the visualization.

Methods

The authors treat visualization redesign as an optimization problem solved through a two-phase process:

  1. Deconstruction: The system crawls SVG-based charts and "decodes" them. It identifies visual groups (like all labels on an X-axis) and maps their properties into a declarative format (similar to Vega). It distinguishes between independent attributes (like font size) and dependent attributes (like a label’s position, which depends on the axis it's attached to).
  2. Optimization via Reinforcement Learning: To mimic the "trial-and-error" process of a human designer, the researchers used a Markov Decision Process (MDP).
  3. State: The current set of mobile-friendly issues (e.g., "Text is overlapping").
  4. Actions: 23 possible modifications, such as resizing the view, repositioning legends, or adjusting font sizes.
  5. Reward: A cost function that penalizes "bad" states (like content being out of the viewport).
  6. The Heuristic: They used a Policy Gradient method to learn a stochastic policy. Crucially, they implemented a "greedy" heuristic to solve issues one by one, combined with a long-term penalty to prevent the agent from getting stuck in "deadlocks" (where fixing one issue immediately creates another).

Datasets

The researchers built their own corpus to train and test the model:

  • The Crawl: They collected 374 SVG visualizations from 103 domains (including bl.ock.org and Google Charts) to identify common mobile-friendly failures.
  • Training Set: A manually curated subset of 81 visualizations representing diverse chart types and layout issues.
  • Generalization Set: To test the model on "unseen" data, they collected 51 visualizations related to "Covid-19" from Observable, published in early 2020. This ensured the model wasn't just memorizing specific chart templates.

Key Insights and Ideas

  • The "Big Five" Issues: The paper categorizes mobile visualization failures into five types: Out of Viewport, Unreadable Font Size, Cluttered Text, Distorted Layout, and Unwanted White Space.
  • Explainability is Key: Unlike "black box" deep learning, the RL framework produces a probabilistic decision rule (a policy). This means researchers can actually look at the model and see why it chose to shrink a margin or move a legend, making the system's "logic" transparent to developers.
  • Preserving Data Encoding: A major challenge in automated redesign is ensuring the "marks" (bars, dots, lines) still accurately represent the data. MobileVisFixer uses "reactive geometry" to ensure that if an axis moves, the data points move with it, maintaining the chart's mathematical truth.
  • RL as a Designer: The authors argue that RL is uniquely suited for this because design is rarely about finding a single "perfect" solution, but rather navigating trade-offs (e.g., "I want bigger text, but I don't want it to overlap").

Key Results

  • Effectiveness: MobileVisFixer successfully solved 89% of the mobile-friendly issues in the real-world test dataset.
  • Efficiency: The system is fast enough to run within "browser rendering time," making it practical for real-time web use.
  • Performance: In training, the agent learned to solve ~90% of problems within just 100 steps.
  • Qualitative Success: The authors showcase several "before and after" examples where cluttered, overflowing desktop charts are transformed into clean, legible mobile versions with repositioned legends and optimized axes.

Limitations and Future Work

  • Static Charts Only: Currently, the framework only handles static SVG visualizations. It does not account for interactive elements like tooltips or zooming, which are common in modern web charts.
  • Cartesian Focus: The model is optimized for single-view Cartesian charts (bar, line, scatter). It may struggle with more complex layouts like sunbursts or geographic maps.
  • The Aspect Ratio Problem: The authors intentionally avoided fixing "Distorted Layout" (aspect ratio changes) because there are currently no clear perceptual guidelines on how much you can stretch a chart before the data becomes misleading.
  • Human-in-the-Loop: Future versions could allow designers to "nudge" the RL policy, combining automated speed with human aesthetic judgment.

Summary updated

BibTeX
@article{wu2021mobilevisfixer,
  author = {Aoyu Wu and Wai Tong and Tim Dwyer and Bongshin Lee and Petra Isenberg and Huamin Qu},
  title = {{MobileVisFixer: Tailoring Web Visualizations for Mobile Phones Leveraging an Explainable Reinforcement Learning Framework}},
  journal = {IEEE Trans. Vis. Comput. Graph.},
  year = {2021},
  doi = {10.1109/tvcg.2020.3030423},
}
Figure