-
-
Save nick3499/44b284aa84999431d8f2453b35270fc4 to your computer and use it in GitHub Desktop.
D3byEX 5.6: Ordinal Scale (Adapted to D3.js v4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <meta charset=utf-8> | |
| <head> | |
| <meta name="description" | |
| content="D3.js v4, .scaleOrdinal, ordinal scale" /> | |
| </head> | |
| <body> | |
| <script src="http://d3js.org/d3.v4.min.js"></script> | |
| <script> | |
| var colorScale = d3.scaleOrdinal() // v4 | |
| .domain(['red', 'green', 'blue']) | |
| .range(['#ff0000', '#00ff00', '#0000ff']); | |
| // view console: #ff0000 #00ff00 #0000ff | |
| console.log(colorScale('red'), colorScale('green'), colorScale('blue')); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment