Search code examples
javascriptsvgclojureclojurescript

Clojurescript, JavaScript, SVG, Charts, Graphics


I'm writing a client side app. I want to use ClojureScript. I would like to generate vector graphics (graphics, charts, line graphs).

What should I read up on?

[The only hard requirement is ClojureScript -- (1) I like Clojure, and would like to do this entire app in Clojure (2) this needs to run in the browser]

Thanks!


Solution

  • Shameless plug: You can use C2, a Clojure/ClojureScript data visualization library. (Github here.) The core idea is the same as D3---mapping data to DOM elements---but since you have Clojure's more powerful semantics and data structures it ends up being much more composable than D3/JavaScript.

    The docs could use some love, but if you're making traditional charts in SVG take a look at the axis and tick-generation helpers:

    https://github.com/lynaghk/c2/blob/master/src/cljx/c2/svg.cljx

    https://github.com/lynaghk/c2/blob/master/src/cljx/c2/ticks.cljx

    While there isn't an official 0.1.0 release yet, we've used it at Keming Labs on several large web and iOS projects.

    If you have a specific visualization that you're not sure how to approach, feel free to ping me @lynaghk or open up a Github issue.