ProductPromotion
Logo

Angular.JS

made by https://0x3d.site

GitHub - cebor/angular-highcharts: Highcharts directive for Angular
Highcharts directive for Angular. Contribute to cebor/angular-highcharts development by creating an account on GitHub.
Visit Site

GitHub - cebor/angular-highcharts: Highcharts directive for Angular

GitHub - cebor/angular-highcharts: Highcharts directive for Angular

angular-highcharts

NPM version NPM downloads

This is a directive for an easy usage of Highcharts with angular.

Requirements

{
  "angular": "^15.1.1",
  "highcharts": "^10.3.3"
}

Installation

yarn

# install angular-highcharts and highcharts
yarn add angular-highcharts highcharts

npm

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

Usage Example

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

@NgModule({
  imports: [
    ChartModule // add ChartModule to your imports
  ]
})
export class AppModule {}
// chart.component.ts
import { Chart } from 'angular-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$: Observable<Highcharts.Chart>

Observable that emits a Highcharts.Chart - Official 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$: Observable<Highstock.Chart>

Observable that emits a Highstock.Chart

MapChart

The Chart object.

Type: class

Constructor

new MapChart(options);

Properties

ref;

Deprecated. Please use ref$.

ref$;

Observable 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 'angular-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 { }

Troubleshooting

Compile Issues

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.

Loading Highcharts Modules manually

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

Demo

License

MIT © Felix Itzenplitz

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory