Fork me on GitHub
#hoplon
<
2016-07-19
>
adamw01:07:27

oh hi @jjttjj; quick question - I saw you were working on integrating amcharts into cljsjs; did you have any luck in the end?

adamw01:07:22

@jjttjj: I don't think there are any h/ui form examples, but I use this:

(form :sh+ 450 attrs :fc c/black
      :submit #(state/sign-in (:email %) (:pwd %))
      (app.logo/sign-in)
      (mui/field-group :sh (r 1 1)
        (elem :fc c/red-400
          (cell= (and state/sign-in-error
                   (.-message state/sign-in-error))))
        (field :key :email :label "Email address")
        (field :key :pwd :label "Password" :type "password"))
      (elem :av :middle :ah :center :stuck_out_tongue: 8 :g pad-sm :sh (r 1 1)
        (submit button-style (mui/anchor) :label "SIGN IN"))
      elems)))
and it works. field-group is just a header.

adamw01:07:44

Note that master has an error in wrap-submit; you need to change one of the submits to submit' or something

adamw01:07:44

like this:

(defn wrap-submit [ctor]
  "set up a form context"
  (fn [{label :label submit' :submit :as attrs} elems]
    {:pre []} ;; todo: validate
    (let [data   *data*
          submit *submit*]
      (with-let [e (ctor (dissoc attrs :label :submit) elems)]
        (.addEventListener (mid e) "click" #((or submit' @submit) @data))
        (bind-in! e [in .-type]  "submit")
        (bind-in! e [in .-value] label)))))

jjttjj06:07:30

@adamw: I never did get amcharts working with cljsjs. I can't quite remember the reason why, it might have just been being totally new to cljsjs, but also not being fully confident in if I was even dividing amcharts up correctly, I cared mainly about AmStock but I remember the AmX suite being broken up in a way that wasn't immediately obviously friendly with cljsjs. At some point I tried highcharts which just worked out of the box with cljsjs already and never really looked back. Sorry I can't be of more help there I'll check when I wake up in the morning if I still have any remnants of my AmCharts cljsjs attempts.

jjttjj06:07:06

@adamw thanks for the form example though, exactly what i needed to see

adamw07:07:41

@jjttjj: no worries, thanks! Was evaluating both and we are using an charts for the static website so seemed sensible to do the same for the app. If high charts is best then I guess it's the easy solution:slightly_smiling_face:

jumblerg08:07:41

@adamw: my inclination would be to use a subset of d3.js rather than going for the highcharts wrappers.

jumblerg08:07:39

i used highcharts some time ago, but ultimately found i had more control working directly with d3; it is a well-desiged api with lots of documentation and examples.

jumblerg08:07:53

not all the features, such as the selectors and styles, make sense for use with hoplon imho. but other components, like the scale functions, might.

jumblerg08:07:29

it would be great to have a data visualization library built on top of hoplon, perhaps leveraging some elements of d3js, someday.