I'm doing something similar to work with dimplejs.org charts. Basically, all of my dimple code is run from either om/IDidMount (if it only needs to be run once once the DOM has been rendered) or om/IDidUpdate (if it needs to be run again later, eg, to update the charts if data changes). Because did-update runs any time the app-state changes, its a good place to put logic to have the chart be driven by app-state.
Then inside one of those, you would need to get the DOM node, either by giving it a :ref and using (om/get-node owner ref) to get the DOM node (like Gary said), or by using domina or dommy or something else to select by CSS selector (or in dimple's case, give it the id of the DOM node). The ref approach probably plays a bit nicer with React, but I've had no issues doing it the other way when needed. On 28 May 2014 17:53, Gary Trakhman <[email protected]> wrote: > I can answer the 'is it possible' part. > > Yes, you can assign 'ref' attributes to nodes, then use om.core/get-node > to get the actual dom node. > > > On Wed, May 28, 2014 at 11:27 AM, Juan Manuel Gimeno Illa < > [email protected]> wrote: > >> I'm trying to define chart components for Om in order to create >> dashboards. For the state management and propagation Om feels right and for >> the charting my idea is to use d3.js (via strokes, a clojurescript adapter). >> >> I have started by translating the code for >> http://10consulting.com/2014/02/19/d3-plus-reactjs-for-charting/ to use >> Om instead of React.js and strokes instead of d3. >> >> The translation is more or less straightforward but something in the >> approach does not feel right. From d3 I only use scales and the data >> binding part is realized by om. For simple bar charts (as those in the >> example) this approach works, but to create the axis with labels I'll have >> to rewrite most of the code in d3 but using om.dom instead accessing the >> read DOM apis. >> >> Here is my question: is it possible to access and work on the real DOM >> node from an Om component? >> >> My idea is to leave Om manage state propagation and re-rendering until >> the SVG container (the node than contains the chart). If it has to be >> re-rendered (because tha data or teh size has changed), leave the >> re-rendering of its children (e.g. rectangles for the bars, text for the >> labels, etc.) to d3 data binding. >> >> Is it possible to do that? Is it sensible? >> >> Thanks !! >> >> Juan Manuel >> >> -- >> Note that posts from new members are moderated - please be patient with >> your first post. >> --- >> You received this message because you are subscribed to the Google Groups >> "ClojureScript" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/clojurescript. >> > > -- > Note that posts from new members are moderated - please be patient with > your first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. > -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
