https://github.com/mathisonian/d3moji
First class emoji support for D3
https://github.com/mathisonian/d3moji
Last synced: about 2 months ago
JSON representation
First class emoji support for D3
- Host: GitHub
- URL: https://github.com/mathisonian/d3moji
- Owner: mathisonian
- License: mit
- Created: 2015-05-04T03:32:48.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-12T00:55:12.000Z (about 8 years ago)
- Last Synced: 2025-01-29T19:43:50.465Z (3 months ago)
- Homepage:
- Size: 2.6 MB
- Stars: 126
- Watchers: 5
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-d3 - d3moji - First class emoji support (Miscellaneous)
- awesome-d3 - d3moji - First class emoji support (Miscellaneous)
README

:chart_with_upwards_trend: First class emoji support for D3

## installation
### CommonJS
```
npm install d3moji
``````js
var d3 = require('d3')
require('d3moji')(d3); // require and apply the plugin
```### old school
The plugin is automatically applied when d3 is found on the window object.
```html
```## usage
### Adding emoji to the svg
```js
svg
.append('emoji')
.attr('symbol', 'smile') // codes taken from http://www.emoji-cheat-sheet.com/ the enclosing :colons: aren't necessary
// do all the standard d3 stuff
.attr('width', 30)
.attr('height', 30)
.attr('x', function(d) {
return d[0];
})
.attr('y', function(d) {
return d[1];
})```
### selecting emoji
```js
d3.select('emoji'); // select the first one found
d3.selectAll('emoji'); // select all emoji
```## attribution
This project uses the open source [twemoji](https://github.com/twitter/twemoji) emoji svgs from twitter.
## faq
**why do you use the twitter emojis?** I couldn't find open SVG sets for the others. PR's welcome if you know more about this.
## LICENSE
MIT