This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.
{ | |
"name": "flare", | |
"children": [ | |
{ | |
"name": "analytics", | |
"children": [ | |
{ | |
"name": "cluster", | |
"children": [ | |
{"name": "AgglomerativeCluster", "size": 3938}, |
This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.
g.append("text") | |
.attr("transform", function(d) { return "translate(" + arc.centroid(d) + ")"; }) | |
.attr("dy", ".35em") | |
.style("text-anchor", "middle") | |
.text(function(d) { return d.data.age; }) | |
.each(function (d) { | |
var bb = this.getBBox(), | |
center = arc.centroid(d); | |
var topLeft = { |
function pointIsInArc(pt, ptData, d3Arc) { | |
// Center of the arc is assumed to be 0,0 | |
// (pt.x, pt.y) are assumed to be relative to the center | |
var r1 = arc.innerRadius()(ptData), // Note: Using the innerRadius | |
r2 = arc.outerRadius()(ptData), | |
theta1 = arc.startAngle()(ptData), | |
theta2 = arc.endAngle()(ptData); | |
var dist = pt.x * pt.x + pt.y * pt.y, | |
angle = Math.atan2(pt.x, -pt.y); // Note: different coordinate system. |
This is an example of how one might place the intermediate labels on circle-packing graphs using the circle-text plugin.
Transitions on position
and radius
of the path are now possible. Click on the circles to see them in action.
A demo for the circle-text plugin, which can place text aligned along the bottom of circles.
This examples demonstrates how to use D3's brush component to implement focus + context zooming. Click and drag in the small chart below to pan or zoom.
This is an adaption of a Zoomable sunburst example with an added text box showing which item was last clicked.
Click on any arc to zoom in. Click on the center circle to zoom out.
A sunburst is similar to a treemap, except it uses a radial layout. The root node of the tree is at the center, with leaves on the circumference. The area (or angle, depending on implementation) of each arc corresponds to its value. Sunburst design by John Stasko. Data courtesy Jeff Heer.
This example is an extension of the original example with the additional feature that clicking on a part of the graph will select it and rotate it to 90 deg.
A sunburst is similar to the treemap, except it uses a radial layout. The root node of the tree is at the center, with leaves on the circumference. The area (or angle, depending on implementation) of each arc corresponds to its value. Sunburst design by John Stasko. Data courtesy Jeff Heer.