UNPKG

@lxlib/chart

Version:

This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.1.

16 lines (14 loc) 5.47 kB
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@antv/g2"),require("@lxlib/util"),require("@angular/common")):"function"==typeof define&&define.amd?define("@lxlib/chart/mini-area",["exports","@angular/core","@antv/g2","@lxlib/util","@angular/common"],e):e(((t=t||self).lxlib=t.lxlib||{},t.lxlib.chart=t.lxlib.chart||{},t.lxlib.chart["mini-area"]={}),t.ng.core,t.g2,t.lxlib.util,t.ng.common)}(this,(function(t,e,o,n,i){"use strict"; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */function r(t,e,o,n){var i,r=arguments.length,a=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,o):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,o,n);else for(var p=t.length-1;p>=0;p--)(i=t[p])&&(a=(r<3?i(a):r>3?i(e,o,a):i(e,o))||a);return r>3&&a&&Object.defineProperty(e,o,a),a}function a(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function p(t,e){var o="function"==typeof Symbol&&t[Symbol.iterator];if(!o)return t;var n,i,r=o.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(n=r.next()).done;)a.push(n.value)}catch(t){i={error:t}}finally{try{n&&!n.done&&(o=r.return)&&o.call(r)}finally{if(i)throw i.error}}return a}function l(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(p(arguments[e]));return t}var u=function(){function t(t,e){this.el=t,this.ngZone=e,this.delay=0,this.color="rgba(24, 144, 255, 0.2)",this.borderColor="#1890FF",this.borderWidth=2,this.height=56,this.fit=!0,this.line=!1,this.animate=!0,this.padding=[8,8,8,8],this.data=[],this.yTooltipSuffix="",this.tooltipType="default"}return t.prototype.install=function(){var t=this,e=t.el,n=t.fit,i=t.height,r=t.padding,a=t.xAxis,p=t.yAxis,l=t.yTooltipSuffix,u=t.tooltipType,s=t.line,c=this.chart=new o.Chart({container:e.nativeElement,autoFit:n,height:i,padding:r});a||p||c.axis(!1),a?c.axis("x",a):c.axis("x",!1),p?c.axis("y",p):c.axis("y",!1),c.legend(!1);var h={showTitle:!1,showMarkers:!0,enterable:!0,domStyles:{"g2-tooltip":{padding:"0px"},"g2-tooltip-title":{display:"none"},"g2-tooltip-list-item":{margin:"4px"}}};"mini"===u&&(h.position="top",h.domStyles["g2-tooltip"]={padding:"0px",backgroundColor:"transparent",boxShadow:"none"},h.itemTpl="<li>{value}</li>",h.offset=0),c.tooltip(h),c.area().position("x*y").tooltip("x*y",(function(t,e){return{name:t,value:e+l}})).shape("smooth"),s&&c.line().position("x*y").shape("smooth").tooltip(!1),c.render(),this.attachChart()},t.prototype.attachChart=function(){var t=this,e=t.chart,o=t.line,n=t.fit,i=t.height,r=t.animate,a=t.padding,p=t.data,l=t.color,u=t.borderColor,s=t.borderWidth;if(e&&p&&!(p.length<=0)){var c=e.geometries;c.forEach((function(t){return t.color(l)})),o&&c[1].color(u).size(s),e.autoFit=n,e.height=i,e.animate(r),e.padding=a,e.changeData(p)}},t.prototype.ngOnInit=function(){var t=this;this.ngZone.runOutsideAngular((function(){return setTimeout((function(){return t.install()}),t.delay)}))},t.prototype.ngOnChanges=function(){var t=this;this.ngZone.runOutsideAngular((function(){return t.attachChart()}))},t.prototype.ngOnDestroy=function(){var t=this;this.chart&&this.ngZone.runOutsideAngular((function(){return t.chart.destroy()}))},t.decorators=[{type:e.Component,args:[{selector:"g2-mini-area",exportAs:"g2MiniArea",template:"",host:{"[style.height.px]":"height"},preserveWhitespaces:!1,changeDetection:e.ChangeDetectionStrategy.OnPush,encapsulation:e.ViewEncapsulation.None}]}],t.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone}]},t.propDecorators={delay:[{type:e.Input}],color:[{type:e.Input}],borderColor:[{type:e.Input}],borderWidth:[{type:e.Input}],height:[{type:e.Input}],fit:[{type:e.Input}],line:[{type:e.Input}],animate:[{type:e.Input}],xAxis:[{type:e.Input}],yAxis:[{type:e.Input}],padding:[{type:e.Input}],data:[{type:e.Input}],yTooltipSuffix:[{type:e.Input}],tooltipType:[{type:e.Input}]},r([n.InputNumber(),a("design:type",Object)],t.prototype,"delay",void 0),r([n.InputNumber(),a("design:type",Object)],t.prototype,"borderWidth",void 0),r([n.InputNumber(),a("design:type",Object)],t.prototype,"height",void 0),r([n.InputBoolean(),a("design:type",Object)],t.prototype,"fit",void 0),r([n.InputBoolean(),a("design:type",Object)],t.prototype,"line",void 0),r([n.InputBoolean(),a("design:type",Object)],t.prototype,"animate",void 0),t}();var s=[u],c=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[i.CommonModule,n.LxlibUtilModule],declarations:l(s),exports:l(s)}]}],t}();t.G2MiniAreaComponent=u,t.G2MiniAreaModule=c,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=mini-area.umd.min.js.map