d3 / d3-shape

Graphical primitives for visualization, such as lines and areas.
https://d3js.org/d3-shape
ISC License
2.48k stars 310 forks source link

Adds cornerRadius parameter to arc #84

Closed luisalima closed 8 years ago

luisalima commented 8 years ago

Hi guys,

I'm doing a small library for doing charts with react native and I realized that cornerRadius parameter was being ignored in the most recent d3 version (installed via yarn, v4.3.0). Here is a failing example (ecmascript 2015):

  data = [1,2,3];
  const innerRadius = 30;
  const outerRadius = 50;
  const cornerRadius = 10;
  const arcs = d3.shape.pie()(data);
  const arc = d3.shape.arc();
  return arcs.map((a) => {
    return arc({ ...a, innerRadius, outerRadius, cornerRadius });
  }
  );
}

I did some debugging using console.log with the example above and realized that cornerRadius was always set to 0 and whatever was passed in parameters was ignored.

I did the fix that I'm sending in this PR, and it works well for me locally. Is there anything that I might be missing?

I noticed that there is one cornerRadius test (https://github.com/d3/d3-shape/blob/master/test/arc-test.js#L20), can you provide me with some guidelines to run the tests?

luisalima commented 8 years ago

I just realized that this might be incorrect, and figured out how to run the tests; I'll close the PR and open another.