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

ng-highcharts

v1.0.0

Published

[![NPM version](https://img.shields.io/npm/v/ng-highcharts.svg)](https://npmjs.org/package/ng-highcharts) [![NPM downloads](https://img.shields.io/npm/dt/ng-highcharts.svg)](https://npmjs.org/package/ng-highcharts) ![](https://github.com/cebor/ng-highchar

Downloads

4

Readme

ng-highcharts

NPM version NPM downloads

This is a Highcharts directive for Angular.

Requirements

{
  "angular": ">=8.0.0",
  "highcharts": ">=7.0.0"
}

Installation

yarn

# install ng-highcharts and highcharts
yarn add ng-highcharts highcharts

npm

# install ng-highcharts and highcharts
npm i --save ng-highcharts highcharts

Usage Example

// app.module.ts
import { ChartModule } from 'ng-highcharts';

@NgModule({
  imports: [
    ChartModule // add ChartModule to your imports
  ]
})
export class AppModule {}
// chart.component.ts
import { Chart } from 'ng-highcharts';

@Component({
  template: `
    <button (click)="add()">Add Point!</button>
    <div [chart]="chart"></div>
  `
})
export class ChartComponent {
  chart = new Chart({
    chart: {
      type: 'line'
    },
    title: {
      text: 'Linechart'
    },
    credits: {
      enabled: false
    },
    series: [
      {
        name: 'Line 1',
        data: [1, 2, 3]
      }
    ]
  });

  // add point to chart serie
  add() {
    this.chart.addPoint(Math.floor(Math.random() * 10));
  }
}

API Docs

Chart

The Chart object.

Type: class

Constructor

new Chart(options: Options)

Properties

ref: Highcharts.Chart;

Deprecated. Please use ref$.

ref$: Observeable<Highcharts.Chart>

Observeable that emits a Highcharts.Chart - Offical Chart API Docs

Methods

addPoint(point: Point, [serieIndex: number = 0]): void

Adds a point to a serie

removePoint(pointIndex: number, [serieIndex: number = 0], [redraw: boolean = true], [shift: boolean = false]): void

Removes a point from a serie

addSeries(series: ChartSerie): void

Adds a series to the chart

removeSeries(seriesIndex: number): void

Remove series from the chart

StockChart

The Chart object.

Type: class

Constructor

new StockChart(options);

Properties

ref: Highstock.Chart;

Deprecated. Please use ref$.

ref$: Observeable<Highstock.Chart>

Observeable that emits a Highstock.Chart

MapChart

The Chart object.

Type: class

Constructor

new MapChart(options);

Properties

ref;

Deprecated. Please use ref$.

ref$;

Observeable that emits a Highmaps.Chart

Using Highcharts modules

To use Highcharts modules you have to import them and provide them in a factory (required for aot). You can find the list of available modules in the highcharts folder ls -la node_modules/highcharts/modules.

Hint: Highcharts-more is a exception, you find this module in the root folder. Don't forget to use the modules with the .src suffix, minimized highcharts modules are not importable.

Example

// app.module.ts
import { ChartModule, HIGHCHARTS_MODULES } from 'ng-highcharts';
import * as more from 'highcharts/highcharts-more.src';
import * as exporting from 'highcharts/modules/exporting.src';

@NgModule({
  providers: [
    { provide: HIGHCHARTS_MODULES, useFactory: () => [ more, exporting ] } // add as factory to your providers
  ]
})
export class AppModule { }

Highstock & Highmaps support

Highstock

For Highstock support load the following module

// app.module.ts
import * as highstock from 'highcharts/modules/stock.src';

@NgModule({
  providers: [
    { provide: HIGHCHARTS_MODULES, useFactory: () => [ highstock ] }
...
// chart.component.ts
import { StockChart } from 'ng-highcharts';

@Component({
  template: `
    <div [chart]="stockChart"></div>
  `
})
export class ChartComponent {
  stockChart = new StockChart({ options });
}

Example Demo

Highmaps

For Highmaps support load the following module

// app.module.ts
import * as highmaps from 'highcharts/modules/map.src';

@NgModule({
  providers: [
    { provide: HIGHCHARTS_MODULES, useFactory: () => [ highmaps ] }
...
// chart.component.ts
import { MapChart } from 'ng-highcharts';

@Component({
  template: `
    <div [chart]="mapChart"></div>
  `
})
export class ChartComponent {
  mapChart = new MapChart({ options });
}

Offical Highcharts NPM Docs: http://www.highcharts.com/docs/getting-started/install-from-npm

Troubleshooting

If you expiring typing errors while you build/serve your angular app the following could be helpful:

// override options type with <any>
chart = new Chart({ options } as any);

This is very useful when using gauge chart type.

Demo

License

MIT © Felix Itzenplitz