background preloader

d3

Facebook Twitter

How to invoke "click" event programmaticaly in d3. Creating a brush region programatically. For auto-redraw such that the focus of a 1D brush matches the graphed domain, you need to do as follows: (1) Apply the brush scale to the graphed domain (i.e., the brush extent) --> store in var brushExtent; (units: pixels) (2) Within the brush element (class='brush'), select the <rect> with class='extent'. (3) If the brush is horizontal (i.e., for the x-axis), set the 'x' attribute to the first value in brushExtent. This moves the start position of the focus <rect> to match the graphed domain. If the brush is vertical (i.e., for the y-axis), set the 'y' attribute to the second value in brushExtent. (4) Next, set the 'width' attribute of the extent to brushExtent[1] - brushExtent[0]. (*) The extent should now programmatically match the graphed domain. I use this procedure as part of a resize function.

. - mostra testo citato - On Tuesday, March 26, 2013 9:52:38 PM UTC, andrew payne wrote: Hi Mike,I'm trying to programmatically set a brush region at the initialization stage. Stephen Boak — Easy as (a) Pie. Through my work at Boundary I’ve started playing with the D3 visualization library, trying to build some interesting visualizations for our real-time network monitoring dashboard. I’ve really been enjoying D3 and Mike Bostock, the creator, has been extremely helpful to me and lots of others in the d3-js Google Group. Since the library is new, I hope the series of experiments I post here can be helpful in spreading some knowledge and awareness of the library. What You’re Building My first experiment is an animated pie chart meant to visualize a breakdown of incoming network traffic by port.

Here is the completed pie chart: I’ve also posted the complete source code on JSFiddle. Building the Visualization For the sake of brevity I’ll skip over some of the details, but feel free to contact me with any questions. There are a couple of D3 helper functions that I use. The second is a function to return a color value from an ordinal scale of 20 preset colors: Improvements. How-To: Update a Pie Chart (Part 2) Bost.ocks.org/mike/d3/workshop/