ng-amchart
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

ng-amchart

Tested for angular5

Installation

npm install ng-amchart

Add amcharts.js to index.html

<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
<script src="https://www.amcharts.com/lib/3/serial.js"></script><!-- must be before amstock -->
<script src="https://www.amcharts.com/lib/3/amstock.js"></script>
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>

How to use

imports amchart module

import { AmChartModule } from "ng-amchart";
@NgModule({
    imports: [ AmChartModule ]
})

imports amchart service

 
import { AmChartsService } from "ng-amchart";
export class myPage
private chart:any;
constructor( protected amchartSvc:AmChartsService) {}
 
    ngAfterViewInit() {
 
     this.chart = this.amchartSvc.makeChart("chartdiv", {
       "type": "serial",
       "theme": "light",
       "categoryField": "category",
       "graphs": [
   {
     "valueField": "value"
   }
 ],
       "dataProvider": [ {
             "category": "item1",
             "value": 8,
 
           },
           {
             "category": "item2",
             "value": 4,
           },
           {
             "category": "item3",
             "value": 15,
           },
           {
             "category": "item4",
             "value": 4,
           }]
     });
   }
 
 
   ngOnDestroy() {
     if (this.chart) {
       this.amchartSvc.destroyChart(this.chart);
     }

Readme

Keywords

Package Sidebar

Install

npm i ng-amchart

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

393 kB

Total Files

39

Last publish

Collaborators

  • pondol