Giter Club home page Giter Club logo

angular2-google-chart's Introduction

Angular2/ Angular 4

This module supports Both angular 2 and angular 4 versions

The sources for this package are in (https://github.com/vimalavinisha/angular2-google-chart) repo. Please file issues and pull requests against this repo.

Recently added Features:

Event listener added when user select/deselect on the chart points. It is an optional.

Live Demo

Live Demo Site OR Live Demo Site

Demo Output

google-chart-op

Usage

node install
npm install angular2-google-chart

1.In index.html page include following script

<script src="https://www.gstatic.com/charts/loader.js"></script>
<script>  
    // !important: You want to give this variable(var googleLoaded = false;). This is used to run multiple chart in your jade.
    var googleLoaded = false;
    // !important: Define which chart packages to preload.Because this package uses ChartWrappers you can use any chart type that Google supports, but if it // isn't loaded it will load it on demand. 
    var googleChartsPackagesToLoad = ['geochart'];
</script>

2.component file use like below

import {Component} from '@angular/core';
@Component({
    selector: 'my-app',
    template: `
    <h2>  Gaugh Chart</h2>
    <div id="gauge_chart" [chartData]="gauge_ChartData" [chartOptions]= "gauge_ChartOptions" chartType="Gauge" GoogleChart></div>
    <h2>  Area Chart</h2>
    <div id="area_chart" [chartData]="area_ChartData" [chartOptions]= "area_ChartOptions" chartType="AreaChart" GoogleChart></div>
    <h2>  Line Chart</h2>
    <div id="line_chart" [chartData]="line_ChartData" [chartOptions]= "line_ChartOptions" chartType="LineChart" GoogleChart></div>
    <h2>  Bubble Chart</h2>
    <div id="bubble_chart" [chartData]="bubble_ChartData"  [chartOptions] = "bubble_ChartOptions" chartType="BubbleChart" GoogleChart></div>
    <h2>  Scatter Chart</h2>
    <div id="scatter_chart" [chartData]="scatter_ChartData"  [chartOptions] = "scatter_ChartOptions" chartType="ScatterChart" GoogleChart></div>
    <h2>  CandlestickChart</h2>
    <div id="candle_chart" [chartData]="candle_ChartData" [chartOptions] = "candle_ChartOptions" chartType="CandlestickChart" GoogleChart></div>
    <h2>  Pie Chart</h2>
    <div id="pie_chart" [chartData]="pie_ChartData" [chartOptions] = "pie_ChartOptions" chartType="PieChart" GoogleChart></div>
    <h2>  Bar Chart</h2>
    <div id="bar_chart" [chartData]="bar_ChartData" [chartOptions] = "bar_ChartOptions" chartType="BarChart" GoogleChart></div>
    <h2>  Map Chart</h2>
    <div id="map_chart" [chartData]="map_ChartData" [chartOptions] = "map_ChartOptions" chartType="GeoChart" GoogleChart></div>
    <h2>  Organization Chart</h2>
    <div id="org_chart" [chartData]="org_ChartData" [chartOptions] = "org_ChartOptions" chartType="OrgChart" GoogleChart></div>

	`
})
export class AppComponent {
    public line_ChartData = [
        ['Year', 'Sales', 'Expenses'],
        ['2004', 1000, 400],
        ['2005', 1170, 460],
        ['2006', 660, 1120],
        ['2007', 1030, 540]];
    public bubble_ChartData = [
        ['ID', 'Life Expectancy', 'Fertility Rate', 'Region', 'Population'],
        ['CAN', 80.66, 1.67, 'North America', 33739900],
        ['DEU', 79.84, 1.36, 'Europe', 81902307],
        ['DNK', 78.6, 1.84, 'Europe', 5523095],
        ['EGY', 72.73, 2.78, 'Middle East', 79716203],
        ['GBR', 80.05, 2, 'Europe', 61801570],
        ['IRN', 72.49, 1.7, 'Middle East', 73137148],
        ['IRQ', 68.09, 4.77, 'Middle East', 31090763],
        ['ISR', 81.55, 2.96, 'Middle East', 7485600],
        ['RUS', 68.6, 1.54, 'Europe', 141850000],
        ['USA', 78.09, 2.05, 'North America', 307007000]];
    public scatter_ChartData = [
        ['Date', 'Sales Percentage'],
        [new Date(2016, 3, 22), 78],
        [new Date(2016, 3, 21, 9, 30, 2), 88],
        [new Date(2016, 3, 20), 67],
        [new Date(2016, 3, 19, 8, 34, 7), 98],
        [new Date(2016, 3, 18, 15, 34, 7), 95],
        [new Date(2016, 3, 16, 7, 30, 45), 89],
        [new Date(2016, 3, 16, 15, 40, 35), 68]
    ];
    public candle_ChartData = [
        ['Day', 'Low', 'Opening value', 'Closing value', 'High'],
        ['Mon', 28, 28, 38, 38],
        ['Tue', 38, 38, 55, 55],
        ['Wed', 55, 55, 77, 77],
        ['Thu', 77, 77, 66, 66],
        ['Fri', 66, 66, 22, 22]
    ];
    public pie_ChartData = [
        ['Task', 'Hours per Day'],
        ['Work', 11],
        ['Eat', 2],
        ['Commute', 2],
        ['Watch TV', 2],
        ['Sleep', 7]];
    public bar_ChartData = [
        ['City', '2010 Population', '2000 Population'],
        ['New York City, NY', 8175000, 8008000],
        ['Los Angeles, CA', 3792000, 3694000],
        ['Chicago, IL', 2695000, 2896000],
        ['Houston, TX', 2099000, 1953000],
        ['Philadelphia, PA', 1526000, 1517000]];
    public map_ChartData = [
        ['Country', 'Popularity'],
        ['Germany', 200],
        ['United States', 300],
        ['Brazil', 400],
        ['Canada', 500],
        ['France', 600],
        ['RU', 700]
    ];
    public org_ChartData = [
        ['Name', 'Manager', 'ToolTip'],
        [{ v: 'Mike', f: 'Mike<div style="color:red; font-style:italic">President</div>' },
            '', 'The President'],
        [{ v: 'Jim', f: 'Jim<div style="color:red; font-style:italic">Vice President</div>' },
            'Mike', 'VP'],
        ['Alice', 'Mike', ''],
        ['Bob', 'Jim', 'Bob Sponge'],
        ['Carol', 'Bob', '']
    ];
    public line_ChartOptions = {
        title: 'Company Performance',
        curveType: 'function',
        legend: {
            position: 'bottom'
        }
    };
    public bubble_ChartOptions = {
        title: 'Correlation between life expectancy, fertility rate ' +
        'and population of some world countries (2010)',
        hAxis: { title: 'Life Expectancy' },
        vAxis: { title: 'Fertility Rate' },
        bubble: { textStyle: { fontSize: 11 } }

    };
    public candle_ChartOptions = {
        legend: 'none',
        bar: { groupWidth: '100%' }, // Remove space between bars.
        candlestick: {
            fallingColor: { strokeWidth: 0, fill: '#a52714' }, // red
            risingColor: { strokeWidth: 0, fill: '#0f9d58' }   // green
        }
    };
    public scatter_ChartOptions = {
        legend: {
            position: 'bottom'
        },
        title: 'Company Sales Percentage'
    };
    public bar_ChartOptions = {
        title: 'Population of Largest U.S. Cities',
        chartArea: { width: '50%' },
        hAxis: {
            title: 'Total Population',
            minValue: 0,
            textStyle: {
                bold: true,
                fontSize: 12,
                color: '#4d4d4d'
            },
            titleTextStyle: {
                bold: true,
                fontSize: 18,
                color: '#4d4d4d'
            }
        },
        vAxis: {
            title: 'City',
            textStyle: {
                fontSize: 14,
                bold: true,
                color: '#848484'
            },
            titleTextStyle: {
                fontSize: 14,
                bold: true,
                color: '#848484'
            }
        }
    };
    public pie_ChartOptions = {
        title: 'My Daily Activities',
        width: 900,
        height: 500
    };
    public gauge_ChartData = [
        ['Label', 'Value'],
        ['Systolic', 120],
        ['Diastolic', 80]];
    public gauge_ChartOptions = {
        width: 400, height: 120,
        redFrom: 90, redTo: 100,
        yellowFrom: 75, yellowTo: 90,
        minorTicks: 5
    };
    public area_ChartData = [
        ['Year', 'Sales', 'Expenses'],
        ['2013', 1000, 400],
        ['2014', 1170, 460],
        ['2015', 660, 1120],
        ['2016', 1030, 540]
    ];

    public area_ChartOptions = {
        title: 'Company Performance',
        hAxis: { title: 'Year', titleTextStyle: { color: '#333' } },
        vAxis: { minValue: 0 }
    };
    public map_ChartOptions = {};
    public org_ChartOptions = {
        allowHtml: true
    };
}

3 In app.module.ts, make the following additions

import {GoogleChart} from 'angular2-google-chart/directives/angular2-google-chart.directive';
@NgModule({
  declarations: [
    AppComponent,
    GoogleChart
  ],...

4 Example Charts

<img src="../app/assets/images/google-charts-output.png">

angular2-google-chart's People

Contributors

butters16 avatar domenicd avatar ert78gb avatar martinmanzo avatar rajan-g avatar sketchthat avatar stefanvitz avatar vimalavinisha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

angular2-google-chart's Issues

Support for Map

I continue to receive the error, "undefined is not a function," when trying to use the map chart type. Is it an issue on my end or are the maps not supported?

Refresh on data change

Chart was not refreshing wen data changes. I handled ngOnChanges event and it worked.
ngOnChanges(){
if(!googleLoaded) {
googleLoaded = true;
google.charts.load('current', {'packages':['corechart', 'gauge']});
}
setTimeout(() =>this.drawGraph(this.chartOptions,this.chartType,this.chartData,this._element),1000);
}

error TS5023: Unknown compiler option 'moduleResolution'. while npm start

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]
6 silly lifecycle [email protected]
prestart: no script for prestart, continuing
7 info lifecycle [email protected]start: [email protected]
8 verbose lifecycle [email protected]
start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;D:\playground\chart-tests\angular2-google-chart\node_modules.bin;C:\Program Files\nodejs;C:\Ruby193\bin;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Program Files (x86)\AMD APP\bin\x86;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Git\cmd;C:\Program Files\Common Files\Autodesk Shared;C:\MongoDB\bin;C:\Python35;C:\Python35\Scripts;C:\Program Files (x86)\Skype\Phone;C:\Program Files\nodejs;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Ketul\AppData\Roaming\npm
10 verbose lifecycle [email protected]
start: CWD: D:\playground\chart-tests\angular2-google-chart
11 silly lifecycle [email protected]start: Args: [ '/d /s /c',
11 silly lifecycle 'tsc && concurrently "npm run tsc:w" "npm run lite" ' ]
12 silly lifecycle [email protected]
start: Returned: code: 1 signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: tsc && concurrently "npm run tsc:w" "npm run lite"
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:239:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:850:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid [email protected]
16 verbose cwd D:\playground\chart-tests\angular2-google-chart
17 error Windows_NT 10.0.10586
18 error argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
19 error node v6.1.0
20 error npm v3.8.6
21 error code ELIFECYCLE
22 error [email protected] start: tsc && concurrently "npm run tsc:w" "npm run lite"
22 error Exit status 1
23 error Failed at the [email protected] start script 'tsc && concurrently "npm run tsc:w" "npm run lite" '.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the angular2-google-chart package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error tsc && concurrently "npm run tsc:w" "npm run lite"
23 error You can get information on how to open an issue for this project with:
23 error npm bugs angular2-google-chart
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls angular2-google-chart
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Not working with Ionic3 - (void 0) is not a function

I am able to get it working with a new Angular4 application, but cannot get it to work with a new Ionic3 applications (using Angular4). I've created a repo to demonstrate: https://github.com/butters16/google-chart-using-ionic3

Steps to reproduce

  1. create blank project using ionic3 cli
  2. install google-chart npm install angular2-google-chart
  3. modify app.module.ts to import GoogleChart and add it to declarations
  4. override home.ts compnent to look like angular2-google-chart README

Error looks like this

platform-browser-dynamic.es5.js:170 Uncaught TypeError: (void 0) is not a function
    at Object.<anonymous> (platform-browser-dynamic.es5.js:170)
    at __webpack_require__ (bootstrap 3cf6321…:19)
    at Object.<anonymous> (src async:7)
    at __webpack_require__ (bootstrap 3cf6321…:19)
    at Object.<anonymous> (main.js:111954)
    at __webpack_require__ (bootstrap 3cf6321…:19)
    at bootstrap 3cf6321…:65
    at bootstrap 3cf6321…:65

how to use redraw method?

Hi, on the pure web/js google charts, there's a possibility to call a redraw method when there's a change on the values, how to do that with angular2-google-chart ?

for exemple:
new google.visualization.ColumnChart($('#global-graph').get(0)).draw(google.visualization.arrayToDataTable((function(days) {...

plus we need a .arrayToDataTable method...

How to add click event in geochart?

Using Angular 4.3.1 I can show province map of Netherlands using:

  public map_ChartData = [
    ['Provinces',   'Popularity'],
         [{ v: 'NL-DR', f: 'Drenthe' },  5],
         [{ v: 'NL-NH', f: 'Noord-Holland' },  1000],
         [{ v: 'NL-UT', f: 'Utrecht' },  800],
         [{ v: 'NL-FL', f: 'Flevoland' },  200],
         [{ v: 'NL-FR', f: 'Friesland' },  350],
         [{ v: 'NL-GE', f: 'Gelderland' },  450],
         [{ v: 'NL-GR', f: 'Groningen' },  788],
         [{ v: 'NL-LI', f: 'Limburg' },  244],
         [{ v: 'NL-NB', f: 'Noord-Brabant' },  750],
         [{ v: 'NL-OV', f: 'Overijssel' },  620],
         [{ v: 'NL-ZE', f: 'Zeeland' },  50],
         [{ v: 'NL-ZH', f: 'Zuid-Holland' },  890]
      ]; 

  public map_ChartOptions = {
    region: 'NL', resolution: 'provinces',
    enableRegionInteractivity: true,
    colorAxis: {
      minValue: 0,
      maxValue: 1000,      
      colors: ['grey', 'yellow', 'orange', 'blue', 'green']
    }};

  itemSelected(evt) {
    console.log(evt);
  }

<div id="map_chart" 
(itemSelect)="itemSelected($event)" 
(itemDeselect)="itemDeselected($event)" 
[chartData]="map_ChartData"
[chartOptions]="map_ChartOptions" 
chartType="GeoChart" 
GoogleChart></div>

When I click on a province I get an error in Chrome console:

core.es5.js:1020 ERROR Error: Invalid column index null. Should be an integer in the range [0-1].
    at gvjs_en (jsapi_compiled_default_module.js:75)
    at gvjs_P.gvjs_.getValue (jsapi_compiled_default_module.js:89)
    at angular2-google-chart.directive.ts:52
    at gvjs_Zn.<anonymous> (jsapi_compiled_default_module.js:179)
    at gvjs__n (jsapi_compiled_default_module.js:129)
    at gvjs_Zn.gvjs_.dispatchEvent (jsapi_compiled_default_module.js:127)
    at gvjs_U (jsapi_compiled_default_module.js:178)
    at jsapi_compiled_default_module.js:252
    at gvjs_Zn.<anonymous> (jsapi_compiled_default_module.js:179)
    at gvjs__n (jsapi_compiled_default_module.js:129)

template parse error

this template doesn't work for me. i get an error
EXCEPTION: Error: Uncaught (in promise): Template parse errors:
Only void and foreign elements can be self closed "div" ("

[ERROR ->]<div id="line_chart",[chartData]="line_ChartData", [chartOptions] = "line_ChartOptions",chartType="Li"): 

template: <div id="line_chart",[chartData]="line_ChartData", [chartOptions] = "line_ChartOptions",chartType="LineChart",GoogleChart/> <div id="bubble_chart",[chartData]="bubble_ChartData", [chartOptions] = "bubble_ChartOptions",chartType="BubbleChart",GoogleChart/> <div id="scatter_chart",[chartData]="scatter_ChartData", [chartOptions] = "scatter_ChartOptions",chartType="ScatterChart",GoogleChart/> <div id="candle_chart",[chartData]="candle_ChartData", [chartOptions] = "candle_ChartOptions",chartType="CandlestickChart",GoogleChart/> <div id="pie_chart",[chartData]="pie_ChartData", [chartOptions] = "pie_ChartOptions",chartType="PieChart",GoogleChart/> <div id="bar_chart",[chartData]="bar_ChartData", [chartOptions] = "bar_ChartOptions",chartType="BarChart",GoogleChart/>

Problem with 'select' event in piecharts

Google charts dispatch the error when some piechart is clicked.

core.es5.js:1084 ERROR Error: Invalid column index null. Should be an integer in the range [0-1].

Checking the code source, the directive uses select event to dispatch emit event, okay! But, inside of method:

            google.visualization.events.addListener(self.wrapper, 'select', function () {
                          ...
                        if (selectedItem.row !== null) {
                            selectedRowValues.push(self.wrapper.getDataTable().getValue(selectedItem.row, 0));
                            selectedRowValues.push(self.wrapper.getDataTable().getValue(selectedItem.row, selectedItem.column));
                          ...
            });

That error is happening because the piechart does not have column property and always is null and dispatching the error.

This is how I successfully integrate this module to my angular2 project with Angular-CLI

Thank you for creating this wonderful NPM module. I am sharing my experience to benefit others.

Use angular2-google-chart

  1. npm i angular2-google-chart
  2. Index.html has
<script src="https://www.gstatic.com/charts/loader.js"></script> <script> var googleLoaded = false; </script>
  1. App.component.ts
    import {GoogleChart} from 'angular2-google-chart/directives/angular2-google-chart.directive';
  2. App.module.ts
    import {GoogleChart} from 'angular2-google-chart/directives/angular2-google-chart.directive';

@NgModule({
declarations: [
AppComponent,
GoogleChart
],

Includes Timeline chart
in app.component.html, I have

Timeline Charts

in app.component.ts , I have
public timeline_ChartData ={
cols: [
{type: 'string', id: 'Executor'},
{type: 'string', id: 'Name'},
{type: 'string', id: 'Tooltip', role: 'tooltip', p: {html: true}},
{type: 'date', id: 'start_date'},
{type: 'date', id: 'finish_date'},
],
rows: [
{c:[{v: 'A'}, {v: 'John'}, {v: 'John Doe'}, {v: new Date(2016, 7, 31)}, {v: new Date(2016, 8, 1)}]},
{c:[{v: 'A'}, {v: 'Jane'}, {v: 'Jane Doe'}, {v: new Date(2016, 7, 27)}, {v: new Date(2016, 7, 31)}]},
{c:[{v: 'B'}, {v: 'John'}, {v: 'John Doe'}, {v: new Date(2016, 7, 30)}, {v: new Date(2016, 8, 1)}]},
{c:[{v: 'B'}, {v: 'Jane'}, {v: 'Jane Doe'}, {v: new Date(2016, 7, 29)}, {v: new Date(2016, 8, 5)}]},
{c:[{v: 'C'}, {v: 'John'}, {v: 'John Doe'}, {v: new Date(2016, 7, 25)}, {v: new Date(2016, 7, 29)}]},
{c:[{v: 'C'}, {v: 'Jane'}, {v: 'Jane Doe'}, {v: new Date(2016, 7, 27)}, {v: new Date(2016, 8, 1)}]},
{c:[{v: 'C'}, {v: 'Fred'}, {v: 'Fred Doe'}, {v: new Date(2016, 7, 21)}, {v: new Date(2016, 7, 26)}]}
]
};

public timeline_ChartOption={
timeline: { colorByRowLabel: true },
backgroundColor: '#ffd',
tooltip: {isHtml: true},
width: '100%',
height: '600px',
chartArea: {
width: '80%',
height: '80%'
},
colors: ['red', 'blue', 'green'],
avoidOverlappingGridLines: true
};

Charts inside `*ngIf` blocks result in error on second load

If a chart component is included in a block that is wrapped by an ngIf statement, then an error will be thrown the second time the chart is viewed. I have a working example of this in this repo.

My current workaround is to simply avoid ngIf blocks, but this isn't satisfactory and requires me to maintain a fork of a widget library on which I depend. Any help in establishing a fix or a workaround would be appreciated.

Error: (SystemJS) XHR error (404 Not Found)

i'm getting this->>
Error: (SystemJS) XHR error (404 Not Found) loading http://localhost:3000/angular2-google-chart/directives/angular2-google-chart.directive
patchProperty/desc.set/wrapFn@http://localhost:3000/node_modules/zone.js/dist/zone.js:698:26
ZoneDelegate.prototype.invokeTask@http://localhost:3000/node_modules/zone.js/dist/zone.js:265:21
Zone.prototype.runTask@http://localhost:3000/node_modules/zone.js/dist/zone.js:154:28
ZoneTask/this.invoke@http://localhost:3000/node_modules/zone.js/dist/zone.js:335:28

Error loading http://localhost:3000/angular2-google-chart/directives/angular2-google-chart.directive as "angular2-google-chart/directives/angular2-google-chart.directive" from http://localhost:3000/app/app.module.js

Fails to load component with parse errors

Here's the error I received in rc6

 [ERROR ->]<div id="line_chart",[chartData]="line_ChartData", [chartOptions] = "line_ChartOptions",chartType="Li"): PiechartComponent@2:4 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:(…) Error: Template parse errors:
Only void and foreign elements can be self closed "div" ("<!--Div that will hold the pie chart-->
<div>
    [ERROR ->]<div id="line_chart",[chartData]="line_ChartData", [chartOptions] = "line_ChartOptions",chartType="Li"): PiechartComponent@2:4
    at DirectiveNormalizer.normalizeLoadedTemplate (http://localhost:4200/vendor/@angular/compiler/bundles/compiler.umd.js:13501:21)
    at eval (http://localhost:4200/vendor/@angular/compiler/bundles/compiler.umd.js:13494:53)
    at ZoneDelegate.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:332:29)
    at Zone.run (http://localhost:4200/vendor/zone.js/dist/zone.js:225:44)
    at http://localhost:4200/vendor/zone.js/dist/zone.js:591:58
    at ZoneDelegate.invokeTask (http://localhost:4200/vendor/zone.js/dist/zone.js:365:38)
    at Zone.runTask (http://localhost:4200/vendor/zone.js/dist/zone.js:265:48)
    at drainMicroTaskQueue (http://localhost:4200/vendor/zone.js/dist/zone.js:497:36)
    at XMLHttpRequest.ZoneTask.invoke (http://localhost:4200/vendor/zone.js/dist/zone.js:437:26)

Piechart component is my custom component in which I am trying to load this chart

Error in angular2 ts directive when compiling

hi,

I get this error when i try to compile my application :

node_modules/angular2-google-chart/directives/angular2-google-chart.directive.ts(33,15): error TS7006: Parameter 'chartOptions' implicitly has a n 'any' type. node_modules/angular2-google-chart/directives/angular2-google-chart.directive.ts(33,29): error TS7006: Parameter 'chartType' implicitly has an ' any' type. node_modules/angular2-google-chart/directives/angular2-google-chart.directive.ts(33,40): error TS7006: Parameter 'chartData' implicitly has an ' any' type. node_modules/angular2-google-chart/directives/angular2-google-chart.directive.ts(33,51): error TS7006: Parameter 'ele' implicitly has an 'any' t ype. node_modules/angular2-google-chart/directives/angular2-google-chart.directive.ts(54,33): error TS2345: Argument of type '{ message: string; row: any; column: any; selectedRowValues: any[]; }' is not assignable to parameter of type '{ row: number; column: number; }'. Object literal may only specify known properties, and 'message' does not exist in type '{ row: number; column: number; }'.
Can someone help me with this ?
I'm using Angular 4.3.0 and the latest version of angular2-google-chart.

Thanks,

Theo

Gantt Chart Example

Hi, Could we please get an example of how to use this wonderful package with a 'Gantt' chart type.

thanks for the awesome work.

Gantt Chart Integration issue

Can anyone tell me how to integrate Gantt Chart using angular2-google-chart.
does this packages provide gantt chart features?
Please revert back asap thanks in advance

Handling events

Hi,
I am able to use the chart components. Please provide guidelines how to register chart events.

Google charts are not working in Anroid Apps

I Used this GoogleChart Directive in my application, It works properly in browser but not working when building an apk file or using phonegap for using app on android phone.

Support for Latest Angular Updates

I am facing an issue similar to angular/angular#15763
This happens because my code is updated to [email protected] but the angular2-google-chart project is still in [email protected]
Please update the package.json to support future versions of angular.
Something like this

    "@angular/common": ">=4.1.3",
    "@angular/compiler": ">=4.1.3",
    "@angular/core": ">=4.1.3",
    "@angular/platform-browser": ">=4.1.3 ",
    "@angular/platform-browser-dynamic": ">=4.1.3",
    "@angular/upgrade": ">=4.1.3",

Or,

    "@angular/common": "^4.1.3",
    "@angular/compiler": "^4.1.3",
    "@angular/core": "^4.1.3",
    "@angular/platform-browser": "^4.1.3 ",
    "@angular/platform-browser-dynamic": "^4.1.3",
    "@angular/upgrade": "^4.1.3",

TIA

failed to install angular2-google-chart

when I tried on windows 7 and Ubunt6u, I got below error with npm install command:

d:\Test\ng2\angular2-google-chart>npm install angular2-google-chart
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\nodejs\node.exe" "D:\nodejs\node_modules\npm\bin\npm-cli.js" "install" "angular2-google-chart"
npm ERR! node v6.6.0
npm ERR! npm v3.10.3
npm ERR! code ENOSELF

npm ERR! Refusing to install angular2-google-chart as a dependency of itself
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:

npm ERR! d:\Test\ng2\angular2-google-chart\npm-debug.log

thanks.

unable to install angular2-google-chart

I am getting below error after running the command npm install angular2-google-chart,
Can some one please advice how to rectify it.
-- [email protected] +-- **UNMET PEER DEPENDENCY @angular/[email protected] +-- UNMET PEER DEPENDENCY @angular/[email protected] +-- UNMET PEER DEPENDENCY @angular/[email protected] -- UNMET PEER DEPENDENCY @angular/[email protected]**

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'D:\Users\pendyala.reddy\package.json'
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.

'google' is not defined - Angular2 - RC6

zone.js:484 Unhandled Promise rejection: Error in http://localhost:4200/app/home/dashboard/piechart.component.html:8:25 caused by: google is not defined ; Zone: angular ; Task: Promise.then ; Value: ViewWrappedError {_nativeError: Error: Error in http://localhost:4200/app/home/dashboard/piechart.component.html:8:25 caused by: goo…, originalError: ReferenceError: google is not defined
    at GoogleChart.ngOnInit (http://localhost:4200/app/directi…, context: DebugContext} ReferenceError: google is not defined
    at GoogleChart.ngOnInit (http://localhost:4200/app/directives/angular2-google-chart.directive.js:21:13)
    at DebugAppView._View_PiechartComponent0.detectChangesInternal (PiechartComponent.ngfactory.js:111:80)
    at DebugAppView.AppView.detectChanges (http://localhost:4200/vendor/@angular/core/bundles/core.umd.js:12061:18)
    at DebugAppView.detectChanges (http://localhost:4200/vendor/@angular/core/bundles/core.umd.js:12166:48)
    at DebugAppView.AppView.detectViewChildrenChanges (http://localhost:4200/vendor/@angular/core/bundles/core.umd.js:12087:23)
    at DebugAppView._View_DashboardComponent0.detectChangesInternal (DashboardComponent.ngfactory.js:270:8)
    at DebugAppView.AppView.detectChanges (http://localhost:4200/vendor/@angular/core/bundles/core.umd.js:12061:18)
    at DebugAppView.detectChanges (http://localhost:4200/vendor/@angular/core/bundles/core.umd.js:12166:48)
    at DebugAppView.AppView.detectViewChildrenChanges (http://localhost:4200/vendor/@angular/core/bundles/core.umd.js:12087:23)
    at DebugAppView._View_DashboardComponent_Host0.detectChangesInternal (DashboardComponent_Host.ngfactory.js:31:8)

I have defined googleLoaded in my component's template HTML. Here's the sample code for the same

<!--Google charts-->
<!--Div that will hold the pie chart-->
<div>
    <div id="line_chart" [chartData]="line_ChartData" [chartOptions]= "line_ChartOptions" chartType="LineChart" GoogleChart>

    </div>
</div>

Not compatible with Ang2 2.0.0-rc.2

Following your example while running Ang2 2.0.0-rc.2 leads to a variety of errors. If you are interested in working on this and want me to replicate specific errors, let me know. If you can run this library with 2.0.0-rc.2 without error, then there must be a problem on my end. I do see "angular2": "2.0.0-beta.17" as a dependency in this package.json though.

Error if I try to use angular2-google-chart with --aot option

It looks that angular2-google-chart doesn't support Ahead-Of-Time compilation. Is true?

This is the error that angular-cli launchs when I tried to apply -aot option:

$ ng build --aot --progress --verbose

ERROR in Error encountered resolving symbol values statically. Calling function 'ɵmakeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in /home/ekaitz/projects/mytoolbox/mytoolbox/Application/frontend/node_modules/angular2-google-chart/node_modules/@angular/core/core.d.ts, resolving symbol ɵf in /home/ekaitz/projects/mytoolbox/mytoolbox/Application/frontend/node_modules/angular2-google-chart/node_modules/@angular/core/core.d.ts, resolving symbol ɵf in /home/ekaitz/projects/mytoolbox/mytoolbox/Application/frontend/node_modules/angular2-google-chart/node_modules/@angular/core/core.d.ts

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/ekaitz/projects/mytoolbox/mytoolbox/Application/frontend/src'
 @ ./src/main.ts 4:0-74
 @ multi ./src/main.ts
Child html-webpack-plugin for "index.html":
         Asset     Size  Chunks  Chunk Names
    index.html  5.35 kB       0  

Ionic 2 Error - 'import' and 'export' may appear only with 'sourceType: module'

Followed your code base but when running on localhost with Ionic 2, I get a parse error stating

//path/angular2-google-chart/directives/angular2-google-chart.directive.ts:1
import {Directive,ElementRef,Input,OnInit} from '@angular/core';
^
ParseError: 'import' and 'export' may appear only with 'sourceType: module'

Is this an issue you can help with?

Calling function 'ɵmakeDecorator', function calls are not supported.

installed using this command. npm install angular2-google-chart
I am on a mac using angular-cli
Once I update app.module.ts with the import statement and the addition to the imports area, I get the stack trace below when I invoke npm start

import { GoogleChart } from 'angular2-google-chart/directives/angular2-google-chart.directive';

imports: [
BrowserModule,
HttpModule,
GoogleChart,

ERROR in Error: Error encountered resolving symbol values statically. Calling function 'ɵmakeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Directive in /Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/angular2-google-chart/node_modules/@angular/core/core.d.ts, resolving symbol GoogleChart in /Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/angular2-google-chart/directives/angular2-google-chart.directive.ts, resolving symbol GoogleChart in /Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/angular2-google-chart/directives/angular2-google-chart.directive.ts
at Error (native)
at syntaxError (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler/bundles/compiler.umd.js:1729:34)
at simplifyInContext (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler/bundles/compiler.umd.js:25118:23)
at StaticReflector.simplify (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler/bundles/compiler.umd.js:25130:13)
at StaticReflector.annotations (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler/bundles/compiler.umd.js:24558:41)
at _getNgModuleMetadata (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler-cli/src/ngtools_impl.js:138:31)
at _extractLazyRoutesFromStaticModule (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler-cli/src/ngtools_impl.js:109:26)
at /Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler-cli/src/ngtools_impl.js:129:27
at Array.reduce (native)
at _extractLazyRoutesFromStaticModule (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler-cli/src/ngtools_impl.js:128:10)
at Object.listLazyRoutesOfModule (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler-cli/src/ngtools_impl.js:53:22)
at Function.NgTools_InternalApi_NG_2.listLazyRoutes (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@angular/compiler-cli/src/ngtools_api.js:91:39)
at AotPlugin._getLazyRoutesFromNgtools (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@ngtools/webpack/src/plugin.js:207:44)
at _donePromise.Promise.resolve.then.then.then.then.then (/Users/briannettles/Desktop/Websites/sites/rockiestocumorah/src/r2csoftware/node_modules/@ngtools/webpack/src/plugin.js:443:24)
at process._tickCallback (internal/process/next_tick.js:109:7)

webpack: Failed to compile.

',' expected.

app/app.component.ts(94,9): error TS1005: ',' expected.
app/app.component.ts(129,7): error TS1005: ',' expected.
app/app.component.ts(130,7): error TS1005: ',' expected.

Three lines are missing commas.

ncaught TypeError: (void 0) is not a function with import GooglChart

I followed this to import GoogleChart in app.module.ts
https://www.npmjs.com/package/angular2-google-chart
But, when I import it, I get the following error:

ncaught TypeError: (void 0) is not a function
at eval (eval at (app.js:5614), :1:9)
at Object. (app.js:5614)
at webpack_require (polyfills.js:53)
at eval (eval at (app.js:5062), :80:41)
at Object. (app.js:5062)
at webpack_require (polyfills.js:53)
at eval (eval at (app.js:3059), :4:20)
at Object. (app.js:3059)
at webpack_require (polyfills.js:53)
at Object. (app.js:5580)
at webpack_require (polyfills.js:53)
at webpackJsonpCallback (polyfills.js:24)

Is there a bug in the library or I am missing something?

Typescript version

Version 2.1.0 does not exist, please can you update your package.json to versions that work.

Thanks

npm install is failing to install angular2-google-chart

I am trying to install angular2-google-chart using npm for my angular2 with Angular-Cli. Below is the error I get while doing npm install. Please let me know if there are any dependency on node js version? Thanks.

D:\gitmyworkspace\mywork\pcfdeploy>	npm install angular2-google-chart
> [email protected] postinstall D:\gitmyworkspace\mywork\pcfdeploy\node_modules\angular2-google-chart
> typings install
'typings' is not recognized as an internal or external command,operable program or batch file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN enoent ENOENT: no such file or directory, open 'D:\gitmyworkspace\mywork\pcfdeploy\node_modules\es6-promise\package.json'
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of rxjs@^5.0.1 but none was installed.
npm WARN @angular/[email protected] requires a peer of zone.js@^0.7.2 but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm WARN @angular/[email protected] requires a peer of @angular/[email protected] but none was installed.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\nodeJS\\node.exe" "D:\\nodeJS\\node_modules\\	npm\\bin\\	npm-cli.js" "install" "angular2-google-chart"
npm ERR! node v6.9.5
npm ERR! 	npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script 'typings install'.
npm ERR! Make sure you have the latest version of node.js and 	npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-google-chart package,
npm ERR! not with 	npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     	npm bugs angular2-google-chart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     	npm owner ls angular2-google-chart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     D:\gitmyworkspace\mywork\pcfdeploy\	npm-debug.log

Demo page

Add demo of this module rather than image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.