https://github.com/anomal/rainbowvis-js
A JavaScript library for colour data visualization. Easily map numbers to a smooth-transitioning colour legend.
https://github.com/anomal/rainbowvis-js
color colour javascript visualization
Last synced: 5 months ago
JSON representation
A JavaScript library for colour data visualization. Easily map numbers to a smooth-transitioning colour legend.
- Host: GitHub
- URL: https://github.com/anomal/rainbowvis-js
- Owner: anomal
- License: epl-1.0
- Created: 2012-02-22T02:42:03.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2022-07-28T22:45:09.000Z (about 3 years ago)
- Last Synced: 2025-05-08T22:57:47.251Z (5 months ago)
- Topics: color, colour, javascript, visualization
- Language: JavaScript
- Homepage:
- Size: 29.3 KB
- Stars: 355
- Watchers: 14
- Forks: 76
- Open Issues: 5
-
Metadata Files:
- Readme: readme.markdown
- License: license.md
Awesome Lists containing this project
README
RainbowVis-JS
=============A JavaScript library for colour data visualization. Easily map numbers to a smooth-transitioning colour legend.
The Rainbow class by default maps the range 0 to 100 (inclusive) to the colours of the rainbow (i.e., a gradient transitioning from red to yellow to lime to blue).
See example.html
`var rainbow = new Rainbow();` creates new instance of Rainbow. By default, the number range is from 0 to 100, and the spectrum is a rainbow.
`rainbow.colourAt(number);` returns the hex colour corresponding to the number. If number is out of range, it returns the appropriate hex colour corresponding to either the minNumber or maxNumber.
`rainbow.setSpectrum(colour1, colour2 [,colourN]);` sets the spectrum of the Rainbow object. By default, the spectrum is a rainbow. You must have a minimum of two colours, but you can specify more than two colours. Colours can be in the form 'red', 'ff0000', or '#ff0000'. For example, `rainbow.setSpectrum('red', 'yellow', 'white');` makes the "Rainbow" a colour gradient from red to yellow to white.
`rainbow.setNumberRange(minNumber, maxNumber);` sets the number range of the Rainbow object. By default, it is 0 to 100.
CommonJS
--------
### Installation
`npm install rainbowvis.js`### Usage
var Rainbow = require('rainbowvis.js');
var myRainbow = new Rainbow();Related Links
-----------------* [RainbowVis-Java](https://github.com/anomal/RainbowVis-Java) - Java version
* [rainbowvis-rails](https://github.com/Intrepidd/rainbowvis-rails) - RainbowVis Rails gem by Intrepidd
* [rainbowvis-dart](https://github.com/ilikerobots/rainbowvis-dart) - Dart version by ilikerobots
* [RainbowVis](https://github.com/danesparza/RainbowVis) - Go version by danesparza