Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Analytic Engine
May 18, 2009

not the analytical engine
The future of webpages:

<html>
<head>
<script getD3 />
</head>
<body>
<script buildSinglePageAppWithD3 />
</body>
</html>

Adbot
ADBOT LOVES YOU

du -hast
Mar 12, 2003

BEHEAD THOSE WHO INSULT GENTOO
why did you make this thread.

akadajet
Sep 14, 2003

who the gently caress uses d3 as a spa framework?

gas

Analytic Engine
May 18, 2009

not the analytical engine

du -hast posted:

why did you make this thread.

akadajet posted:

who the gently caress uses d3 as a spa framework?

gas

I’m just spreading the good word about the General Update Pattern of Saint Bostock. Enter, Update, Exit, my brothers.

code:
var tDuration = 500;
var tEase = d3.easeCubicInOut;
var body = d3.select('body');

var elemClass1Data = [{...}, {...}, ...];
var elemClass1s = body.selectAll('elem.class1')
    .data(elemClass1Data);
elemClass1s = elemClass1s.enter().append('elem')
    .classed('class1', true)
    .attr('attr1', function(d) { return ...; }) // initial attr 1
    .style('style1', function(d) { return ...; }) // initial style 1
    .on('event1', function(d) { return ...; }) // event handler 1
    .merge(elemClass1s);
elemClass1s
    .transition().duration(tDuration).ease(tEase)
    .attr('attr1', function(d) { return ...; }) // updated attr 1
    .style('style1', function(d) { return ...; }); // updated style 1
elemClass1s.exit()
    .transition().duration(tDuration).ease(tEase)
    .style('opacity', 0)
    .remove();

React.js is cool too, he can render the boring non-SVG non-Canvas stuff.

  • Locked thread