javascript - Getting error on applying transition in d3 -
i trying apply transition effect on bar graph designed in d3. here code-
svg.selectall(".bar") .data(data) .enter().append("g") .attr("class", "bar") .append("rect") .attr("rx", barradius) .attr("fill","333" ) // .attr("color_value", "steelblue") .attr("index_value", function(d, i) { return "index-" + d[columns[0]].replace(/[^a-za-z0-9]/g, '', 'gi'); }) .attr("class", function(d, i) { return "bars-bubble-index-" + d[columns[0]].replace(/[^a-za-z0-9]/g, '', 'gi')+div; }) .attr("id", function(d) { return d[columns[0]] + ":" + d[measure1]; }) .attr("onclick", fun) .attr("x", function(d) { return x(d[columns[0]]); }) .attr("width",0) .transition() .duration(2000)//1 second .attr("width", x.rangeband()) .attr("y", function(d) { return y(d[measure1]); }) .attr("height", function(d) { return height - y(d[measure1]); })
transition seem working fine except fact receiving following errors on browser console typeerror: svg.selectall(...).data(...).enter(...).append(...).attr(...).append(...).attr(...).attr(...).attr(...).attr(...).attr(...).attr(...).attr(...).attr(...).transition(...).duration(...).attr(...).attr(...).attr(...).on not function typeerror: bars.append(...).attr(...).attr(...).transition(...).duration(...).attr(...).attr(...).transition(...).duration(...).attr(...).attr(...).attr(...).attr(...).attr(...).attr(...).attr(...).attr(...).on not function
and because of these error rest of script not working , graphs displayed properly. appreciated.
add .on(...)
call before .transition()
, should fine.
Comments
Post a Comment