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-cli-nvd3

v0.1.3

Published

An EmberJS NVD3 wrapper

Downloads

122

Readme

Ember CLI NVD3

Join the chat at https://gitter.im/offirgolan/ember-cli-nvd3 Build Status npm version Code Climate Dependency Status devDependency Status

An EmberJS NVD3 wrapper

Installation

ember install ember-cli-nvd3

Looking for help?

If it is a bug please open an issue on GitHub.

NVD3 Documentation

Before using this addon, you might want to checkout the NVD3 Docs

Basic Usage

All you need to get started is to specify which type of chart you want and the data it should display

{{nvd3-chart type='lineChart' datum=datum}}

Options

Chart Options

All chart specific options can be specified via the options.chart property.

options: {
    chart: {
      height: 500,
      color: ["#FF0000","#00FF00","#0000FF"]
  }
}
{{nvd3-chart type='lineChart' datum=datum options=options}}

Other Options

All other option can be freely specified under the options object.

options: {
  bars1: {
    groupSpacing: 0.1
  },
  xAxis: {
    tickFormat(d) {
      return d3.time.format('%b %e')(new Date(d));
    }
  },
  yAxis1: {
    tickFormat: d3.format(',s'),
    showMaxMin: false
  },
  tooltip: {
    gravity: 'n',
    headerFormatter(d) { return d + ' monkeys' }
  },
  legend: {
    rightAlign: false,
    vers: 'furious'
  }
}
{{nvd3-chart type='lineChart' datum=datum options=options}}

Dispatch Events

All events you want to dispatch can be specified via the dispatchEvents property. All chart specific events should be defined under the chart property.

dispatchEvents: {
  chart: {
    stateChange(container, chart, e) {
      console.log('State Changed');
    }
  },
  lines: {
    elementClick(container, chart, e) {
      alert(`${e.series.key}: (${e.point.x}, ${e.point.y})`);
    }
  }
}

Initially, the context of each event is set to the chart's targetObject property. This is done so you can interact with your ember object when the event is fired. To override this, you can specify the eventContext manually.

{{nvd3-chart type='lineChart' datum=datum dispatchEvents=dispatchEvents eventContext=parent}}

Helper Actions

Currently there are two helper actions provided:

1. beforeSetup

This is called after the svg container is initially created and before any options is set on the chart.

beforeSetup(svgContainer, chart) {}
// Set the height of the svg container
beforeSetup(svgContainer /*, chart*/) {
  svgContainer.attr({
    height: 500
  });
}
{{nvd3-chart type='lineChart' datum=datum beforeSetup=beforeSetup}}

2. afterSetup

This is called after all chart options and data have been set, as well as after the chart has been created.

afterSetup(svgContainer, chart) {}
// Setup click event on all visible x-axis ticks
afterSetup(svgContainer /*, chart*/) {
  svgContainer.selectAll('g.nv-axis.nv-x text')
    .filter(function() {
          return $(this).css('opacity') === "1";
      })
      .style("pointer-events", "visiblePainted")
        .style("cursor", "pointer")
        .on("click", function(x) {
          alert(`X-Axis: ${x}`);
        });
  }
{{nvd3-chart type='lineChart' datum=datum afterSetup=afterSetup}}

Styling

This addon imports the nvd3 css into your application. To disable that, add the following to your ember-cli-build.js

var app = new EmberApp(defaults, {
  'ember-cli-nvd3': {
    includeCss: false
  }
});

Want to help?

Installation

  • git clone this repository
  • npm install
  • bower install

Running

  • ember server
  • Visit your app at http://localhost:4200.

Running Tests

  • ember test
  • ember test --server

Building

  • ember build

For more information on using ember-cli, visit http://www.ember-cli.com/.