This example demonstrates accelerated two-dimensional filtering enabled by d3.geom.quadtree. A quadtree recursively subdivides square cells into four equal-sized subcells. Each leaf node of the quadtree contains a single point. If a given quadtree cell does not intersect the brush extent, then none of the points contained in that subtree can be selected, and thus do not need to be scanned. Above, orange indicates points that are scanned but not selected. Without a quadtree, all points would need to be scanned!
. |
. |
So we can still embed code in the prose, and it will be syntax-highlighted. Super! So let's test sytax highlighting in other languages. Like maybe clojure(script)?
; this is a snippet of the strokes quadtree gist (4409139)
; Check it out clojurists - here we generate a lazy-seq of maps
(defn gen-data []
(for [x (range 2500)]
{:x (rand width), :y (rand height)}))
Enclosure diagrams use containment to represent the hierarchy. Although circle packing is not as space-efficient as a treemap, it better reveals the hierarchy. Implementation based on work by Jeff Heer. Data shows the Flare class hierarchy, also courtesy Jeff Heer.
A fork and port of mike's js version (gist/block), programmed in clojurescript atop the maturing strokes library.
This is running atop the first version of strokes that is able to repair a persistent data structure that has been mutated by javascript as the d3 layouts do - effectively trying to add new fields to the clojure maps. In this example the mrhyde function repersist
reconstructs a persistent view of each node.
(Merge request? Use the repo version.)
Looking for a small and easy to follow strokes example? You've found it.
A fork and port of mike's js version (gist/block), for the strokes examples repo.
(merge requests should go to the example in the repo).
The Voronoi layout, d3.geom.voronoi, does not provide clipping by default; the returned diagram spans ±1e6. This example demonstrates how to clip the diagram to known dimensions.
A minimalist example of a strokes program: 3 circles. This example highlights the succinctness of clojure maps when setting attributes. In addition to d3's selection.attr maps can be used on selection.style, selection.classed, selection.property, selection.on, transition.attr and transition.style.
Inspired by Mike's #1067616, but with using d3 multi-value maps for attributes as in #3305515 and with the styling moved into the css.
. |
strokes fork and port of mike's general update pattern tutorial, I.
merge requests should go to the example in the repo
This example demonstrates the general update pattern in D3, where a data-join is followed by operations on the enter, update and exit selections. Entering elements are shown in green, while updating elements are shown in black. Exiting elements are removed immediately, so they're invisible.
This example does not use a key function for the data-join, so entering elements are always added to the end: when the new data has more letters than the old data, new elements are entered to display the new letters. Likewise, exiting letters are always removed from the end when the new data has fewer letters than the old data.