How can I revive the protovis flow?

It’s hard for me to figure out how to revive the proto-stream. I think that the best way - just pass an array of indices i, jin .layers()and function .x()and .y()will look for the actual value of updates. Is there an easier way?

+3
source share
1 answer

Could you just update the data before each rendering? Assuming the data has changed, I'm not sure I see the advantage of doing it otherwise, since I think that all vis will have to be rendered again.

function getData(offset) {
   // get/create your data here, maybe seeded with an offset
}

var offset = 0;

// ... define scales and stuff

var vis = new pv.Panel()
    .width(w)
    .height(h);

vis.add(pv.Layout.Stack)
     // wrap in a function to re-evaluate on render
    .layers(function() getData(offset))
    .offset("wiggle")
    .x(x.by(pv.index))
    .y(y)
.layer.add(pv.Area);

// use setInterval to animate
setInterval(function() { 
    offset++; // still working on the offset idea
    vis.render(); 
}, 20);

, , , - .

+2

Source: https://habr.com/ru/post/1768481/


All Articles