Comparing version 0.0.153 to 0.0.161
@@ -106,38 +106,2 @@ 'use strict'; | ||
var _schemeCategory = require('./scales/color/schemeCategory10'); | ||
Object.defineProperty(exports, 'schemeCategory10', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_schemeCategory).default; | ||
} | ||
}); | ||
var _schemeCategory2 = require('./scales/color/schemeCategory20'); | ||
Object.defineProperty(exports, 'schemeCategory20', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_schemeCategory2).default; | ||
} | ||
}); | ||
var _schemeCategory20b = require('./scales/color/schemeCategory20b'); | ||
Object.defineProperty(exports, 'schemeCategory20b', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_schemeCategory20b).default; | ||
} | ||
}); | ||
var _schemeCategory20c = require('./scales/color/schemeCategory20c'); | ||
Object.defineProperty(exports, 'schemeCategory20c', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_schemeCategory20c).default; | ||
} | ||
}); | ||
var _updateScale = require('./util/updateScale'); | ||
@@ -144,0 +108,0 @@ |
{ | ||
"name": "@vx/scale", | ||
"version": "0.0.153", | ||
"version": "0.0.161", | ||
"description": "vx scale", | ||
@@ -46,3 +46,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"d3-scale": "^1.0.5" | ||
"d3-scale": "^2.0.0" | ||
}, | ||
@@ -49,0 +49,0 @@ "publishConfig": { |
@@ -37,27 +37,2 @@ # @vx/scale | ||
### Color Scaling | ||
Color scales convert a point to a series of colors. D3 comes with a number of schemes that you can use just like any other scale. | ||
[Original d3 docs with colors](https://github.com/d3/d3-scale/blob/master/README.md#schemeCategory10) | ||
#### Scale 10 colors | ||
![scale10 colors](https://raw.githubusercontent.com/d3/d3-scale/master/img/category10.png) | ||
#### Scale 20 colors | ||
![scale20 colors](https://raw.githubusercontent.com/d3/d3-scale/master/img/category20.png) | ||
#### Scale 20b colors | ||
![scale20b colors](https://raw.githubusercontent.com/d3/d3-scale/master/img/category20b.png) | ||
#### Scale 20c colors | ||
![scale20c colors](https://raw.githubusercontent.com/d3/d3-scale/master/img/category20c.png) | ||
Example: | ||
``` javascript | ||
const scale10 = Scale.schemeCategory10({ /* range, domain, unknown */}) | ||
const scale20 = Scale.schemeCategory20({ /* range, domain, unknown */}) | ||
const scale20b = Scale.schemeCategory20b({ /* range, domain, unknown */}) | ||
const scale20c = Scale.schemeCategory20c({ /* range, domain, unknown */}) | ||
``` | ||
### Band Scaling | ||
@@ -193,1 +168,29 @@ | ||
``` | ||
### Color Scales | ||
D3 scales offer the ability to map points to colors. You can use [`d3-scale-chromatic`](https://github.com/d3/d3-scale-chromatic) in conjunction with vx's `scaleOrdinal` to make color scales. | ||
You can install `d3-scale-chromatic` with npm: | ||
``` | ||
npm install --save d3-scale-chromatic | ||
``` | ||
You create a color scale like so: | ||
```javascript | ||
import { scaleOrdinal } from '@vx/scale'; | ||
import { schemeSet1 } from 'd3-scale-chromatic'; | ||
const colorScale = scaleOrdinal({ | ||
domain: arrayOfThings, | ||
range: schemeSet1 | ||
}); | ||
``` | ||
This generates a color scale with the following colors: | ||
![d3-scale-chromatic schemeSet1](https://raw.githubusercontent.com/d3/d3-scale-chromatic/master/img/Set1.png) | ||
There are a number of other [categorical color schemes](https://github.com/d3/d3-scale-chromatic/blob/master/README.md#categorical) available, along with other continuous color schemes. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
195
16736
339
+ Addedd3-scale@2.2.2(transitive)
- Removedd3-scale@1.0.7(transitive)
Updatedd3-scale@^2.0.0