@lowcodeunit/lcu-charts-common
Version:
A Charting and Graphing Library based on and influenced by Ngx-charts
15 lines (13 loc) • 317 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/common"),require("@angular/animations"),require("@angular/cdk/portal"),require("rxjs"),require("rxjs/operators"),require("d3-selection"),require("d3-brush"),require("d3-scale"),require("@angular/platform-browser"),require("d3-shape"),require("d3-array"),require("d3-interpolate"),require("d3-format"),require("@lcu/common"),require("d3-time-format"),require("d3-color")):"function"==typeof define&&define.amd?define("@lowcodeunit/lcu-charts-common",["exports","@angular/core","@angular/common","@angular/animations","@angular/cdk/portal","rxjs","rxjs/operators","d3-selection","d3-brush","d3-scale","@angular/platform-browser","d3-shape","d3-array","d3-interpolate","d3-format","@lcu/common","d3-time-format","d3-color"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).lowcodeunit=t.lowcodeunit||{},t.lowcodeunit["lcu-charts-common"]={}),t.ng.core,t.ng.common,t.ng.animations,t.ng.cdk.portal,t.rxjs,t.rxjs.operators,t.d3Selection,t.d3Brush,t.d3Scale,t.ng.platformBrowser,t.d3Shape,t.d3Array,t.d3Interpolate,t.d3Format,t.common$1,t.d3TimeFormat,t.d3_color)}(this,(function(t,e,i,n,a,r,s,o,l,c,h,p,u,d,g,m,v,y){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var f=function(t,e){return(f=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])})(t,e)};function x(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function i(){this.constructor=t}f(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}Object.create;function b(t){var e="function"==typeof Symbol&&Symbol.iterator,i=e&&t[e],n=0;if(i)return i.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function T(t,e){var i="function"==typeof Symbol&&t[Symbol.iterator];if(!i)return t;var n,a,r=i.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=r.next()).done;)s.push(n.value)}catch(t){a={error:t}}finally{try{n&&!n.done&&(i=r.return)&&i.call(r)}finally{if(a)throw a.error}}return s}function k(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(T(arguments[e]));return t}Object.create;var w,A=function(){function t(t,e,i){this.applicationRef=t,this.componentFactoryResolver=e,this.injector=i}return t.setGlobalRootViewContainer=function(e){t.globalRootViewContainer=e},t.prototype.getRootViewContainer=function(){if(this._container)return this._container;if(t.globalRootViewContainer)return t.globalRootViewContainer;if(this.applicationRef.components.length)return this.applicationRef.components[0];throw new Error("View Container not found! ngUpgrade needs to manually set this via setRootViewContainer or setGlobalRootViewContainer.")},t.prototype.setRootViewContainer=function(t){this._container=t},t.prototype.getComponentRootNode=function(t){return t.element?t.element.nativeElement:t.hostView&&t.hostView.rootNodes.length>0?t.hostView.rootNodes[0]:t.location.nativeElement},t.prototype.getRootViewContainerNode=function(t){return this.getComponentRootNode(t)},t.prototype.projectComponentBindings=function(t,e){var i,n,a,r;if(e){if(void 0!==e.inputs){var s=Object.getOwnPropertyNames(e.inputs);try{for(var o=b(s),l=o.next();!l.done;l=o.next()){var c=l.value;t.instance[c]=e.inputs[c]}}catch(t){i={error:t}}finally{try{l&&!l.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}}if(void 0!==e.outputs){var h=Object.getOwnPropertyNames(e.outputs);try{for(var p=b(h),u=p.next();!u.done;u=p.next()){var d=u.value;t.instance[d]=e.outputs[d]}}catch(t){a={error:t}}finally{try{u&&!u.done&&(r=p.return)&&r.call(p)}finally{if(a)throw a.error}}}}return t},t.prototype.appendComponent=function(t,e,i){void 0===e&&(e={}),i||(i=this.getRootViewContainer());var n=this.getComponentRootNode(i),r=new a.DomPortalHost(n,this.componentFactoryResolver,this.applicationRef,this.injector),s=new a.ComponentPortal(t),o=r.attach(s);return this.projectComponentBindings(o,e),o},t}();function I(t,e,i){var n,a,r;i=i||{};var s=null,o=0;function l(){o=!1===i.leading?0:+new Date,s=null,r=t.apply(n,a)}return function(){var c=+new Date;o||!1!==i.leading||(o=c);var h=e-(c-o);return n=this,a=arguments,h<=0?(clearTimeout(s),s=null,o=c,r=t.apply(n,a)):s||!1===i.trailing||(s=setTimeout(l,h)),r}}function L(t,e){return function(i,n,a){return{configurable:!0,enumerable:a.enumerable,get:function(){return Object.defineProperty(this,n,{configurable:!0,enumerable:a.enumerable,value:I(a.value,t,e)}),this[n]}}}}A.globalRootViewContainer=null,A.decorators=[{type:e.Injectable}],A.ctorParameters=function(){return[{type:e.ApplicationRef},{type:e.ComponentFactoryResolver},{type:e.Injector}]},function(t){t[t.top="top"]="top",t[t.bottom="bottom"]="bottom",t[t.left="left"]="left",t[t.right="right"]="right"}(w||(w={}));function S(t,e,i){return"top"===i?t.top-7:"bottom"===i?t.top+t.height-e.height+7:"center"===i?t.top+t.height/2-e.height/2:void 0}function D(t,e,i){return"left"===i?t.left-7:"right"===i?t.left+t.width-e.width+7:"center"===i?t.left+t.width/2-e.width/2:void 0}var C=function(){function t(){}return t.calculateVerticalAlignment=function(t,e,i){var n=S(t,e,i);return n+e.height>window.innerHeight&&(n=window.innerHeight-e.height),n},t.calculateVerticalCaret=function(t,e,i,n){var a;"top"===n&&(a=t.height/2-i.height/2+7),"bottom"===n&&(a=e.height-t.height/2-i.height/2-7),"center"===n&&(a=e.height/2-i.height/2);var r=S(t,e,n);return r+e.height>window.innerHeight&&(a+=r+e.height-window.innerHeight),a},t.calculateHorizontalAlignment=function(t,e,i){var n=D(t,e,i);return n+e.width>window.innerWidth&&(n=window.innerWidth-e.width),n},t.calculateHorizontalCaret=function(t,e,i,n){var a;"left"===n&&(a=t.width/2-i.width/2+7),"right"===n&&(a=e.width-t.width/2-i.width/2-7),"center"===n&&(a=e.width/2-i.width/2);var r=D(t,e,n);return r+e.width>window.innerWidth&&(a+=r+e.width-window.innerWidth),a},t.shouldFlip=function(t,e,i,n){var a=!1;return"right"===i&&t.left+t.width+e.width+n>window.innerWidth&&(a=!0),"left"===i&&t.left-e.width-n<0&&(a=!0),"top"===i&&t.top-e.height-n<0&&(a=!0),"bottom"===i&&t.top+t.height+e.height+n>window.innerHeight&&(a=!0),a},t.positionCaret=function(e,i,n,a,r){var s=0,o=0;return e===w.right?(o=-7,s=t.calculateVerticalCaret(n,i,a,r)):e===w.left?(o=i.width,s=t.calculateVerticalCaret(n,i,a,r)):e===w.top?(s=i.height,o=t.calculateHorizontalCaret(n,i,a,r)):e===w.bottom&&(s=-7,o=t.calculateHorizontalCaret(n,i,a,r)),{top:s,left:o}},t.positionContent=function(e,i,n,a,r){var s=0,o=0;return e===w.right?(o=n.left+n.width+a,s=t.calculateVerticalAlignment(n,i,r)):e===w.left?(o=n.left-i.width-a,s=t.calculateVerticalAlignment(n,i,r)):e===w.top?(s=n.top-i.height-a,o=t.calculateHorizontalAlignment(n,i,r)):e===w.bottom&&(s=n.top+n.height+a,o=t.calculateHorizontalAlignment(n,i,r)),{top:s,left:o}},t.determinePlacement=function(e,i,n,a){if(t.shouldFlip(n,i,e,a)){if(e===w.right)return w.left;if(e===w.left)return w.right;if(e===w.top)return w.bottom;if(e===w.bottom)return w.top}return e},t}(),E=function(){function t(t,e){this.element=t,this.renderer=e}return Object.defineProperty(t.prototype,"cssClasses",{get:function(){var t="lcu-charts-tooltip-content";return t+=" position-"+this.placement,t+=" type-"+this.type,t+=" "+this.cssClass},enumerable:!1,configurable:!0}),t.prototype.ngAfterViewInit=function(){setTimeout(this.position.bind(this))},t.prototype.position=function(){var t=this,e=this.element.nativeElement,i=this.host.nativeElement.getBoundingClientRect();if(i.height||i.width){var n=e.getBoundingClientRect();this.checkFlip(i,n),this.positionContent(e,i,n),this.showCaret&&this.positionCaret(i,n),setTimeout((function(){return t.renderer.addClass(e,"animate")}),1)}},t.prototype.positionContent=function(t,e,i){var n=C.positionContent(this.placement,i,e,this.spacing,this.alignment),a=n.top,r=n.left;this.renderer.setStyle(t,"top",a+"px"),this.renderer.setStyle(t,"left",r+"px")},t.prototype.positionCaret=function(t,e){var i=this.caretElm.nativeElement,n=i.getBoundingClientRect(),a=C.positionCaret(this.placement,e,t,n,this.alignment),r=a.top,s=a.left;this.renderer.setStyle(i,"top",r+"px"),this.renderer.setStyle(i,"left",s+"px")},t.prototype.checkFlip=function(t,e){this.placement=C.determinePlacement(this.placement,e,t,this.spacing)},t.prototype.onWindowResize=function(){this.position()},t}();E.decorators=[{type:e.Component,args:[{selector:"lcu-tooltip-content",template:'\n <div>\n <span #caretElm [hidden]="!showCaret" class="tooltip-caret position-{{ this.placement }}"> </span>\n <div class="tooltip-content">\n <span *ngIf="!title">\n <ng-template [ngTemplateOutlet]="template" [ngTemplateOutletContext]="{ model: context }"> </ng-template>\n </span>\n <span *ngIf="title" [innerHTML]="title"> </span>\n </div>\n </div>\n ',encapsulation:e.ViewEncapsulation.None,styles:[".lcu-charts-tooltip-content{position:fixed;border-radius:3px;z-index:5000;display:block;font-weight:400;opacity:0;pointer-events:none!important}.lcu-charts-tooltip-content.type-popover{background:#fff;color:#060709;border:1px solid #72809b;box-shadow:0 1px 3px 0 rgba(0,0,0,.2),0 1px 1px 0 rgba(0,0,0,.14),0 2px 1px -1px rgba(0,0,0,.12);font-size:13px;padding:4px}.lcu-charts-tooltip-content.type-popover .tooltip-caret{position:absolute;z-index:5001;width:0;height:0}.lcu-charts-tooltip-content.type-popover .tooltip-caret.position-left{border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:7px solid #fff}.lcu-charts-tooltip-content.type-popover .tooltip-caret.position-top{border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid #fff}.lcu-charts-tooltip-content.type-popover .tooltip-caret.position-right{border-top:7px solid transparent;border-bottom:7px solid transparent;border-right:7px solid #fff}.lcu-charts-tooltip-content.type-popover .tooltip-caret.position-bottom{border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid #fff}.lcu-charts-tooltip-content.type-tooltip{color:#fff;background:rgba(0,0,0,.75);font-size:12px;padding:0 10px;text-align:center;pointer-events:auto}.lcu-charts-tooltip-content.type-tooltip .tooltip-caret.position-left{border-top:7px solid transparent;border-bottom:7px solid transparent;border-left:7px solid rgba(0,0,0,.75)}.lcu-charts-tooltip-content.type-tooltip .tooltip-caret.position-top{border-left:7px solid transparent;border-right:7px solid transparent;border-top:7px solid rgba(0,0,0,.75)}.lcu-charts-tooltip-content.type-tooltip .tooltip-caret.position-right{border-top:7px solid transparent;border-bottom:7px solid transparent;border-right:7px solid rgba(0,0,0,.75)}.lcu-charts-tooltip-content.type-tooltip .tooltip-caret.position-bottom{border-left:7px solid transparent;border-right:7px solid transparent;border-bottom:7px solid rgba(0,0,0,.75)}.lcu-charts-tooltip-content .tooltip-label{display:block;line-height:1em;padding:8px 5px 5px;font-size:1em}.lcu-charts-tooltip-content .tooltip-val{display:block;font-size:1.3em;line-height:1em;padding:0 5px 8px}.lcu-charts-tooltip-content .tooltip-caret{position:absolute;z-index:5001;width:0;height:0}.lcu-charts-tooltip-content.position-right{transform:translate3d(10px,0,0)}.lcu-charts-tooltip-content.position-left{transform:translate3d(-10px,0,0)}.lcu-charts-tooltip-content.position-top{transform:translate3d(0,-10px,0)}.lcu-charts-tooltip-content.position-bottom{transform:translate3d(0,10px,0)}.lcu-charts-tooltip-content.animate{opacity:1;transition:opacity .3s,transform .3s;transform:translateZ(0);pointer-events:auto}.area-tooltip-container{padding:5px 0;pointer-events:none}.tooltip-item{text-align:left;line-height:1.2em;padding:5px 0}.tooltip-item .tooltip-item-color{display:inline-block;height:12px;width:12px;margin-right:5px;color:#5b646b;border-radius:3px}"]}]}],E.ctorParameters=function(){return[{type:e.ElementRef},{type:e.Renderer2}]},E.propDecorators={host:[{type:e.Input}],showCaret:[{type:e.Input}],type:[{type:e.Input}],placement:[{type:e.Input}],alignment:[{type:e.Input}],spacing:[{type:e.Input}],cssClass:[{type:e.Input}],title:[{type:e.Input}],template:[{type:e.Input}],context:[{type:e.Input}],caretElm:[{type:e.ViewChild,args:["caretElm"]}],cssClasses:[{type:e.HostBinding,args:["class"]}],onWindowResize:[{type:e.HostListener,args:["window:resize"]}]},function(t,e,i,n){var a,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,n);else for(var o=t.length-1;o>=0;o--)(a=t[o])&&(s=(r<3?a(s):r>3?a(e,i,s):a(e,i))||s);r>3&&s&&Object.defineProperty(e,i,s)}([L(100)],E.prototype,"onWindowResize",null);var O=function(){function t(t){this.injectionService=t,this.defaults={},this.components=new Map}return t.prototype.getByType=function(t){return void 0===t&&(t=this.type),this.components.get(t)},t.prototype.create=function(t){return this.createByType(this.type,t)},t.prototype.createByType=function(t,e){e=this.assignDefaults(e);var i=this.injectComponent(t,e);return this.register(t,i),i},t.prototype.destroy=function(t){var e=this.components.get(t.componentType);if(e&&e.length){var i=e.indexOf(t);if(i>-1)e[i].destroy(),e.splice(i,1)}},t.prototype.destroyAll=function(){this.destroyByType(this.type)},t.prototype.destroyByType=function(t){var e=this.components.get(t);if(e&&e.length)for(var i=e.length-1;i>=0;)this.destroy(e[i--])},t.prototype.injectComponent=function(t,e){return this.injectionService.appendComponent(t,e)},t.prototype.assignDefaults=function(t){var e=Object.assign({},this.defaults.inputs),i=Object.assign({},this.defaults.outputs);return t.inputs||t.outputs||(t={inputs:t}),e&&(t.inputs=Object.assign(Object.assign({},e),t.inputs)),i&&(t.outputs=Object.assign(Object.assign({},i),t.outputs)),t},t.prototype.register=function(t,e){this.components.has(t)||this.components.set(t,[]),this.components.get(t).push(e)},t}(),M=function(t){function e(e){var i=t.call(this,e)||this;return i.type=E,i}return x(e,t),e}(O);M.decorators=[{type:e.Injectable}],M.ctorParameters=function(){return[{type:A}]};var F=function(){function t(){this.showLegend=!1,this.animations=!0,this.legendLabelClick=new e.EventEmitter,this.legendLabelActivate=new e.EventEmitter,this.legendLabelDeactivate=new e.EventEmitter}return t.prototype.ngOnChanges=function(t){this.update()},t.prototype.update=function(){var t=0;this.showLegend&&(this.legendType=this.getLegendType(),this.legendOptions&&"right"!==this.legendOptions.position||(t="scaleLegend"===this.legendType?1:2));var e=12-t;this.chartWidth=Math.floor(this.view[0]*e/12),this.legendWidth=this.legendOptions&&"right"!==this.legendOptions.position?this.chartWidth:Math.floor(this.view[0]*t/12)},t.prototype.getLegendType=function(){return"linear"===this.legendOptions.scaleType?"scaleLegend":"legend"},t}();F.decorators=[{type:e.Component,args:[{providers:[M],selector:"lcu-charts-chart",template:'\n <div class="lcu-charts-outer" [style.width.px]="view[0]" [@animationState]="\'active\'" [@.disabled]="!animations">\n <svg class="lcu-charts" [attr.width]="chartWidth" [attr.height]="view[1]">\n <ng-content></ng-content>\n </svg>\n <lcu-charts-scale-legend\n *ngIf="showLegend && legendType === \'scaleLegend\'"\n class="chart-legend"\n [horizontal]="legendOptions && legendOptions.position === \'below\'"\n [valueRange]="legendOptions.domain"\n [colors]="legendOptions.colors"\n [height]="view[1]"\n [width]="legendWidth"\n >\n </lcu-charts-scale-legend>\n <lcu-charts-legend\n *ngIf="showLegend && legendType === \'legend\'"\n class="chart-legend"\n [horizontal]="legendOptions && legendOptions.position === \'below\'"\n [data]="legendOptions.domain"\n [title]="legendOptions.title"\n [colors]="legendOptions.colors"\n [height]="view[1]"\n [width]="legendWidth"\n [activeEntries]="activeEntries"\n (labelClick)="legendLabelClick.emit($event)"\n (labelActivate)="legendLabelActivate.emit($event)"\n (labelDeactivate)="legendLabelDeactivate.emit($event)"\n >\n </lcu-charts-legend>\n </div>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[n.trigger("animationState",[n.transition(":enter",[n.style({opacity:0}),n.animate("500ms 100ms",n.style({opacity:1}))])])]}]}],F.propDecorators={view:[{type:e.Input}],showLegend:[{type:e.Input}],legendOptions:[{type:e.Input}],data:[{type:e.Input}],legendData:[{type:e.Input}],legendType:[{type:e.Input}],colors:[{type:e.Input}],activeEntries:[{type:e.Input}],animations:[{type:e.Input}],legendLabelClick:[{type:e.Output}],legendLabelActivate:[{type:e.Output}],legendLabelDeactivate:[{type:e.Output}]};var P=function(){function t(t,i){this.element=t,this.zone=i,this.visible=new e.EventEmitter,this.isVisible=!1,this.runCheck()}return t.prototype.destroy=function(){clearTimeout(this.timeout)},t.prototype.onVisibilityChange=function(){var t=this;this.zone.run((function(){t.isVisible=!0,t.visible.emit(!0)}))},t.prototype.runCheck=function(){var t=this,e=function(){if(t.element){var i=t.element.nativeElement,n=i.offsetHeight,a=i.offsetWidth;n&&a?(clearTimeout(t.timeout),t.onVisibilityChange()):(clearTimeout(t.timeout),t.zone.runOutsideAngular((function(){t.timeout=setTimeout((function(){return e()}),100)})))}};this.zone.runOutsideAngular((function(){t.timeout=setTimeout((function(){return e()}))}))},t}();P.decorators=[{type:e.Directive,args:[{selector:"lcu-visibility-observer"}]}],P.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone}]},P.propDecorators={visible:[{type:e.Output}]};var X=function(){function t(t,i,n){this.chartElement=t,this.zone=i,this.cd=n,this.scheme="cool",this.schemeType="ordinal",this.animations=!0,this.select=new e.EventEmitter}return t.prototype.ngAfterViewInit=function(){this.bindWindowResizeEvent(),this.visibilityObserver=new P(this.chartElement,this.zone),this.visibilityObserver.visible.subscribe(this.update.bind(this))},t.prototype.ngOnDestroy=function(){this.unbindEvents(),this.visibilityObserver&&(this.visibilityObserver.visible.unsubscribe(),this.visibilityObserver.destroy())},t.prototype.ngOnChanges=function(t){this.update()},t.prototype.update=function(){if(this.results?this.results=this.cloneData(this.results):this.results=[],this.view)this.width=this.view[0],this.height=this.view[1];else{var t=this.getContainerDims();t&&(this.width=t.width,this.height=t.height)}this.width||(this.width=600),this.height||(this.height=400),this.width=Math.floor(this.width),this.height=Math.floor(this.height),this.cd&&this.cd.markForCheck()},t.prototype.getContainerDims=function(){var t,e,i=this.chartElement.nativeElement;if(null!==i.parentNode){var n=i.parentNode.getBoundingClientRect();t=n.width,e=n.height}return t&&e?{width:t,height:e}:null},t.prototype.formatDates=function(){for(var t=0;t<this.results.length;t++){var e=this.results[t];if(e.label=e.name,e.label instanceof Date&&(e.label=e.label.toLocaleDateString()),e.series)for(var i=0;i<e.series.length;i++){var n=e.series[i];n.label=n.name,n.label instanceof Date&&(n.label=n.label.toLocaleDateString())}}},t.prototype.unbindEvents=function(){this.resizeSubscription&&this.resizeSubscription.unsubscribe()},t.prototype.bindWindowResizeEvent=function(){var t=this,e=r.fromEvent(window,"resize").pipe(s.debounceTime(200)).subscribe((function(e){t.update(),t.cd&&t.cd.markForCheck()}));this.resizeSubscription=e},t.prototype.cloneData=function(t){var e,i,n,a,r=[];try{for(var s=b(t),o=s.next();!o.done;o=s.next()){var l=o.value,c={name:l.name};if(void 0!==l.value&&(c.value=l.value),void 0!==l.series){c.series=[];try{for(var h=(n=void 0,b(l.series)),p=h.next();!p.done;p=h.next()){var u=p.value,d=Object.assign({},u);c.series.push(d)}}catch(t){n={error:t}}finally{try{p&&!p.done&&(a=h.return)&&a.call(h)}finally{if(n)throw n.error}}}void 0!==l.extra&&(c.extra=JSON.parse(JSON.stringify(l.extra))),r.push(c)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(i=s.return)&&i.call(s)}finally{if(e)throw e.error}}return r},t}();X.decorators=[{type:e.Component,args:[{selector:"lcu-base-chart",template:"\n <div></div>\n "}]}],X.ctorParameters=function(){return[{type:e.ElementRef},{type:e.NgZone},{type:e.ChangeDetectorRef}]},X.propDecorators={results:[{type:e.Input}],view:[{type:e.Input}],scheme:[{type:e.Input}],schemeType:[{type:e.Input}],customColors:[{type:e.Input}],animations:[{type:e.Input}],select:[{type:e.Output}]};var R=function(){function t(t){this.textHeight=25,this.margin=5,this.element=t.nativeElement}return t.prototype.ngOnChanges=function(t){this.update()},t.prototype.update=function(){switch(this.strokeWidth="0.01",this.textAnchor="middle",this.transform="",this.orient){case"top":case"bottom":this.y=this.offset,this.x=this.width/2;break;case"left":this.y=-(this.offset+this.textHeight+this.margin),this.x=-this.height/2,this.transform="rotate(270)";break;case"right":this.y=this.offset+this.margin,this.x=-this.height/2,this.transform="rotate(270)"}},t}();function Y(t,e){return void 0===e&&(e=16),"string"!=typeof t?"number"==typeof t?t+"":"":(t=t.trim()).length<=e?t:t.slice(0,e)+"..."}function H(t,e){if(t.length>e){for(var i=[],n=Math.floor(t.length/e),a=0;a<t.length;a++)a%n==0&&i.push(t[a]);t=i}return t}R.decorators=[{type:e.Component,args:[{selector:"g[lcu-charts-axis-label]",template:'\n <svg:text\n [attr.stroke-width]="strokeWidth"\n [attr.x]="x"\n [attr.y]="y"\n [attr.text-anchor]="textAnchor"\n [attr.transform]="transform"\n >\n {{ label }}\n </svg:text>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],R.ctorParameters=function(){return[{type:e.ElementRef}]},R.propDecorators={orient:[{type:e.Input}],label:[{type:e.Input}],offset:[{type:e.Input}],width:[{type:e.Input}],height:[{type:e.Input}]};var W=function(){function t(){this.tickArguments=[5],this.tickStroke="#ccc",this.trimTicks=!0,this.maxTickLength=16,this.showGridLines=!1,this.rotateTicks=!0,this.dimensionsChanged=new e.EventEmitter,this.verticalSpacing=20,this.rotateLabels=!1,this.innerTickSize=6,this.outerTickSize=6,this.tickPadding=3,this.textAnchor="middle",this.maxTicksLength=0,this.maxAllowedLength=16,this.height=0}return t.prototype.ngOnChanges=function(t){this.update()},t.prototype.ngAfterViewInit=function(){var t=this;setTimeout((function(){return t.updateDims()}))},t.prototype.updateDims=function(){var t=this,e=parseInt(this.ticksElement.nativeElement.getBoundingClientRect().height,10);e!==this.height&&(this.height=e,this.dimensionsChanged.emit({height:e}),setTimeout((function(){return t.updateDims()})))},t.prototype.update=function(){var t=this,e=this.scale;this.ticks=this.getTicks(),this.tickFormatting?this.tickFormat=this.tickFormatting:e.tickFormat?this.tickFormat=e.tickFormat.apply(e,this.tickArguments):this.tickFormat=function(t){return"Date"===t.constructor.name?t.toLocaleDateString():t.toLocaleString()};var i=this.rotateTicks?this.getRotationAngle(this.ticks):null;this.adjustedScale=this.scale.bandwidth?function(t){return this.scale(t)+.5*this.scale.bandwidth()}:this.scale,this.textTransform="",i&&0!==i?(this.textTransform="rotate("+i+")",this.textAnchor="end",this.verticalSpacing=10):this.textAnchor="middle",setTimeout((function(){return t.updateDims()}))},t.prototype.getRotationAngle=function(t){var e=0;this.maxTicksLength=0;for(var i=0;i<t.length;i++){var n=this.tickFormat(t[i]).toString(),a=n.length;this.trimTicks&&(a=this.tickTrim(n).length),a>this.maxTicksLength&&(this.maxTicksLength=a)}for(var r=8*Math.min(this.maxTicksLength,this.maxAllowedLength),s=r,o=Math.floor(this.width/t.length);s>o&&e>-90;)e-=30,s=Math.cos(e*(Math.PI/180))*r;return e},t.prototype.getTicks=function(){var t=this.getMaxTicks(20),e=this.getMaxTicks(100);return this.tickValues?this.tickValues:this.scale.ticks?this.scale.ticks.apply(this.scale,[e]):H(this.scale.domain(),t)},t.prototype.getMaxTicks=function(t){return Math.floor(this.width/t)},t.prototype.tickTransform=function(t){return"translate("+this.adjustedScale(t)+","+this.verticalSpacing+")"},t.prototype.gridLineTransform=function(){return"translate(0,"+(-this.verticalSpacing-5)+")"},t.prototype.tickTrim=function(t){return this.trimTicks?Y(t,this.maxTickLength):t},t}();W.decorators=[{type:e.Component,args:[{selector:"g[lcu-charts-x-axis-ticks]",template:'\n <svg:g #ticksel>\n <svg:g *ngFor="let tick of ticks" class="tick" [attr.transform]="tickTransform(tick)">\n <title>{{ tickFormat(tick) }}</title>\n <svg:text\n stroke-width="0.01"\n [attr.text-anchor]="textAnchor"\n [attr.transform]="textTransform"\n [style.font-size]="\'12px\'"\n >\n {{ tickTrim(tickFormat(tick)) }}\n </svg:text>\n </svg:g>\n </svg:g>\n\n <svg:g *ngFor="let tick of ticks" [attr.transform]="tickTransform(tick)">\n <svg:g *ngIf="showGridLines" [attr.transform]="gridLineTransform()">\n <svg:line class="gridline-path gridline-path-vertical" [attr.y1]="-gridLineHeight" y2="0" />\n </svg:g>\n </svg:g>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],W.propDecorators={scale:[{type:e.Input}],orient:[{type:e.Input}],tickArguments:[{type:e.Input}],tickValues:[{type:e.Input}],tickStroke:[{type:e.Input}],trimTicks:[{type:e.Input}],maxTickLength:[{type:e.Input}],tickFormatting:[{type:e.Input}],showGridLines:[{type:e.Input}],gridLineHeight:[{type:e.Input}],width:[{type:e.Input}],rotateTicks:[{type:e.Input}],dimensionsChanged:[{type:e.Output}],ticksElement:[{type:e.ViewChild,args:["ticksel"]}]};var V=function(){function t(){this.rotateTicks=!0,this.showGridLines=!1,this.xOrient="bottom",this.xAxisOffset=0,this.dimensionsChanged=new e.EventEmitter,this.xAxisClassName="x axis",this.labelOffset=0,this.fill="none",this.stroke="stroke",this.tickStroke="#ccc",this.strokeWidth="none",this.padding=5}return t.prototype.ngOnChanges=function(t){this.update()},t.prototype.update=function(){this.transform="translate(0,"+(this.xAxisOffset+this.padding+this.dims.height)+")",void 0!==this.xAxisTickCount&&(this.tickArguments=[this.xAxisTickCount])},t.prototype.emitTicksHeight=function(t){var e=this,i=t.height,n=i+25+5;n!==this.labelOffset&&(this.labelOffset=n,setTimeout((function(){e.dimensionsChanged.emit({height:i})}),0))},t}();function B(t,e,i,n,a,r){var s=T(r,4),o=s[0],l=s[1],c=s[2],h=s[3],p="";return p="M"+[t+a,e],p+="h"+((i=0===(i=Math.floor(i))?1:i)-2*a),p+=l?"a"+[a,a]+" 0 0 1 "+[a,a]:"h"+a+"v"+a,p+="v"+((n=0===(n=Math.floor(n))?1:n)-2*a),p+=h?"a"+[a,a]+" 0 0 1 "+[-a,a]:"v"+a+"h"+-a,p+="h"+(2*a-i),p+=c?"a"+[a,a]+" 0 0 1 "+[-a,-a]:"h"+-a+"v"+-a,p+="v"+(2*a-n),p+=o?"a"+[a,a]+" 0 0 1 "+[a,-a]:"v"+-a+"h"+a,p+="z"}V.decorators=[{type:e.Component,args:[{selector:"g[lcu-charts-x-axis]",template:'\n <svg:g [attr.class]="xAxisClassName" [attr.transform]="transform">\n <svg:g\n lcu-charts-x-axis-ticks\n *ngIf="xScale"\n [trimTicks]="trimTicks"\n [rotateTicks]="rotateTicks"\n [maxTickLength]="maxTickLength"\n [tickFormatting]="tickFormatting"\n [tickArguments]="tickArguments"\n [tickStroke]="tickStroke"\n [scale]="xScale"\n [orient]="xOrient"\n [showGridLines]="showGridLines"\n [gridLineHeight]="dims.height"\n [width]="dims.width"\n [tickValues]="ticks"\n (dimensionsChanged)="emitTicksHeight($event)"\n />\n <svg:g\n lcu-charts-axis-label\n *ngIf="showLabel"\n [label]="labelText"\n [offset]="labelOffset"\n [orient]="\'bottom\'"\n [height]="dims.height"\n [width]="dims.width"\n ></svg:g>\n </svg:g>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],V.propDecorators={xScale:[{type:e.Input}],dims:[{type:e.Input}],trimTicks:[{type:e.Input}],rotateTicks:[{type:e.Input}],maxTickLength:[{type:e.Input}],tickFormatting:[{type:e.Input}],showGridLines:[{type:e.Input}],showLabel:[{type:e.Input}],labelText:[{type:e.Input}],ticks:[{type:e.Input}],xAxisTickInterval:[{type:e.Input}],xAxisTickCount:[{type:e.Input}],xOrient:[{type:e.Input}],xAxisOffset:[{type:e.Input}],dimensionsChanged:[{type:e.Output}],ticksComponent:[{type:e.ViewChild,args:[W]}]};var z=function(){function t(){this.tickArguments=[5],this.tickStroke="#ccc",this.trimTicks=!0,this.maxTickLength=16,this.showGridLines=!1,this.showRefLabels=!1,this.showRefLines=!1,this.dimensionsChanged=new e.EventEmitter,this.innerTickSize=6,this.tickPadding=3,this.verticalSpacing=20,this.textAnchor="middle",this.width=0,this.outerTickSize=6,this.rotateLabels=!1,this.referenceLineLength=0}return t.prototype.ngOnChanges=function(t){this.update()},t.prototype.ngAfterViewInit=function(){var t=this;setTimeout((function(){return t.updateDims()}))},t.prototype.updateDims=function(){var t=this,e=parseInt(this.ticksElement.nativeElement.getBoundingClientRect().width,10);e!==this.width&&(this.width=e,this.dimensionsChanged.emit({width:e}),setTimeout((function(){return t.updateDims()})))},t.prototype.update=function(){var t,e=this,i="top"===this.orient||"right"===this.orient?-1:1;switch(this.tickSpacing=Math.max(this.innerTickSize,0)+this.tickPadding,t=this.scale,this.ticks=this.getTicks(),this.tickFormatting?this.tickFormat=this.tickFormatting:t.tickFormat?this.tickFormat=t.tickFormat.apply(t,this.tickArguments):this.tickFormat=function(t){return"Date"===t.constructor.name?t.toLocaleDateString():t.toLocaleString()},this.adjustedScale=t.bandwidth?function(e){return t(e)+.5*t.bandwidth()}:t,this.showRefLines&&this.referenceLines&&this.setReferencelines(),this.orient){case"top":case"bottom":this.transform=function(t){return"translate("+this.adjustedScale(t)+",0)"},this.textAnchor="middle",this.y2=this.innerTickSize*i,this.y1=this.tickSpacing*i,this.dy=i<0?"0em":".71em";break;case"left":this.transform=function(t){return"translate(0,"+this.adjustedScale(t)+")"},this.textAnchor="end",this.x2=this.innerTickSize*-i,this.x1=this.tickSpacing*-i,this.dy=".32em";break;case"right":this.transform=function(t){return"translate(0,"+this.adjustedScale(t)+")"},this.textAnchor="start",this.x2=this.innerTickSize*-i,this.x1=this.tickSpacing*-i,this.dy=".32em"}setTimeout((function(){return e.updateDims()}))},t.prototype.setReferencelines=function(){this.refMin=this.adjustedScale(Math.min.apply(null,this.referenceLines.map((function(t){return t.value})))),this.refMax=this.adjustedScale(Math.max.apply(null,this.referenceLines.map((function(t){return t.value})))),this.referenceLineLength=this.referenceLines.length,this.referenceAreaPath=B(0,this.refMax,this.gridLineWidth,this.refMin-this.refMax,0,[!1,!1,!1,!1])},t.prototype.getTicks=function(){var t=this.getMaxTicks(20),e=this.getMaxTicks(50);return this.tickValues?this.tickValues:this.scale.ticks?this.scale.ticks.apply(this.scale,[e]):H(this.scale.domain(),t)},t.prototype.getMaxTicks=function(t){return Math.floor(this.height/t)},t.prototype.tickTransform=function(t){return"translate("+this.adjustedScale(t)+","+this.verticalSpacing+")"},t.prototype.gridLineTransform=function(){return"translate(5,0)"},t.prototype.tickTrim=function(t){return this.trimTicks?Y(t,this.maxTickLength):t},t}();z.decorators=[{type:e.Component,args:[{selector:"g[lcu-charts-y-axis-ticks]",template:'\n <svg:g #ticksel>\n <svg:g *ngFor="let tick of ticks" class="tick" [attr.transform]="transform(tick)">\n <title>{{ tickFormat(tick) }}</title>\n <svg:text\n stroke-width="0.01"\n [attr.dy]="dy"\n [attr.x]="x1"\n [attr.y]="y1"\n [attr.text-anchor]="textAnchor"\n [style.font-size]="\'12px\'"\n >\n {{ tickTrim(tickFormat(tick)) }}\n </svg:text>\n </svg:g>\n </svg:g>\n\n <svg:path\n *ngIf="referenceLineLength > 1 && refMax && refMin && showRefLines"\n class="reference-area"\n [attr.d]="referenceAreaPath"\n [attr.transform]="gridLineTransform()"\n />\n <svg:g *ngFor="let tick of ticks" [attr.transform]="transform(tick)">\n <svg:g *ngIf="showGridLines" [attr.transform]="gridLineTransform()">\n <svg:line\n *ngIf="orient === \'left\'"\n class="gridline-path gridline-path-horizontal"\n x1="0"\n [attr.x2]="gridLineWidth"\n />\n <svg:line\n *ngIf="orient === \'right\'"\n class="gridline-path gridline-path-horizontal"\n x1="0"\n [attr.x2]="-gridLineWidth"\n />\n </svg:g>\n </svg:g>\n\n <svg:g *ngFor="let refLine of referenceLines">\n <svg:g *ngIf="showRefLines" [attr.transform]="transform(refLine.value)">\n <svg:line\n class="refline-path gridline-path-horizontal"\n x1="0"\n [attr.x2]="gridLineWidth"\n [attr.transform]="gridLineTransform()"\n />\n <svg:g *ngIf="showRefLabels">\n <title>{{ tickTrim(tickFormat(refLine.value)) }}</title>\n <svg:text\n class="refline-label"\n [attr.dy]="dy"\n [attr.y]="-6"\n [attr.x]="gridLineWidth"\n [attr.text-anchor]="textAnchor"\n >\n {{ refLine.name }}\n </svg:text>\n </svg:g>\n </svg:g>\n </svg:g>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],z.propDecorators={scale:[{type:e.Input}],orient:[{type:e.Input}],tickArguments:[{type:e.Input}],tickValues:[{type:e.Input}],tickStroke:[{type:e.Input}],trimTicks:[{type:e.Input}],maxTickLength:[{type:e.Input}],tickFormatting:[{type:e.Input}],showGridLines:[{type:e.Input}],gridLineWidth:[{type:e.Input}],height:[{type:e.Input}],referenceLines:[{type:e.Input}],showRefLabels:[{type:e.Input}],showRefLines:[{type:e.Input}],dimensionsChanged:[{type:e.Output}],ticksElement:[{type:e.ViewChild,args:["ticksel"]}]};var G=function(){function t(){this.showGridLines=!1,this.yOrient="left",this.yAxisOffset=0,this.dimensionsChanged=new e.EventEmitter,this.yAxisClassName="y axis",this.labelOffset=15,this.fill="none",this.stroke="#CCC",this.tickStroke="#CCC",this.strokeWidth=1,this.padding=5}return t.prototype.ngOnChanges=function(t){this.update()},t.prototype.update=function(){this.offset=-(this.yAxisOffset+this.padding),"right"===this.yOrient?(this.labelOffset=65,this.transform="translate("+(this.offset+this.dims.width)+" , 0)"):(this.offset=this.offset,this.transform="translate("+this.offset+" , 0)"),void 0!==this.yAxisTickCount&&(this.tickArguments=[this.yAxisTickCount])},t.prototype.emitTicksWidth=function(t){var e=this,i=t.width;i!==this.labelOffset&&"right"===this.yOrient?(this.labelOffset=i+this.labelOffset,setTimeout((function(){e.dimensionsChanged.emit({width:i})}),0)):i!==this.labelOffset&&(this.labelOffset=i,setTimeout((function(){e.dimensionsChanged.emit({width:i})}),0))},t}();G.decorators=[{type:e.Component,args:[{selector:"g[lcu-charts-y-axis]",template:'\n <svg:g [attr.class]="yAxisClassName" [attr.transform]="transform">\n <svg:g\n lcu-charts-y-axis-ticks\n *ngIf="yScale"\n [trimTicks]="trimTicks"\n [maxTickLength]="maxTickLength"\n [tickFormatting]="tickFormatting"\n [tickArguments]="tickArguments"\n [tickValues]="ticks"\n [tickStroke]="tickStroke"\n [scale]="yScale"\n [orient]="yOrient"\n [showGridLines]="showGridLines"\n [gridLineWidth]="dims.width"\n [referenceLines]="referenceLines"\n [showRefLines]="showRefLines"\n [showRefLabels]="showRefLabels"\n [height]="dims.height"\n (dimensionsChanged)="emitTicksWidth($event)"\n />\n\n <svg:g\n lcu-charts-axis-label\n *ngIf="showLabel"\n [label]="labelText"\n [offset]="labelOffset"\n [orient]="yOrient"\n [height]="dims.height"\n [width]="dims.width"\n ></svg:g>\n </svg:g>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],G.propDecorators={yScale:[{type:e.Input}],dims:[{type:e.Input}],trimTicks:[{type:e.Input}],maxTickLength:[{type:e.Input}],tickFormatting:[{type:e.Input}],ticks:[{type:e.Input}],showGridLines:[{type:e.Input}],showLabel:[{type:e.Input}],labelText:[{type:e.Input}],yAxisTickInterval:[{type:e.Input}],yAxisTickCount:[{type:e.Input}],yOrient:[{type:e.Input}],referenceLines:[{type:e.Input}],showRefLines:[{type:e.Input}],showRefLabels:[{type:e.Input}],yAxisOffset:[{type:e.Input}],dimensionsChanged:[{type:e.Output}],ticksComponent:[{type:e.ViewChild,args:[z]}]};var $,N,j,Z=function(){};Z.decorators=[{type:e.NgModule,args:[{imports:[i.CommonModule],declarations:[R,V,W,G,z],exports:[R,V,W,G,z]}]}],($=t.StyleTypes||(t.StyleTypes={}))[$.popover="popover"]="popover",$[$.tooltip="tooltip"]="tooltip",(N=t.AlignmentTypes||(t.AlignmentTypes={}))[N.left="left"]="left",N[N.center="center"]="center",N[N.right="right"]="right",(j=t.ShowTypes||(t.ShowTypes={}))[j.all="all"]="all",j[j.focus="focus"]="focus",j[j.mouseover="mouseover"]="mouseover";var _=function(){function i(i,n,a){this.tooltipService=i,this.viewContainerRef=n,this.renderer=a,this.tooltipCssClass="",this.tooltipTitle="",this.tooltipAppendToBody=!0,this.tooltipSpacing=10,this.tooltipDisabled=!1,this.tooltipShowCaret=!0,this.tooltipPlacement=w.top,this.tooltipAlignment=t.AlignmentTypes.center,this.tooltipType=t.StyleTypes.popover,this.tooltipCloseOnClickOutside=!0,this.tooltipCloseOnMouseLeave=!0,this.tooltipHideTimeout=300,this.tooltipShowTimeout=100,this.tooltipShowEvent=t.ShowTypes.all,this.tooltipImmediateExit=!1,this.show=new e.EventEmitter,this.hide=new e.EventEmitter}return Object.defineProperty(i.prototype,"listensForFocus",{get:function(){return this.tooltipShowEvent===t.ShowTypes.all||this.tooltipShowEvent===t.ShowTypes.focus},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"listensForHover",{get:function(){return this.tooltipShowEvent===t.ShowTypes.all||this.tooltipShowEvent===t.ShowTypes.mouseover},enumerable:!1,configurable:!0}),i.prototype.ngOnDestroy=function(){this.hideTooltip(!0)},i.prototype.onFocus=function(){this.listensForFocus&&this.showTooltip()},i.prototype.onBlur=function(){this.listensForFocus&&this.hideTooltip(!0)},i.prototype.onMouseEnter=function(){this.listensForHover&&this.showTooltip()},i.prototype.onMouseLeave=function(t){if(this.listensForHover&&this.tooltipCloseOnMouseLeave){if(clearTimeout(this.timeout),this.component)if(this.component.instance.element.nativeElement.contains(t))return;this.hideTooltip(this.tooltipImmediateExit)}},i.prototype.onMouseClick=function(){this.listensForHover&&this.hideTooltip(!0)},i.prototype.showTooltip=function(t){var e=this;if(!this.component&&!this.tooltipDisabled){var i=t?0:this.tooltipShowTimeout;clearTimeout(this.timeout),this.timeout=setTimeout((function(){e.tooltipService.destroyAll();var t=e.createBoundOptions();e.component=e.tooltipService.create(t),setTimeout((function(){e.component&&e.addHideListeners(e.component.instance.element.nativeElement)}),10),e.show.emit(!0)}),i)}},i.prototype.addHideListeners=function(t){var e=this;this.mouseEnterContentEvent=this.renderer.listen(t,"mouseenter",(function(){clearTimeout(e.timeout)})),this.tooltipCloseOnMouseLeave&&(this.mouseLeaveContentEvent=this.renderer.listen(t,"mouseleave",(function(){e.hideTooltip(e.tooltipImmediateExit)}))),this.tooltipCloseOnClickOutside&&(this.documentClickEvent=this.renderer.listen(document,"click",(function(i){t.contains(i.target)||e.hideTooltip()})))},i.prototype.hideTooltip=function(t){var e=this;if(void 0===t&&(t=!1),this.component){var i=function(){e.mouseLeaveContentEvent&&e.mouseLeaveContentEvent(),e.mouseEnterContentEvent&&e.mouseEnterContentEvent(),e.documentClickEvent&&e.documentClickEvent(),e.hide.emit(!0),e.tooltipService.destroy(e.component),e.component=void 0};clearTimeout(this.timeout),t?i():this.timeout=setTimeout(i,this.tooltipHideTimeout)}},i.prototype.createBoundOptions=function(){return{title:this.tooltipTitle,template:this.tooltipTemplate,host:this.viewContainerRef.element,placement:this.tooltipPlacement,alignment:this.tooltipAlignment,type:this.tooltipType,showCaret:this.tooltipShowCaret,cssClass:this.tooltipCssClass,spacing:this.tooltipSpacing,context:this.tooltipContext}},i}();_.decorators=[{type:e.Directive,args:[{selector:"[lcu-tooltip]"}]}],_.ctorParameters=function(){return[{type:M},{type:e.ViewContainerRef},{type:e.Renderer2}]},_.propDecorators={tooltipCssClass:[{type:e.Input}],tooltipTitle:[{type:e.Input}],tooltipAppendToBody:[{type:e.Input}],tooltipSpacing:[{type:e.Input}],tooltipDisabled:[{type:e.Input}],tooltipShowCaret:[{type:e.Input}],tooltipPlacement:[{type:e.Input}],tooltipAlignment:[{type:e.Input}],tooltipType:[{type:e.Input}],tooltipCloseOnClickOutside:[{type:e.Input}],tooltipCloseOnMouseLeave:[{type:e.Input}],tooltipHideTimeout:[{type:e.Input}],tooltipShowTimeout:[{type:e.Input}],tooltipTemplate:[{type:e.Input}],tooltipShowEvent:[{type:e.Input}],tooltipContext:[{type:e.Input}],tooltipImmediateExit:[{type:e.Input}],show:[{type:e.Output}],hide:[{type:e.Output}],onFocus:[{type:e.HostListener,args:["focusin"]}],onBlur:[{type:e.HostListener,args:["blur"]}],onMouseEnter:[{type:e.HostListener,args:["mouseenter"]}],onMouseLeave:[{type:e.HostListener,args:["mouseleave",["$event.target"]]}],onMouseClick:[{type:e.HostListener,args:["click"]}]};var q=function(){};function U(t){return t=t instanceof Date?t.toLocaleDateString():t.toLocaleString()}function J(t){return t.toLocaleString().replace(/[&'`"<>]/g,(function(t){return{"&":"&","'":"'","`":"`",'"':""","<":"<",">":">"}[t]}))}q.decorators=[{type:e.NgModule,args:[{declarations:[E,_],providers:[A,M],exports:[E,_],imports:[i.CommonModule],entryComponents:[E]}]}];var Q={};function K(){var t=("0000"+(Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4);return Q[t="a"+t]?K():(Q[t]=!0,t)}var tt=function(){function t(){this.type="standard",this.tooltipDisabled=!1,this.select=new e.EventEmitter,this.activate=new e.EventEmitter,this.deactivate=new e.EventEmitter,this.barVisible=!1}return t.prototype.ngOnInit=function(){this.gradientId="grad"+K().toString(),this.gradientFill="url(#"+this.gradientId+")"},t.prototype.ngOnChanges=function(t){this.update()},t.prototype.update=function(){this.circle=this.getActiveCircle()},t.prototype.getActiveCircle=function(){var t=this,e=this.data.series.findIndex((function(e){var i=e.name;return i&&t.visibleValue&&i.toString()===t.visibleValue.toString()&&void 0!==e.value}));if(-1!==e)return this.mapDataPointToCircle(this.data.series[e],e)},t.prototype.mapDataPointToCircle=function(t,e){var i,n=this.data.name,a=t.value,r=t.name,s=U(r);i="time"===this.scaleType?this.xScale(r):"linear"===this.scaleType?this.xScale(Number(r)):this.xScale(r);var o,l=this.yScale("standard"===this.type?a:t.d1),c=this.yScale.range()[0]-l;return o="linear"===this.colors.scaleType?"standard"===this.type?this.colors.getColor(a):this.colors.getColor(t.d1):this.colors.getColor(n),{classNames:["circle-data-"+e],value:a,label:r,data:Object.assign({},t,{series:n,value:a,name:r}),cx:i,cy:l,radius:5,height:c,tooltipLabel:s,color:o,opacity:1,seriesName:n,gradientStops:this.getGradientStops(o),min:t.min,max:t.max}},t.prototype.getTooltipText=function(t){var e=t.tooltipLabel,i=t.value,n=t.seriesName,a=t.min,r=t.max;return'\n <span class="tooltip-label">'+J(n)+" • "+J(e)+'</span>\n <span class="tooltip-val">'+i.toLocaleString()+this.getTooltipMinMaxText(a,r)+"</span>\n "},t.prototype.getTooltipMinMaxText=function(t,e){if(void 0!==t||void 0!==e){var i=" (";return void 0!==t?(void 0===e&&(i+="≥"),i+=t.toLocaleString(),void 0!==e&&(i+=" - ")):void 0!==e&&(i+="≤"),void 0!==e&&(i+=e.toLocaleString()),i+=")"}return""},t.prototype.getGradientStops=function(t){return[{offset:0,color:t,opacity:.2},{offset:100,color:t,opacity:1}]},t.prototype.onClick=function(t){this.select.emit(t)},t.prototype.isActive=function(t){return!!this.activeEntries&&void 0!==this.activeEntries.find((function(e){return t.name===e.name}))},t.prototype.activateCircle=function(){this.barVisible=!0,this.activate.emit({name:this.data.name})},t.prototype.deactivateCircle=function(){this.barVisible=!1,this.circle.opacity=0,this.deactivate.emit({name:this.data.name})},t}();tt.decorators=[{type:e.Component,args:[{selector:"g[lcu-charts-circle-series]",template:'\n <svg:g *ngIf="circle">\n <defs>\n <svg:g\n lcu-charts-svg-linear-gradient\n orientation="vertical"\n [name]="gradientId"\n [stops]="circle.gradientStops"\n />\n </defs>\n <svg:rect\n *ngIf="barVisible && type === \'standard\'"\n [@animationState]="\'active\'"\n [attr.x]="circle.cx - circle.radius"\n [attr.y]="circle.cy"\n [attr.width]="circle.radius * 2"\n [attr.height]="circle.height"\n [attr.fill]="gradientFill"\n class="tooltip-bar"\n />\n <svg:g\n lcu-charts-circle\n class="circle"\n [cx]="circle.cx"\n [cy]="circle.cy"\n [r]="circle.radius"\n [fill]="circle.color"\n [class.active]="isActive({ name: circle.seriesName })"\n [pointerEvents]="circle.value === 0 ? \'none\' : \'all\'"\n [data]="circle.value"\n [classNames]="circle.classNames"\n (select)="onClick(circle.data)"\n (activate)="activateCircle()"\n (deactivate)="deactivateCircle()"\n lcu-tooltip\n [tooltipDisabled]="tooltipDisabled"\n [tooltipPlacement]="\'top\'"\n [tooltipType]="\'tooltip\'"\n [tooltipTitle]="tooltipTemplate ? undefined : getTooltipText(circle)"\n [tooltipTemplate]="tooltipTemplate"\n [tooltipContext]="circle.data"\n />\n </svg:g>\n ',changeDetection:e.ChangeDetectionStrategy.OnPush,animations:[n.trigger("animationState",[n.transition(":enter",[n.style({opacity:0}),n.animate(250,n.style({opacity:1}))])])]}]}],tt.propDecorators={data:[{type:e.Input}],type:[{type:e.Input}],xScale:[{type:e.Input}],yScale:[{type:e.Input}],colors:[{type:e.Input}],scaleType:[{type:e.Input}],visibleValue:[{type:e.Input}],activeEntries:[{type:e.Input}],tooltipDisabled:[{type:e.Input}],tooltipTemplate:[{type:e.Input}],select:[{type:e.Output}],activate:[{type:e.Output}],deactivate:[{type:e.Output}]};var et=function(){function t(){this.select=new e.EventEmitter,this.activate=new e.EventEmitter,this.deactivate=new e.EventEmitter}return t.prototype.onClick=function(){this.select.emit(this.data)},t.prototype.onMouseEnter=function(){this.activate.emit(this.data)},t.prototype.onMouseLeave=function(){this.deactivate.emit(this.data)},t.prototype.ngOnChanges=function(t){this.classNames=Array.isArray(this.classNames)?this.classNames.join(" "):"",this.classNames+="circle"},t}();et.decorators=[{type:e.Component,args:[{selector:"g[lcu-charts-circle]",template:'\n <svg:circle\n [attr.cx]="cx"\n [attr.cy]="cy"\n [attr.r]="r"\n [attr.fill]="fill"\n [attr.stroke]="stroke"\n [attr.opacity]="circleOpacity"\n [attr.class]="classNames"\n [attr.pointer-events]="pointerEvents"\n />\n ',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],et.propDecorators={cx:[{type:e.Input}],cy:[{type:e.Input}],r:[{type:e.Input}],fill:[{type:e.Input}],stroke:[{type:e.Input}],data:[{type:e.Input}],classNames:[{type:e.Input}],circleOpacity:[{type:e.Input}],pointerEvents:[{type:e.Input}],select:[{type:e.Output}],activate:[{type:e.Output}],deactivate:[{type:e.Output}],onClick:[{type:e.HostListener,args:["click"]}],onMouseEnter:[{type:e.HostListener,args:["mouseenter"]}],onMouseLeave:[{type:e.HostListener,args:["mouseleave"]}]};var it=function(){};it.decorators=[{type:e.Component,args:[{selector:"g[lcu-charts-grid-panel]",template:'\n <svg:rect [attr.height]="height" [attr.width]="width" [attr.x]="x" [attr.y]="y" stroke="none" class="gridpanel" />\n ',changeDetection:e.ChangeDetectionStrategy.OnPush}]}],it.propDecorators={path:[{type:e.Input}],width:[{type:e.Input}],height:[{type:e.Input}],x:[{type:e.Input}],y:[{type:e.Input}]};var nt=function(){function t(){}return t.prototype.ngOnChanges=function(t){this.update()},t.prototype.update=function(){this.gridPanels=this.getGridPanels()},t.prototype.getGridPanels=function(){var t=this;return this.data.map((function(e){var i,n,a,r,s,o="odd";if("vertical"===t.orient){var l=t.xScale(e.name);Number.parseInt((l/t.xScale.step()).toString(),10)%2==1&&(o="even"),i=t.xScale.bandwidth()*t.xScale.paddingInner(),n=t.xScale.bandwidth()+i,a=t.dims.height,r=t.xScale(e.name)-i/2,s=0}else if("horizontal"===t.orient){l=t.yScale(e.name);Number.parseInt((l/t.yScale.step()).toString(),10)%2==1&&(o="even"),i=t.yScale.bandwidth()*t.yScale.paddingInner(),n=t.dims.width,a=t.yScale.bandwidth()+i,r=0,s=t.yScale(e.name)-i/2}return{name:e.name,class:o,height:a,width:n,x:r,y:s}}))},t}();nt.decorators=[{type:e.Comp