javascript - D3 Adding data to 3D Pie Chart -
below js code d3 example found here.
var msasubgroup = svg.append("g").attr("id","msasubgroupdata").attr("class","piechart"); donut3d.draw("msasubgroupdata", getdata(msa), 450, 150, 130, 100, 30, 0.4); var wedges = msasubgroup.selectall("g.slices").data(datum).enter(); wedges.on("mousemove", function(d){ //this browser complaining about. mousex = d3.mouse(this); mousex = mousex[0]; //console.log(d); d3.select(this) .classed("hover", true); tooltip.html(d.label+": " + d.value).style("visibility", "visible").style("left", mousex + "px" ); });
i have made few modification try , add data along tool tip. seemed pretty straight forward in fact needed bind data svg. however, getting curious error in console:
uncaught typeerror: undefined not function
what undefined? when console.log(datum) can see array of objects being returned, doing wrong?
thanks much.
your wedges
result of enter()
call which:
only defines
append
,insert
,select
,call
operators
so doesn't have on
method , what's causing "undefined not function" error.
i'm assuming want either:
var wedges = msasubgroup .selectall("g.slices") .on('mousemove', ...); wedges.data(mydata).enter()...
or
var wedges = msasubgroup .selectall("g.slices") .data(mydata) .enter() .append('g') .on('mousemove', ...);
Comments
Post a Comment