Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ng2-google-charts

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-google-charts - npm Package Compare versions

Comparing version 2.4.1 to 3.0.0

google-chart/chart-mouse-event.d.ts

84

bundles/ng2-google-charts.umd.js

@@ -76,3 +76,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ return __webpack_require__(__webpack_require__.s = 6);
/******/ })

@@ -137,2 +137,3 @@ /************************************************************************/

this.mouseOver = new core_1.EventEmitter();
this.mouseOut = new core_1.EventEmitter();
}

@@ -181,3 +182,4 @@ GoogleChartComponent.prototype.ngOnChanges = function (changes) {

line: 'point#%s#%r',
legend: 'legendentry#%s'
legend: 'legendentry#%s',
area: 'point#%s#%r'
};

@@ -252,3 +254,3 @@ var selector = selectors[seriesType];

};
GoogleChartComponent.prototype.parseMouseOverEvent = function (item) {
GoogleChartComponent.prototype.parseMouseEvent = function (item) {
var event = {

@@ -258,3 +260,2 @@ position: item,

value: this.getValueAtPosition(item),
tooltip: this.getHTMLTooltip(),
columnType: this.getColumnTypeAtPosition(item),

@@ -274,6 +275,15 @@ columnLabel: this.getColumnLabelAtPosition(item)

google.visualization.events.addListener(chart, 'onmouseover', function (item) {
var event = _this.parseMouseOverEvent(item);
var event = _this.parseMouseEvent(item);
event.tooltip = _this.getHTMLTooltip();
_this.mouseOver.emit(event);
});
}
if (this.mouseOut.observers.length > 0) {
var chart = this.wrapper.getChart();
this.cli = chart.getChartLayoutInterface();
google.visualization.events.addListener(chart, 'onmouseout', function (item) {
var event = _this.parseMouseEvent(item);
_this.mouseOut.emit(event);
});
}
};

@@ -343,2 +353,6 @@ GoogleChartComponent.prototype.registerChartWrapperEvents = function () {

], GoogleChartComponent.prototype, "mouseOver", void 0);
__decorate([
core_1.Output(),
__metadata("design:type", core_1.EventEmitter)
], GoogleChartComponent.prototype, "mouseOut", void 0);
GoogleChartComponent = __decorate([

@@ -475,2 +489,54 @@ core_1.Component({

var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ChartMouseEvent = (function () {
function ChartMouseEvent() {
}
return ChartMouseEvent;
}());
exports.ChartMouseEvent = ChartMouseEvent;
/**
* @deprecated Use ChartMouseOverEvent instead
*/
var MouseOverEvent = (function (_super) {
__extends(MouseOverEvent, _super);
function MouseOverEvent() {
return _super !== null && _super.apply(this, arguments) || this;
}
return MouseOverEvent;
}(ChartMouseEvent));
exports.MouseOverEvent = MouseOverEvent;
var ChartMouseOverEvent = (function (_super) {
__extends(ChartMouseOverEvent, _super);
function ChartMouseOverEvent() {
return _super !== null && _super.apply(this, arguments) || this;
}
return ChartMouseOverEvent;
}(ChartMouseEvent));
exports.ChartMouseOverEvent = ChartMouseOverEvent;
var ChartMouseOutEvent = (function (_super) {
__extends(ChartMouseOutEvent, _super);
function ChartMouseOutEvent() {
return _super !== null && _super.apply(this, arguments) || this;
}
return ChartMouseOutEvent;
}(ChartMouseEvent));
exports.ChartMouseOutEvent = ChartMouseOutEvent;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {

@@ -508,3 +574,3 @@ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;

/***/ }),
/* 5 */
/* 6 */
/***/ (function(module, exports, __webpack_require__) {

@@ -521,3 +587,7 @@

exports.ChartHTMLTooltip = chart_html_tooltip_1.ChartHTMLTooltip;
var google_charts_module_1 = __webpack_require__(4);
var chart_mouse_event_1 = __webpack_require__(4);
exports.ChartMouseOverEvent = chart_mouse_event_1.ChartMouseOverEvent;
exports.ChartMouseOutEvent = chart_mouse_event_1.ChartMouseOutEvent;
exports.MouseOverEvent = chart_mouse_event_1.MouseOverEvent;
var google_charts_module_1 = __webpack_require__(5);
exports.Ng2GoogleChartsModule = google_charts_module_1.Ng2GoogleChartsModule;

@@ -524,0 +594,0 @@

2

bundles/ng2-google-charts.umd.min.js

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@angular/core")):"function"==typeof define&&define.amd?define(["@angular/core"],t):"object"==typeof exports?exports["ng2-google-charts.umd.min"]=t(require("@angular/core")):e["ng2-google-charts.umd.min"]=t(e["@angular/core"])}(this,function(e){return function(e){function t(r){if(o[r])return o[r].exports;var n=o[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var o={};return t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,r){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=5)}([function(t,o){t.exports=e},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e){this.tooltipDOMElement=e}return e.prototype.setPosition=function(t,o){this.tooltipDOMElement.nativeElement.style.left=t+e.PIXELS,this.tooltipDOMElement.nativeElement.style.top=o+e.PIXELS},e.prototype.getDOMElement=function(){return this.tooltipDOMElement},e}();r.PIXELS="px",t.ChartHTMLTooltip=r},function(e,t,o){"use strict";var r=this&&this.__decorate||function(e,t,o,r){var n,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,o,a):n(t,o))||a);return i>3&&a&&Object.defineProperty(t,o,a),a},n=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0});var i=o(0),a=o(3),s=o(1),c=function(){function e(e,t){this.el=e,this.loaderService=t,this.chartSelect=new i.EventEmitter,this.chartReady=new i.EventEmitter,this.chartError=new i.EventEmitter,this.mouseOver=new i.EventEmitter}return e.prototype.ngOnChanges=function(e){var t=this;if(e.data){if(!this.data)return;this.options=this.data.options,this.loaderService.load(this.data.chartType).then(function(){if(void 0===t.wrapper||t.wrapper.getChartType!==t.data.chartType?t.wrapper=new google.visualization.ChartWrapper(t.data):(t.unregisterChartEvents(),t.wrapper.setDataTable(t.data.dataTable),t.wrapper.setOptions(t.options)),t.registerChartWrapperEvents(),void 0!==t.data.formatters)for(var e=0,o=t.data.formatters;e<o.length;e++)for(var r=o[e],n=google.visualization[r.type],i=r.options,a=new n(i),s=0,c=r.columns;s<c.length;s++){var l=c[s];a.format(t.wrapper.getDataTable(),l)}t.redraw()})}},e.prototype.redraw=function(){this.wrapper.draw(this.el.nativeElement.querySelector("div"))},e.prototype.getSelectorBySeriesType=function(e){return{bars:"bar#%s#%r",haxis:"hAxis#0#label",line:"point#%s#%r",legend:"legendentry#%s"}[e]},e.prototype.getSeriesByColumn=function(e){for(var t=0,o=this.wrapper.getDataTable(),r=e-1;r>=0;r--){var n=o.getColumnRole(r),i=o.getColumnType(r);"data"!==n&&"number"!==i||t++}return t},e.prototype.getBoundingBoxForItem=function(e){var t={top:0,left:0,width:0,height:0};if(this.cli){var o=e.column,r=this.getSeriesByColumn(o),n=(e.row,e.row),i=this.options.seriesType;if(this.options.series&&this.options.series[r]&&this.options.series[r].type&&(i=this.options.series[r].type),i){var a=this.getSelectorBySeriesType(i);if(a){a=a.replace("%s",r+"").replace("%c",o+"").replace("%r",n+"");var s=this.cli.getBoundingBox(a);s&&(t=s)}}}return t},e.prototype.getValueAtPosition=function(e){return null===e.row?null:this.wrapper.getDataTable().getValue(e.row,e.column)},e.prototype.getColumnTypeAtPosition=function(e){return this.wrapper.getDataTable().getColumnType(e.column)||""},e.prototype.getColumnLabelAtPosition=function(e){return this.wrapper.getDataTable().getColumnLabel(e.column)||""},e.prototype.getHTMLTooltip=function(){var e=new i.ElementRef(this.el.nativeElement.querySelector(".google-visualization-tooltip"));return new s.ChartHTMLTooltip(e)},e.prototype.parseMouseOverEvent=function(e){return{position:e,boundingBox:this.getBoundingBoxForItem(e),value:this.getValueAtPosition(e),tooltip:this.getHTMLTooltip(),columnType:this.getColumnTypeAtPosition(e),columnLabel:this.getColumnLabelAtPosition(e)}},e.prototype.unregisterChartEvents=function(){google.visualization.events.removeAllListeners(this.wrapper)},e.prototype.registerChartEvents=function(){var e=this;if(this.mouseOver.observers.length>0){var t=this.wrapper.getChart();this.cli=t.getChartLayoutInterface(),google.visualization.events.addListener(t,"onmouseover",function(t){var o=e.parseMouseOverEvent(t);e.mouseOver.emit(o)})}},e.prototype.registerChartWrapperEvents=function(){var e=this;google.visualization.events.addListener(this.wrapper,"ready",function(){e.chartReady.emit({message:"Chart ready"}),e.registerChartEvents()}),google.visualization.events.addListener(this.wrapper,"error",function(t){e.chartError.emit(t)}),google.visualization.events.addListener(this.wrapper,"select",function(){var t,o=e.wrapper.visualization.getSelection()[0];if(void 0!==o){var r=[];if(null!==o.row)for(var n=e.wrapper.getDataTable(),i=n.getNumberOfColumns(),a=0;a<i;a++)r.push(n.getValue(o.row,a));s={message:"select",row:o.row,column:o.column},s.selectedRowValues=r,t=s}else t={message:"deselect",row:null,column:null,selectedRowValues:[]};e.chartSelect.emit(t);var s})},e}();r([i.Input(),n("design:type",Object)],c.prototype,"data",void 0),r([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"chartReady",void 0),r([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"chartError",void 0),r([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"chartSelect",void 0),r([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"mouseOver",void 0),c=r([i.Component({selector:"google-chart",template:"<div></div>",changeDetection:i.ChangeDetectionStrategy.OnPush}),n("design:paramtypes",[i.ElementRef,a.GoogleChartsLoaderService])],c),t.GoogleChartComponent=c},function(e,t,o){"use strict";var r=this&&this.__decorate||function(e,t,o,r){var n,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,o,a):n(t,o))||a);return i>3&&a&&Object.defineProperty(t,o,a),a},n=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0});var i=o(0),a=function(){function e(){this.chartPackage={AnnotationChart:"annotationchart",AreaChart:"corechart",Bar:"bar",BarChart:"corechart",BubbleChart:"corechart",Calendar:"calendar",CandlestickChart:"corechart",ColumnChart:"corechart",ComboChart:"corechart",PieChart:"corechart",Gantt:"gantt",Gauge:"gauge",GeoChart:"geochart",Histogram:"corechart",Line:"line",LineChart:"corechart",Map:"map",OrgChart:"orgchart",Sankey:"sankey",Scatter:"scatter",ScatterChart:"corechart",SteppedAreaChart:"corechart",Table:"table",Timeline:"timeline",TreeMap:"treemap",WordTree:"wordtree"},this.googleScriptLoadingNotifier=new i.EventEmitter,this.googleScriptIsLoading=!1}return e.prototype.load=function(e){var t=this;return new Promise(function(o,r){void 0===o&&(o=Function.prototype),void 0===r&&(r=Function.prototype),t.loadGoogleChartsScript().then(function(){google.charts.load("45",{packages:[t.chartPackage[e]],callback:o})}).catch(function(){console.error("Google charts script could not be loaded")})})},e.prototype.loadGoogleChartsScript=function(){var e=this;return new Promise(function(t,o){if(void 0===t&&(t=Function.prototype),void 0===o&&(o=Function.prototype),"undefined"!=typeof google&&google.charts)t();else if(e.googleScriptIsLoading)e.googleScriptLoadingNotifier.subscribe(function(e){e?t():o()});else{e.googleScriptIsLoading=!0;var r=document.createElement("script");r.type="text/javascript",r.src="https://www.gstatic.com/charts/loader.js",r.async=!0,r.defer=!0,r.onload=function(){e.googleScriptIsLoading=!1,e.googleScriptLoadingNotifier.emit(!0),t()},r.onerror=function(){e.googleScriptIsLoading=!1,e.googleScriptLoadingNotifier.emit(!1),o()},document.getElementsByTagName("head")[0].appendChild(r)}})},e}();a=r([i.Injectable(),n("design:paramtypes",[])],a),t.GoogleChartsLoaderService=a},function(e,t,o){"use strict";var r=this&&this.__decorate||function(e,t,o,r){var n,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,o,r);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,o,a):n(t,o))||a);return i>3&&a&&Object.defineProperty(t,o,a),a};Object.defineProperty(t,"__esModule",{value:!0});var n=o(0),i=o(2),a=o(3),s=function(){function e(){}return e}();s=r([n.NgModule({declarations:[i.GoogleChartComponent],providers:[a.GoogleChartsLoaderService],exports:[i.GoogleChartComponent]})],s),t.Ng2GoogleChartsModule=s},function(e,t,o){"use strict";function r(e){for(var o in e)t.hasOwnProperty(o)||(t[o]=e[o])}Object.defineProperty(t,"__esModule",{value:!0}),r(o(2));var n=o(1);t.ChartHTMLTooltip=n.ChartHTMLTooltip;var i=o(4);t.Ng2GoogleChartsModule=i.Ng2GoogleChartsModule}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@angular/core")):"function"==typeof define&&define.amd?define(["@angular/core"],t):"object"==typeof exports?exports["ng2-google-charts.umd.min"]=t(require("@angular/core")):e["ng2-google-charts.umd.min"]=t(e["@angular/core"])}(this,function(e){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,o){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:o})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/",t(t.s=6)}([function(t,r){t.exports=e},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e){this.tooltipDOMElement=e}return e.prototype.setPosition=function(t,r){this.tooltipDOMElement.nativeElement.style.left=t+e.PIXELS,this.tooltipDOMElement.nativeElement.style.top=r+e.PIXELS},e.prototype.getDOMElement=function(){return this.tooltipDOMElement},e}();o.PIXELS="px",t.ChartHTMLTooltip=o},function(e,t,r){"use strict";var o=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},n=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=r(3),s=r(1),c=function(){function e(e,t){this.el=e,this.loaderService=t,this.chartSelect=new i.EventEmitter,this.chartReady=new i.EventEmitter,this.chartError=new i.EventEmitter,this.mouseOver=new i.EventEmitter,this.mouseOut=new i.EventEmitter}return e.prototype.ngOnChanges=function(e){var t=this;if(e.data){if(!this.data)return;this.options=this.data.options,this.loaderService.load(this.data.chartType).then(function(){if(void 0===t.wrapper||t.wrapper.getChartType!==t.data.chartType?t.wrapper=new google.visualization.ChartWrapper(t.data):(t.unregisterChartEvents(),t.wrapper.setDataTable(t.data.dataTable),t.wrapper.setOptions(t.options)),t.registerChartWrapperEvents(),void 0!==t.data.formatters)for(var e=0,r=t.data.formatters;e<r.length;e++)for(var o=r[e],n=google.visualization[o.type],i=o.options,a=new n(i),s=0,c=o.columns;s<c.length;s++){var u=c[s];a.format(t.wrapper.getDataTable(),u)}t.redraw()})}},e.prototype.redraw=function(){this.wrapper.draw(this.el.nativeElement.querySelector("div"))},e.prototype.getSelectorBySeriesType=function(e){return{bars:"bar#%s#%r",haxis:"hAxis#0#label",line:"point#%s#%r",legend:"legendentry#%s",area:"point#%s#%r"}[e]},e.prototype.getSeriesByColumn=function(e){for(var t=0,r=this.wrapper.getDataTable(),o=e-1;o>=0;o--){var n=r.getColumnRole(o),i=r.getColumnType(o);"data"!==n&&"number"!==i||t++}return t},e.prototype.getBoundingBoxForItem=function(e){var t={top:0,left:0,width:0,height:0};if(this.cli){var r=e.column,o=this.getSeriesByColumn(r),n=(e.row,e.row),i=this.options.seriesType;if(this.options.series&&this.options.series[o]&&this.options.series[o].type&&(i=this.options.series[o].type),i){var a=this.getSelectorBySeriesType(i);if(a){a=a.replace("%s",o+"").replace("%c",r+"").replace("%r",n+"");var s=this.cli.getBoundingBox(a);s&&(t=s)}}}return t},e.prototype.getValueAtPosition=function(e){return null===e.row?null:this.wrapper.getDataTable().getValue(e.row,e.column)},e.prototype.getColumnTypeAtPosition=function(e){return this.wrapper.getDataTable().getColumnType(e.column)||""},e.prototype.getColumnLabelAtPosition=function(e){return this.wrapper.getDataTable().getColumnLabel(e.column)||""},e.prototype.getHTMLTooltip=function(){var e=new i.ElementRef(this.el.nativeElement.querySelector(".google-visualization-tooltip"));return new s.ChartHTMLTooltip(e)},e.prototype.parseMouseEvent=function(e){return{position:e,boundingBox:this.getBoundingBoxForItem(e),value:this.getValueAtPosition(e),columnType:this.getColumnTypeAtPosition(e),columnLabel:this.getColumnLabelAtPosition(e)}},e.prototype.unregisterChartEvents=function(){google.visualization.events.removeAllListeners(this.wrapper)},e.prototype.registerChartEvents=function(){var e=this;if(this.mouseOver.observers.length>0){var t=this.wrapper.getChart();this.cli=t.getChartLayoutInterface(),google.visualization.events.addListener(t,"onmouseover",function(t){var r=e.parseMouseEvent(t);r.tooltip=e.getHTMLTooltip(),e.mouseOver.emit(r)})}if(this.mouseOut.observers.length>0){var t=this.wrapper.getChart();this.cli=t.getChartLayoutInterface(),google.visualization.events.addListener(t,"onmouseout",function(t){var r=e.parseMouseEvent(t);e.mouseOut.emit(r)})}},e.prototype.registerChartWrapperEvents=function(){var e=this;google.visualization.events.addListener(this.wrapper,"ready",function(){e.chartReady.emit({message:"Chart ready"}),e.registerChartEvents()}),google.visualization.events.addListener(this.wrapper,"error",function(t){e.chartError.emit(t)}),google.visualization.events.addListener(this.wrapper,"select",function(){var t,r=e.wrapper.visualization.getSelection()[0];if(void 0!==r){var o=[];if(null!==r.row)for(var n=e.wrapper.getDataTable(),i=n.getNumberOfColumns(),a=0;a<i;a++)o.push(n.getValue(r.row,a));s={message:"select",row:r.row,column:r.column},s.selectedRowValues=o,t=s}else t={message:"deselect",row:null,column:null,selectedRowValues:[]};e.chartSelect.emit(t);var s})},e}();o([i.Input(),n("design:type",Object)],c.prototype,"data",void 0),o([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"chartReady",void 0),o([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"chartError",void 0),o([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"chartSelect",void 0),o([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"mouseOver",void 0),o([i.Output(),n("design:type",i.EventEmitter)],c.prototype,"mouseOut",void 0),c=o([i.Component({selector:"google-chart",template:"<div></div>",changeDetection:i.ChangeDetectionStrategy.OnPush}),n("design:paramtypes",[i.ElementRef,a.GoogleChartsLoaderService])],c),t.GoogleChartComponent=c},function(e,t,r){"use strict";var o=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a},n=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0});var i=r(0),a=function(){function e(){this.chartPackage={AnnotationChart:"annotationchart",AreaChart:"corechart",Bar:"bar",BarChart:"corechart",BubbleChart:"corechart",Calendar:"calendar",CandlestickChart:"corechart",ColumnChart:"corechart",ComboChart:"corechart",PieChart:"corechart",Gantt:"gantt",Gauge:"gauge",GeoChart:"geochart",Histogram:"corechart",Line:"line",LineChart:"corechart",Map:"map",OrgChart:"orgchart",Sankey:"sankey",Scatter:"scatter",ScatterChart:"corechart",SteppedAreaChart:"corechart",Table:"table",Timeline:"timeline",TreeMap:"treemap",WordTree:"wordtree"},this.googleScriptLoadingNotifier=new i.EventEmitter,this.googleScriptIsLoading=!1}return e.prototype.load=function(e){var t=this;return new Promise(function(r,o){void 0===r&&(r=Function.prototype),void 0===o&&(o=Function.prototype),t.loadGoogleChartsScript().then(function(){google.charts.load("45",{packages:[t.chartPackage[e]],callback:r})}).catch(function(){console.error("Google charts script could not be loaded")})})},e.prototype.loadGoogleChartsScript=function(){var e=this;return new Promise(function(t,r){if(void 0===t&&(t=Function.prototype),void 0===r&&(r=Function.prototype),"undefined"!=typeof google&&google.charts)t();else if(e.googleScriptIsLoading)e.googleScriptLoadingNotifier.subscribe(function(e){e?t():r()});else{e.googleScriptIsLoading=!0;var o=document.createElement("script");o.type="text/javascript",o.src="https://www.gstatic.com/charts/loader.js",o.async=!0,o.defer=!0,o.onload=function(){e.googleScriptIsLoading=!1,e.googleScriptLoadingNotifier.emit(!0),t()},o.onerror=function(){e.googleScriptIsLoading=!1,e.googleScriptLoadingNotifier.emit(!1),r()},document.getElementsByTagName("head")[0].appendChild(o)}})},e}();a=o([i.Injectable(),n("design:paramtypes",[])],a),t.GoogleChartsLoaderService=a},function(e,t,r){"use strict";var o=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])};return function(t,r){function o(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(o.prototype=r.prototype,new o)}}();Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(){}return e}();t.ChartMouseEvent=n;var i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t}(n);t.MouseOverEvent=i;var a=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t}(n);t.ChartMouseOverEvent=a;var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t}(n);t.ChartMouseOutEvent=s},function(e,t,r){"use strict";var o=this&&this.__decorate||function(e,t,r,o){var n,i=arguments.length,a=i<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(i<3?n(a):i>3?n(t,r,a):n(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a};Object.defineProperty(t,"__esModule",{value:!0});var n=r(0),i=r(2),a=r(3),s=function(){function e(){}return e}();s=o([n.NgModule({declarations:[i.GoogleChartComponent],providers:[a.GoogleChartsLoaderService],exports:[i.GoogleChartComponent]})],s),t.Ng2GoogleChartsModule=s},function(e,t,r){"use strict";function o(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),o(r(2));var n=r(1);t.ChartHTMLTooltip=n.ChartHTMLTooltip;var i=r(4);t.ChartMouseOverEvent=i.ChartMouseOverEvent,t.ChartMouseOutEvent=i.ChartMouseOutEvent,t.MouseOverEvent=i.MouseOverEvent;var a=r(5);t.Ng2GoogleChartsModule=a.Ng2GoogleChartsModule}])});

@@ -6,3 +6,3 @@ import { ElementRef, OnChanges, SimpleChanges, EventEmitter } from '@angular/core';

import { ChartSelectEvent } from './chart-select-event';
import { MouseOverEvent } from './mouse-over-event';
import { ChartMouseOverEvent, ChartMouseOutEvent } from './chart-mouse-event';
export declare class GoogleChartComponent implements OnChanges {

@@ -13,3 +13,4 @@ data: any;

chartSelect: EventEmitter<ChartSelectEvent>;
mouseOver: EventEmitter<MouseOverEvent>;
mouseOver: EventEmitter<ChartMouseOverEvent>;
mouseOut: EventEmitter<ChartMouseOutEvent>;
wrapper: any;

@@ -37,3 +38,3 @@ private cli;

private getHTMLTooltip();
private parseMouseOverEvent(item);
private parseMouseEvent(item);
private unregisterChartEvents();

@@ -40,0 +41,0 @@ private registerChartEvents();

@@ -14,2 +14,3 @@ "use strict";

this.mouseOver = new core_1.EventEmitter();
this.mouseOut = new core_1.EventEmitter();
}

@@ -58,3 +59,4 @@ GoogleChartComponent.prototype.ngOnChanges = function (changes) {

line: 'point#%s#%r',
legend: 'legendentry#%s'
legend: 'legendentry#%s',
area: 'point#%s#%r'
};

@@ -129,3 +131,3 @@ var selector = selectors[seriesType];

};
GoogleChartComponent.prototype.parseMouseOverEvent = function (item) {
GoogleChartComponent.prototype.parseMouseEvent = function (item) {
var event = {

@@ -135,3 +137,2 @@ position: item,

value: this.getValueAtPosition(item),
tooltip: this.getHTMLTooltip(),
columnType: this.getColumnTypeAtPosition(item),

@@ -151,6 +152,15 @@ columnLabel: this.getColumnLabelAtPosition(item)

google.visualization.events.addListener(chart, 'onmouseover', function (item) {
var event = _this.parseMouseOverEvent(item);
var event = _this.parseMouseEvent(item);
event.tooltip = _this.getHTMLTooltip();
_this.mouseOver.emit(event);
});
}
if (this.mouseOut.observers.length > 0) {
var chart = this.wrapper.getChart();
this.cli = chart.getChartLayoutInterface();
google.visualization.events.addListener(chart, 'onmouseout', function (item) {
var event = _this.parseMouseEvent(item);
_this.mouseOut.emit(event);
});
}
};

@@ -218,3 +228,4 @@ GoogleChartComponent.prototype.registerChartWrapperEvents = function () {

'mouseOver': [{ type: core_1.Output },],
'mouseOut': [{ type: core_1.Output },],
};
exports.GoogleChartComponent = GoogleChartComponent;

@@ -1,1 +0,1 @@

[{"__symbolic":"module","version":3,"metadata":{"GoogleChartComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"google-chart","template":"<div></div>","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy"},"member":"OnPush"}}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"chartReady":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"chartError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"chartSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"mouseOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"../google-charts-loader.service","name":"GoogleChartsLoaderService"}]}],"ngOnChanges":[{"__symbolic":"method"}],"redraw":[{"__symbolic":"method"}],"getSelectorBySeriesType":[{"__symbolic":"method"}],"getSeriesByColumn":[{"__symbolic":"method"}],"getBoundingBoxForItem":[{"__symbolic":"method"}],"getValueAtPosition":[{"__symbolic":"method"}],"getColumnTypeAtPosition":[{"__symbolic":"method"}],"getColumnLabelAtPosition":[{"__symbolic":"method"}],"getHTMLTooltip":[{"__symbolic":"method"}],"parseMouseOverEvent":[{"__symbolic":"method"}],"unregisterChartEvents":[{"__symbolic":"method"}],"registerChartEvents":[{"__symbolic":"method"}],"registerChartWrapperEvents":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"GoogleChartComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"google-chart","template":"<div></div>","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy"},"member":"OnPush"}}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"chartReady":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"chartError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"chartSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"mouseOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"../google-charts-loader.service","name":"GoogleChartsLoaderService"}]}],"ngOnChanges":[{"__symbolic":"method"}],"redraw":[{"__symbolic":"method"}],"getSelectorBySeriesType":[{"__symbolic":"method"}],"getSeriesByColumn":[{"__symbolic":"method"}],"getBoundingBoxForItem":[{"__symbolic":"method"}],"getValueAtPosition":[{"__symbolic":"method"}],"getColumnTypeAtPosition":[{"__symbolic":"method"}],"getColumnLabelAtPosition":[{"__symbolic":"method"}],"getHTMLTooltip":[{"__symbolic":"method"}],"parseMouseOverEvent":[{"__symbolic":"method"}],"unregisterChartEvents":[{"__symbolic":"method"}],"registerChartEvents":[{"__symbolic":"method"}],"registerChartWrapperEvents":[{"__symbolic":"method"}]}}}}]
[{"__symbolic":"module","version":3,"metadata":{"GoogleChartComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"google-chart","template":"<div></div>","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy"},"member":"OnPush"}}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"chartReady":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"chartError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"chartSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"mouseOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"mouseOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"../google-charts-loader.service","name":"GoogleChartsLoaderService"}]}],"ngOnChanges":[{"__symbolic":"method"}],"redraw":[{"__symbolic":"method"}],"getSelectorBySeriesType":[{"__symbolic":"method"}],"getSeriesByColumn":[{"__symbolic":"method"}],"getBoundingBoxForItem":[{"__symbolic":"method"}],"getValueAtPosition":[{"__symbolic":"method"}],"getColumnTypeAtPosition":[{"__symbolic":"method"}],"getColumnLabelAtPosition":[{"__symbolic":"method"}],"getHTMLTooltip":[{"__symbolic":"method"}],"parseMouseEvent":[{"__symbolic":"method"}],"unregisterChartEvents":[{"__symbolic":"method"}],"registerChartEvents":[{"__symbolic":"method"}],"registerChartWrapperEvents":[{"__symbolic":"method"}]}}}},{"__symbolic":"module","version":1,"metadata":{"GoogleChartComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component"},"arguments":[{"selector":"google-chart","template":"<div></div>","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy"},"member":"OnPush"}}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input"}}]}],"chartReady":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"chartError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"chartSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"mouseOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"mouseOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output"}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef"},{"__symbolic":"reference","module":"../google-charts-loader.service","name":"GoogleChartsLoaderService"}]}],"ngOnChanges":[{"__symbolic":"method"}],"redraw":[{"__symbolic":"method"}],"getSelectorBySeriesType":[{"__symbolic":"method"}],"getSeriesByColumn":[{"__symbolic":"method"}],"getBoundingBoxForItem":[{"__symbolic":"method"}],"getValueAtPosition":[{"__symbolic":"method"}],"getColumnTypeAtPosition":[{"__symbolic":"method"}],"getColumnLabelAtPosition":[{"__symbolic":"method"}],"getHTMLTooltip":[{"__symbolic":"method"}],"parseMouseEvent":[{"__symbolic":"method"}],"unregisterChartEvents":[{"__symbolic":"method"}],"registerChartEvents":[{"__symbolic":"method"}],"registerChartWrapperEvents":[{"__symbolic":"method"}]}}}}]

@@ -6,5 +6,5 @@ export * from './google-chart/google-chart.component';

export { ChartHTMLTooltip } from './google-chart/chart-html-tooltip';
export { MouseOverEvent } from './google-chart/mouse-over-event';
export { BoundingBox } from './google-chart/mouse-over-event';
export { DataPointPosition } from './google-chart/mouse-over-event';
export { ChartMouseOverEvent, ChartMouseOutEvent, MouseOverEvent } from './google-chart/chart-mouse-event';
export { BoundingBox } from './google-chart/chart-mouse-event';
export { DataPointPosition } from './google-chart/chart-mouse-event';
export { Ng2GoogleChartsModule } from './google-charts.module';

@@ -9,3 +9,7 @@ "use strict";

exports.ChartHTMLTooltip = chart_html_tooltip_1.ChartHTMLTooltip;
var chart_mouse_event_1 = require("./google-chart/chart-mouse-event");
exports.ChartMouseOverEvent = chart_mouse_event_1.ChartMouseOverEvent;
exports.ChartMouseOutEvent = chart_mouse_event_1.ChartMouseOutEvent;
exports.MouseOverEvent = chart_mouse_event_1.MouseOverEvent;
var google_charts_module_1 = require("./google-charts.module");
exports.Ng2GoogleChartsModule = google_charts_module_1.Ng2GoogleChartsModule;

@@ -1,1 +0,1 @@

[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./google-chart/google-chart.component"},{"from":"./google-chart/chart-ready-event","export":["ChartReadyEvent"]},{"from":"./google-chart/chart-error-event","export":["ChartErrorEvent"]},{"from":"./google-chart/chart-select-event","export":["ChartSelectEvent"]},{"from":"./google-chart/chart-html-tooltip","export":["ChartHTMLTooltip"]},{"from":"./google-chart/mouse-over-event","export":["MouseOverEvent"]},{"from":"./google-chart/mouse-over-event","export":["BoundingBox"]},{"from":"./google-chart/mouse-over-event","export":["DataPointPosition"]},{"from":"./google-charts.module","export":["Ng2GoogleChartsModule"]}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./google-chart/google-chart.component"},{"from":"./google-chart/chart-ready-event","export":["ChartReadyEvent"]},{"from":"./google-chart/chart-error-event","export":["ChartErrorEvent"]},{"from":"./google-chart/chart-select-event","export":["ChartSelectEvent"]},{"from":"./google-chart/chart-html-tooltip","export":["ChartHTMLTooltip"]},{"from":"./google-chart/mouse-over-event","export":["MouseOverEvent"]},{"from":"./google-chart/mouse-over-event","export":["BoundingBox"]},{"from":"./google-chart/mouse-over-event","export":["DataPointPosition"]},{"from":"./google-charts.module","export":["Ng2GoogleChartsModule"]}]}]
[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./google-chart/google-chart.component"},{"from":"./google-chart/chart-ready-event","export":["ChartReadyEvent"]},{"from":"./google-chart/chart-error-event","export":["ChartErrorEvent"]},{"from":"./google-chart/chart-select-event","export":["ChartSelectEvent"]},{"from":"./google-chart/chart-html-tooltip","export":["ChartHTMLTooltip"]},{"from":"./google-chart/chart-mouse-event","export":["ChartMouseOverEvent","ChartMouseOutEvent","MouseOverEvent"]},{"from":"./google-chart/chart-mouse-event","export":["BoundingBox"]},{"from":"./google-chart/chart-mouse-event","export":["DataPointPosition"]},{"from":"./google-charts.module","export":["Ng2GoogleChartsModule"]}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./google-chart/google-chart.component"},{"from":"./google-chart/chart-ready-event","export":["ChartReadyEvent"]},{"from":"./google-chart/chart-error-event","export":["ChartErrorEvent"]},{"from":"./google-chart/chart-select-event","export":["ChartSelectEvent"]},{"from":"./google-chart/chart-html-tooltip","export":["ChartHTMLTooltip"]},{"from":"./google-chart/chart-mouse-event","export":["ChartMouseOverEvent","ChartMouseOutEvent","MouseOverEvent"]},{"from":"./google-chart/chart-mouse-event","export":["BoundingBox"]},{"from":"./google-chart/chart-mouse-event","export":["DataPointPosition"]},{"from":"./google-charts.module","export":["Ng2GoogleChartsModule"]}]}]
{
"main": "bundles/ng2-google-charts.umd.js",
"version": "2.4.1",
"version": "3.0.0",
"description": "Angular2 Google Charts module",

@@ -31,4 +31,4 @@ "module": "index.js",

},
"_id": "ng2-google-charts@2.4.1",
"_id": "ng2-google-charts@3.0.0",
"devDependencies": {}
}

@@ -189,5 +189,5 @@ # ng2-google-charts

Your `mouseOver()` function is passed an event whose interface looks like this:
Your `mouseOver()` function is passed an event whose class looks like this:
```ts
interface MouseOverEvent {
class ChartMouseOverEvent {
position: DataPointPosition;

@@ -202,5 +202,5 @@ boundingBox: BoundingBox;

You can import the `MouseOverEvent` interface in your `.ts` file:
You can import the `ChartMouseOverEvent` class in your `.ts` file:
```ts
import { MouseOverEvent } from 'ng2-google-charts';
import { ChartMouseOverEvent } from 'ng2-google-charts';
```

@@ -210,3 +210,3 @@

```ts
public mouseOver(event: MouseOverEvent) {
public mouseOver(event: ChartMouseOverEvent) {
// your logic

@@ -216,2 +216,35 @@ }

### mouseOut
The `mouseOut` event is fired when the user moves the mouse out of some chart
item.
Bind the `MouseOut` event in the `google-chart` component like this:
```html
<google-chart [data]="comboChartData" (mouseOut)="mouseOut($event)"></google-chart>
```
Your `mouseOut()` function is passed an event whose class looks like this:
```ts
class ChartMouseOutEvent {
position: DataPointPosition;
boundingBox: BoundingBox;
value: any;
columnType: string;
columnLabel: string;
}
```
You can import the `ChartMouseOutEvent` class in your `.ts` file:
```ts
import { ChartMouseOutEvent } from 'ng2-google-charts';
```
and then use it like:
```ts
public mouseOut(event: ChartMouseOutEvent) {
// your logic
}
```
# Advanced usage

@@ -218,0 +251,0 @@ You can access Google Chart's underlying [ChartWrapper](https://developers.google.com/chart/interactive/docs/reference#chartwrapperobject) through the

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc