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) 4.78 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-bar",["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-bar"]={}),t.ng.core,t.g2,t.lxlib.util,t.ng.common)}(this,(function(t,e,n,o,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,n,o){var i,r=arguments.length,a=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,n):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,o);else for(var l=t.length-1;l>=0;l--)(i=t[l])&&(a=(r<3?i(a):r>3?i(e,n,a):i(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a}function a(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function l(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var o,i,r=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(o=r.next()).done;)a.push(o.value)}catch(t){i={error:t}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return a}function p(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(l(arguments[e]));return t}var u=function(){function t(t,e){this.el=t,this.ngZone=e,this.delay=0,this.color="#1890FF",this.height=0,this.borderWidth=5,this.padding=[8,8,8,8],this.data=[],this.yTooltipSuffix="",this.tooltipType="default"}return t.prototype.install=function(){var t=this,e=t.el,o=t.height,i=t.padding,r=t.yTooltipSuffix,a=t.tooltipType,l=this.chart=new n.Chart({container:e.nativeElement,autoFit:!0,height:o,padding:i});l.scale({x:{type:"cat"},y:{min:0}}),l.legend(!1),l.axis(!1);var p={showTitle:!1,showMarkers:!0,showCrosshairs:!1,enterable:!0,domStyles:{"g2-tooltip":{padding:"0px"},"g2-tooltip-title":{display:"none"},"g2-tooltip-list-item":{margin:"4px"}}};"mini"===a&&(p.position="top",p.domStyles["g2-tooltip"]={padding:"0px",backgroundColor:"transparent",boxShadow:"none"},p.itemTpl="<li>{value}</li>",p.offset=0),l.tooltip(p),l.interval().position("x*y").tooltip("x*y",(function(t,e){return{name:t,value:e+r}})),l.render(),this.attachChart()},t.prototype.attachChart=function(){var t=this,e=t.chart,n=t.height,o=t.padding,i=t.data,r=t.color,a=t.borderWidth;!e||!i||i.length<=0||(e.geometries[0].size(a).color(r),e.height=n,e.padding=o,e.changeData(i))},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-bar",exportAs:"g2MiniBar",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}],height:[{type:e.Input}],borderWidth:[{type:e.Input}],padding:[{type:e.Input}],data:[{type:e.Input}],yTooltipSuffix:[{type:e.Input}],tooltipType:[{type:e.Input}]},r([o.InputNumber(),a("design:type",Object)],t.prototype,"delay",void 0),r([o.InputNumber(),a("design:type",Object)],t.prototype,"height",void 0),r([o.InputNumber(),a("design:type",Object)],t.prototype,"borderWidth",void 0),t}();var c=[u],s=function(){function t(){}return t.decorators=[{type:e.NgModule,args:[{imports:[i.CommonModule,o.LxlibUtilModule],declarations:p(c),exports:p(c)}]}],t}();t.G2MiniBarComponent=u,t.G2MiniBarModule=s,Object.defineProperty(t,"__esModule",{value:!0})})); //# sourceMappingURL=mini-bar.umd.min.js.map