npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

virtual-streamgraph

1.0.3 • Public • Published

virtual-streamgraph stability

npm version build status test coverage downloads js-standard-style

Create a virtual-dom streamgraph. Useful to visualize time series data.

example

Usage

const vgraph = require('virtual-streamgraph')
const vdom = require('virtual-dom')
const hyperx = require('hyperx')
const hx = hyperx(vdom.h)
 
const data = [
  { name: 'apples', values: [ { x: 1, y: 55 }, { x: 2, y: 65 }, { x: 3, y: 67 }] },
  { name: 'bananas', values: [ { x: 1, y: 55 }, { x: 2, y: 65 }, { x: 3, y: 67 }] },
  { name: 'cherries', values: [ { x: 1, y: 55 }, { x: 2, y: 65 }, { x: 3, y: 67 }] },
  { name: 'dates', values: [ { x: 1, y: 55 }, { x: 2, y: 65 }, { x: 3, y: 67 }] }
]
 
const tree = hx`
  <section className="my-graph">
    ${vgraph({ height: 500, width: 960, data: data })}
  </section>
`
console.log(vdom.create(tree).toString())

API

vgraph(opts)

Create a new virtual-streamgraph from data. Opts can contain the following fields:

  • opts.data: set data to be rendered
  • opts.width: set width dimension of the graph
  • opts.height: set height dimension of the graph
  • opts.min: optional, set lower bound for graph
  • opts.max: optional, set upper bound for graph
  • opts.limit: optional, limit amount of data points to be displayed

See Also

Installation

$ npm install virtual-streamgraph

License

MIT

install

npm i virtual-streamgraph

Downloadsweekly downloads

13

version

1.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability