ng2-google-charts
Advanced tools
Comparing version 6.0.1 to 6.1.0
@@ -1129,2 +1129,68 @@ (function (global, factory) { | ||
function isComponent(chart) { | ||
return chart.wrapper !== undefined; | ||
} | ||
exports.GoogleChartEditor = /** @class */ (function () { | ||
function GoogleChartEditor(loaderService) { | ||
this.loaderService = loaderService; | ||
} | ||
GoogleChartEditor.prototype.createEditor = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (this.chartEditor !== undefined) { | ||
return [2 /*return*/]; | ||
} | ||
return [4 /*yield*/, this.loaderService.load({ packages: ['charteditor'] })]; | ||
case 1: | ||
_a.sent(); | ||
this.chartEditor = new google.visualization.ChartEditor(); | ||
google.visualization.events.addListener(this.chartEditor, 'ok', function () { | ||
var wrapper = _this.chartEditor.getChartWrapper(); | ||
_this.comp.wrapper = wrapper; | ||
_this.comp.data.chartType = wrapper.getChartType(); | ||
if (_this.comp.data.options !== undefined || Object.isExtensible(_this.comp.data)) { | ||
_this.comp.data.options = wrapper.getOptions(); | ||
} | ||
_this.comp.wrapper.draw(); | ||
}); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
GoogleChartEditor.prototype.openDialog = function (chart, options) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.createEditor()]; | ||
case 1: | ||
_a.sent(); | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
_this.comp = isComponent(chart) ? chart : chart.component; | ||
_this.chartEditor.openDialog(_this.comp.wrapper, options); | ||
google.visualization.events.addListener(_this.chartEditor, 'ok', function () { | ||
resolve(_this.comp.wrapper); | ||
}); | ||
google.visualization.events.addListener(_this.chartEditor, 'cancel', function () { | ||
reject(); | ||
}); | ||
})]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return GoogleChartEditor; | ||
}()); | ||
exports.GoogleChartEditor.ɵprov = i0.ɵɵdefineInjectable({ factory: function GoogleChartEditor_Factory() { return new exports.GoogleChartEditor(i0.ɵɵinject(exports.GoogleChartsLoaderService)); }, token: exports.GoogleChartEditor, providedIn: "root" }); | ||
exports.GoogleChartEditor = __decorate([ | ||
i0.Injectable({ | ||
providedIn: 'root' | ||
}), | ||
__metadata("design:paramtypes", [exports.GoogleChartsLoaderService]) | ||
], exports.GoogleChartEditor); | ||
/* | ||
@@ -1131,0 +1197,0 @@ * Public API Surface of ng2-google-charts |
@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("ng2-google-charts",["exports","@angular/core"],t):t((e=e||self)["ng2-google-charts"]={},e.ng.core)}(this,(function(e,t){"use strict"; | ||
and limitations under the License. | ||
***************************************************************************** */function o(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}function r(e,t){return function(o,r){t(o,r,e)}}function n(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function i(e,t,o,r){return new(o||(o=Promise))((function(n,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?n(e.value):new o((function(t){t(e.value)})).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function a(e,t){var o,r,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(n=2&i[0]?r.return:i[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,i[1])).done)return n;switch(r=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{o=n=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function s(e){var t="function"==typeof Symbol&&e[Symbol.iterator],o=0;return t?t.call(e):{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}}}e.GoogleChartsLoaderService=function(){function e(e,o){var r=this;this.googleChartsSettings=o,this.googleScriptLoadingNotifier=new t.EventEmitter,this.googleScriptIsLoading=!1,this.localeId=e,this.loadGoogleChartsScriptPromise=new Promise((function(e,t){if("undefined"!=typeof google&&google.charts)e();else if(r.googleScriptIsLoading)r.googleScriptLoadingNotifier.subscribe((function(o){o?e():t()}));else{r.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(){r.googleScriptIsLoading=!1,r.googleScriptLoadingNotifier.emit(!0),e()},o.onerror=function(){r.googleScriptIsLoading=!1,r.googleScriptLoadingNotifier.emit(!1),t()},document.getElementsByTagName("head")[0].appendChild(o)}}))}return e.prototype.load=function(e){return i(this,void 0,void 0,(function(){var t=this;return a(this,(function(o){switch(o.label){case 0:return[4,this.loadGoogleChartsScriptPromise];case 1:return o.sent(),[4,new Promise((function(o){e||(e=Object.create(t.googleChartsSettings)),e||(e={}),e.language||(e.language=t.localeId),e.googleChartsVersion||(e.googleChartsVersion="47");var r=e;r.callback=o,google.charts.load(e.googleChartsVersion,r)}))];case 2:return o.sent(),[2]}}))}))},e}(),e.GoogleChartsLoaderService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.GoogleChartsLoaderService(t.ɵɵinject(t.LOCALE_ID),t.ɵɵinject("googleChartsSettings",8))},token:e.GoogleChartsLoaderService,providedIn:"root"}),e.GoogleChartsLoaderService=o([t.Injectable({providedIn:"root"}),r(0,t.Inject(t.LOCALE_ID)),r(1,t.Inject("googleChartsSettings")),r(1,t.Optional()),n("design:paramtypes",[String,Object])],e.GoogleChartsLoaderService);var l=function(){function e(e){this.opt=e,this.dataTableChanged=new t.EventEmitter,e&&this._setDataTable(e.dataTable,e.firstRowIsData)}return e.prototype.send=function(){var e=this;void 0!==this.query&&this.query.send((function(t){e.setDataTable(t.getDataTable()),e.opt.queryCallback&&e.opt.queryCallback(t)}))},e.prototype.init=function(e){var t=this;e&&(this.opt=e),void 0!==this.tid&&(window.clearInterval(this.tid),this.tid=void 0),this.opt.dataSourceUrl?(this.query=new google.visualization.Query(this.opt.dataSourceUrl),this.opt.query&&this.query.setQuery(this.opt.query),void 0!==this.opt.timeout&&this.query.setTimeout(this.opt.timeout),this.opt.refreshInterval&&(this.tid=window.setInterval((function(){t.send()}),1e3*this.opt.refreshInterval)),this.send()):this.setDataTable(this.opt.dataTable)},e.prototype.getDataTable=function(){return this.dataTable},e.prototype.setDataTable=function(e,t){void 0===t&&(t=this.opt.firstRowIsData),this._setDataTable(e,t),this.dataTableChanged.emit(this.dataTable)},e.prototype._setDataTable=function(e,t){Array.isArray(e)&&(e=google.visualization.arrayToDataTable(e,t)),this.dataTable=e,this.reformat()},e.prototype.reformat=function(){var e,t,o,r,n,i,a=this.dataTable;if(void 0!==a&&void 0!==this.opt.formatters)try{for(var l=s(this.opt.formatters),u=l.next();!u.done;u=l.next()){var p=u.value,c=void 0;if("PatternFormat"!==p.type){var h=google.visualization[p.type],d=p.options;if(c=new h(d),"ColorFormat"===p.type&&d){b=d;try{for(var g=(o=void 0,s(b.ranges)),v=g.next();!v.done;v=g.next()){var m=v.value;void 0!==m.fromBgColor&&void 0!==m.toBgColor?c.addGradientRange(m.from,m.to,m.color,m.fromBgColor,m.toBgColor):c.addRange(m.from,m.to,m.color,m.bgcolor)}}catch(e){o={error:e}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(o)throw o.error}}}try{for(var f=(n=void 0,s(p.columns)),y=f.next();!y.done;y=f.next()){var C=y.value;c.format(a,C)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}else{var b=p.options;(c=new google.visualization.PatternFormat(b.pattern)).format(a,p.columns,b.dstColumnIndex)}}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}},e}();o([t.Output(),n("design:type",t.EventEmitter)],l.prototype,"dataTableChanged",void 0);var u=function(){function e(e){this.el=e}return e.prototype.setPosition=function(t,o){this.el.nativeElement.style.left=t+e.PIXELS,this.el.nativeElement.style.top=o+e.PIXELS},e.prototype.getDOMElement=function(){return this.el},e}();u.PIXELS="px",e.GoogleChartComponent=function(){function e(e,o){var r=this;this.el=e,this.loaderService=o,this.mouseOverListener=function(e){var t=r.parseMouseEvent(e);return t.tooltip=r.getHTMLTooltip(),t},this.mouseOutListener=function(e){return r.parseMouseEvent(e)},this.selectListener=function(){var e={message:"select",row:null,column:null,selectedRowValues:[],selectedRowFormattedValues:[],columnLabel:""},t=r.wrapper.visualization.getSelection(),o=t[t.length-1];if(!o)return e.message="deselect",e;var n=o;if(null!=o.row){e.row=n.row;for(var i=[],a=[],s=r.wrapper.getDataTable(),l=s.getNumberOfColumns(),u=0;u<l;u++)i.push(s.getValue(n.row,u)),a.push(s.getFormattedValue(n.row,u));e.selectedRowValues=i,e.selectedRowFormattedValues=a}return null!=n.column&&(e.column=n.column,e.columnLabel=r.getColumnLabelAtPosition(n)),o.name&&(e.columnLabel=o.name),e},this.chartSelect=new t.EventEmitter,this.chartSelectOneTime=new t.EventEmitter,this.chartReady=new t.EventEmitter,this.chartReadyOneTime=new t.EventEmitter,this.chartError=new t.EventEmitter,this.chartErrorOneTime=new t.EventEmitter,this.mouseOver=new t.EventEmitter,this.mouseOverOneTime=new t.EventEmitter,this.mouseOut=new t.EventEmitter,this.mouseOutOneTime=new t.EventEmitter,this.regionClick=new t.EventEmitter,this.regionClickOneTime=new t.EventEmitter}return e.prototype.ngOnInit=function(){var e=this;this.HTMLel=this.el.nativeElement.querySelector("div"),Object.isExtensible(this.data)&&(this.data.component=this),this.options=this.data.options,this.init().then((function(){e.draw()}))},e.prototype.init=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.loaderService.load()];case 1:return e.sent(),this.recreateWrapper(),[2]}}))}))},e.prototype.recreateWrapper=function(){var e=this;if(void 0===this.wrapper||this.wrapper.getChartType()!==this.data.chartType){this.dataTable=new l(this.data),this.dataTable.dataTableChanged.subscribe((function(t){e._draw()}));var t=this.data;if(this.data.firstRowIsData&&((t=Object.assign(t,this.data)).dataTable=this.dataTable.getDataTable()),this.wrapper=new google.visualization.ChartWrapper(t),this.registerChartWrapperEvents(),void 0===t.dataTable&&void 0===t.dataSourceUrl)try{this.wrapper.draw(this.HTMLel)}catch(e){}}},e.prototype._draw=function(){return i(this,void 0,void 0,(function(){var e;return a(this,(function(t){return void 0===(e=this.dataTable.getDataTable())?[2]:(this.convertOptions(),this.recreateWrapper(),this.wrapper.setOptions(this.options),this.wrapper.setDataTable(e),this.wrapper.draw(this.HTMLel),[2])}))}))},e.prototype.getDataTable=function(){return this.dataTable},e.prototype.draw=function(e){void 0===e&&(e=this.data),this.options=e.options,this.dataTable.init(e)},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,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,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 t.ElementRef(this.el.nativeElement.querySelector(".google-visualization-tooltip"));return new u(e)},e.prototype.parseMouseEvent=function(e){var t=this.wrapper.getChartType(),o=e.column;if(null==o)switch(t){case"Timeline":o=3===this.wrapper.getDataTable().getNumberOfColumns()?0:1;break;default:o=0}var r={row:e.row,column:o};return{position:e,boundingBox:this.getBoundingBoxForItem(r),value:this.getValueAtPosition(r),columnType:this.getColumnTypeAtPosition(r),columnLabel:this.getColumnLabelAtPosition(r)}},e.prototype.unregisterEvents=function(){google.visualization.events.removeAllListeners(this.wrapper.getChart()),google.visualization.events.removeAllListeners(this.wrapper)},e.prototype.registerChartEvents=function(){var e=this,t=this.wrapper.getChart();this.cli=t.getChartLayoutInterface?t.getChartLayoutInterface():null,this.mouseOver.observers.length>0&&google.visualization.events.addListener(t,"onmouseover",(function(t){var o=e.parseMouseEvent(t);o.tooltip=e.getHTMLTooltip(),e.mouseOver.emit(o)})),this.mouseOverOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(t,"onmouseover",(function(t){var o=e.parseMouseEvent(t);o.tooltip=e.getHTMLTooltip(),e.mouseOverOneTime.emit(o)})),this.mouseOut.observers.length>0&&google.visualization.events.addListener(t,"onmouseout",(function(t){var o=e.parseMouseEvent(t);e.mouseOut.emit(o)})),this.mouseOutOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(t,"onmouseout",(function(t){var o=e.parseMouseEvent(t);e.mouseOutOneTime.emit(o)})),"GeoChart"===this.data.chartType&&(this.regionClick.observers.length>0&&google.visualization.events.addListener(t,"regionClick",(function(t){e.regionClick.emit(t)})),this.regionClickOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(t,"regionClick",(function(t){e.regionClick.emit(t)})))},e.prototype.registerChartWrapperEvents=function(){var e=this;google.visualization.events.addListener(this.wrapper,"ready",(function(){e.chartReady.emit({message:"Chart ready"})})),google.visualization.events.addOneTimeListener(this.wrapper,"ready",(function(){e.chartReadyOneTime.emit({message:"Chart ready (one time)"}),e.registerChartEvents()})),google.visualization.events.addListener(this.wrapper,"error",(function(t){e.chartError.emit(t)})),google.visualization.events.addOneTimeListener(this.wrapper,"error",(function(t){e.chartErrorOneTime.emit(t)})),this.addListener(this.wrapper,"select",this.selectListener,this.chartSelect),this.addOneTimeListener(this.wrapper,"select",this.selectListener,this.chartSelectOneTime)},e.prototype.addListener=function(e,t,o,r){google.visualization.events.addListener(e,t,(function(){r.emit(o())}))},e.prototype.addOneTimeListener=function(e,t,o,r){google.visualization.events.addOneTimeListener(e,t,(function(){r.emit(o())}))},e.prototype.convertOptions=function(){try{this.options=google.charts[this.data.chartType].convertOptions(this.options)}catch(e){return}},e}(),o([t.Input(),n("design:type",Object)],e.GoogleChartComponent.prototype,"data",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartReady",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartReadyOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartError",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartErrorOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartSelect",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartSelectOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"mouseOver",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"mouseOverOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"mouseOut",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"mouseOutOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"regionClick",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"regionClickOneTime",void 0),e.GoogleChartComponent=o([t.Component({selector:"google-chart",template:"<div></div>"}),n("design:paramtypes",[t.ElementRef,e.GoogleChartsLoaderService])],e.GoogleChartComponent),e.GoogleChartsDashboardComponent=function(){function e(e,t){this.el=e,this.loaderService=t,this.el=e,this.loaderService=t}return e.prototype.ngOnInit=function(){var e=this;this.data.component=this,this.init().then((function(){e.dataTable||(e.dataTable=new l(e.data),e.dataTable.dataTableChanged.subscribe((function(t){e._draw()}))),e.draw()}))},e.prototype.init=function(){return i(this,void 0,void 0,(function(){var e,t,o,r,n,i,l,u,p,c,h,d,g,v,m,f,y,C,b,w;return a(this,(function(a){switch(a.label){case 0:return[4,this.loaderService.load({packages:["controls"]})];case 1:a.sent(),this.dashboard=new google.visualization.Dashboard(this.el.nativeElement.querySelector("div")),a.label=2;case 2:a.trys.push([2,21,22,23]),e=s(this.data.bind),t=e.next(),a.label=3;case 3:if(t.done)return[3,20];o=t.value,r=o[0],n=o[1],r instanceof Array||(r=[r]),n instanceof Array||(n=[n]),a.label=4;case 4:a.trys.push([4,9,10,11]),y=void 0,i=s(r),l=i.next(),a.label=5;case 5:return l.done?[3,8]:[4,(h=l.value).component.ensureInit()];case 6:a.sent(),a.label=7;case 7:return l=i.next(),[3,5];case 8:return[3,11];case 9:return u=a.sent(),y={error:u},[3,11];case 10:try{l&&!l.done&&(C=i.return)&&C.call(i)}finally{if(y)throw y.error}return[7];case 11:a.trys.push([11,16,17,18]),b=void 0,p=s(n),c=p.next(),a.label=12;case 12:return c.done?[3,15]:[4,(h=c.value).component.init()];case 13:if(a.sent(),void 0!==(d=h.component.data).dataTable||void 0!==d.dataSourceUrl)throw Error("dataTable and dataSourceUrl cannot be specified when chart is drawn in a Dashboard");a.label=14;case 14:return c=p.next(),[3,12];case 15:return[3,18];case 16:return g=a.sent(),b={error:g},[3,18];case 17:try{c&&!c.done&&(w=p.return)&&w.call(p)}finally{if(b)throw b.error}return[7];case 18:this.dashboard.bind(r.map((function(e){return e.component.wrapper})),n.map((function(e){return e.component.wrapper}))),a.label=19;case 19:return t=e.next(),[3,3];case 20:return[3,23];case 21:return v=a.sent(),m={error:v},[3,23];case 22:try{t&&!t.done&&(f=e.return)&&f.call(e)}finally{if(m)throw m.error}return[7];case 23:return[2]}}))}))},e.prototype.draw=function(e){this.dataTable.init(e)},e.prototype._draw=function(){this.dashboard.draw(this.dataTable.getDataTable())},e}(),o([t.Input(),n("design:type",Object)],e.GoogleChartsDashboardComponent.prototype,"data",void 0),e.GoogleChartsDashboardComponent=o([t.Component({selector:"google-charts-dashboard",template:"<div></div>"}),n("design:paramtypes",[t.ElementRef,e.GoogleChartsLoaderService])],e.GoogleChartsDashboardComponent),e.GoogleChartsControlComponent=function(){function e(e,t){this.el=e,this.loaderService=t,this.el=e,this.loaderService=t}return e.prototype.ngOnInit=function(){this.data.component=this},e.prototype.ensureInit=function(){return i(this,void 0,void 0,(function(){var e;return a(this,(function(t){switch(t.label){case 0:return this.wrapper?[2]:[4,this.loaderService.load({packages:["controls"]})];case 1:return t.sent(),(e=Object.create(this.data)).containerId=this.el.nativeElement.querySelector("div"),this.wrapper=new google.visualization.ControlWrapper(e),[2]}}))}))},e}(),o([t.Input(),n("design:type",Object)],e.GoogleChartsControlComponent.prototype,"data",void 0),e.GoogleChartsControlComponent=o([t.Component({selector:"google-charts-control",template:"<div></div>"}),n("design:paramtypes",[t.ElementRef,e.GoogleChartsLoaderService])],e.GoogleChartsControlComponent),e.Ng2GoogleChartsModule=function(){},e.Ng2GoogleChartsModule=o([t.NgModule({declarations:[e.GoogleChartComponent,e.GoogleChartsDashboardComponent,e.GoogleChartsControlComponent],providers:[e.GoogleChartsLoaderService],exports:[e.GoogleChartComponent,e.GoogleChartsDashboardComponent,e.GoogleChartsControlComponent]})],e.Ng2GoogleChartsModule),e.ChartHTMLTooltip=u,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
***************************************************************************** */function o(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}function r(e,t){return function(o,r){t(o,r,e)}}function n(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function i(e,t,o,r){return new(o||(o=Promise))((function(n,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?n(e.value):new o((function(t){t(e.value)})).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function a(e,t){var o,r,n,i,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(o)throw new TypeError("Generator is already executing.");for(;a;)try{if(o=1,r&&(n=2&i[0]?r.return:i[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,i[1])).done)return n;switch(r=0,n&&(i=[2&i[0],n.value]),i[0]){case 0:case 1:n=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(n=(n=a.trys).length>0&&n[n.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!n||i[1]>n[0]&&i[1]<n[3])){a.label=i[1];break}if(6===i[0]&&a.label<n[1]){a.label=n[1],n=i;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(i);break}n[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{o=n=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function s(e){var t="function"==typeof Symbol&&e[Symbol.iterator],o=0;return t?t.call(e):{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}}}e.GoogleChartsLoaderService=function(){function e(e,o){var r=this;this.googleChartsSettings=o,this.googleScriptLoadingNotifier=new t.EventEmitter,this.googleScriptIsLoading=!1,this.localeId=e,this.loadGoogleChartsScriptPromise=new Promise((function(e,t){if("undefined"!=typeof google&&google.charts)e();else if(r.googleScriptIsLoading)r.googleScriptLoadingNotifier.subscribe((function(o){o?e():t()}));else{r.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(){r.googleScriptIsLoading=!1,r.googleScriptLoadingNotifier.emit(!0),e()},o.onerror=function(){r.googleScriptIsLoading=!1,r.googleScriptLoadingNotifier.emit(!1),t()},document.getElementsByTagName("head")[0].appendChild(o)}}))}return e.prototype.load=function(e){return i(this,void 0,void 0,(function(){var t=this;return a(this,(function(o){switch(o.label){case 0:return[4,this.loadGoogleChartsScriptPromise];case 1:return o.sent(),[4,new Promise((function(o){e||(e=Object.create(t.googleChartsSettings)),e||(e={}),e.language||(e.language=t.localeId),e.googleChartsVersion||(e.googleChartsVersion="47");var r=e;r.callback=o,google.charts.load(e.googleChartsVersion,r)}))];case 2:return o.sent(),[2]}}))}))},e}(),e.GoogleChartsLoaderService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.GoogleChartsLoaderService(t.ɵɵinject(t.LOCALE_ID),t.ɵɵinject("googleChartsSettings",8))},token:e.GoogleChartsLoaderService,providedIn:"root"}),e.GoogleChartsLoaderService=o([t.Injectable({providedIn:"root"}),r(0,t.Inject(t.LOCALE_ID)),r(1,t.Inject("googleChartsSettings")),r(1,t.Optional()),n("design:paramtypes",[String,Object])],e.GoogleChartsLoaderService);var l=function(){function e(e){this.opt=e,this.dataTableChanged=new t.EventEmitter,e&&this._setDataTable(e.dataTable,e.firstRowIsData)}return e.prototype.send=function(){var e=this;void 0!==this.query&&this.query.send((function(t){e.setDataTable(t.getDataTable()),e.opt.queryCallback&&e.opt.queryCallback(t)}))},e.prototype.init=function(e){var t=this;e&&(this.opt=e),void 0!==this.tid&&(window.clearInterval(this.tid),this.tid=void 0),this.opt.dataSourceUrl?(this.query=new google.visualization.Query(this.opt.dataSourceUrl),this.opt.query&&this.query.setQuery(this.opt.query),void 0!==this.opt.timeout&&this.query.setTimeout(this.opt.timeout),this.opt.refreshInterval&&(this.tid=window.setInterval((function(){t.send()}),1e3*this.opt.refreshInterval)),this.send()):this.setDataTable(this.opt.dataTable)},e.prototype.getDataTable=function(){return this.dataTable},e.prototype.setDataTable=function(e,t){void 0===t&&(t=this.opt.firstRowIsData),this._setDataTable(e,t),this.dataTableChanged.emit(this.dataTable)},e.prototype._setDataTable=function(e,t){Array.isArray(e)&&(e=google.visualization.arrayToDataTable(e,t)),this.dataTable=e,this.reformat()},e.prototype.reformat=function(){var e,t,o,r,n,i,a=this.dataTable;if(void 0!==a&&void 0!==this.opt.formatters)try{for(var l=s(this.opt.formatters),c=l.next();!c.done;c=l.next()){var u=c.value,p=void 0;if("PatternFormat"!==u.type){var h=google.visualization[u.type],d=u.options;if(p=new h(d),"ColorFormat"===u.type&&d){b=d;try{for(var g=(o=void 0,s(b.ranges)),v=g.next();!v.done;v=g.next()){var m=v.value;void 0!==m.fromBgColor&&void 0!==m.toBgColor?p.addGradientRange(m.from,m.to,m.color,m.fromBgColor,m.toBgColor):p.addRange(m.from,m.to,m.color,m.bgcolor)}}catch(e){o={error:e}}finally{try{v&&!v.done&&(r=g.return)&&r.call(g)}finally{if(o)throw o.error}}}try{for(var f=(n=void 0,s(u.columns)),y=f.next();!y.done;y=f.next()){var C=y.value;p.format(a,C)}}catch(e){n={error:e}}finally{try{y&&!y.done&&(i=f.return)&&i.call(f)}finally{if(n)throw n.error}}}else{var b=u.options;(p=new google.visualization.PatternFormat(b.pattern)).format(a,u.columns,b.dstColumnIndex)}}}catch(t){e={error:t}}finally{try{c&&!c.done&&(t=l.return)&&t.call(l)}finally{if(e)throw e.error}}},e}();o([t.Output(),n("design:type",t.EventEmitter)],l.prototype,"dataTableChanged",void 0);var c=function(){function e(e){this.el=e}return e.prototype.setPosition=function(t,o){this.el.nativeElement.style.left=t+e.PIXELS,this.el.nativeElement.style.top=o+e.PIXELS},e.prototype.getDOMElement=function(){return this.el},e}();c.PIXELS="px",e.GoogleChartComponent=function(){function e(e,o){var r=this;this.el=e,this.loaderService=o,this.mouseOverListener=function(e){var t=r.parseMouseEvent(e);return t.tooltip=r.getHTMLTooltip(),t},this.mouseOutListener=function(e){return r.parseMouseEvent(e)},this.selectListener=function(){var e={message:"select",row:null,column:null,selectedRowValues:[],selectedRowFormattedValues:[],columnLabel:""},t=r.wrapper.visualization.getSelection(),o=t[t.length-1];if(!o)return e.message="deselect",e;var n=o;if(null!=o.row){e.row=n.row;for(var i=[],a=[],s=r.wrapper.getDataTable(),l=s.getNumberOfColumns(),c=0;c<l;c++)i.push(s.getValue(n.row,c)),a.push(s.getFormattedValue(n.row,c));e.selectedRowValues=i,e.selectedRowFormattedValues=a}return null!=n.column&&(e.column=n.column,e.columnLabel=r.getColumnLabelAtPosition(n)),o.name&&(e.columnLabel=o.name),e},this.chartSelect=new t.EventEmitter,this.chartSelectOneTime=new t.EventEmitter,this.chartReady=new t.EventEmitter,this.chartReadyOneTime=new t.EventEmitter,this.chartError=new t.EventEmitter,this.chartErrorOneTime=new t.EventEmitter,this.mouseOver=new t.EventEmitter,this.mouseOverOneTime=new t.EventEmitter,this.mouseOut=new t.EventEmitter,this.mouseOutOneTime=new t.EventEmitter,this.regionClick=new t.EventEmitter,this.regionClickOneTime=new t.EventEmitter}return e.prototype.ngOnInit=function(){var e=this;this.HTMLel=this.el.nativeElement.querySelector("div"),Object.isExtensible(this.data)&&(this.data.component=this),this.options=this.data.options,this.init().then((function(){e.draw()}))},e.prototype.init=function(){return i(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,this.loaderService.load()];case 1:return e.sent(),this.recreateWrapper(),[2]}}))}))},e.prototype.recreateWrapper=function(){var e=this;if(void 0===this.wrapper||this.wrapper.getChartType()!==this.data.chartType){this.dataTable=new l(this.data),this.dataTable.dataTableChanged.subscribe((function(t){e._draw()}));var t=this.data;if(this.data.firstRowIsData&&((t=Object.assign(t,this.data)).dataTable=this.dataTable.getDataTable()),this.wrapper=new google.visualization.ChartWrapper(t),this.registerChartWrapperEvents(),void 0===t.dataTable&&void 0===t.dataSourceUrl)try{this.wrapper.draw(this.HTMLel)}catch(e){}}},e.prototype._draw=function(){return i(this,void 0,void 0,(function(){var e;return a(this,(function(t){return void 0===(e=this.dataTable.getDataTable())?[2]:(this.convertOptions(),this.recreateWrapper(),this.wrapper.setOptions(this.options),this.wrapper.setDataTable(e),this.wrapper.draw(this.HTMLel),[2])}))}))},e.prototype.getDataTable=function(){return this.dataTable},e.prototype.draw=function(e){void 0===e&&(e=this.data),this.options=e.options,this.dataTable.init(e)},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,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,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 t.ElementRef(this.el.nativeElement.querySelector(".google-visualization-tooltip"));return new c(e)},e.prototype.parseMouseEvent=function(e){var t=this.wrapper.getChartType(),o=e.column;if(null==o)switch(t){case"Timeline":o=3===this.wrapper.getDataTable().getNumberOfColumns()?0:1;break;default:o=0}var r={row:e.row,column:o};return{position:e,boundingBox:this.getBoundingBoxForItem(r),value:this.getValueAtPosition(r),columnType:this.getColumnTypeAtPosition(r),columnLabel:this.getColumnLabelAtPosition(r)}},e.prototype.unregisterEvents=function(){google.visualization.events.removeAllListeners(this.wrapper.getChart()),google.visualization.events.removeAllListeners(this.wrapper)},e.prototype.registerChartEvents=function(){var e=this,t=this.wrapper.getChart();this.cli=t.getChartLayoutInterface?t.getChartLayoutInterface():null,this.mouseOver.observers.length>0&&google.visualization.events.addListener(t,"onmouseover",(function(t){var o=e.parseMouseEvent(t);o.tooltip=e.getHTMLTooltip(),e.mouseOver.emit(o)})),this.mouseOverOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(t,"onmouseover",(function(t){var o=e.parseMouseEvent(t);o.tooltip=e.getHTMLTooltip(),e.mouseOverOneTime.emit(o)})),this.mouseOut.observers.length>0&&google.visualization.events.addListener(t,"onmouseout",(function(t){var o=e.parseMouseEvent(t);e.mouseOut.emit(o)})),this.mouseOutOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(t,"onmouseout",(function(t){var o=e.parseMouseEvent(t);e.mouseOutOneTime.emit(o)})),"GeoChart"===this.data.chartType&&(this.regionClick.observers.length>0&&google.visualization.events.addListener(t,"regionClick",(function(t){e.regionClick.emit(t)})),this.regionClickOneTime.observers.length>0&&google.visualization.events.addOneTimeListener(t,"regionClick",(function(t){e.regionClick.emit(t)})))},e.prototype.registerChartWrapperEvents=function(){var e=this;google.visualization.events.addListener(this.wrapper,"ready",(function(){e.chartReady.emit({message:"Chart ready"})})),google.visualization.events.addOneTimeListener(this.wrapper,"ready",(function(){e.chartReadyOneTime.emit({message:"Chart ready (one time)"}),e.registerChartEvents()})),google.visualization.events.addListener(this.wrapper,"error",(function(t){e.chartError.emit(t)})),google.visualization.events.addOneTimeListener(this.wrapper,"error",(function(t){e.chartErrorOneTime.emit(t)})),this.addListener(this.wrapper,"select",this.selectListener,this.chartSelect),this.addOneTimeListener(this.wrapper,"select",this.selectListener,this.chartSelectOneTime)},e.prototype.addListener=function(e,t,o,r){google.visualization.events.addListener(e,t,(function(){r.emit(o())}))},e.prototype.addOneTimeListener=function(e,t,o,r){google.visualization.events.addOneTimeListener(e,t,(function(){r.emit(o())}))},e.prototype.convertOptions=function(){try{this.options=google.charts[this.data.chartType].convertOptions(this.options)}catch(e){return}},e}(),o([t.Input(),n("design:type",Object)],e.GoogleChartComponent.prototype,"data",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartReady",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartReadyOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartError",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartErrorOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartSelect",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"chartSelectOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"mouseOver",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"mouseOverOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"mouseOut",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"mouseOutOneTime",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"regionClick",void 0),o([t.Output(),n("design:type",t.EventEmitter)],e.GoogleChartComponent.prototype,"regionClickOneTime",void 0),e.GoogleChartComponent=o([t.Component({selector:"google-chart",template:"<div></div>"}),n("design:paramtypes",[t.ElementRef,e.GoogleChartsLoaderService])],e.GoogleChartComponent),e.GoogleChartsDashboardComponent=function(){function e(e,t){this.el=e,this.loaderService=t,this.el=e,this.loaderService=t}return e.prototype.ngOnInit=function(){var e=this;this.data.component=this,this.init().then((function(){e.dataTable||(e.dataTable=new l(e.data),e.dataTable.dataTableChanged.subscribe((function(t){e._draw()}))),e.draw()}))},e.prototype.init=function(){return i(this,void 0,void 0,(function(){var e,t,o,r,n,i,l,c,u,p,h,d,g,v,m,f,y,C,b,w;return a(this,(function(a){switch(a.label){case 0:return[4,this.loaderService.load({packages:["controls"]})];case 1:a.sent(),this.dashboard=new google.visualization.Dashboard(this.el.nativeElement.querySelector("div")),a.label=2;case 2:a.trys.push([2,21,22,23]),e=s(this.data.bind),t=e.next(),a.label=3;case 3:if(t.done)return[3,20];o=t.value,r=o[0],n=o[1],r instanceof Array||(r=[r]),n instanceof Array||(n=[n]),a.label=4;case 4:a.trys.push([4,9,10,11]),y=void 0,i=s(r),l=i.next(),a.label=5;case 5:return l.done?[3,8]:[4,(h=l.value).component.ensureInit()];case 6:a.sent(),a.label=7;case 7:return l=i.next(),[3,5];case 8:return[3,11];case 9:return c=a.sent(),y={error:c},[3,11];case 10:try{l&&!l.done&&(C=i.return)&&C.call(i)}finally{if(y)throw y.error}return[7];case 11:a.trys.push([11,16,17,18]),b=void 0,u=s(n),p=u.next(),a.label=12;case 12:return p.done?[3,15]:[4,(h=p.value).component.init()];case 13:if(a.sent(),void 0!==(d=h.component.data).dataTable||void 0!==d.dataSourceUrl)throw Error("dataTable and dataSourceUrl cannot be specified when chart is drawn in a Dashboard");a.label=14;case 14:return p=u.next(),[3,12];case 15:return[3,18];case 16:return g=a.sent(),b={error:g},[3,18];case 17:try{p&&!p.done&&(w=u.return)&&w.call(u)}finally{if(b)throw b.error}return[7];case 18:this.dashboard.bind(r.map((function(e){return e.component.wrapper})),n.map((function(e){return e.component.wrapper}))),a.label=19;case 19:return t=e.next(),[3,3];case 20:return[3,23];case 21:return v=a.sent(),m={error:v},[3,23];case 22:try{t&&!t.done&&(f=e.return)&&f.call(e)}finally{if(m)throw m.error}return[7];case 23:return[2]}}))}))},e.prototype.draw=function(e){this.dataTable.init(e)},e.prototype._draw=function(){this.dashboard.draw(this.dataTable.getDataTable())},e}(),o([t.Input(),n("design:type",Object)],e.GoogleChartsDashboardComponent.prototype,"data",void 0),e.GoogleChartsDashboardComponent=o([t.Component({selector:"google-charts-dashboard",template:"<div></div>"}),n("design:paramtypes",[t.ElementRef,e.GoogleChartsLoaderService])],e.GoogleChartsDashboardComponent),e.GoogleChartsControlComponent=function(){function e(e,t){this.el=e,this.loaderService=t,this.el=e,this.loaderService=t}return e.prototype.ngOnInit=function(){this.data.component=this},e.prototype.ensureInit=function(){return i(this,void 0,void 0,(function(){var e;return a(this,(function(t){switch(t.label){case 0:return this.wrapper?[2]:[4,this.loaderService.load({packages:["controls"]})];case 1:return t.sent(),(e=Object.create(this.data)).containerId=this.el.nativeElement.querySelector("div"),this.wrapper=new google.visualization.ControlWrapper(e),[2]}}))}))},e}(),o([t.Input(),n("design:type",Object)],e.GoogleChartsControlComponent.prototype,"data",void 0),e.GoogleChartsControlComponent=o([t.Component({selector:"google-charts-control",template:"<div></div>"}),n("design:paramtypes",[t.ElementRef,e.GoogleChartsLoaderService])],e.GoogleChartsControlComponent),e.Ng2GoogleChartsModule=function(){},e.Ng2GoogleChartsModule=o([t.NgModule({declarations:[e.GoogleChartComponent,e.GoogleChartsDashboardComponent,e.GoogleChartsControlComponent],providers:[e.GoogleChartsLoaderService],exports:[e.GoogleChartComponent,e.GoogleChartsDashboardComponent,e.GoogleChartsControlComponent]})],e.Ng2GoogleChartsModule),e.GoogleChartEditor=function(){function e(e){this.loaderService=e}return e.prototype.createEditor=function(){return i(this,void 0,void 0,(function(){var e=this;return a(this,(function(t){switch(t.label){case 0:return void 0!==this.chartEditor?[2]:[4,this.loaderService.load({packages:["charteditor"]})];case 1:return t.sent(),this.chartEditor=new google.visualization.ChartEditor,google.visualization.events.addListener(this.chartEditor,"ok",(function(){var t=e.chartEditor.getChartWrapper();e.comp.wrapper=t,e.comp.data.chartType=t.getChartType(),(void 0!==e.comp.data.options||Object.isExtensible(e.comp.data))&&(e.comp.data.options=t.getOptions()),e.comp.wrapper.draw()})),[2]}}))}))},e.prototype.openDialog=function(e,t){return i(this,void 0,void 0,(function(){var o=this;return a(this,(function(r){switch(r.label){case 0:return[4,this.createEditor()];case 1:return r.sent(),[2,new Promise((function(r,n){o.comp=function(e){return void 0!==e.wrapper}(e)?e:e.component,o.chartEditor.openDialog(o.comp.wrapper,t),google.visualization.events.addListener(o.chartEditor,"ok",(function(){r(o.comp.wrapper)})),google.visualization.events.addListener(o.chartEditor,"cancel",(function(){n()}))}))]}}))}))},e}(),e.GoogleChartEditor.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.GoogleChartEditor(t.ɵɵinject(e.GoogleChartsLoaderService))},token:e.GoogleChartEditor,providedIn:"root"}),e.GoogleChartEditor=o([t.Injectable({providedIn:"root"}),n("design:paramtypes",[e.GoogleChartsLoaderService])],e.GoogleChartEditor),e.ChartHTMLTooltip=c,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ng2-google-charts.umd.min.js.map |
@@ -0,1 +1,7 @@ | ||
<a name="v6.1.0"></a> | ||
# Version 6.1.0 | ||
* add `GoogleChartEditor` | ||
<a name="v6.0.1"></a> | ||
@@ -2,0 +8,0 @@ |
@@ -1,1 +0,1 @@ | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ29vZ2xlLWNoYXJ0cy1pbnRlcmZhY2VzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vcHJvamVjdHMvbmcyLWdvb2dsZS1jaGFydHMvc3JjL2xpYi9nb29nbGUtY2hhcnRzLWludGVyZmFjZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCBpbnRlcmZhY2UgR29vZ2xlQ2hhcnRzU2V0dGluZ3Mge1xuICAvKiogKHY0NSkgQW4gQVBJIGtleSB0aGF0IHlvdSBtYXkgdXNlIHdpdGggR2VvY2hhcnQgYW5kIE1hcCBDaGFydCAqL1xuICBtYXBzQXBpS2V5Pzogc3RyaW5nO1xuXG4gIGdvb2dsZUNoYXJ0c1ZlcnNpb24/OiBzdHJpbmc7XG5cbiAgLyoqIGxhbmd1YWdlIGNvZGUgb3IgbG9jYWxlIChlLmcuICdpdCcsICdlbl9VUycpICovXG4gIGxhbmd1YWdlPzogc3RyaW5nO1xuXG4gIC8qKlxuICAgKiAodjQ3KSBXaGVuIHNldCB0byB0cnVlLCBhb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gc2V0T3B0aW9uKGtleTogc3RyaW5nLCB2YWx1ZTogYW55KTogdm9pZDtcbiAgc2V0T3B0aW9ucyhvcHQ6IGFueSk6IHZvaWQ7XG4gIHNldFZpZXcodmlldzogYW55KTogdm9pZDtcbn1cbiJdfQ== |
@@ -10,2 +10,3 @@ /* | ||
export * from './lib/google-charts-loader.service'; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL25nMi1nb29nbGUtY2hhcnRzL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYywyQ0FBMkMsQ0FBQztBQUMxRCxjQUFjLGlFQUFpRSxDQUFDO0FBQ2hGLGNBQWMsNkRBQTZELENBQUM7QUFLNUUsY0FBYyx1Q0FBdUMsQ0FBQztBQUt0RCxjQUFjLGdDQUFnQyxDQUFDO0FBQy9DLGNBQWMsb0NBQW9DLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKlxuICogUHVibGljIEFQSSBTdXJmYWNlIG9mIG5nMi1nb29nbGUtY2hhcnRzXG4gKi9cblxuZXhwb3J0ICogZnJvbSAnLi9saWIvZ29vZ2xlLWNoYXJ0L2dvb2dsZS1jaGFydC5jb21wb25lbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvZ29vZ2xlLWNoYXJ0cy1kYXNoYm9hcmQvZ29vZ2xlLWNoYXJ0cy1kYXNoYm9hcmQuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2dvb2dsZS1jaGFydHMtY29udHJvbC9nb29nbGUtY2hhcnRzLWNvbnRyb2wuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2dvb2dsZS1jaGFydHMtaW50ZXJmYWNlcyc7XG5leHBv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aGFydC9jaGFydC1tb3VzZS1ldmVudCc7XG5leHBvcnQgKiBmcm9tICcuL2xpYi9nb29nbGUtY2hhcnQvY2hhcnQtbW91c2UtZXZlbnQnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbmcyLWdvb2dsZS1jaGFydHMubW9kdWxlJztcbmV4cG9ydCAqIGZyb20gJy4vbGliL2dvb2dsZS1jaGFydHMtbG9hZGVyLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvZ29vZ2xlLWNoYXJ0LWVkaXRvcic7XG4iXX0= |
@@ -701,2 +701,51 @@ import { __awaiter, __decorate, __param, __metadata } from 'tslib'; | ||
function isComponent(chart) { | ||
return chart.wrapper !== undefined; | ||
} | ||
let GoogleChartEditor = class GoogleChartEditor { | ||
constructor(loaderService) { | ||
this.loaderService = loaderService; | ||
} | ||
createEditor() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (this.chartEditor !== undefined) { | ||
return; | ||
} | ||
yield this.loaderService.load({ packages: ['charteditor'] }); | ||
this.chartEditor = new google.visualization.ChartEditor(); | ||
google.visualization.events.addListener(this.chartEditor, 'ok', () => { | ||
const wrapper = this.chartEditor.getChartWrapper(); | ||
this.comp.wrapper = wrapper; | ||
this.comp.data.chartType = wrapper.getChartType(); | ||
if (this.comp.data.options !== undefined || Object.isExtensible(this.comp.data)) { | ||
this.comp.data.options = wrapper.getOptions(); | ||
} | ||
this.comp.wrapper.draw(); | ||
}); | ||
}); | ||
} | ||
openDialog(chart, options) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
yield this.createEditor(); | ||
return new Promise((resolve, reject) => { | ||
this.comp = isComponent(chart) ? chart : chart.component; | ||
this.chartEditor.openDialog(this.comp.wrapper, options); | ||
google.visualization.events.addListener(this.chartEditor, 'ok', () => { | ||
resolve(this.comp.wrapper); | ||
}); | ||
google.visualization.events.addListener(this.chartEditor, 'cancel', () => { | ||
reject(); | ||
}); | ||
}); | ||
}); | ||
} | ||
}; | ||
GoogleChartEditor.ɵprov = ɵɵdefineInjectable({ factory: function GoogleChartEditor_Factory() { return new GoogleChartEditor(ɵɵinject(GoogleChartsLoaderService)); }, token: GoogleChartEditor, providedIn: "root" }); | ||
GoogleChartEditor = __decorate([ | ||
Injectable({ | ||
providedIn: 'root' | ||
}), | ||
__metadata("design:paramtypes", [GoogleChartsLoaderService]) | ||
], GoogleChartEditor); | ||
/* | ||
@@ -710,3 +759,3 @@ * Public API Surface of ng2-google-charts | ||
export { ChartHTMLTooltip, GoogleChartComponent, GoogleChartsControlComponent, GoogleChartsDashboardComponent, GoogleChartsLoaderService, Ng2GoogleChartsModule }; | ||
export { ChartHTMLTooltip, GoogleChartComponent, GoogleChartEditor, GoogleChartsControlComponent, GoogleChartsDashboardComponent, GoogleChartsLoaderService, Ng2GoogleChartsModule }; | ||
//# sourceMappingURL=ng2-google-charts.js.map |
@@ -15,1 +15,27 @@ export interface GoogleChartsSettings { | ||
} | ||
export interface GoogleChartWrapper { | ||
draw(containerRef?: any): void; | ||
toJSON(): string; | ||
clone(): GoogleChartWrapper; | ||
getDataSourceUrl(): string; | ||
getDataTable(): any; | ||
getChartType(): string; | ||
getChartName(): string; | ||
getChart(): any; | ||
getContainerId(): string; | ||
getQuery(): string; | ||
getRefreshInterval(): string; | ||
getOption(key: string, defaultVal?: any): any; | ||
getOptions(): any; | ||
getView(): any; | ||
setDataSourceUrl(url: string): void; | ||
setDataTable(dt: any): void; | ||
setChartType(type: string): void; | ||
setChartName(name: string): void; | ||
setContainerId(id: string): void; | ||
setQuery(q: string): void; | ||
setRefreshInterval(interval: number): void; | ||
setOption(key: string, value: any): void; | ||
setOptions(opt: any): void; | ||
setView(view: any): void; | ||
} |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"GoogleChartInterface":{"__symbolic":"interface"},"GoogleChartComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":33,"character":1},"arguments":[{"selector":"google-chart","template":"<div></div>"}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"chartReady":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":41,"character":3}}]}],"chartReadyOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":42,"character":3}}]}],"chartError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":44,"character":3}}]}],"chartErrorOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":45,"character":3}}]}],"chartSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":47,"character":3}}]}],"chartSelectOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":48,"character":3}}]}],"mouseOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":50,"character":3}}]}],"mouseOverOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":51,"character":3}}]}],"mouseOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":53,"character":3}}]}],"mouseOutOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":54,"character":3}}]}],"regionClick":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":56,"character":3}}]}],"regionClickOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":57,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":66,"character":33},{"__symbolic":"reference","name":"GoogleChartsLoaderService"}]}],"ngOnInit":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"recreateWrapper":[{"__symbolic":"method"}],"_draw":[{"__symbolic":"method"}],"getDataTable":[{"__symbolic":"method"}],"draw":[{"__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"}]}},"GoogleChartsDashboardInterface":{"__symbolic":"interface"},"GoogleChartsDashboardComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":24,"character":1},"arguments":[{"selector":"google-charts-dashboard","template":"<div></div>"}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":35,"character":33},{"__symbolic":"reference","name":"GoogleChartsLoaderService"}]}],"ngOnInit":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"draw":[{"__symbolic":"method"}],"_draw":[{"__symbolic":"method"}]}},"GoogleChartsControlInterface":{"__symbolic":"interface"},"GoogleChartsControlComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":19,"character":1},"arguments":[{"selector":"google-charts-control","template":"<div></div>"}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":29,"character":33},{"__symbolic":"reference","name":"GoogleChartsLoaderService"}]}],"ngOnInit":[{"__symbolic":"method"}],"ensureInit":[{"__symbolic":"method"}]}},"GoogleChartsSettings":{"__symbolic":"interface"},"ChartReadyEvent":{"__symbolic":"interface"},"ChartErrorEvent":{"__symbolic":"interface"},"ChartSelectEvent":{"__symbolic":"interface"},"ChartHTMLTooltip":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":7,"character":33}]}],"setPosition":[{"__symbolic":"method"}],"getDOMElement":[{"__symbolic":"method"}]},"statics":{"PIXELS":"px"}},"DataPointPosition":{"__symbolic":"interface"},"BoundingBox":{"__symbolic":"interface"},"ChartMouseEvent":{"__symbolic":"interface"},"ChartMouseOverEvent":{"__symbolic":"interface"},"ChartMouseOutEvent":{"__symbolic":"interface"},"RegionClickEvent":{"__symbolic":"interface"},"Ng2GoogleChartsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"GoogleChartComponent"},{"__symbolic":"reference","name":"GoogleChartsDashboardComponent"},{"__symbolic":"reference","name":"GoogleChartsControlComponent"}],"providers":[{"__symbolic":"reference","name":"GoogleChartsLoaderService"}],"exports":[{"__symbolic":"reference","name":"GoogleChartComponent"},{"__symbolic":"reference","name":"GoogleChartsDashboardComponent"},{"__symbolic":"reference","name":"GoogleChartsControlComponent"}]}]}],"members":{}},"GoogleChartsLoaderService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"LOCALE_ID","line":20,"character":12}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":5},"arguments":["googleChartsSettings"]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":21,"character":37}}]],"parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"GoogleChartsSettings"}]}],"load":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}},"origins":{"GoogleChartInterface":"./lib/google-chart/google-chart.component","GoogleChartComponent":"./lib/google-chart/google-chart.component","GoogleChartsDashboardInterface":"./lib/google-charts-dashboard/google-charts-dashboard.component","GoogleChartsDashboardComponent":"./lib/google-charts-dashboard/google-charts-dashboard.component","GoogleChartsControlInterface":"./lib/google-charts-control/google-charts-control.component","GoogleChartsControlComponent":"./lib/google-charts-control/google-charts-control.component","GoogleChartsSettings":"./lib/google-charts-interfaces","ChartReadyEvent":"./lib/google-chart/chart-ready-event","ChartErrorEvent":"./lib/google-chart/chart-error-event","ChartSelectEvent":"./lib/google-chart/chart-select-event","ChartHTMLTooltip":"./lib/google-chart/chart-html-tooltip","DataPointPosition":"./lib/google-chart/chart-mouse-event","BoundingBox":"./lib/google-chart/chart-mouse-event","ChartMouseEvent":"./lib/google-chart/chart-mouse-event","ChartMouseOverEvent":"./lib/google-chart/chart-mouse-event","ChartMouseOutEvent":"./lib/google-chart/chart-mouse-event","RegionClickEvent":"./lib/google-chart/geochart-events","Ng2GoogleChartsModule":"./lib/ng2-google-charts.module","GoogleChartsLoaderService":"./lib/google-charts-loader.service"},"importAs":"ng2-google-charts"} | ||
{"__symbolic":"module","version":4,"metadata":{"GoogleChartInterface":{"__symbolic":"interface"},"GoogleChartComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":33,"character":1},"arguments":[{"selector":"google-chart","template":"<div></div>"}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":39,"character":3}}]}],"chartReady":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":41,"character":3}}]}],"chartReadyOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":42,"character":3}}]}],"chartError":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":44,"character":3}}]}],"chartErrorOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":45,"character":3}}]}],"chartSelect":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":47,"character":3}}]}],"chartSelectOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":48,"character":3}}]}],"mouseOver":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":50,"character":3}}]}],"mouseOverOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":51,"character":3}}]}],"mouseOut":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":53,"character":3}}]}],"mouseOutOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":54,"character":3}}]}],"regionClick":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":56,"character":3}}]}],"regionClickOneTime":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":57,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":66,"character":33},{"__symbolic":"reference","name":"GoogleChartsLoaderService"}]}],"ngOnInit":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"recreateWrapper":[{"__symbolic":"method"}],"_draw":[{"__symbolic":"method"}],"getDataTable":[{"__symbolic":"method"}],"draw":[{"__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"}]}},"GoogleChartsDashboardInterface":{"__symbolic":"interface"},"GoogleChartsDashboardComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":24,"character":1},"arguments":[{"selector":"google-charts-dashboard","template":"<div></div>"}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":30,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":35,"character":33},{"__symbolic":"reference","name":"GoogleChartsLoaderService"}]}],"ngOnInit":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"draw":[{"__symbolic":"method"}],"_draw":[{"__symbolic":"method"}]}},"GoogleChartsControlInterface":{"__symbolic":"interface"},"GoogleChartsControlComponent":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Component","line":19,"character":1},"arguments":[{"selector":"google-charts-control","template":"<div></div>"}]}],"members":{"data":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":25,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":29,"character":33},{"__symbolic":"reference","name":"GoogleChartsLoaderService"}]}],"ngOnInit":[{"__symbolic":"method"}],"ensureInit":[{"__symbolic":"method"}]}},"GoogleChartsSettings":{"__symbolic":"interface"},"GoogleChartWrapper":{"__symbolic":"interface"},"ChartReadyEvent":{"__symbolic":"interface"},"ChartErrorEvent":{"__symbolic":"interface"},"ChartSelectEvent":{"__symbolic":"interface"},"ChartHTMLTooltip":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"ElementRef","line":7,"character":33}]}],"setPosition":[{"__symbolic":"method"}],"getDOMElement":[{"__symbolic":"method"}]},"statics":{"PIXELS":"px"}},"DataPointPosition":{"__symbolic":"interface"},"BoundingBox":{"__symbolic":"interface"},"ChartMouseEvent":{"__symbolic":"interface"},"ChartMouseOverEvent":{"__symbolic":"interface"},"ChartMouseOutEvent":{"__symbolic":"interface"},"RegionClickEvent":{"__symbolic":"interface"},"Ng2GoogleChartsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":7,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"GoogleChartComponent"},{"__symbolic":"reference","name":"GoogleChartsDashboardComponent"},{"__symbolic":"reference","name":"GoogleChartsControlComponent"}],"providers":[{"__symbolic":"reference","name":"GoogleChartsLoaderService"}],"exports":[{"__symbolic":"reference","name":"GoogleChartComponent"},{"__symbolic":"reference","name":"GoogleChartsDashboardComponent"},{"__symbolic":"reference","name":"GoogleChartsControlComponent"}]}]}],"members":{}},"GoogleChartsLoaderService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":9,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameterDecorators":[[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":20,"character":5},"arguments":[{"__symbolic":"reference","module":"@angular/core","name":"LOCALE_ID","line":20,"character":12}]}],[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Inject","line":21,"character":5},"arguments":["googleChartsSettings"]},{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Optional","line":21,"character":37}}]],"parameters":[{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","name":"GoogleChartsSettings"}]}],"load":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}},"GoogleChartEditorOptions":{"__symbolic":"interface"},"GoogleChartEditor":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":16,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"GoogleChartsLoaderService"}]}],"createEditor":[{"__symbolic":"method"}],"openDialog":[{"__symbolic":"method"}]},"statics":{"ɵprov":{}}}},"origins":{"GoogleChartInterface":"./lib/google-chart/google-chart.component","GoogleChartComponent":"./lib/google-chart/google-chart.component","GoogleChartsDashboardInterface":"./lib/google-charts-dashboard/google-charts-dashboard.component","GoogleChartsDashboardComponent":"./lib/google-charts-dashboard/google-charts-dashboard.component","GoogleChartsControlInterface":"./lib/google-charts-control/google-charts-control.component","GoogleChartsControlComponent":"./lib/google-charts-control/google-charts-control.component","GoogleChartsSettings":"./lib/google-charts-interfaces","GoogleChartWrapper":"./lib/google-charts-interfaces","ChartReadyEvent":"./lib/google-chart/chart-ready-event","ChartErrorEvent":"./lib/google-chart/chart-error-event","ChartSelectEvent":"./lib/google-chart/chart-select-event","ChartHTMLTooltip":"./lib/google-chart/chart-html-tooltip","DataPointPosition":"./lib/google-chart/chart-mouse-event","BoundingBox":"./lib/google-chart/chart-mouse-event","ChartMouseEvent":"./lib/google-chart/chart-mouse-event","ChartMouseOverEvent":"./lib/google-chart/chart-mouse-event","ChartMouseOutEvent":"./lib/google-chart/chart-mouse-event","RegionClickEvent":"./lib/google-chart/geochart-events","Ng2GoogleChartsModule":"./lib/ng2-google-charts.module","GoogleChartsLoaderService":"./lib/google-charts-loader.service","GoogleChartEditorOptions":"./lib/google-chart-editor","GoogleChartEditor":"./lib/google-chart-editor"},"importAs":"ng2-google-charts"} |
{ | ||
"name": "ng2-google-charts", | ||
"version": "6.0.1", | ||
"version": "6.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Google Charts module for Angular 2 and beyond", |
@@ -15,1 +15,2 @@ export * from './lib/google-chart/google-chart.component'; | ||
export * from './lib/google-charts-loader.service'; | ||
export * from './lib/google-chart-editor'; |
# ng2-google-charts | ||
> Google Charts module for Angular 2 and beyond. | ||
> Angular Google Charts module (works with Angular 8, Angular 9). | ||
@@ -8,2 +8,9 @@ [![NPM Version][npm-image]][npm-url] | ||
## Features | ||
* All chart types | ||
* Dashboard and controls | ||
* Chart Editor | ||
* Formatters | ||
* Events | ||
## Sponsoring | ||
@@ -20,2 +27,41 @@ | ||
## Quick start | ||
Import the module in your `app.module.ts`: | ||
```ts | ||
import { Ng2GoogleChartsModule } from 'ng2-google-charts'; | ||
@NgModule({ | ||
... | ||
imports: [ | ||
... | ||
Ng2GoogleChartsModule, | ||
], | ||
providers: [ | ||
}) | ||
export class AppModule { } | ||
``` | ||
In your templates, use the `google-chart` component like this: | ||
```html | ||
<google-chart [data]="pieChart"></google-chart> | ||
``` | ||
and in the corresponding `.ts` file: | ||
```ts | ||
import { GoogleChartInterface } from 'ng2-google-charts'; | ||
public pieChart: GoogleChartInterface = { | ||
chartType: 'PieChart', | ||
dataTable: [ | ||
['Task', 'Hours per Day'], | ||
['Work', 11], | ||
['Eat', 2], | ||
['Commute', 2], | ||
['Watch TV', 2], | ||
['Sleep', 7] | ||
], | ||
//firstRowIsData: true, | ||
options: {'title': 'Tasks'}, | ||
}; | ||
``` | ||
## Usage & Demo | ||
@@ -32,4 +78,4 @@ Check out the [reference documentation][reference] and the [live demo][example-page]. | ||
[npm-downloads-url]: https://npmjs.org/package/ng2-google-charts | ||
[reference]: https://www.devrandom.it/software/ng2-google-charts/ | ||
[reference]: https://www.devrandom.it/software/ng2-google-charts/additional-documentation/usage.html | ||
[example-page]: https://www.devrandom.it/software/ng2-google-charts/demo | ||
[donate-url]: https://github.com/gmazzamuto/ng2-google-charts?sponsor=1 |
Sorry, the diff of this file is not supported yet
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
435199
43
3145
79