Clojurians
#reagent
<
2016-03-08
>

This page is not created by, affiliated with, or supported by Slack Technologies, Inc.

martintrojer12:03:37

hello, using highcharts with reagent. The example works fine. However, I want to generate a new graph when the data changes.

martintrojer12:03:51

How can you accomplish that with reagent?

martintrojer12:03:02

(defn chart-render []
  [:div])

(defn chart-did-mount [topic data this]
  (.highcharts (js/$ (reagent/dom-node this))
               (clj->js (chart-config topic data))))

(defn chart [topic data]
  (reagent/create-class {:reagent-render      chart-render
                         :component-did-mount (partial chart-did-mount topic data)}))

martintrojer12:03:54

[:#chart] (content (if chart-data
                                       [highcharts/chart topic chart-data]
                                       [:h2 "No matching data found!"]))

martintrojer12:03:07

since its did-mount, this is only called once. I did try using component-did-update but then the chart redraws whenever something happens on the page (which is not what I want).

martintrojer12:03:59

@mikethompson: ta

mikethompson12:03:34

Be sure to look at this derivative work too (referenced at the end of that Wiki page): http://zachcp.org/blog/2015/reagent-d3/ He does similar work via reagent/argv (explained in his blog post).

martintrojer12:03:03

thanks again, this pattern works perfectly in my case.

mmeix15:03:37

does React 15.0 break something in reagent / re-frame?

mmeix15:03:16

(there is full SVG support in React 15, which is great news for my project ...)

mikethompson18:03:46

@mmeix the release candidtate for React v15.0 is only 2 days old. I'm not sure anyone has looked at it. In fact, support for React for v0.14 is still alpha. So no good answers yet

mmeix18:03:20

@mikethompson of course, silly me

hugobessaa19:03:44

lack of support for v0.14 is hitting me. is there a milestone to get us there? would like to help

mikethompson19:03:12

Test your apps with Reagent 0.6.0-alpha (React v0.14) and report how you go here: https://github.com/reagent-project/reagent/issues/212 I'm particularly keen to see how re-frame apps go.

hugobessaa20:03:08

anyone using masked inputs? how you doing?