npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-d3

v0.5.1

Published

Loads D3.js into your Ember application

Downloads

11,609

Readme

ember-d3 Build Status Ember Observer Score npm version Dependency Status devDependency Status

This Ember Addon acts as a loader for consuming D3.js within your Ember application or Addon. It works by applying a lightweight AMD transform around the D3 UMD builds which can be consumed by Ember CLI, making it possible to import any individual D3 package or the entire bundle as "d3" from NPM.

ember install ember-d3

Requirements:

  • NPM >= 3 (Check by running npm version)
  • Node >= 8 (Check by running node --version)
  • Ember CLI >= 2.16 (Check by running ember version)

You can upgrade NPM by running:

npm i -g npm@3

If you're looking for the ember-d3 for [email protected], see the v3 branch.

Loading 3rd Party D3 Plugins

If you want to use 3rd party plugins, like d3-selection-multi or d3-flame-graph, simply add them to your project and the module loader will automatically detect them, and any other packages beginning with d3- in the name.

Advanced Installation

You can specify any d3 version on the v4 release by adding it to your project:

npm install --save-dev [email protected]

Configuration and Usage:

There's two ways to use this library in your project, you can either load just the APIs you desire, or you can import the entire D3 object (similar to version 3).

Option 1:

import { line } from 'd3-shape'
import { scaleOrdinal } from 'd3-scale'
import { extent } from 'd3-array'

Option 2:

See Global D3 section below for configuration

import D3 from 'd3'

We've put together a complete demo component which you can use to really get a feel for how to use the different packages provided by this addon.

Global D3

We don't support the global window.d3 object, as this is viewed as an anti-pattern. However, you can expose a bundled import of d3 by enabling the bundle config flag:

module.exports = function() {
  return {
    'ember-d3': {
      bundle: true
    }
  }
}

This will allow you to do:

import d3 from 'd3'

Note: This will disable support for using the dependency whitelist/blacklist.

Dependency whitelist/blacklist

In case you do not want to include all of d3's dependencies, you may whitelist the packages that you want to include in your project's config/environment.js file.

For example, if you only wanted to use d3-scale, you would do:

// config/environment.js
module.exports = function() {
  return {
    'ember-d3': {
      only: ['d3-scale']
    }
  }
}

Or if you want to exclude a package:

// config/environment.js
module.exports = function() {
  return {
    'ember-d3': {
      except: ['d3-scale']
    }
  }
}

Note: Even though you only add d3-scale, it has a few transitive d3 dependencies. You will need to add these to the whitelist as needed.

Running Tests

  • yarn test (Runs ember try:each to test your addon against multiple Ember versions)
  • ember test
  • ember test --server

Contributing

This addon is developed by the community and is maintained by Ivan Vanderbyl.

All contributions are welcome by opening an issue or Pull Request.