popkinj / polymorph

Convert one SVG path to another.
17 stars 4 forks source link

adopt reusable chart API convention? #1

Open bollwyvl opened 9 years ago

bollwyvl commented 9 years ago

This looks great, but it feels a bit imperative vs the fluent, chainable style of d3 where it is most likely to be used. Specifically, you have to .each each time you'd want to use this for particular data.

Not that I can imagine what they'd be (other than maybe direction), but as you add more configurable features, rather than passing them as a big old jquery-style config object, how about an API like this (loosely based on the example in the readme):

var transpose = polymorph.transpose()
  .before(d3.geo.path().projection(proj))
  .after(circleIt);

shape.transition()
  .attr(d, transpose)
.transition()
  .attr(d, transpose.direction(false))
thednp commented 8 years ago

The problem is, this code isn't working outside of D3, as stated by developer.