https://github.com/mbostock/d3/wiki
Mike
--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
d3.json("/d/4063550/flare.json", function(error, root) {
var path = svg.selectAll("path")
.data(partition.nodes(root))
.enter().append("path")
.attr("d", arc)
.style("fill", function(d) { return color((d.children ? d : d.parent).name); })
.on("click", click);
function click(d) {
path.transition()
.duration(750)
.attrTween("d", arcTween(d)); } }); d3.select(self.frameElement).style("height", height + "px");
Do you know of a simple way to add the text labels to the arcs? Or is this as complicated as your fix looks?!
I see you have lots of conditional references to whether certain rings are being shown and that's making it hard for me
to know where to start.
I guess it's just some simplifying of your code? I tried changing the variables vis to svg. but no joy...var path = vis.selectAll(".pie") .data(nodes) .enter().append("path") .attr("id", function(d, i) { return "path-" + i; }) .attr("class", function(d, i) { return "pie ring_" + d.depth +" " + attributes(d)}) .attr("d", arc) //.style("fill", colour) //.style("fill-opacity", opacity) .style("stroke-width", 2) .on("click", click); var text = vis.selectAll("text").data(nodes); var textEnter = text.enter().append("text") .attr("class", function(d, i) { var cls = "ring_" + d.depth; if (d.depth == ringCount) { cls += " timelabel"; } return cls;}) .style("opacity", 1) .attr("text-anchor", function(d) { // ?? HOW DO I CALCULATE THE CORRECT ANCHOR POINT ON OUTER RING??? return x(d.x + d.dx / 2) > Math.PI ? "end" : "start"; }) .attr("dy", ".2em") .attr("transform", function(d) { var multiline = (d.name || "").split(" ").length > 1, angle = x(d.x + d.dx / 2) * 180 / Math.PI - 90, rotate = angle + (multiline ? -.5 : 0); return "rotate(" + rotate + ")translate(" + (y(d.y) + p) + ")rotate(" + (angle > 90 ? -180 : 0) + ")";
})
.on("click", click);
textEnter.append("tspan")
.attr("color", "#FFF")
.attr("x", 0)
.text(label);
/* for splitting name across lines
textEnter.append("tspan")
.attr("x", 0)
.attr("dy", "1em")
.text(function(d) { return d.depth ? d.name.split(" ")[1] || "" : ""; });
Thanks for your help!
Jon
d3.json("flare.json", function(error, root) { var path = svg.datum(root).selectAll("path") .data(partition.nodes) //access the nodes .enter() .append("path") .attr("display", function(d) { return d.depth ? null : 'none';}) //hide inner ring .attr("d", arc) .style("stroke", "#fff") .style("fill", function(d) { return color((d.children ? d : d.parent).name);}) .style("fill-rule", "evenodd") .each(stash) .on("mouseover", mouseover); function mouseover(d) {
d3.select("#text") .append("svg:text") .transition() .duration(1000) .style("opacity", 1) .style("fill", 'black') .text(function(d) { return d.parent.name; }); console.log('columnIndex', mouseover); };--
You received this message because you are subscribed to the Google Groups "d3-js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to d3-js+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
#text { font-size: 2.5em; text-align: center; color: #666; position: absolute; top: 260px; left: 305px; width: 140px; text-align: center; color: #666; z-index: -1;}#text { font-size: 2.5em; text-align: center; color: #666; position: absolute; top: 260px; left: 305px; width: 140px; text-align: center; color: #666; z-index: -1;}On May 9, 2015, at 5:05 PM, Odanga Madung <kvnma...@gmail.com> wrote:If I look at my DOM I don't see any text elements being created. My main problem is that the code I have is not making the text appear in the center of the inner circle upon mouseover. My ultimate goal with this is to be able to have it be highlightable just like Kerry rowden's example bl.ocks.org/kerryrodden/7090426
d3.select("#text").append("svg:text").transition().duration(1000).style("opacity", 1).style("fill", 'black').text(function(d) { return d.parent.name; });
--
You received this message because you are subscribed to a topic in the Google Groups "d3-js" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/d3-js/lhHxcNZCK0I/unsubscribe.
To unsubscribe from this group and all its topics, send an email to d3-js+un...@googlegroups.com.