The Oatmeal
Email Fallback:
Bocoup: Mobile Vis
Sebastian Sadowski: Mobile Infovis
Major form factors/devices:
Differences:
Differences:
Device-centric -> User-centric
How do you design for someone who ...
Heer, Shneiderman: Interactive Dynamics for Visual Analysis
Major question of responsive design: how to shrink interaction to different form factors?
Do we even NEED interaction?
1. If you make the reader click or do anything other than scroll, something spectacular has to happen.
Archie Tse: Malofiej 2016
2. If you make a tooltip or rollover, assume no one will ever see it. If the content is important for readers to see, don't hide it.
Archie Tse: Malofiej 2016
3. When deciding to make something interactive, remember that getting it to work on all platforms is expensive.
Archie Tse: Malofiej 2016
OECD Regional Well-Being
OECD Better Life Index
2q17.de
Good (clear) design becomes more important, the less space there is available!
Use the right meta tags:
<meta
name="viewport"
content="width=device-width, initial-scale=1"
>
Use relative sizes instead of absolute ones:
#viz {
width: 960px;
}
#viz {
width: 80%;
}
Use (r)em instead of px/pt for font sizes:
.title {
font-size: 2em;
}
body {
font-size: 24px;
}
CSS media queries let you fine-tune for specific devices:
#nav {
width: 100%;
}
@media screen and (min-width: 1368px) {
#nav {
float: left;
width: 32.5%;
}
}
To keep CSS and JS in sync, use window.matchMedia:
var query = '(min-width: 1280px)';
var isDesktop = window.matchMedia(query).matches
// >= 1280px => true
// < 1280px => false
Organizing content in boxes and placing them in a grid not only makes for a cleaner design, but also helps with adapting to different screen sizes.
OECD Regional Well-Being
There are various CSS frameworks supporting grids out there. The bigger ones are Twitter's Bootstrap and Zurb's Foundation.
Let's have a look at Bootstrap's grids:
Bootstrap grid options
Let's work with an example:
https://dominikus.github.io/rdv/01_cards.html
As the name implies, SVG are scalable, which makes them automatically look nice on various types of devices.
You can fine-tune the scaling using the SVG viewBox and preserveAspectRatio attributes:
<svg width="600" height="400"
viewBox="0 0 200 200"
preserveAspectRatio="xMinYMax meet" />
Touch input has different event handlers. But they work just like their mouse counterparts.
circle.on('touchstart', ...)
.on('touchmove', ...)
.on('touchend', ...);
Apple: Human Interface Guidelines
Mobile browsers have to juggle touch-to-scroll with touch-to-interact. If you have a fullscreen page anyway, consider disabling scrolling:
document.ontouchstart =
function(e){
e.preventDefault();
};
Consider adding enlarged (invisible) touch areas:
.touch-help {
opacity: 0;
z-index: 99999;
}
... or even take over interactivity completely:
touchHelpers.on('touchstart', function(){
console.log(d3.touches(this));
// => [342.1, 283.5]
});
Use voronoi diagrams for fine-grained interaction.
Mike Bostock: Voronoi Tesselation
Voronoi scatterplot:
Voronoi scatterplot
Tooltips are pretty useful for data exploration - we don't want to lose them on mobile!
One solution: have a position: fixed
tooltip at the bottom!
Two-step interaction: tap once to open, tap again to click, tap anywhere to close.
OECD Regional Well-Being
Mobile devices also have upsides: cool sensors!
Geolocation:
navigator.geolocation.getCurrentPosition(
function(position){
console.log(
position.coords.latitude +
"," + position.coords.longitude
);
}
);
Geolocation:
OECD Regional Well-Being
Multitouch/Gestural interactions: Supported by most d3 behaviors out of the box.
Mike Bostock: Pan & Zoom IV
Mike Bostock: Multitouch II
You can also use a dedicated gesture library like QuoJS or HammerJS to support fancier interactions.
Gyroscopes/Accelerometers
window.addEventListener(
"deviceorientation",
function(orientation){
console.log(orientation.alpha +
"," + orientation.beta +
"," + orientation.gamma
);
},
true
);
http://dominiku.indus.uberspace.de/marble/
Bill Hinderman: Building Responsive Data Visualization for the Web
The Pudding: The Unlikely Odds of Making it Big
Mike Bostock: How To Scroll
The Pudding: Scrollytelling with six libraries
The Pudding: Responsive Scrollytelling best practices
Waypoints.js
Russell Goldenberg: Scrollama
Let's work with an example:
https://dominikus.github.io/rdv/02_scrolly_vis.html
(Continued)
https://dominikus.github.io/rdv/03_globe.html
Let's put it all together:
https://dominikus.github.io/rdv/04_unlikely_odds.html
Would be even nicer with sticky positioning of the vis:
MDN: position
Speaking about responsiveness, oftentimes we bind redraw handler to the resize event:
window.on('resize', redraw);
This can lead to A LOT of redraws. Consider using some way of debouncing:
window.on('resize', _.debounce(redraw, 300))
Use requestAnimationFrame
instead of setTimeout
.
Sometimes: canvas/WebGL can be faster than SVG (usually with really massive amounts of shapes/animations).
Plus all the other details:
Dominikus Baur: Weighing Performance Against Pain (OpenVisConf)