Google Chart Implementation In Angular 6
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
e2e
src
.angular-cli.json
.editorconfig
.gitignore
Angular Google Chart Demo.png
LICENSE
README.md
Untitled.png
_config.yml
angular.json
karma.conf.js
loader.js
package-lock.json
package.json
protractor.conf.js
tsconfig.json
tslint.json

README.md

Angular Google Chart Component

This project was generated with Angular CLI version 6.0.7.

How To Use

  1. Import Google Chart Module to your module file : import {GoogleChartModule} from './angular-google-chart/google-chart.module';

  2. Add component in HTML <google-chart [chartType]="'LineChart'" [dataPromise]="dataPromise" [options]="options" (onSelect)="onSelect($event)" ></google-chart>

Options

  • chartType - Type of Chart. For example: LineChart, ScatterChart, AreaChart, BarChart, BubbleChart, CandlestickChart, ColumnChart, ComboChart, PieChart, Gantt,Gauge, GeoChart, Histogram, OrgChart, Sankey, SteppedAreaChart, Table, Timeline, TreeMap, WordTree, Calendar, Map

  • dataPromise - Promise to fetch data

  • options - Google Chart Option Object Google Chart Customization

  • config - Chart additional configuration object. For example, chart data does not have header & starts with row only then set firstRowAsData as true.

  • onInit - Event which will be fired when angular chart component will be initialized with ChartWrapper. It will return div - dynamic generated div Id for reference & wrapper - Reference to ChartWrapper to make changes and modify chart configuration and data manually

  • onReady - Event which fires every time chart is rendered & ready with new data or options. This event has no parameters.

  • onError - Event which fires on error while rendering chart.

  • onSelect - Event which will ne called on selecting data points on chart

Configuration

Provided angular-google-chart.config JSON file which has following configuration options:

  • packages - Packages to load. This is depend on chart type you use.

  • mapsApiKey - Google Developer API Key in order to access google map JS API.

Features

  • Inbuild Google Library Loading - All related library and packages will be loaded throgh component so no need to include explicitly and loading chart relaed packages

  • Data Changes Aware - Component is data changes aware so in case of changes in data promise, chart will rerender again automatically.

  • Option Changes Aware - Any changes made to Google Option Object, will be automatically drawn to chart.

Demo

Setup latest angular CLI(6.0.7) then clone this repo and fire command ng serve

Please refer demo.component for all chart type demo.

Roadmap

Reffer Wiki

Screenshot

alt text