{"action":"created","issue":{"url":"https://api.github.com/repos/thi-ng/geom/issues/26","labels_url":"https://api.github.com/repos/thi-ng/geom/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/thi-ng/geom/issues/26/comments","events_url":"https://api.github.com/repos/thi-ng/geom/issues/26/events","html_url":"https://github.com/thi-ng/geom/issues/26","id":111228416,"number":26,"title":"CLJS serialization story for SVG","user":{"login":"den1k","id":4651810,"avatar_url":"https://avatars.githubusercontent.com/u/4651810?v=3","gravatar_id":"","url":"https://api.github.com/users/den1k","html_url":"https://github.com/den1k","followers_url":"https://api.github.com/users/den1k/followers","following_url":"https://api.github.com/users/den1k/following{/other_user}","gists_url":"https://api.github.com/users/den1k/gists{/gist_id}","starred_url":"https://api.github.com/users/den1k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/den1k/subscriptions","organizations_url":"https://api.github.com/users/den1k/orgs","repos_url":"https://api.github.com/users/den1k/repos","events_url":"https://api.github.com/users/den1k/events{/privacy}","received_events_url":"https://api.github.com/users/den1k/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/thi-ng/geom/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/thi-ng/geom/labels/inprogress","name":"inprogress","color":"bfe5bf"},{"url":"https://api.github.com/repos/thi-ng/geom/labels/module:svg","name":"module:svg","color":"006b75"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-10-13T17:24:20Z","updated_at":"2015-10-15T13:10:40Z","closed_at":null,"body":"For CLJ hiccup serializes SVG's as in\r\n\r\n```\r\n#?(:clj\r\n   (defn serialize\r\n     ^String [svg] (str xml-preamble (html {:mode :xml} svg))))\r\n```\r\n\r\nI have tried multiple alternatives for CLJS (hiccups, hipo and sablono for react), which AFAIK each miss an :xml mode.\r\nsablono works properly for the [area and line plot](https://github.com/thi-ng/geom/blob/master/geom-viz/src/core.org#line--area-plot) example, but fails when used with the [bar graph](https://github.com/thi-ng/geom/blob/master/geom-viz/src/core.org#bar-graph).\r\n\r\n\r\nIn Om the following returns a valid react component based on the line-plot example:\r\n```\r\n(ns geom-test.geom\r\n  (:require\r\n    [om.core :as om :include-macros true]\r\n    [sablono.core :refer-macros [html]]\r\n    [thi.ng.geom.viz.core :as viz]\r\n    [thi.ng.geom.svg.core :as svg]\r\n    [thi.ng.math.core :as m :refer [PI]]))\r\n\r\n(defn test-equation\r\n  [t] (let [x (m/mix (- PI) PI t)] [x (* (Math/cos (* 0.5 x)) (Math/sin (* x x x)))]))\r\n\r\n(def viz-spec\r\n  {:x-axis (viz/linear-axis\r\n             {:domain [(- PI) PI] :range [50 580] :major (/ PI 2) :minor (/ PI 4) :pos 250})\r\n   :y-axis (viz/linear-axis\r\n             {:domain     [-1 1] :range [250 20] :major 0.2 :minor 0.1 :pos 50\r\n              :label-dist 15 :label {:text-anchor \"end\"}})\r\n   :grid   {:attribs {:stroke \"#caa\"}\r\n            :minor-y true}\r\n   :data   [{:values  (map test-equation (m/norm-range 200))\r\n             :attribs {:fill \"none\" :stroke \"#0af\"}\r\n             :layout  viz/svg-line-plot}]})\r\n\r\n(defn line-plot [_ owner]\r\n  (om/component\r\n    (html\r\n      [:svg {:width 600 :height 320}\r\n       (viz/svg-plot2d-cartesian viz-spec)])))\r\n```"},"comment":{"url":"https://api.github.com/repos/thi-ng/geom/issues/comments/148379957","html_url":"https://github.com/thi-ng/geom/issues/26#issuecomment-148379957","issue_url":"https://api.github.com/repos/thi-ng/geom/issues/26","id":148379957,"user":{"login":"den1k","id":4651810,"avatar_url":"https://avatars.githubusercontent.com/u/4651810?v=3","gravatar_id":"","url":"https://api.github.com/users/den1k","html_url":"https://github.com/den1k","followers_url":"https://api.github.com/users/den1k/followers","following_url":"https://api.github.com/users/den1k/following{/other_user}","gists_url":"https://api.github.com/users/den1k/gists{/gist_id}","starred_url":"https://api.github.com/users/den1k/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/den1k/subscriptions","organizations_url":"https://api.github.com/users/den1k/orgs","repos_url":"https://api.github.com/users/den1k/repos","events_url":"https://api.github.com/users/den1k/events{/privacy}","received_events_url":"https://api.github.com/users/den1k/received_events","type":"User","site_admin":false},"created_at":"2015-10-15T13:10:40Z","updated_at":"2015-10-15T13:10:40Z","body":"thanks @postspectacular I'm a huge fan of the geom toolkit. Looking forward to use it more & more in the future!"}}