Skip to content

Render vega-lite charts in IJavascript Jupyter notebooks

Notifications You must be signed in to change notification settings

nickslevine/jvl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jvl - embed vega-lite charts in JS Jupyter notebooks

jvl is a tiny helper function for embedding vega-lite charts in Jupyter notebooks that are using the IJavaScript kernel.

Usage

Install Jupyter and the IJavascript kernel - see instructions here.

In your project folder:

npm init -y
npm install --save jvl
jupyter lab

In your notebook:

const {jvl} = require('jvl')

To print a vega-lite chart simply pass a vega-lite spec to jvl():

const spec = {
  data: {
    values: [
      {a: "A", b: 28}, {a: "B", b: 55}, {a: "C", b: 43},
      {a: "D", b: 91}, {a: "E", b: 81}, {a: "F", b: 53},
      {a: "G", b: 19}, {a: "H", b: 87}, {a: "I", b: 52}
    ]
  },
  mark: "bar",
  encoding: {
    x: {field: "a", type: "ordinal"},
    y: {field: "b", type: "quantitative"}
  }
}

jvl(spec)

About

Render vega-lite charts in IJavascript Jupyter notebooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published