Re-Render partially Choropleth Map

51 views
Skip to first unread message

Nori

unread,
May 2, 2012, 11:29:19 AM5/2/12
to protovis
Hi Protovis-ers,

I am trying to visualize some data for municipalities in the same way
as the example in protovis http://mbostock.github.com/protovis/ex/choropleth.html

I am instead using radio buttons to choose different indicators that
need to be visualized. This in practice should result only in changing
colors of each municipality (just like they do when the year slider is
played in the example).

But it turns out that this is pretty slow if you call vis.render() to
re-render the complete map and colors if the shapes of the
municipalities are not with straight lines but rather complex. In
other words my us_lowers.js file is 4 times as big and it is executed
4 times as slow when new data is visualized after user has picked a
particular radio button!

Is anyone aware of a way to not render the whole graph together with
shapes (in other words not to re-draw borders of municipalities) but
simply update the color of each shape based on the new data that are
read after an onclick event on a radio button?

thanks a lot

Mike Bostock

unread,
May 2, 2012, 1:45:25 PM5/2/12
to prot...@googlegroups.com
I would recommend switching to D3, which lets you do incremental
updates (including updating the color of existing path elements). Here
are a few examples of D3 choropleths:

http://mbostock.github.com/d3/talk/20111018/choropleth.html
http://mbostock.github.com/d3/ex/choropleth.html

Mike
Reply all
Reply to author
Forward
0 new messages