Hello!
I am curious to know other people's opinions on the following topic:
At work we are building a complex angular.js application that also has d3 based interactive charts.
The approach I generally follow for building charts in angular looks like this:
- On one side I have my own customized library of d3 reusable charts, that loosely follow the principles in: http://bost.ocks.org/mike/chart/ This bit is completely separated from angular and could be re-used anywhere else.
- On the other I create specific angular directives and pass them data and configuration objects. When these change (on watch) I simply re-update and re-call my reusable d3 chart functions from within these directives.
In my experience this approach works nicely and I can't see much benefit from changing things, but a colleague of mine has a somewhat different idea. In his opinion the whole d3 enter-update-exit pattern and most DOM manipulation should be handled directly by angular. Something in line with this post
http://alexandros.resin.io/angular-d3-svg/
Now, although I can see his point here as a possible and interesting approach, I also feel very uncomfortable at the idea of going down this route for complex visualizations. One example I can think of is about how one would easily handle complex svg transitions within this scenario... something just doesn't feel quite right to me. Although I do admit that this scepticism could also be my resistance for trying something new and for leaving the path I feel comfortable with... so, does anyone else have experiences with this approach?
Again, I would love to hear other people's opinions on this.
Many thanks,
Decio