Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mathisonian/d3moji
First class emoji support for D3
https://github.com/mathisonian/d3moji
Last synced: about 1 month 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 (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-12T00:55:12.000Z (almost 8 years ago)
- Last Synced: 2024-10-30T15:51:18.385Z (about 1 month 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
![invert](https://cloud.githubusercontent.com/assets/1074773/22858734/c86a504c-f07a-11e6-97a1-4ec86c68f0d6.png)
:chart_with_upwards_trend: First class emoji support for D3
![emojigif](./images/emoji.gif)
## 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