javascript - d3.js can't change outer radius of arc -


I have some donut layouts in my code:
  var cityPercentage = [50,  30, 20,10]; Var width = 300, height = 300, radius = 100; Var color = d3.scale.linear () .domain ([0,60]). Color (["red", "blue"]); ("Width", width) .attr ("height", height) .attr ("class", "span4"); var city division = d.seselect ("# cities") .append ("svg"). Var group = citydivision.endend ("g") .attr ("conversion", "translation (" + width / 2 + "," + height / 2 + ")"); Var arc = d3.svg.arc (). Witrateredius (Radius-19) .Untra radius (radius); var pi = d3 Layout. (). Value (function (d) {return d;}); Var arcs = group.selectAll (". Arc"). Data (Pie (city credit)). Center () .append ("g") .attr ("class", "arc") .attr ("id", function (d) {return d.data;}); Arcs.append ("path") .attr ("d", arc) .attr ("fill", function (d) {return color (d.data);});   

On the mouse, I want it to make the radius of the external. Here's what I have:

  $ (". Arc"). ("Mouseover", (function () {console.log ($ (this). Find ("path")); $ (this) .fund ("path"). Transition (). Period (10) .attr ("Outer radius", radius + 20);}));   

It says

  Unkit type error: Undefined is not a function VM24: 44 (anonymous function) VM24: 44 jQuery.event.dispatch jquery js: 5095 elemData.handle    

As mentioned in the comments, An arc generator should use the infection by using

Add an onClick listener and create another type of arc, and then change the d attribute of the path: var arc = d3.svg.arc (). Witrateredius (Radius-19) .Untra radius (radius); Var arcLarge = d3.svg.arc (). Electricity radius (Radius-25). Otterra radius (Radius +10); Var pi = d3 Layout. (). Value (function (d) {return d;}); Var toggleArc = function (p) {p.state =! P.state; Var dest = p.state? Archlurge: Arc; D3 Selection (this). Selection ("path"). Infection (). Duration (1000) .attr ("d", dest); }; Var arcs = group.selectAll (". Arc"). Data (Pie (city credit)). Center () .append ("g") .attr ("class", "arc") .attr ("id", function (d) {d.data;}) .on ("click", toggleArc) .append ("Path") .attr ("d", arc) .attr ("fill", function (d) {return color (d.data);});

In this example, I toggle the status of the data element, so it toggles between the normal and expanded form.

View.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -