4 ms·
Interesting point. I simply relied o this post of Mike Bostock http://bost.ocks.org/mike/chart/ http://bost.ocks.org/mike/chart/.
by ricsca 12y ago
Interesting point. I simply relied o this post of Mike Bostock http://bost.ocks.org/mike/chart/ http://bost.ocks.org/mike/chart/.
- findjashua 12y agoimho, if the operations are to be performed in a certain order, use chaining. Otherwise, passing a config object is much cleaner
- wayfarer2s 12y agoAn 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.
- bkirwi 12y agoYeah, it makes sense to mimic the D3 style: the only thing worse than a bad convention is two conventions.