Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Interesting point. I simply relied o this post of Mike Bostock http://bost.ocks.org/mike/chart/.


An initial config object would probably be ideal, and then you could have the chaining to supplement those values. You could have the initial method take in the config and use the values in that in place of the defaults. So

  textures.circles()
    .radius(4)
    .fill("transparent")
    .strokeWidth(2);
could initially be

  var circles = textures.circles({
    radius: 4,
    fill: "transparent",
    strokeWidth: 2 
  });
and later updated to be

  circles.strokeWidth( 1 );
Which works rather nicely especially when the config object is generated dynamically.


Yeah, it makes sense to mimic the D3 style: the only thing worse than a bad convention is two conventions.


imho, if the operations are to be performed in a certain order, use chaining. Otherwise, passing a config object is much cleaner




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: