This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-17
Channels
- # admin-announcements (4)
- # beginners (21)
- # boot (37)
- # cider (41)
- # cljs-dev (3)
- # cljsjs (11)
- # cljsrn (4)
- # clojure (31)
- # clojure-austin (21)
- # clojure-belgium (30)
- # clojure-canada (1)
- # clojure-dusseldorf (2)
- # clojure-poland (7)
- # clojure-russia (20)
- # clojure-taiwan (1)
- # clojure-uk (45)
- # clojurescript (90)
- # core-async (8)
- # cursive (4)
- # data-science (1)
- # datomic (5)
- # dirac (6)
- # docker (1)
- # emacs (8)
- # hoplon (102)
- # ldnproclodo (2)
- # lein-figwheel (3)
- # leiningen (13)
- # off-topic (9)
- # om (54)
- # onyx (4)
- # other-languages (101)
- # pedestal (8)
- # planck (2)
- # protorepl (1)
- # re-frame (15)
- # reagent (13)
- # spacemacs (4)
- # untangled (126)
- # yada (4)
@gadfly361: Man, you are the best !!! It worked. So, how about
gauge-consumo-did-mount
or gauge-consumo-render
with parameter? Like updating many gauges in Dashboard page, each with different ids? How to select each gaugue to get reagent/atom like {:ROOM-1 0 :ROOM-2 0} and ROOM-# as parameter?(ns view-fortigate.core
(:require
[reagent.core :as reagent]))
(defonce app-state
(reagent/atom
{:valor-1 10
:valor-2 50}))
(defn gauge-consumo-config [vl]
{:chart {:type "solidgauge"}
:title {:text "SALA 105"}
:pane {
;:center ["58%" "85%"]
:size "100%"
:startAngle -90
:endAngle 90
:background {
:backgroundColor "#FFF"
:innerRadius "60%"
:outerRadius "100%"
:shape "arc1"
}
}
:tooltip { :enabled false }
:credits { :enabled false }
:yAxis {:stops [[0.1 "#55BF3B"]
[0.5 "#DDDF0D"]
[0.9 "#DF5353"]]
:lineWidth 0
:minorTickInterval nil
:tickPixelInterval 400
:tickWidth 0
:title {:text "" :y -70}
:labels {:y 16}
:min 0
:max 100
}
:series [{:name "Consumo"
:data [vl]
}]
:plotOptions {
:solidgauge {
:dataLabels {:y 15
:borderWidth 0
:useHTML false
:format "{y} %"}
}
}
})
(defn gauge-consumo-did-mount [this ratom k]
(js/Highcharts.Chart. (reagent/dom-node this)
(clj->js (gauge-consumo-config (k @ratom)))))
(defn gauge-consumo-render [ratom]
(let [_ @ratom]
[:div {:style {:width "200px" :height "200px" :margin "0 auto"}}]))
(defn gauge-consumo [ratom k]
(reagent/create-class
{:component-did-mount #(gauge-consumo-did-mount % ratom k)
:component-did-update #(gauge-consumo-did-mount % ratom k)
:reagent-render #(gauge-consumo-render ratom)}))
(defn home [ratom]
[:div
[gauge-consumo ratom :valor-1]
[gauge-consumo ratom :valor-2]])
(defn reload []
(reagent/render [home app-state]
(.getElementById js/document "app")))
(defn ^:export main []
(reload))
@gadfly361 is a pillar in the reagent scene. From maintaining reagent templates to always helping out in #C0620C0C8, to maintaining the reagent cookbook. He's the man!!!
@escherize: @gadfly361 IS MASTER !!! It worked => gadgent . Thanks a lot, now I understand how it works.
How do you specify the key for an element using (reagent.core/as-element …)?
Ah, never mind. It’s just
(r/as-element
^{:key (str section-id "-" row-id)}
[touchable-highlight {:onPress #()}
Well, in my case I’m using react native and the listview component takes a “renderRow” argument that specifies this:
renderRow function
(rowData, sectionID, rowID, highlightRow) => renderable
https://facebook.github.io/react-native/docs/listview.htmlThanks for that @seantempesta.