Skip to content

sorenmacbeth/vizard

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vizard

Magic Visualization

Overview

vizard is a tiny client/server library meant to enable REPL-based data visualization in the browser.

Usage

Add vizard to your leiningen project dependencies

[yieldbot/vizard "1.0.1"]

In a repl:

    (require '[vizard [core :refer :all] [lite :as lite]])

    (start-plot-server!)

    (defn group-data [& names]
        (apply concat (for [n names]
        (map-indexed (fn [i x] {:x i :y x :col n}) (take 20 (repeatedly #(rand-int 100)))))))

Now send some plots off. Here is a stacked bar plot:

  (def stacked-bar (p! (lite/lite {:mark "bar"
                                   :encoding {:x {:field "x"
                                                  :type "ordinal"}
                                              :y {:aggregate "sum"
                                                  :field "y"
                                                  :type "quantitative"}
                                              :color {:field "col"
                                                      :type "nominal"}}}
                                  (group-data "foo" "bar" "baz" "buh" "bunk" "dunk"))))

Which should look something like this in when rendered in the browser:

bar

Here's a multiple series line plot:

  (def multi-line (p! (lite/lite {:mark "line"
                                  :encoding {:x {:field "x"
                                                 :type "ordinal"}
                                             :y {:field "y"
                                                 :type "quantitative"}
                                             :color {:field "col"
                                                     :type "nominal"}}}
                                 (group-data "foo" "bar" "baz" "buh" "bunk" "dunk"))))

Which should look about like this:

line

Local Development

First, start up figwheel

  (do-it-fools!)

License

Copyright © 2017 Yieldbot, Inc.

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.