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

angular2-nvd3-aot

v1.0.1

Published

Angular2 module for NVD3 chart

Downloads

4

Readme

angular2-nvd3

NPM Version NPM license Dependency Status Build Status

Create nvd3 with angular2 use directive or as a component. This project has tested latest angular2 v2.4.1. This project is reincarnation from ng2-nvd3. If you are using nvd3 for angular2.RC take a look ng2-nvd3.

Install

This node use some dependency of @types :

  • @types/nvd3@^1.8.33
  • @types/d3@^3.5.35
  • d3@^3.5.17
  • nvd3@^1.8.5

Most of people get chart background turn into black, make sure to include nvd3.css via transpiler webpack or systemjs or current using it.

Usage

Hopefully you already know how to use decorator, module, component, directive, input on angular2.

Include module in your root module of your target component decalaration via NgModule.

import { NvD3Module } from 'angular2-nvd3';
....

@NgModule({
  ...
  imports: [ // import Angular's modules
    ...
    NvD3Module
    ...
  ],
  declarations: [
    ... // your component target to implement nvd3
  ]
  ...
})

then lets do awosome chart...

Use as component

@Component({
  ...
  template: `<div><app-nvd3 [options]="options" [data]="data"></app-nvd3></div>`
  ...
})

Use as directive

In case you want to use as directive appNvD3.

@Component({
  ...
  template: `<app-chart appNvD3 [options]="options" [data]="data"></app-chart>`
  ...
})

Set option and data

all chaining function use ase json...

    this.options = {
      chart: {
        type: 'lineChart',
        useInteractiveGuideline: true,
        height: 450,
        transitionDuration: 350,
        showLegend: false,
        margin: {
          top: 20,
          right: 20,
          bottom: 40,
          left: 55
        },
        x: (d) => { return d.x; },
        y: (d) => { return d.y; },
        xScale: d3.time.scale(),
        xAxis: {
          ticks: d3.time.months,
          tickFormat: (d) => {
              return d3.time.format('%b')(new Date(d));
          }
        },
        yAxis: {
          axisLabel: 'Gross volume',
          tickFormat: (d) => {
              if (d == null) {
                  return 0;
              }
              return d3.format('.02f')(d);
          },
          axisLabelDistance: 400
        }
      }
    }

    this.data = [
      {
        key: "Cumulative Return",
        values: [
          {
            "label" : "A" ,
            "value" : -29.765957771107
          } ,
          {
            "label" : "B" ,
            "value" : 0
          } ,
          {
            "label" : "C" ,
            "value" : 32.807804682612
          } ,
        ]
      }
    ];

you can set your callback:

    this.options = {
      chart: {
        ...
        callback: () => {
          // do something maybe change background
        }
      }
    }

you rock....!!!