javascript - How do I animate a protovis streamgraph? -
i'm having trouble figuring out how animate protovis streamgraph. think best way pass array of i, j
indexes .layers()
, have .x()
, .y()
functions actual updating values. there simpler way?
couldn't update data before every render? assuming data has changed, i'm not sure see benefit doing otherwise, think whole vis need re-render.
function getdata(offset) { // get/create data here, maybe seeded offset } var offset = 0; // ... define scales , stuff var vis = new pv.panel() .width(w) .height(h); vis.add(pv.layout.stack) // wrap in function re-evaluate on render .layers(function() getdata(offset)) .offset("wiggle") .x(x.by(pv.index)) .y(y) .layer.add(pv.area); // use setinterval animate setinterval(function() { offset++; // still working on offset idea vis.render(); }, 20);
this seems work, though depends kind of animation you're looking create - there may more efficient approaches kinds of animation.
Comments
Post a Comment