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

x-react-d3

v1.2.0

Published

ReactJS charts using d3

Downloads

4

Readme

react-d3

Modular ReactJS charts made using d3 chart utilities.

Caution: alpha state software. Chart APIs will change.

Build Status

Version

npm version

Chart types

Current charts:

  • bar chart
  • line chart
  • pie chart
  • area chart
  • treemap
  • scatter chart

The basic charts generated from the examples/main.js ReactJS app can be viewed here. Additional chart types and chart animations are soon to come.

Basic usage

First, install via npm:

npm install react-d3

Then, import into your ReactJS project:

var rd3 = require('react-d3');

The charts are then available under the rd3 namespace, which you can then use as shown on the demonstration page.

JSFiddle

There's a development build available for experimentation on JSFiddle: http://jsfiddle.net/esbullington/jp9dkh1g/

Please note that this build should probably not be used in production, since it bundles all of react-d3's dependencies in a single bundle (this is also the cause of the "Cannot read property 'firstChild' of undefined" error message on the JS console, which occurs when there are two React libraries in the same namespace).

All the react-d3 charts are available in this JSFiddle fork under the global rd3 namespace.

Background

Although there have been several different approaches proposed for combining the power of d3 with the flexibility and modularity of ReactJS, the approach I'm using here was inspired by this blog post by Ben Smith of Binary Consulting. Basically, it uses React to generate a chart's svg components using stateless React components.

With this approach, ReactJS itself is responsible for the SVG markup. d3 is used for its tremendous collection of utility functions, such as those that calculate the path value for various chart types.

However, I've diverged a bit from this original vision and am storing a bit of state in top-level chart components in order to leverage d3's axis generators, at least until I develop native React chart axes.

Todo

  • Many more charts types to do:
    • candlestick
    • radial gauge
    • and many more...
  • Add optional animation to charts using ReactJS transitions
  • Demos galore
  • Documentation

Changelog

####0.1.0:

  • Added treemap (Thanks @yang-wei!)
  • Restructured project for improved npm compatibility
  • Harmonized chart palettes
  • Fixed non-initial-render for charts with axes (contributions from @tarrencev and @unbracketed)
  • Improved documentation (contribution from @jeffriesen)
  • Improved chart APIs (contribution from @wookiehangover)

####0.0.1:

  • Initial release with linechart, barchart and areachart follow in subsequent patch updates

License

MIT

Copyright (c) 2014 Eric. S Bullington