colorcoded-bar
A colorcoded bar.
Example
var Bar = ; // Vertical bar { var bar = ; for var i = 0; i < 100; i++ bar; documentbody;}; // Horizontal bar { var bar = ; for var i = 0; i < 100; i++ bar; documentbody;}; // Automatic input scaling { var bar = ; for var i = 0; i < 10; i++ bar; documentbody;}; // Pretty rainbows { var bar = ; var height = 500; for var i = 0; i < height; i++ var color = 'hsl(' + Math + ', 100%, 50%)'; bar; documentbody;};
Installation
$ npm install colorcoded-bar
API
new Bar()
Create a new colorcoded bar.
#set(idx, color)
Set color
at idx
, any css supported color notation will work.
#render([{ canvas, horizontal, height, width }])
Render the bar, returning a canvas.
Options:
canvas
: use an already existing canvashorizontal
: render from left to right instead of top to bottomheight
/width
: size the canvas. default: 100
License
MIT