ng2-google-charts
Advanced tools
Comparing version 4.0.0 to 5.0.0
@@ -79,3 +79,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(__webpack_require__.s = 4); | ||
/******/ return __webpack_require__(__webpack_require__.s = 5); | ||
/******/ }) | ||
@@ -109,2 +109,8 @@ /************************************************************************/ | ||
/* 4 */ | ||
/***/ (function(module, exports) { | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
@@ -206,2 +212,4 @@ | ||
this.mouseOutOneTime = new core_["EventEmitter"](); | ||
this.regionClick = new core_["EventEmitter"](); | ||
this.regionClickOneTime = new core_["EventEmitter"](); | ||
} | ||
@@ -223,3 +231,3 @@ GoogleChartComponent.prototype.ngOnChanges = function (changes) { | ||
_this.convertOptions(); | ||
if (_this.data.opt_firstRowIsData && Array.isArray(_this.data.dataTable)) { | ||
if (_this.data.firstRowIsData && Array.isArray(_this.data.dataTable)) { | ||
_this.data.dataTable = google.visualization.arrayToDataTable(_this.data.dataTable, true); | ||
@@ -238,3 +246,27 @@ } | ||
GoogleChartComponent.prototype.draw = function () { | ||
this.wrapper.setDataTable(this.data.dataTable); | ||
var _this = this; | ||
if (this.data.dataTable) { | ||
this.wrapper.setDataTable(this.data.dataTable); | ||
this._draw(); | ||
} | ||
else if (this.data.dataSourceUrl) { | ||
var query = new google.visualization.Query(this.data.dataSourceUrl); | ||
if (this.data.refreshInterval) { | ||
query.setRefreshInterval(this.data.refreshInterval); | ||
} | ||
if (this.data.query) { | ||
query.setQuery(this.data.query); | ||
} | ||
query.send(function (queryResponse) { | ||
if (queryResponse.isError()) { | ||
return; | ||
} | ||
var dt = queryResponse.getDataTable(); | ||
_this.wrapper.setDataTable(dt); | ||
_this.data.dataTable = dt; | ||
_this._draw(); | ||
}); | ||
} | ||
}; | ||
GoogleChartComponent.prototype._draw = function () { | ||
this.convertOptions(); | ||
@@ -253,9 +285,18 @@ this.wrapper.setOptions(this.options); | ||
if (this.data.formatters !== undefined) { | ||
var dt = this.wrapper.getDataTable(); | ||
for (var _i = 0, _a = this.data.formatters; _i < _a.length; _i++) { | ||
var formatterConfig = _a[_i]; | ||
var formatter = void 0; | ||
if (formatterConfig.type === 'PatternFormat') { | ||
var _fmtOptions = formatterConfig.options; | ||
formatter = new google.visualization.PatternFormat(_fmtOptions.pattern); | ||
formatter.format(dt, formatterConfig.columns, _fmtOptions.dstColumnIndex); | ||
continue; | ||
} | ||
var formatterConstructor = google.visualization[formatterConfig.type]; | ||
var formatterOptions = formatterConfig.options; | ||
var formatter = new formatterConstructor(formatterOptions); | ||
formatter = new formatterConstructor(formatterOptions); | ||
if (formatterConfig.type === 'ColorFormat' && formatterOptions) { | ||
for (var _b = 0, _c = formatterOptions.ranges; _b < _c.length; _b++) { | ||
var _fmtOptions = formatterOptions; | ||
for (var _b = 0, _c = _fmtOptions.ranges; _b < _c.length; _b++) { | ||
var range = _c[_b]; | ||
@@ -270,3 +311,2 @@ if (typeof (range.fromBgColor) !== 'undefined' && typeof (range.toBgColor) !== 'undefined') { | ||
} | ||
var dt = this.wrapper.getDataTable(); | ||
for (var _d = 0, _e = formatterConfig.columns; _d < _e.length; _d++) { | ||
@@ -414,2 +454,14 @@ var col = _e[_d]; | ||
} | ||
if (this.data.chartType === 'GeoChart') { | ||
if (this.regionClick.observers.length > 0) { | ||
google.visualization.events.addListener(chart, 'regionClick', function (item) { | ||
_this.regionClick.emit(item); | ||
}); | ||
} | ||
if (this.regionClickOneTime.observers.length > 0) { | ||
google.visualization.events.addOneTimeListener(chart, 'regionClick', function (item) { | ||
_this.regionClick.emit(item); | ||
}); | ||
} | ||
} | ||
}; | ||
@@ -485,2 +537,8 @@ GoogleChartComponent.prototype.registerChartWrapperEvents = function () { | ||
], GoogleChartComponent.prototype, "mouseOutOneTime", void 0); | ||
__decorate([ | ||
Object(core_["Output"])() | ||
], GoogleChartComponent.prototype, "regionClick", void 0); | ||
__decorate([ | ||
Object(core_["Output"])() | ||
], GoogleChartComponent.prototype, "regionClickOneTime", void 0); | ||
GoogleChartComponent = __decorate([ | ||
@@ -498,9 +556,9 @@ Object(core_["Component"])({ | ||
// EXTERNAL MODULE: ./.tmp/google-chart/chart-ready-event.ts | ||
var chart_ready_event = __webpack_require__(3); | ||
var chart_ready_event = __webpack_require__(4); | ||
// EXTERNAL MODULE: ./.tmp/google-chart/chart-error-event.ts | ||
var chart_error_event = __webpack_require__(2); | ||
var chart_error_event = __webpack_require__(3); | ||
// EXTERNAL MODULE: ./.tmp/google-chart/chart-select-event.ts | ||
var chart_select_event = __webpack_require__(1); | ||
var chart_select_event = __webpack_require__(2); | ||
@@ -555,2 +613,5 @@ // CONCATENATED MODULE: ./.tmp/google-chart/chart-mouse-event.ts | ||
// EXTERNAL MODULE: ./.tmp/google-chart/geochart-events.ts | ||
var geochart_events = __webpack_require__(1); | ||
// CONCATENATED MODULE: ./.tmp/google-charts-loader.service.ts | ||
@@ -684,2 +745,3 @@ var google_charts_loader_service_decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) { | ||
/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "MouseOverEvent", function() { return MouseOverEvent; }); | ||
/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "RegionClickEvent", function() { return geochart_events["RegionClickEvent"]; }); | ||
/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "BoundingBox", function() { return /* Cannot get final name for export "BoundingBox" in "./.tmp/google-chart/chart-mouse-event.ts" (known exports: ChartMouseEvent MouseOverEvent ChartMouseOverEvent ChartMouseOutEvent, known reexports: ) */ undefined; }); | ||
@@ -699,2 +761,3 @@ /* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "DataPointPosition", function() { return /* Cannot get final name for export "DataPointPosition" in "./.tmp/google-chart/chart-mouse-event.ts" (known exports: ChartMouseEvent MouseOverEvent ChartMouseOverEvent ChartMouseOutEvent, known reexports: ) */ undefined; }); | ||
/***/ }) | ||
@@ -701,0 +764,0 @@ /******/ ]); |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core")):"function"==typeof define&&define.amd?define(["@angular/core"],e):"object"==typeof exports?exports["ng2-google-charts.umd.min"]=e(require("@angular/core")):t["ng2-google-charts.umd.min"]=e(t["@angular/core"])}(window,function(t){return function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o(o.s=4)}([function(e,o){e.exports=t},function(t,e){},function(t,e){},function(t,e){},function(t,e,o){"use strict";o.r(e);var r=o(0),n=function(){function t(t){this.tooltipDOMElement=t}return t.prototype.setPosition=function(e,o){this.tooltipDOMElement.nativeElement.style.left=e+t.PIXELS,this.tooltipDOMElement.nativeElement.style.top=o+t.PIXELS},t.prototype.getDOMElement=function(){return this.tooltipDOMElement},t.PIXELS="px",t}(),i=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},a=function(){function t(t,e){var o=this;this.mouseOverListener=function(t){var e=o.parseMouseEvent(t);return e.tooltip=o.getHTMLTooltip(),e},this.mouseOutListener=function(t){return o.parseMouseEvent(t)},this.selectListener=function(){var t={message:"select",row:null,column:null,selectedRowValues:[],selectedRowFormattedValues:[],columnLabel:""},e=o.wrapper.visualization.getSelection(),r=e[e.length-1];if(!r)return t.message="deselect",t;var n=r;if(null!=r.row){t.row=n.row;for(var i=[],a=[],s=o.wrapper.getDataTable(),u=s.getNumberOfColumns(),l=0;l<u;l++)i.push(s.getValue(n.row,l)),a.push(s.getFormattedValue(n.row,l));t.selectedRowValues=i,t.selectedRowFormattedValues=a}return null!=n.column&&(t.column=n.column,t.columnLabel=o.getColumnLabelAtPosition(n)),r.name&&(t.columnLabel=r.name),t},this.el=t,this.loaderService=e,this.chartSelect=new r.EventEmitter,this.chartSelectOneTime=new r.EventEmitter,this.chartReady=new r.EventEmitter,this.chartReadyOneTime=new r.EventEmitter,this.chartError=new r.EventEmitter,this.chartErrorOneTime=new r.EventEmitter,this.mouseOver=new r.EventEmitter,this.mouseOverOneTime=new r.EventEmitter,this.mouseOut=new r.EventEmitter,this.mouseOutOneTime=new r.EventEmitter}return t.prototype.ngOnChanges=function(t){var e=this;if(t.data){if(!this.data)return;this.options=this.data.options,this.options||(this.options={}),this.data.component=this,this.loaderService.load().then(function(){void 0!==e.wrapper&&e.wrapper.getChartType()===e.data.chartType||(e.convertOptions(),e.data.opt_firstRowIsData&&Array.isArray(e.data.dataTable)&&(e.data.dataTable=google.visualization.arrayToDataTable(e.data.dataTable,!0)),e.wrapper=new google.visualization.ChartWrapper(e.data),e.registerChartWrapperEvents()),e.draw()})}},t.prototype.draw=function(){this.wrapper.setDataTable(this.data.dataTable),this.convertOptions(),this.wrapper.setOptions(this.options),this.reformat(),this.wrapper.draw(this.el.nativeElement.querySelector("div"))},t.prototype.reformat=function(){if(this.data&&void 0!==this.data.formatters)for(var t=0,e=this.data.formatters;t<e.length;t++){var o=e[t],r=google.visualization[o.type],n=o.options,i=new r(n);if("ColorFormat"===o.type&&n)for(var a=0,s=n.ranges;a<s.length;a++){var u=s[a];void 0!==u.fromBgColor&&void 0!==u.toBgColor?i.addGradientRange(u.from,u.to,u.color,u.fromBgColor,u.toBgColor):i.addRange(u.from,u.to,u.color,u.bgcolor)}for(var l=this.wrapper.getDataTable(),c=0,p=o.columns;c<p.length;c++){var h=p[c];i.format(l,h)}}},t.prototype.getSelectorBySeriesType=function(t){return{bars:"bar#%s#%r",haxis:"hAxis#0#label",line:"point#%s#%r",legend:"legendentry#%s",area:"point#%s#%r"}[t]},t.prototype.getSeriesByColumn=function(t){for(var e=0,o=this.wrapper.getDataTable(),r=t-1;r>=0;r--){var n=o.getColumnRole(r),i=o.getColumnType(r);"data"!==n&&"number"!==i||e++}return e},t.prototype.getBoundingBoxForItem=function(t){var e={top:0,left:0,width:0,height:0};if(this.cli){var o=t.column,r=this.getSeriesByColumn(o),n=t.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&&(e=s)}}}return e},t.prototype.getValueAtPosition=function(t){return null==t.row?null:this.wrapper.getDataTable().getValue(t.row,t.column)},t.prototype.getColumnTypeAtPosition=function(t){return this.wrapper.getDataTable().getColumnType(t.column)||""},t.prototype.getColumnLabelAtPosition=function(t){return this.wrapper.getDataTable().getColumnLabel(t.column)||""},t.prototype.getHTMLTooltip=function(){var t=new r.ElementRef(this.el.nativeElement.querySelector(".google-visualization-tooltip"));return new n(t)},t.prototype.parseMouseEvent=function(t){var e=this.wrapper.getChartType(),o=t.column;if(null==o)switch(e){case"Timeline":o=3===this.wrapper.getDataTable().getNumberOfColumns()?0:1;break;default:o=0}var r={row:t.row,column:o};return{position:t,boundingBox:this.getBoundingBoxForItem(r),value:this.getValueAtPosition(r),columnType:this.getColumnTypeAtPosition(r),columnLabel:this.getColumnLabelAtPosition(r)}},t.prototype.unregisterEvents=function(){google.visualization.events.removeAllListeners(this.wrapper.getChart()),google.visualization.events.removeAllListeners(this.wrapper)},t.prototype.registerChartEvents=function(){var t=this,e=this.wrapper.getChart();this.cli=e.getChartLayoutInterface?e.getChartLayoutInterface():null,this.mouseOver.observers.length>0&&google.visualization.events.addListener(e,"onmouseover",function(e){var o=t.parseMouseEvent(e);o.tooltip=t.getHTMLTooltip(),t.mouseOver.emit(o)}),this.mouseOverOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(e,"onmouseover",function(e){var o=t.parseMouseEvent(e);o.tooltip=t.getHTMLTooltip(),t.mouseOverOneTime.emit(o)}),this.mouseOut.observers.length>0&&google.visualization.events.addListener(e,"onmouseout",function(e){var o=t.parseMouseEvent(e);t.mouseOut.emit(o)}),this.mouseOutOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(e,"onmouseout",function(e){var o=t.parseMouseEvent(e);t.mouseOutOneTime.emit(o)})},t.prototype.registerChartWrapperEvents=function(){var t=this;google.visualization.events.addListener(this.wrapper,"ready",function(){t.chartReady.emit({message:"Chart ready"})}),google.visualization.events.addOneTimeListener(this.wrapper,"ready",function(){t.chartReadyOneTime.emit({message:"Chart ready (one time)"}),t.registerChartEvents()}),google.visualization.events.addListener(this.wrapper,"error",function(e){t.chartError.emit(e)}),google.visualization.events.addOneTimeListener(this.wrapper,"error",function(e){t.chartErrorOneTime.emit(e)}),this.addListener(this.wrapper,"select",this.selectListener,this.chartSelect),this.addOneTimeListener(this.wrapper,"select",this.selectListener,this.chartSelectOneTime)},t.prototype.addListener=function(t,e,o,r){google.visualization.events.addListener(t,e,function(){r.emit(o())})},t.prototype.addOneTimeListener=function(t,e,o,r){google.visualization.events.addOneTimeListener(t,e,function(){r.emit(o())})},t.prototype.convertOptions=function(){try{this.options=google.charts[this.data.chartType].convertOptions(this.options)}catch(t){return}},i([Object(r.Input)()],t.prototype,"data",void 0),i([Object(r.Output)()],t.prototype,"chartReady",void 0),i([Object(r.Output)()],t.prototype,"chartReadyOneTime",void 0),i([Object(r.Output)()],t.prototype,"chartError",void 0),i([Object(r.Output)()],t.prototype,"chartErrorOneTime",void 0),i([Object(r.Output)()],t.prototype,"chartSelect",void 0),i([Object(r.Output)()],t.prototype,"chartSelectOneTime",void 0),i([Object(r.Output)()],t.prototype,"mouseOver",void 0),i([Object(r.Output)()],t.prototype,"mouseOverOneTime",void 0),i([Object(r.Output)()],t.prototype,"mouseOut",void 0),i([Object(r.Output)()],t.prototype,"mouseOutOneTime",void 0),t=i([Object(r.Component)({selector:"google-chart",template:"<div></div>",changeDetection:r.ChangeDetectionStrategy.OnPush})],t)}(),s=o(3),u=o(2),l=o(1),c=function(){var t=function(e,o){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(e,o)};return function(e,o){function r(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),p=function(){return function(){}}(),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e}(p),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e}(p),f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e}(p),d=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},m=function(t,e){return function(o,r){e(o,r,t)}},v=function(){function t(t,e,o){this.googleChartsVersion=e,this.mapsApiKey=o,this.googleScriptLoadingNotifier=new r.EventEmitter,this.googleScriptIsLoading=!1,this.localeId=t,null===this.googleChartsVersion&&(this.googleChartsVersion="46")}return t.prototype.load=function(t){var e=this;return new Promise(function(o,r){void 0===o&&(o=Function.prototype),void 0===r&&(r=Function.prototype),e.loadGoogleChartsScript().then(function(){var r={language:e.localeId,callback:o,packages:t};e.mapsApiKey&&(r.mapsApiKey=e.mapsApiKey),google.charts.load(e.googleChartsVersion,r)}).catch(function(t){return r()})})},t.prototype.loadGoogleChartsScript=function(){var t=this;return new Promise(function(e,o){if(void 0===e&&(e=Function.prototype),void 0===o&&(o=Function.prototype),"undefined"!=typeof google&&google.charts)e();else if(t.googleScriptIsLoading)t.googleScriptLoadingNotifier.subscribe(function(t){t?e():o()});else{t.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(){t.googleScriptIsLoading=!1,t.googleScriptLoadingNotifier.emit(!0),e()},r.onerror=function(){t.googleScriptIsLoading=!1,t.googleScriptLoadingNotifier.emit(!1),o()},document.getElementsByTagName("head")[0].appendChild(r)}})},t=d([Object(r.Injectable)(),m(0,Object(r.Inject)(r.LOCALE_ID)),m(1,Object(r.Inject)("googleChartsVersion")),m(1,Object(r.Optional)()),m(2,Object(r.Inject)("mapsApiKey")),m(2,Object(r.Optional)())],t)}(),y=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},O=function(){function t(){}return t=y([Object(r.NgModule)({declarations:[a],providers:[v],exports:[a]})],t)}();o.d(e,"GoogleChartComponent",function(){return a}),o.d(e,"ChartReadyEvent",function(){return s.ChartReadyEvent}),o.d(e,"ChartErrorEvent",function(){return u.ChartErrorEvent}),o.d(e,"ChartSelectEvent",function(){return l.ChartSelectEvent}),o.d(e,"ChartHTMLTooltip",function(){return n}),o.d(e,"ChartMouseOverEvent",function(){return g}),o.d(e,"ChartMouseOutEvent",function(){return f}),o.d(e,"MouseOverEvent",function(){return h}),o.d(e,"BoundingBox",function(){}),o.d(e,"DataPointPosition",function(){}),o.d(e,"Ng2GoogleChartsModule",function(){return O})}])}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/core")):"function"==typeof define&&define.amd?define(["@angular/core"],e):"object"==typeof exports?exports["ng2-google-charts.umd.min"]=e(require("@angular/core")):t["ng2-google-charts.umd.min"]=e(t["@angular/core"])}(window,function(t){return function(t){var e={};function o(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=t,o.c=e,o.d=function(t,e,r){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:r})},o.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="/",o(o.s=5)}([function(e,o){e.exports=t},function(t,e){},function(t,e){},function(t,e){},function(t,e){},function(t,e,o){"use strict";o.r(e);var r=o(0),n=function(){function t(t){this.tooltipDOMElement=t}return t.prototype.setPosition=function(e,o){this.tooltipDOMElement.nativeElement.style.left=e+t.PIXELS,this.tooltipDOMElement.nativeElement.style.top=o+t.PIXELS},t.prototype.getDOMElement=function(){return this.tooltipDOMElement},t.PIXELS="px",t}(),i=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},a=function(){function t(t,e){var o=this;this.mouseOverListener=function(t){var e=o.parseMouseEvent(t);return e.tooltip=o.getHTMLTooltip(),e},this.mouseOutListener=function(t){return o.parseMouseEvent(t)},this.selectListener=function(){var t={message:"select",row:null,column:null,selectedRowValues:[],selectedRowFormattedValues:[],columnLabel:""},e=o.wrapper.visualization.getSelection(),r=e[e.length-1];if(!r)return t.message="deselect",t;var n=r;if(null!=r.row){t.row=n.row;for(var i=[],a=[],s=o.wrapper.getDataTable(),u=s.getNumberOfColumns(),l=0;l<u;l++)i.push(s.getValue(n.row,l)),a.push(s.getFormattedValue(n.row,l));t.selectedRowValues=i,t.selectedRowFormattedValues=a}return null!=n.column&&(t.column=n.column,t.columnLabel=o.getColumnLabelAtPosition(n)),r.name&&(t.columnLabel=r.name),t},this.el=t,this.loaderService=e,this.chartSelect=new r.EventEmitter,this.chartSelectOneTime=new r.EventEmitter,this.chartReady=new r.EventEmitter,this.chartReadyOneTime=new r.EventEmitter,this.chartError=new r.EventEmitter,this.chartErrorOneTime=new r.EventEmitter,this.mouseOver=new r.EventEmitter,this.mouseOverOneTime=new r.EventEmitter,this.mouseOut=new r.EventEmitter,this.mouseOutOneTime=new r.EventEmitter,this.regionClick=new r.EventEmitter,this.regionClickOneTime=new r.EventEmitter}return t.prototype.ngOnChanges=function(t){var e=this;if(t.data){if(!this.data)return;this.options=this.data.options,this.options||(this.options={}),this.data.component=this,this.loaderService.load().then(function(){void 0!==e.wrapper&&e.wrapper.getChartType()===e.data.chartType||(e.convertOptions(),e.data.firstRowIsData&&Array.isArray(e.data.dataTable)&&(e.data.dataTable=google.visualization.arrayToDataTable(e.data.dataTable,!0)),e.wrapper=new google.visualization.ChartWrapper(e.data),e.registerChartWrapperEvents()),e.draw()})}},t.prototype.draw=function(){var t=this;if(this.data.dataTable)this.wrapper.setDataTable(this.data.dataTable),this._draw();else if(this.data.dataSourceUrl){var e=new google.visualization.Query(this.data.dataSourceUrl);this.data.refreshInterval&&e.setRefreshInterval(this.data.refreshInterval),this.data.query&&e.setQuery(this.data.query),e.send(function(e){if(!e.isError()){var o=e.getDataTable();t.wrapper.setDataTable(o),t.data.dataTable=o,t._draw()}})}},t.prototype._draw=function(){this.convertOptions(),this.wrapper.setOptions(this.options),this.reformat(),this.wrapper.draw(this.el.nativeElement.querySelector("div"))},t.prototype.reformat=function(){if(this.data&&void 0!==this.data.formatters)for(var t=this.wrapper.getDataTable(),e=0,o=this.data.formatters;e<o.length;e++){var r=o[e],n=void 0;if("PatternFormat"!==r.type){var i=google.visualization[r.type],a=r.options;if(n=new i(a),"ColorFormat"===r.type&&a)for(var s=0,u=(g=a).ranges;s<u.length;s++){var l=u[s];void 0!==l.fromBgColor&&void 0!==l.toBgColor?n.addGradientRange(l.from,l.to,l.color,l.fromBgColor,l.toBgColor):n.addRange(l.from,l.to,l.color,l.bgcolor)}for(var c=0,p=r.columns;c<p.length;c++){var h=p[c];n.format(t,h)}}else{var g=r.options;(n=new google.visualization.PatternFormat(g.pattern)).format(t,r.columns,g.dstColumnIndex)}}},t.prototype.getSelectorBySeriesType=function(t){return{bars:"bar#%s#%r",haxis:"hAxis#0#label",line:"point#%s#%r",legend:"legendentry#%s",area:"point#%s#%r"}[t]},t.prototype.getSeriesByColumn=function(t){for(var e=0,o=this.wrapper.getDataTable(),r=t-1;r>=0;r--){var n=o.getColumnRole(r),i=o.getColumnType(r);"data"!==n&&"number"!==i||e++}return e},t.prototype.getBoundingBoxForItem=function(t){var e={top:0,left:0,width:0,height:0};if(this.cli){var o=t.column,r=this.getSeriesByColumn(o),n=t.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&&(e=s)}}}return e},t.prototype.getValueAtPosition=function(t){return null==t.row?null:this.wrapper.getDataTable().getValue(t.row,t.column)},t.prototype.getColumnTypeAtPosition=function(t){return this.wrapper.getDataTable().getColumnType(t.column)||""},t.prototype.getColumnLabelAtPosition=function(t){return this.wrapper.getDataTable().getColumnLabel(t.column)||""},t.prototype.getHTMLTooltip=function(){var t=new r.ElementRef(this.el.nativeElement.querySelector(".google-visualization-tooltip"));return new n(t)},t.prototype.parseMouseEvent=function(t){var e=this.wrapper.getChartType(),o=t.column;if(null==o)switch(e){case"Timeline":o=3===this.wrapper.getDataTable().getNumberOfColumns()?0:1;break;default:o=0}var r={row:t.row,column:o};return{position:t,boundingBox:this.getBoundingBoxForItem(r),value:this.getValueAtPosition(r),columnType:this.getColumnTypeAtPosition(r),columnLabel:this.getColumnLabelAtPosition(r)}},t.prototype.unregisterEvents=function(){google.visualization.events.removeAllListeners(this.wrapper.getChart()),google.visualization.events.removeAllListeners(this.wrapper)},t.prototype.registerChartEvents=function(){var t=this,e=this.wrapper.getChart();this.cli=e.getChartLayoutInterface?e.getChartLayoutInterface():null,this.mouseOver.observers.length>0&&google.visualization.events.addListener(e,"onmouseover",function(e){var o=t.parseMouseEvent(e);o.tooltip=t.getHTMLTooltip(),t.mouseOver.emit(o)}),this.mouseOverOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(e,"onmouseover",function(e){var o=t.parseMouseEvent(e);o.tooltip=t.getHTMLTooltip(),t.mouseOverOneTime.emit(o)}),this.mouseOut.observers.length>0&&google.visualization.events.addListener(e,"onmouseout",function(e){var o=t.parseMouseEvent(e);t.mouseOut.emit(o)}),this.mouseOutOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(e,"onmouseout",function(e){var o=t.parseMouseEvent(e);t.mouseOutOneTime.emit(o)}),"GeoChart"===this.data.chartType&&(this.regionClick.observers.length>0&&google.visualization.events.addListener(e,"regionClick",function(e){t.regionClick.emit(e)}),this.regionClickOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(e,"regionClick",function(e){t.regionClick.emit(e)}))},t.prototype.registerChartWrapperEvents=function(){var t=this;google.visualization.events.addListener(this.wrapper,"ready",function(){t.chartReady.emit({message:"Chart ready"})}),google.visualization.events.addOneTimeListener(this.wrapper,"ready",function(){t.chartReadyOneTime.emit({message:"Chart ready (one time)"}),t.registerChartEvents()}),google.visualization.events.addListener(this.wrapper,"error",function(e){t.chartError.emit(e)}),google.visualization.events.addOneTimeListener(this.wrapper,"error",function(e){t.chartErrorOneTime.emit(e)}),this.addListener(this.wrapper,"select",this.selectListener,this.chartSelect),this.addOneTimeListener(this.wrapper,"select",this.selectListener,this.chartSelectOneTime)},t.prototype.addListener=function(t,e,o,r){google.visualization.events.addListener(t,e,function(){r.emit(o())})},t.prototype.addOneTimeListener=function(t,e,o,r){google.visualization.events.addOneTimeListener(t,e,function(){r.emit(o())})},t.prototype.convertOptions=function(){try{this.options=google.charts[this.data.chartType].convertOptions(this.options)}catch(t){return}},i([Object(r.Input)()],t.prototype,"data",void 0),i([Object(r.Output)()],t.prototype,"chartReady",void 0),i([Object(r.Output)()],t.prototype,"chartReadyOneTime",void 0),i([Object(r.Output)()],t.prototype,"chartError",void 0),i([Object(r.Output)()],t.prototype,"chartErrorOneTime",void 0),i([Object(r.Output)()],t.prototype,"chartSelect",void 0),i([Object(r.Output)()],t.prototype,"chartSelectOneTime",void 0),i([Object(r.Output)()],t.prototype,"mouseOver",void 0),i([Object(r.Output)()],t.prototype,"mouseOverOneTime",void 0),i([Object(r.Output)()],t.prototype,"mouseOut",void 0),i([Object(r.Output)()],t.prototype,"mouseOutOneTime",void 0),i([Object(r.Output)()],t.prototype,"regionClick",void 0),i([Object(r.Output)()],t.prototype,"regionClickOneTime",void 0),t=i([Object(r.Component)({selector:"google-chart",template:"<div></div>",changeDetection:r.ChangeDetectionStrategy.OnPush})],t)}(),s=o(4),u=o(3),l=o(2),c=function(){var t=function(e,o){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(e,o)};return function(e,o){function r(){this.constructor=e}t(e,o),e.prototype=null===o?Object.create(o):(r.prototype=o.prototype,new r)}}(),p=function(){return function(){}}(),h=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e}(p),g=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e}(p),d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return c(e,t),e}(p),f=o(1),v=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},m=function(t,e){return function(o,r){e(o,r,t)}},y=function(){function t(t,e,o){this.googleChartsVersion=e,this.mapsApiKey=o,this.googleScriptLoadingNotifier=new r.EventEmitter,this.googleScriptIsLoading=!1,this.localeId=t,null===this.googleChartsVersion&&(this.googleChartsVersion="46")}return t.prototype.load=function(t){var e=this;return new Promise(function(o,r){void 0===o&&(o=Function.prototype),void 0===r&&(r=Function.prototype),e.loadGoogleChartsScript().then(function(){var r={language:e.localeId,callback:o,packages:t};e.mapsApiKey&&(r.mapsApiKey=e.mapsApiKey),google.charts.load(e.googleChartsVersion,r)}).catch(function(t){return r()})})},t.prototype.loadGoogleChartsScript=function(){var t=this;return new Promise(function(e,o){if(void 0===e&&(e=Function.prototype),void 0===o&&(o=Function.prototype),"undefined"!=typeof google&&google.charts)e();else if(t.googleScriptIsLoading)t.googleScriptLoadingNotifier.subscribe(function(t){t?e():o()});else{t.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(){t.googleScriptIsLoading=!1,t.googleScriptLoadingNotifier.emit(!0),e()},r.onerror=function(){t.googleScriptIsLoading=!1,t.googleScriptLoadingNotifier.emit(!1),o()},document.getElementsByTagName("head")[0].appendChild(r)}})},t=v([Object(r.Injectable)(),m(0,Object(r.Inject)(r.LOCALE_ID)),m(1,Object(r.Inject)("googleChartsVersion")),m(1,Object(r.Optional)()),m(2,Object(r.Inject)("mapsApiKey")),m(2,Object(r.Optional)())],t)}(),O=function(t,e,o,r){var n,i=arguments.length,a=i<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,o):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,r);else for(var s=t.length-1;s>=0;s--)(n=t[s])&&(a=(i<3?n(a):i>3?n(e,o,a):n(e,o))||a);return i>3&&a&&Object.defineProperty(e,o,a),a},b=function(){function t(){}return t=O([Object(r.NgModule)({declarations:[a],providers:[y],exports:[a]})],t)}();o.d(e,"GoogleChartComponent",function(){return a}),o.d(e,"ChartReadyEvent",function(){return s.ChartReadyEvent}),o.d(e,"ChartErrorEvent",function(){return u.ChartErrorEvent}),o.d(e,"ChartSelectEvent",function(){return l.ChartSelectEvent}),o.d(e,"ChartHTMLTooltip",function(){return n}),o.d(e,"ChartMouseOverEvent",function(){return g}),o.d(e,"ChartMouseOutEvent",function(){return d}),o.d(e,"MouseOverEvent",function(){return h}),o.d(e,"RegionClickEvent",function(){return f.RegionClickEvent}),o.d(e,"BoundingBox",function(){}),o.d(e,"DataPointPosition",function(){}),o.d(e,"Ng2GoogleChartsModule",function(){return b})}])}); | ||
//# sourceMappingURL=ng2-google-charts.umd.min.js.map |
@@ -0,1 +1,16 @@ | ||
<a name="v5.0.0"></a> | ||
# Version 5.0.0 | ||
* Add interface for remote data source | ||
* Add interfaces for all formatters | ||
* Add `regionClick` event for `GeoChart` | ||
* Add missing properties in `GoogleChartInterface`, implement loading data | ||
from a remote source | ||
## Breaking changes | ||
* rename interface `FormatterOptionsInterface` -> `ColorFormatInterface` | ||
* in `GoogleChartInterface`, rename `opt_firstRowIsData` -> `firstRowIsData` | ||
<a name="v4.0.0"></a> | ||
@@ -13,1 +28,4 @@ | ||
* `GoogleChartsLoaderService`: inject `googleChartsVersion` and `mapsApiKey` | ||
## Breaking changes | ||
* rename method in GoogleChartComponent: redraw() -> draw() |
@@ -7,2 +7,4 @@ # ng2-google-charts | ||
[![Donate][donate-btn]][donate-url] *To support development, please consider making a donation if you find this package useful.* | ||
[![NPM Version][npm-image]][npm-url] | ||
@@ -55,3 +57,3 @@ [![Downloads][npm-downloads-image]][npm-downloads-url] | ||
], | ||
//opt_firstRowIsData: true, | ||
//firstRowIsData: true, | ||
options: {'title': 'Tasks'}, | ||
@@ -62,3 +64,3 @@ }; | ||
`ChartWrapper` ([documentation][ChartWrapperMethods]). | ||
If `opt_firstRowIsData` is true, `dataTable` will be first passed to | ||
If `firstRowIsData` is true, `dataTable` will be first passed to | ||
`arrayToDataTable(dataTable, true)` ([documentation][arrayToDataTable]). | ||
@@ -74,3 +76,3 @@ | ||
```ts | ||
public tableChart = { | ||
public tableChart: GoogleChartInterface = { | ||
chartType: 'Table', | ||
@@ -104,3 +106,3 @@ dataTable: [ | ||
], | ||
options: {title: 'Countries', allowHtml: true} | ||
options: {allowHtml: true} | ||
}; | ||
@@ -306,3 +308,3 @@ ``` | ||
//force a redraw | ||
ccComponent.redraw(); | ||
ccComponent.draw(); | ||
} | ||
@@ -319,3 +321,3 @@ | ||
[npm-url]: https://npmjs.org/package/ng2-google-charts | ||
[npm-downloads-image]: http://img.shields.io/npm/dm/ng2-google-charts.svg | ||
[npm-downloads-image]: https://img.shields.io/npm/dm/ng2-google-charts.svg | ||
[npm-downloads-url]: https://npmjs.org/package/ng2-google-charts | ||
@@ -326,1 +328,3 @@ [example-page]: https://www.devrandom.it/software/ng2-google-charts/demo | ||
[ChartWrapperMethods]: https://developers.google.com/chart/interactive/docs/reference#methods_4 | ||
[donate-btn]: https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif | ||
[donate-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H94QELJUXWFWA&source=url |
@@ -8,2 +8,3 @@ import { ElementRef, OnChanges, SimpleChanges, EventEmitter } from '@angular/core'; | ||
import { ChartMouseOverEvent, ChartMouseOutEvent } from './chart-mouse-event'; | ||
import { RegionClickEvent } from './geochart-events'; | ||
export declare class GoogleChartComponent implements OnChanges, GoogleChartComponentInterface { | ||
@@ -21,2 +22,4 @@ data: GoogleChartInterface; | ||
mouseOutOneTime: EventEmitter<ChartMouseOutEvent>; | ||
regionClick: EventEmitter<RegionClickEvent>; | ||
regionClickOneTime: EventEmitter<RegionClickEvent>; | ||
wrapper: any; | ||
@@ -30,2 +33,3 @@ private cli; | ||
draw(): void; | ||
private _draw; | ||
/** | ||
@@ -32,0 +36,0 @@ * Applies formatters to data columns, if defined |
@@ -75,2 +75,4 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
this.mouseOutOneTime = new EventEmitter(); | ||
this.regionClick = new EventEmitter(); | ||
this.regionClickOneTime = new EventEmitter(); | ||
} | ||
@@ -92,3 +94,3 @@ GoogleChartComponent.prototype.ngOnChanges = function (changes) { | ||
_this.convertOptions(); | ||
if (_this.data.opt_firstRowIsData && Array.isArray(_this.data.dataTable)) { | ||
if (_this.data.firstRowIsData && Array.isArray(_this.data.dataTable)) { | ||
_this.data.dataTable = google.visualization.arrayToDataTable(_this.data.dataTable, true); | ||
@@ -107,3 +109,27 @@ } | ||
GoogleChartComponent.prototype.draw = function () { | ||
this.wrapper.setDataTable(this.data.dataTable); | ||
var _this = this; | ||
if (this.data.dataTable) { | ||
this.wrapper.setDataTable(this.data.dataTable); | ||
this._draw(); | ||
} | ||
else if (this.data.dataSourceUrl) { | ||
var query = new google.visualization.Query(this.data.dataSourceUrl); | ||
if (this.data.refreshInterval) { | ||
query.setRefreshInterval(this.data.refreshInterval); | ||
} | ||
if (this.data.query) { | ||
query.setQuery(this.data.query); | ||
} | ||
query.send(function (queryResponse) { | ||
if (queryResponse.isError()) { | ||
return; | ||
} | ||
var dt = queryResponse.getDataTable(); | ||
_this.wrapper.setDataTable(dt); | ||
_this.data.dataTable = dt; | ||
_this._draw(); | ||
}); | ||
} | ||
}; | ||
GoogleChartComponent.prototype._draw = function () { | ||
this.convertOptions(); | ||
@@ -122,9 +148,18 @@ this.wrapper.setOptions(this.options); | ||
if (this.data.formatters !== undefined) { | ||
var dt = this.wrapper.getDataTable(); | ||
for (var _i = 0, _a = this.data.formatters; _i < _a.length; _i++) { | ||
var formatterConfig = _a[_i]; | ||
var formatter = void 0; | ||
if (formatterConfig.type === 'PatternFormat') { | ||
var _fmtOptions = formatterConfig.options; | ||
formatter = new google.visualization.PatternFormat(_fmtOptions.pattern); | ||
formatter.format(dt, formatterConfig.columns, _fmtOptions.dstColumnIndex); | ||
continue; | ||
} | ||
var formatterConstructor = google.visualization[formatterConfig.type]; | ||
var formatterOptions = formatterConfig.options; | ||
var formatter = new formatterConstructor(formatterOptions); | ||
formatter = new formatterConstructor(formatterOptions); | ||
if (formatterConfig.type === 'ColorFormat' && formatterOptions) { | ||
for (var _b = 0, _c = formatterOptions.ranges; _b < _c.length; _b++) { | ||
var _fmtOptions = formatterOptions; | ||
for (var _b = 0, _c = _fmtOptions.ranges; _b < _c.length; _b++) { | ||
var range = _c[_b]; | ||
@@ -139,3 +174,2 @@ if (typeof (range.fromBgColor) !== 'undefined' && typeof (range.toBgColor) !== 'undefined') { | ||
} | ||
var dt = this.wrapper.getDataTable(); | ||
for (var _d = 0, _e = formatterConfig.columns; _d < _e.length; _d++) { | ||
@@ -283,2 +317,14 @@ var col = _e[_d]; | ||
} | ||
if (this.data.chartType === 'GeoChart') { | ||
if (this.regionClick.observers.length > 0) { | ||
google.visualization.events.addListener(chart, 'regionClick', function (item) { | ||
_this.regionClick.emit(item); | ||
}); | ||
} | ||
if (this.regionClickOneTime.observers.length > 0) { | ||
google.visualization.events.addOneTimeListener(chart, 'regionClick', function (item) { | ||
_this.regionClick.emit(item); | ||
}); | ||
} | ||
} | ||
}; | ||
@@ -365,2 +411,10 @@ GoogleChartComponent.prototype.registerChartWrapperEvents = function () { | ||
], GoogleChartComponent.prototype, "mouseOutOneTime", void 0); | ||
__decorate([ | ||
Output(), | ||
__metadata("design:type", EventEmitter) | ||
], GoogleChartComponent.prototype, "regionClick", void 0); | ||
__decorate([ | ||
Output(), | ||
__metadata("design:type", EventEmitter) | ||
], GoogleChartComponent.prototype, "regionClickOneTime", void 0); | ||
GoogleChartComponent = __decorate([ | ||
@@ -367,0 +421,0 @@ Component({ |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"GoogleChartComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":27,"character":1},"arguments":[{"selector":"google-chart","template":"<div></div>","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":30,"character":19},"member":"OnPush"}}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":34,"character":3}}]}],"chartReady":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":36,"character":3}}]}],"chartReadyOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":37,"character":3}}]}],"chartError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":39,"character":3}}]}],"chartErrorOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":40,"character":3}}]}],"chartSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":42,"character":3}}]}],"chartSelectOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":43,"character":3}}]}],"mouseOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":45,"character":3}}]}],"mouseOverOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":46,"character":3}}]}],"mouseOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":48,"character":3}}]}],"mouseOutOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":49,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":58,"character":25},{"__symbolic":"reference","module":"../google-charts-loader.service","name":"GoogleChartsLoaderService","line":59,"character":36}]}],"ngOnChanges":[{"__symbolic":"method"}],"draw":[{"__symbolic":"method"}],"reformat":[{"__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"}],"unregisterEvents":[{"__symbolic":"method"}],"registerChartEvents":[{"__symbolic":"method"}],"registerChartWrapperEvents":[{"__symbolic":"method"}],"addListener":[{"__symbolic":"method"}],"addOneTimeListener":[{"__symbolic":"method"}],"convertOptions":[{"__symbolic":"method"}]}}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"GoogleChartComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":29,"character":1},"arguments":[{"selector":"google-chart","template":"<div></div>","changeDetection":{"__symbolic":"select","expression":{"__symbolic":"reference","module":"@angular/core","name":"ChangeDetectionStrategy","line":32,"character":19},"member":"OnPush"}}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":36,"character":3}}]}],"chartReady":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":38,"character":3}}]}],"chartReadyOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":39,"character":3}}]}],"chartError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":41,"character":3}}]}],"chartErrorOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":42,"character":3}}]}],"chartSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":44,"character":3}}]}],"chartSelectOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":45,"character":3}}]}],"mouseOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":47,"character":3}}]}],"mouseOverOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":48,"character":3}}]}],"mouseOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":50,"character":3}}]}],"mouseOutOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":51,"character":3}}]}],"regionClick":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":53,"character":3}}]}],"regionClickOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":54,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":63,"character":25},{"__symbolic":"reference","module":"../google-charts-loader.service","name":"GoogleChartsLoaderService","line":64,"character":36}]}],"ngOnChanges":[{"__symbolic":"method"}],"draw":[{"__symbolic":"method"}],"_draw":[{"__symbolic":"method"}],"reformat":[{"__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"}],"unregisterEvents":[{"__symbolic":"method"}],"registerChartEvents":[{"__symbolic":"method"}],"registerChartWrapperEvents":[{"__symbolic":"method"}],"addListener":[{"__symbolic":"method"}],"addOneTimeListener":[{"__symbolic":"method"}],"convertOptions":[{"__symbolic":"method"}]}}}}] |
import { ChartReadyEvent } from './google-chart/chart-ready-event'; | ||
import { ChartErrorEvent } from './google-chart/chart-error-event'; | ||
import { ChartSelectEvent } from './google-chart/chart-select-event'; | ||
import { RegionClickEvent } from './google-chart/geochart-events'; | ||
import { ChartMouseOverEvent, ChartMouseOutEvent } from './google-chart/chart-mouse-event'; | ||
@@ -13,2 +14,3 @@ import { EventEmitter } from '@angular/core'; | ||
mouseOut: EventEmitter<ChartMouseOutEvent>; | ||
regionClick: EventEmitter<RegionClickEvent>; | ||
wrapper: any; | ||
@@ -21,10 +23,27 @@ draw(): void; | ||
dataTable?: any; | ||
opt_firstRowIsData?: boolean; | ||
dataSourceUrl?: string; | ||
query?: string; | ||
refreshInterval?: number; | ||
firstRowIsData?: boolean; | ||
formatters?: FormatterInterface[]; | ||
view?: string | object | object[]; | ||
component?: GoogleChartComponentInterface; | ||
} | ||
export interface ArrowFormatInterface { | ||
base: number; | ||
} | ||
export interface BarFormatInterface { | ||
base?: number; | ||
colorNegative?: string; | ||
colorPositive?: string; | ||
drawZeroLine?: boolean; | ||
max?: number; | ||
min?: number; | ||
showValue?: boolean; | ||
width?: number; | ||
} | ||
export interface RangeInterface { | ||
from: Number | Date | number[]; | ||
to: Number | Date | number[]; | ||
color: string; | ||
color?: string; | ||
bgcolor?: string; | ||
@@ -34,9 +53,28 @@ fromBgColor?: string; | ||
} | ||
export interface FormatterOptionsInterface { | ||
export interface ColorFormatInterface { | ||
ranges?: RangeInterface[]; | ||
} | ||
export interface DateFormat { | ||
formatType?: string; | ||
pattern?: string; | ||
timeZone?: number; | ||
} | ||
export interface NumberFormatInterface { | ||
decimalSymbol?: string; | ||
fractionDigits?: number; | ||
groupingSymbol?: string; | ||
negativeColor?: string; | ||
negativeParens?: boolean; | ||
pattern?: string; | ||
prefix?: string; | ||
suffix?: string; | ||
} | ||
export interface PatternFormatInterface { | ||
pattern: string; | ||
dstColumnIndex?: number; | ||
} | ||
export interface FormatterInterface { | ||
type: string; | ||
options?: FormatterOptionsInterface; | ||
options?: (ArrowFormatInterface | BarFormatInterface | ColorFormatInterface | DateFormat | NumberFormatInterface | PatternFormatInterface); | ||
columns: number[]; | ||
} |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"metadata":{"GoogleChartComponentInterface":{"__symbolic":"interface"},"GoogleChartInterface":{"__symbolic":"interface"},"RangeInterface":{"__symbolic":"interface"},"FormatterOptionsInterface":{"__symbolic":"interface"},"FormatterInterface":{"__symbolic":"interface"}}}] | ||
[{"__symbolic":"module","version":4,"metadata":{"GoogleChartComponentInterface":{"__symbolic":"interface"},"GoogleChartInterface":{"__symbolic":"interface"},"ArrowFormatInterface":{"__symbolic":"interface"},"BarFormatInterface":{"__symbolic":"interface"},"RangeInterface":{"__symbolic":"interface"},"ColorFormatInterface":{"__symbolic":"interface"},"DateFormat":{"__symbolic":"interface"},"NumberFormatInterface":{"__symbolic":"interface"},"PatternFormatInterface":{"__symbolic":"interface"},"FormatterInterface":{"__symbolic":"interface"}}}] |
@@ -7,4 +7,5 @@ export * from './google-chart/google-chart.component'; | ||
export { ChartMouseOverEvent, ChartMouseOutEvent, MouseOverEvent } from './google-chart/chart-mouse-event'; | ||
export { RegionClickEvent } from './google-chart/geochart-events'; | ||
export { BoundingBox } from './google-chart/chart-mouse-event'; | ||
export { DataPointPosition } from './google-chart/chart-mouse-event'; | ||
export { Ng2GoogleChartsModule } from './google-charts.module'; |
@@ -1,1 +0,1 @@ | ||
[{"__symbolic":"module","version":4,"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":4,"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/geochart-events","export":["RegionClickEvent"]},{"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": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Angular2 Google Charts module", | ||
@@ -24,3 +24,6 @@ "module": "index.js", | ||
"name": "ng2-google-charts", | ||
"_id": "ng2-google-charts@4.0.0" | ||
"peerDependencies": { | ||
"@angular/core": "~8.2.14" | ||
}, | ||
"_id": "ng2-google-charts@5.0.0" | ||
} |
@@ -8,2 +8,4 @@ # ng2-google-charts | ||
[![Donate][donate-btn]][donate-url] *To support development, please consider making a donation if you find this package useful.* | ||
## Install | ||
@@ -24,5 +26,7 @@ | ||
[npm-url]: https://npmjs.org/package/ng2-google-charts | ||
[npm-downloads-image]: http://img.shields.io/npm/dm/ng2-google-charts.svg | ||
[npm-downloads-image]: https://img.shields.io/npm/dm/ng2-google-charts.svg | ||
[npm-downloads-url]: https://npmjs.org/package/ng2-google-charts | ||
[reference]: https://www.devrandom.it/software/ng2-google-charts/ | ||
[example-page]: https://www.devrandom.it/software/ng2-google-charts/demo | ||
[donate-btn]: https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif | ||
[donate-url]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=H94QELJUXWFWA&source=url |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
180023
42
1578
31
1