jvl

0.0.1 • Public • Published

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)

Package Sidebar

Install

npm i jvl

Weekly Downloads

0

Version

0.0.1

License

ISC

Unpacked Size

21.6 kB

Total Files

6

Last publish

Collaborators

  • nlevine