[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

using d3 bindings for js_of_ocaml



I am trying to use the bindings, but have some problems doing so. This code:

let svg = select(Selector.tag "body")
                >>append "svg"
                >> attr "width"  (fun _ _-> Some(w))
                >> attr "height" (fun _ _-> Some (h)) in

                svg>>subnodes "rect"
                           >> data dataset
                           >> enter
>> append "rect" >> attr "x" (fun d i -> Some(i * (w / Array.length dataset)) )
                           >> attr "y"  (fun d _ ->Some(h - (d * 4)))
>> attr "width" (fun _ _ -> Some(w / Array.length dataset - barPadding))
                           >> attr "height" (fun d _ -> Some( d * 4))
>> attr "fill" (fun d _ ->Some( "rgb(0, 0, " ^ string_of_int (d * 10) ^ ")")); ...

Produces weird results when I inspect the page : <svg width="function (x) { return caml_call_gen(f, args.concat([x]));}" ...

all the parameters of the svg and the rect's are strings of functions.

What am I doing wrong?

Many thanks in advance!

Best wishes,
Dimitar





 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.