Giter Site home page Giter Site logo

d3moji's Introduction

invert

๐Ÿ“ˆ First class emoji support for D3

emojigif

installation

CommonJS

npm install d3moji
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.

<script src="path/to/d3.js" />
<script src="path/to/d3moji.js" /> 

usage

Adding emoji to the svg


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

d3.select('emoji'); // select the first one found
d3.selectAll('emoji'); // select all emoji

attribution

This project uses the open source 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

d3moji's People

Contributors

mathisonian avatar moklick avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

d3moji's Issues

add an AMD example

The readme shows how to use this library with commonjs or with <script> tags. The module exports itself as an AMD module too - this should be reflected in the README

configurable URL

The plugin works by fetching emoji SVG assets from a CDN on demand. This URL should be configurable so that we can work support multiple icon sets.

See an example use case in #2

font-awesome svg

I discovered this a couple weeks ago https://github.com/encharm/Font-Awesome-SVG-PNG, but unfortunately still does not solve the problem, since currently it seems you need something like the twemoji cdn to serve it up. It would be slow, but could just do a gh-pages branch of that repo to serve up the generated SVG.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.