This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-14
Channels
- # arachne (5)
- # architecture (2)
- # bangalore-clj (7)
- # beginners (96)
- # boot (34)
- # braveandtrue (1)
- # cider (12)
- # cljs-dev (38)
- # cljsrn (59)
- # clojure (326)
- # clojure-dev (35)
- # clojure-greece (1)
- # clojure-italy (6)
- # clojure-russia (47)
- # clojure-spec (16)
- # clojure-uk (25)
- # clojurescript (136)
- # core-async (18)
- # cursive (18)
- # datascript (2)
- # datomic (28)
- # dirac (6)
- # emacs (4)
- # garden (3)
- # hoplon (28)
- # instaparse (1)
- # jobs (4)
- # juxt (1)
- # lein-figwheel (10)
- # liberator (1)
- # mount (3)
- # off-topic (39)
- # om (16)
- # om-next (1)
- # onyx (15)
- # pedestal (9)
- # proton (1)
- # random (1)
- # re-frame (48)
- # reagent (8)
- # ring-swagger (4)
- # rum (3)
- # specter (5)
- # sql (3)
- # unrepl (273)
- # untangled (27)
- # vim (4)
- # yada (7)
@limist yeah my Gist is really simplistic. At that time I was just playing around with understanding how to render the chart and didn’t have a need for a component-did-update. However I used the document referenced by @mikethompson for another component and it worked well.
Maybe once you are done with your changes, you can share some code and I can update that Gist to handle updates. If I remember, someone else had the same problem as you did too.
@limist I suggest you use the hard work someone else has already done with react-chartjs-2. https://github.com/gor181/react-chartjs-2 https://github.com/cljsjs/packages/tree/master/react-chartjs-2 Or if you're using chartjs 1 then https://github.com/reactjs/react-chartjs and you'd need to make your own externs.
I am using react-chartjs-2 in my current project and it works well. Here is how I define the different chart types:
(ns myns.chartjs
(:require
[cljsjs.chartjs]
[cljsjs.react-chartjs-2]
[goog.object :as obj]
[reagent.core :as reagent]))
(def line-chart (reagent/adapt-react-class (obj/get js/reactChartjs2 "Line")))
(def bar-chart (reagent/adapt-react-class (obj/get js/reactChartjs2 "Bar")))
(def horizontal-bar-chart (reagent/adapt-react-class (obj/get js/reactChartjs2 "HorizontalBar")))
(def radar-chart (reagent/adapt-react-class (obj/get js/reactChartjs2 "Radar")))
(def polar-chart (reagent/adapt-react-class (obj/get js/reactChartjs2 "Polar")))
(def pie-chart (reagent/adapt-react-class (obj/get js/reactChartjs2 "Pie")))
(def doughnut-chart (reagent/adapt-react-class (obj/get js/reactChartjs2 "Doughnut")))
(def bubble-chart (reagent/adapt-react-class (obj/get js/reactChartjs2 "Bubble")))
And here's an example usage:
[chartjs/line-chart {:data {:labels ["Red" "Blue" "Yellow" "Green" "Purple" "Orange"]
:datasets [{:label "# of votes"
:data [12 19 3 5 2 3]
:backgroundColor "rgba(255, 99, 132, 0.2)"}]}
:options {:legend {:display false}}}]
goog.require could not find: devtools.context
on browser console running lein new re-frame app
@kenny Thanks for the links, this looks like a real time/sanity-saver, will try it out!
@kenny So in your example usage, f the :datasets
are using subscriptions/atoms, then the chart will update automagically, as the subscriptions change?
Hi. I'm trying to use re-frame with figwheel but I need to change/reload every NS when I refresh my browser.
Yes, I'm :require
ing there NS in main.
I discovered that it's a problem with goog.history
something like... (my bad implementation of history/url)
I removed everything related to history/url and everything went back up
For now, i will not use url's 🙂
I am using cljs with react native. I would not like to navigate to another screen on-press. Can you please share the peace of example code to do ?
Hey guys not to be obtuse, but how do I get the default loggers to log clojure data structures as clojure data structures instead of as the JS objects?
and something like: https://gist.github.com/hkjels/90c689754bf8f5520f9507d6f0a7e2d7
I didn’t have the custom formatters turned on in Chrome, I already had everything else set up
So, I’m trying to use a raw request through re-frame-http-fx… And the xhrio instance I get back has nothing in it… And the status code is -1, no header data, nothing. Like it has no relationship to the call other than the URI
I would receive the xhrio and was able to manipulate it. I forget how I figured it out. Basically identity gave me the xhrio object and I could then get Data from the Headers and manually transform the content to a clojurescript map with xhrio.getResponseJson and then js->clj
The provider of the service basically used a Header to provide paging information… in both directions...
I didn’t write the service, but I can go re-write it, but damn I’d hate to have to do that for this to work properly. The paging information should be in the JSON, but it’s not. I’d like to not have to rewrite every service in this older application.
https://github.com/JulianBirch/cljs-ajax/blob/master/docs/formats.md At the end of this document it describes how to get a raw xhrio back.
Sorry if I have mis understood, but at the bottom there it looks like you might have to change the :response-format
in your effects
I know not including that can cause problems
ah, apologies. I did misunderstand
The xhrio object I get back in the event handler is non-functional.. It doesn’t have any of the data from the call in it and no status. It does have the right uri and that’s it.
I’m gonna go dive through the re-frame-http-fx code and see what’s happening in there if I can tell.
I think I see, If I have access to xhrio it’s not data in the event. It might pass through some kind of clojure function that basically neuters it.
We’d have to modify re-frame-http-fx to allow you to register to pick up additional data from Headers.
@andre has something changed about re-frisk with v0.4? I seem to be getting "goog.require could not find: datafrisk.core" errors since updating from (IIRC) 0.3.something
hrmm... 0.3.2 seems to be throwing up some kind of grumble to do with dispatching also: re-frame: expected a vector, but got: null
originating in re_frisk$core$enable_re_frisk_BANG_:24
followed by a re-frame: no subscription handler registered for: "". Returning a nil subscription.
from the same location.