UNPKG

@swimlane/ngx-charts

Version:

Declarative Charting Framework for Angular2 and beyond!

2 lines 319 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@angular/common"),require("@angular/core"),require("@angular/platform-browser"),require("d3-array"),require("d3-brush"),require("d3-color"),require("d3-force"),require("d3-format"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("moment"),require("rxjs/Rx")):"function"==typeof define&&define.amd?define("ngx-charts",["@angular/common","@angular/core","@angular/platform-browser","d3-array","d3-brush","d3-color","d3-force","d3-format","d3-hierarchy","d3-interpolate","d3-scale","d3-selection","d3-shape","moment","rxjs/Rx"],e):"object"==typeof exports?exports["ngx-charts"]=e(require("@angular/common"),require("@angular/core"),require("@angular/platform-browser"),require("d3-array"),require("d3-brush"),require("d3-color"),require("d3-force"),require("d3-format"),require("d3-hierarchy"),require("d3-interpolate"),require("d3-scale"),require("d3-selection"),require("d3-shape"),require("moment"),require("rxjs/Rx")):t["ngx-charts"]=e(t["@angular/common"],t["@angular/core"],t["@angular/platform-browser"],t["d3-array"],t["d3-brush"],t["d3-color"],t["d3-force"],t["d3-format"],t["d3-hierarchy"],t["d3-interpolate"],t["d3-scale"],t["d3-selection"],t["d3-shape"],t.moment,t["rxjs/Rx"])}(this,function(t,e,n,i,o,r,a,s,c,p,l,h,d,u,g){return function(t){function e(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return t[i].call(o.exports,o,o.exports,e),o.l=!0,o.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,e,n){Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s="./src/index.ts")}({"./src/area-chart/area-chart-normalized.component.ts":function(t,e,n){"use strict";var i=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},o=this&&this.__decorate||function(t,e,n,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,n,a):o(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},r=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=n(0),s=n("./src/d3.ts"),c=n("./src/common/view-dimensions.helper.ts"),p=n("./src/common/color.helper.ts"),l=n("./src/common/base-chart.component.ts"),h=n(1),d=n("./src/utils/id.ts"),u=function(t){function e(){t.apply(this,arguments),this.legend=!1,this.showGridLines=!0,this.curve=s.default.shape.curveLinear,this.activeEntries=[],this.activate=new a.EventEmitter,this.deactivate=new a.EventEmitter,this.margin=[10,20,10,20],this.xAxisHeight=0,this.yAxisWidth=0,this.timelineHeight=50,this.timelinePadding=10}return i(e,t),e.prototype.update=function(){var e=this;t.prototype.update.call(this),this.zone.run(function(){e.dims=c.calculateViewDimensions({width:e.width,height:e.height,margins:e.margin,showXAxis:e.xAxis,showYAxis:e.yAxis,xAxisHeight:e.xAxisHeight,yAxisWidth:e.yAxisWidth,showXLabel:e.showXAxisLabel,showYLabel:e.showYAxisLabel,showLegend:e.legend,legendType:e.schemeType}),e.timeline&&(e.dims.height-=e.timelineHeight+e.margin[2]+e.timelinePadding),e.xDomain=e.getXDomain(),e.filteredDomain&&(e.xDomain=e.filteredDomain),e.yDomain=e.getYDomain(),e.seriesDomain=e.getSeriesDomain(),e.xScale=e.getXScale(e.xDomain,e.dims.width),e.yScale=e.getYScale(e.yDomain,e.dims.height);for(var t=function(t){for(var n=e.xSet[t],i=0,o=0,r=0,a=e.results;r<a.length;r++){var s=a[r],c=s.series.find(function(t){var i=t.name,o=n;return"time"===e.scaleType&&(i=i.valueOf(),o=o.valueOf()),i===o});c&&(o+=c.value)}for(var p=0,l=e.results;p<l.length;p++){var s=l[p],c=s.series.find(function(t){var i=t.name,o=n;return"time"===e.scaleType&&(i=i.valueOf(),o=o.valueOf()),i===o});c?(c.d0=i,c.d1=i+c.value,i+=c.value):(c={name:n,value:0,d0:i,d1:i},s.series.push(c)),o>0?(c.d0=100*c.d0/o,c.d1=100*c.d1/o):(c.d0=0,c.d1=0)}},n=0;n<e.xSet.length;n++)t(n);e.updateTimeline(),e.setColors(),e.legendOptions=e.getLegendOptions(),e.transform="translate("+e.dims.xOffset+" , "+e.margin[0]+")";var i=window.location.href;e.clipPathId="clip"+d.id().toString(),e.clipPath="url("+i+"#"+e.clipPathId+")"})},e.prototype.updateTimeline=function(){this.timeline&&(this.timelineWidth=this.width,this.legend&&(this.timelineWidth=this.dims.width),this.timelineXDomain=this.getXDomain(),this.timelineXScale=this.getXScale(this.timelineXDomain,this.timelineWidth),this.timelineYScale=this.getYScale(this.yDomain,this.timelineHeight),this.timelineTransform="translate("+this.dims.xOffset+", "+-this.margin[2]+")")},e.prototype.getXDomain=function(){for(var t=[],e=0,n=this.results;e<n.length;e++)for(var i=n[e],o=0,r=i.series;o<r.length;o++){var a=r[o];t.includes(a.name)||t.push(a.name)}this.scaleType=this.getScaleType(t);var s=[];if("time"===this.scaleType){t=t.map(function(t){return h(t).toDate()});var c=Math.min.apply(Math,t),p=Math.max.apply(Math,t);s=[new Date(c),new Date(p)]}else if("linear"===this.scaleType){t=t.map(function(t){return Number(t)});var c=Math.min.apply(Math,t),p=Math.max.apply(Math,t);s=[c,p]}else s=t;return this.xSet=t,s},e.prototype.getYDomain=function(){return[0,100]},e.prototype.getSeriesDomain=function(){return this.results.map(function(t){return t.name})},e.prototype.getXScale=function(t,e){var n;return"time"===this.scaleType?n=s.default.scaleTime().range([0,e]).domain(t):"linear"===this.scaleType?n=s.default.scaleLinear().range([0,e]).domain(t):"ordinal"===this.scaleType&&(n=s.default.scalePoint().range([0,e]).padding(.1).domain(t)),n},e.prototype.getYScale=function(t,e){return s.default.scaleLinear().range([e,0]).domain(t)},e.prototype.getScaleType=function(t){for(var e=!0,n=!0,i=0,o=t;i<o.length;i++){var r=o[i];this.isDate(r)||(e=!1),"number"!=typeof r&&(n=!1)}return e?"time":n?"linear":"ordinal"},e.prototype.isDate=function(t){return t instanceof Date},e.prototype.updateDomain=function(t){this.filteredDomain=t,this.xDomain=this.filteredDomain,this.xScale=this.getXScale(this.xDomain,this.dims.width)},e.prototype.updateHoveredVertical=function(t){this.hoveredVertical=t.value},e.prototype.hideCircles=function(){this.hoveredVertical=null},e.prototype.onClick=function(t,e){e&&(t.series=e.name),this.select.emit(t)},e.prototype.trackBy=function(t,e){return e.name},e.prototype.setColors=function(){var t;t="ordinal"===this.schemeType?this.seriesDomain:this.yDomain,this.colors=new p.ColorHelper(this.scheme,this.schemeType,t,this.customColors)},e.prototype.getLegendOptions=function(){var t={scaleType:this.schemeType,colors:void 0,domain:[]};return"ordinal"===t.scaleType?(t.domain=this.seriesDomain,t.colors=this.colors):(t.domain=this.yDomain,t.colors=this.colors.scale),t},e.prototype.updateYAxisWidth=function(t){var e=t.width;this.yAxisWidth=e,this.update()},e.prototype.updateXAxisHeight=function(t){var e=t.height;this.xAxisHeight=e,this.update()},e.prototype.onActivate=function(t){var e=this.activeEntries.findIndex(function(e){return e.name===t.name&&e.value===t.value});e>-1||(this.activeEntries=[t].concat(this.activeEntries),this.activate.emit({value:t,entries:this.activeEntries}))},e.prototype.onDeactivate=function(t){var e=this.activeEntries.findIndex(function(e){return e.name===t.name&&e.value===t.value});this.activeEntries.splice(e,1),this.activeEntries=this.activeEntries.slice(),this.deactivate.emit({value:event,entries:this.activeEntries})},o([a.Input(),r("design:type",Object)],e.prototype,"legend",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"xAxis",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"yAxis",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"showXAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"showYAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"xAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"yAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"timeline",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"gradient",void 0),o([a.Input(),r("design:type",Boolean)],e.prototype,"showGridLines",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"curve",void 0),o([a.Input(),r("design:type",Array)],e.prototype,"activeEntries",void 0),o([a.Input(),r("design:type",String)],e.prototype,"schemeType",void 0),o([a.Output(),r("design:type",a.EventEmitter)],e.prototype,"activate",void 0),o([a.Output(),r("design:type",a.EventEmitter)],e.prototype,"deactivate",void 0),o([a.HostListener("mouseleave"),r("design:type",Function),r("design:paramtypes",[]),r("design:returntype",void 0)],e.prototype,"hideCircles",null),e=o([a.Component({selector:"ngx-charts-area-chart-normalized",template:'\n <ngx-charts-chart\n [view]="[width, height]"\n [showLegend]="legend"\n [legendOptions]="legendOptions"\n [activeEntries]="activeEntries"\n (legendLabelClick)="onClick($event)"\n (legendLabelActivate)="onActivate($event)"\n (legendLabelDeactivate)="onDeactivate($event)">\n <svg:defs>\n <svg:clipPath [attr.id]="clipPathId">\n <svg:rect\n [attr.width]="dims.width + 10"\n [attr.height]="dims.height + 10"\n [attr.transform]="\'translate(-5, -5)\'"/>\n </svg:clipPath>\n </svg:defs>\n <svg:g [attr.transform]="transform" class="area-chart chart">\n <svg:g ngx-charts-x-axis\n *ngIf="xAxis"\n [xScale]="xScale"\n [dims]="dims"\n [showGridLines]="showGridLines"\n [showLabel]="showXAxisLabel"\n [labelText]="xAxisLabel"\n (dimensionsChanged)="updateXAxisHeight($event)">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf="yAxis"\n [yScale]="yScale"\n [dims]="dims"\n [showGridLines]="showGridLines"\n [showLabel]="showYAxisLabel"\n [labelText]="yAxisLabel"\n (dimensionsChanged)="updateYAxisWidth($event)">\n </svg:g>\n <svg:g [attr.clip-path]="clipPath">\n <svg:g *ngFor="let series of results; trackBy:trackBy">\n <svg:g ngx-charts-area-series\n [xScale]="xScale"\n [yScale]="yScale"\n [colors]="colors"\n [data]="series"\n [scaleType]="scaleType"\n [activeEntries]="activeEntries"\n [gradient]="gradient"\n normalized="true"\n [curve]="curve"\n />\n </svg:g>\n <svg:g ngx-charts-area-tooltip\n [xSet]="xSet"\n [xScale]="xScale"\n [yScale]="yScale"\n [results]="results"\n [height]="dims.height"\n [colors]="colors"\n [showPercentage]="true"\n (hover)="updateHoveredVertical($event)"\n />\n <svg:g *ngFor="let series of results">\n <svg:g ngx-charts-circle-ceries\n type="stacked"\n [xScale]="xScale"\n [yScale]="yScale"\n [colors]="colors"\n [activeEntries]="activeEntries"\n [data]="series"\n [scaleType]="scaleType"\n [visibleValue]="hoveredVertical"\n (select)="onClick($event, series)"\n (activate)="onActivate($event)"\n (deactivate)="onDeactivate($event)"\n />\n </svg:g>\n </svg:g>\n </svg:g>\n <svg:g ngx-charts-timeline\n *ngIf="timeline && scaleType === \'time\'"\n [attr.transform]="timelineTransform"\n [results]="results"\n [view]="[timelineWidth, height]"\n [height]="timelineHeight"\n [scheme]="scheme"\n [customColors]="customColors"\n [legend]="legend"\n [scaleType]="scaleType"\n (onDomainChange)="updateDomain($event)">\n <svg:g *ngFor="let series of results; trackBy:trackBy">\n <svg:g ngx-charts-area-series\n [xScale]="timelineXScale"\n [yScale]="timelineYScale"\n [colors]="colors"\n [data]="series"\n [scaleType]="scaleType"\n [gradient]="gradient"\n normalized="true"\n [curve]="curve"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ',changeDetection:a.ChangeDetectionStrategy.OnPush}),r("design:paramtypes",[])],e)}(l.BaseChartComponent);e.AreaChartNormalizedComponent=u},"./src/area-chart/area-chart-stacked.component.ts":function(t,e,n){"use strict";var i=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},o=this&&this.__decorate||function(t,e,n,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,n,a):o(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},r=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=n(0),s=n("./src/common/view-dimensions.helper.ts"),c=n("./src/common/color.helper.ts"),p=n("./src/common/base-chart.component.ts"),l=n(1),h=n("./src/utils/id.ts"),d=n("./src/d3.ts"),u=function(t){function e(){t.apply(this,arguments),this.legend=!1,this.showGridLines=!0,this.curve=d.default.shape.curveLinear,this.activeEntries=[],this.activate=new a.EventEmitter,this.deactivate=new a.EventEmitter,this.margin=[10,20,10,20],this.xAxisHeight=0,this.yAxisWidth=0,this.timelineHeight=50,this.timelinePadding=10}return i(e,t),e.prototype.update=function(){var e=this;t.prototype.update.call(this),this.zone.run(function(){e.dims=s.calculateViewDimensions({width:e.width,height:e.height,margins:e.margin,showXAxis:e.xAxis,showYAxis:e.yAxis,xAxisHeight:e.xAxisHeight,yAxisWidth:e.yAxisWidth,showXLabel:e.showXAxisLabel,showYLabel:e.showYAxisLabel,showLegend:e.legend,legendType:e.schemeType}),e.timeline&&(e.dims.height-=e.timelineHeight+e.margin[2]+e.timelinePadding),e.xDomain=e.getXDomain(),e.filteredDomain&&(e.xDomain=e.filteredDomain),e.yDomain=e.getYDomain(),e.seriesDomain=e.getSeriesDomain(),e.xScale=e.getXScale(e.xDomain,e.dims.width),e.yScale=e.getYScale(e.yDomain,e.dims.height);for(var t=function(t){for(var n=e.xSet[t],i=0,o=0,r=e.results;o<r.length;o++){var a=r[o],s=a.series.find(function(t){var i=t.name,o=n;return"time"===e.scaleType&&(i=i.valueOf(),o=o.valueOf()),i===o});s?(s.d0=i,s.d1=i+s.value,i+=s.value):(s={name:n,value:0,d0:i,d1:i},a.series.push(s))}},n=0;n<e.xSet.length;n++)t(n);e.updateTimeline(),e.setColors(),e.legendOptions=e.getLegendOptions(),e.transform="translate("+e.dims.xOffset+" , "+e.margin[0]+")";var i=window.location.href;e.clipPathId="clip"+h.id().toString(),e.clipPath="url("+i+"#"+e.clipPathId+")"})},e.prototype.updateTimeline=function(){this.timeline&&(this.timelineWidth=this.width,this.legend&&(this.timelineWidth=this.dims.width),this.timelineXDomain=this.getXDomain(),this.timelineXScale=this.getXScale(this.timelineXDomain,this.timelineWidth),this.timelineYScale=this.getYScale(this.yDomain,this.timelineHeight),this.timelineTransform="translate("+this.dims.xOffset+", "+-this.margin[2]+")")},e.prototype.getXDomain=function(){for(var t=[],e=0,n=this.results;e<n.length;e++)for(var i=n[e],o=0,r=i.series;o<r.length;o++){var a=r[o];t.includes(a.name)||t.push(a.name)}this.scaleType=this.getScaleType(t);var s=[];if("time"===this.scaleType){t=t.map(function(t){return l(t).toDate()});var c=Math.min.apply(Math,t),p=Math.max.apply(Math,t);s=[new Date(c),new Date(p)]}else if("linear"===this.scaleType){t=t.map(function(t){return Number(t)});var c=Math.min.apply(Math,t),p=Math.max.apply(Math,t);s=[c,p]}else s=t;return this.xSet=t,s},e.prototype.getYDomain=function(){for(var t=this,e=[],n=function(n){for(var o=i.xSet[n],r=0,a=0,s=i.results;a<s.length;a++){var c=s[a],p=c.series.find(function(e){var n=e.name,i=o;return"time"===t.scaleType&&(n=n.valueOf(),i=i.valueOf()),n===i});p&&(r+=p.value)}e.push(r)},i=this,o=0;o<this.xSet.length;o++)n(o);var r=Math.min.apply(Math,[0].concat(e)),a=Math.max.apply(Math,e);return[r,a]},e.prototype.getSeriesDomain=function(){return this.results.map(function(t){return t.name})},e.prototype.getXScale=function(t,e){var n;return"time"===this.scaleType?n=d.default.scaleTime().range([0,e]).domain(t):"linear"===this.scaleType?n=d.default.scaleLinear().range([0,e]).domain(t):"ordinal"===this.scaleType&&(n=d.default.scalePoint().range([0,e]).padding(.1).domain(t)),n},e.prototype.getYScale=function(t,e){return d.default.scaleLinear().range([e,0]).domain(t)},e.prototype.getScaleType=function(t){for(var e=!0,n=!0,i=0,o=t;i<o.length;i++){var r=o[i];this.isDate(r)||(e=!1),"number"!=typeof r&&(n=!1)}return e?"time":n?"linear":"ordinal"},e.prototype.isDate=function(t){return t instanceof Date},e.prototype.updateDomain=function(t){this.filteredDomain=t,this.xDomain=this.filteredDomain,this.xScale=this.getXScale(this.xDomain,this.dims.width)},e.prototype.updateHoveredVertical=function(t){this.hoveredVertical=t.value},e.prototype.hideCircles=function(){this.hoveredVertical=null},e.prototype.onClick=function(t,e){e&&(t.series=e.name),this.select.emit(t)},e.prototype.trackBy=function(t,e){return e.name},e.prototype.setColors=function(){var t;t="ordinal"===this.schemeType?this.seriesDomain:this.yDomain,this.colors=new c.ColorHelper(this.scheme,this.schemeType,t,this.customColors)},e.prototype.getLegendOptions=function(){var t={scaleType:this.schemeType,colors:void 0,domain:[]};return"ordinal"===t.scaleType?(t.domain=this.seriesDomain,t.colors=this.colors):(t.domain=this.yDomain,t.colors=this.colors.scale),t},e.prototype.updateYAxisWidth=function(t){var e=t.width;this.yAxisWidth=e,this.update()},e.prototype.updateXAxisHeight=function(t){var e=t.height;this.xAxisHeight=e,this.update()},e.prototype.onActivate=function(t){var e=this.activeEntries.findIndex(function(e){return e.name===t.name&&e.value===t.value});e>-1||(this.activeEntries=[t].concat(this.activeEntries),this.activate.emit({value:t,entries:this.activeEntries}))},e.prototype.onDeactivate=function(t){var e=this.activeEntries.findIndex(function(e){return e.name===t.name&&e.value===t.value});this.activeEntries.splice(e,1),this.activeEntries=this.activeEntries.slice(),this.deactivate.emit({value:event,entries:this.activeEntries})},o([a.Input(),r("design:type",Object)],e.prototype,"legend",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"xAxis",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"yAxis",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"showXAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"showYAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"xAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"yAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"timeline",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"gradient",void 0),o([a.Input(),r("design:type",Boolean)],e.prototype,"showGridLines",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"curve",void 0),o([a.Input(),r("design:type",Array)],e.prototype,"activeEntries",void 0),o([a.Input(),r("design:type",String)],e.prototype,"schemeType",void 0),o([a.Output(),r("design:type",a.EventEmitter)],e.prototype,"activate",void 0),o([a.Output(),r("design:type",a.EventEmitter)],e.prototype,"deactivate",void 0),o([a.HostListener("mouseleave"),r("design:type",Function),r("design:paramtypes",[]),r("design:returntype",void 0)],e.prototype,"hideCircles",null),e=o([a.Component({selector:"ngx-charts-area-chart-stacked",template:'\n <ngx-charts-chart\n [view]="[width, height]"\n [showLegend]="legend"\n [legendOptions]="legendOptions"\n [activeEntries]="activeEntries"\n (legendLabelClick)="onClick($event)"\n (legendLabelActivate)="onActivate($event)"\n (legendLabelDeactivate)="onDeactivate($event)">\n <svg:defs>\n <svg:clipPath [attr.id]="clipPathId">\n <svg:rect\n [attr.width]="dims.width + 10"\n [attr.height]="dims.height + 10"\n [attr.transform]="\'translate(-5, -5)\'"/>\n </svg:clipPath>\n </svg:defs>\n <svg:g [attr.transform]="transform" class="area-chart chart">\n <svg:g ngx-charts-x-axis\n *ngIf="xAxis"\n [xScale]="xScale"\n [dims]="dims"\n [showGridLines]="showGridLines"\n [showLabel]="showXAxisLabel"\n [labelText]="xAxisLabel"\n (dimensionsChanged)="updateXAxisHeight($event)">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf="yAxis"\n [yScale]="yScale"\n [dims]="dims"\n [showGridLines]="showGridLines"\n [showLabel]="showYAxisLabel"\n [labelText]="yAxisLabel"\n (dimensionsChanged)="updateYAxisWidth($event)">\n </svg:g>\n <svg:g [attr.clip-path]="clipPath">\n <svg:g *ngFor="let series of results; trackBy:trackBy">\n <svg:g ngx-charts-area-series\n [xScale]="xScale"\n [yScale]="yScale"\n [colors]="colors"\n [data]="series"\n [scaleType]="scaleType"\n [gradient]="gradient"\n [activeEntries]="activeEntries"\n stacked="true"\n [curve]="curve"\n />\n </svg:g>\n <svg:g ngx-charts-area-tooltip\n [xSet]="xSet"\n [xScale]="xScale"\n [yScale]="yScale"\n [results]="results"\n [height]="dims.height"\n [colors]="colors"\n (hover)="updateHoveredVertical($event)"\n />\n <svg:g *ngFor="let series of results; trackBy:trackBy">\n <svg:g ngx-charts-circle-ceries\n type="stacked"\n [xScale]="xScale"\n [yScale]="yScale"\n [colors]="colors"\n [activeEntries]="activeEntries"\n [data]="series"\n [scaleType]="scaleType"\n [visibleValue]="hoveredVertical"\n (select)="onClick($event, series)"\n (activate)="onActivate($event)"\n (deactivate)="onDeactivate($event)"\n />\n </svg:g>\n </svg:g>\n </svg:g>\n <svg:g ngx-charts-timeline\n *ngIf="timeline && scaleType === \'time\'"\n [attr.transform]="timelineTransform"\n [results]="results"\n [view]="[timelineWidth, height]"\n [height]="timelineHeight"\n [scheme]="scheme"\n [customColors]="customColors"\n [legend]="legend"\n [scaleType]="scaleType"\n (onDomainChange)="updateDomain($event)">\n <svg:g *ngFor="let series of results; trackBy:trackBy">\n <svg:g ngx-charts-area-series\n [xScale]="timelineXScale"\n [yScale]="timelineYScale"\n [colors]="colors"\n [data]="series"\n [scaleType]="scaleType"\n [gradient]="gradient"\n stacked="true"\n [curve]="curve"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ',changeDetection:a.ChangeDetectionStrategy.OnPush}),r("design:paramtypes",[])],e)}(p.BaseChartComponent);e.AreaChartStackedComponent=u},"./src/area-chart/area-chart.component.ts":function(t,e,n){"use strict";var i=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},o=this&&this.__decorate||function(t,e,n,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,n,a):o(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},r=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=n(0),s=n("./src/common/view-dimensions.helper.ts"),c=n("./src/common/color.helper.ts"),p=n("./src/common/base-chart.component.ts"),l=n(1),h=n("./src/utils/id.ts"),d=n("./src/d3.ts"),u=function(t){function e(){t.apply(this,arguments),this.showGridLines=!0,this.curve=d.default.shape.curveLinear,this.activeEntries=[],this.activate=new a.EventEmitter,this.deactivate=new a.EventEmitter,this.margin=[10,20,10,20],this.xAxisHeight=0,this.yAxisWidth=0,this.timelineHeight=50,this.timelinePadding=10}return i(e,t),e.prototype.update=function(){var e=this;t.prototype.update.call(this),this.zone.run(function(){e.dims=s.calculateViewDimensions({width:e.width,height:e.height,margins:e.margin,showXAxis:e.xAxis,showYAxis:e.yAxis,xAxisHeight:e.xAxisHeight,yAxisWidth:e.yAxisWidth,showXLabel:e.showXAxisLabel,showYLabel:e.showYAxisLabel,showLegend:e.legend,legendType:e.schemeType}),e.timeline&&(e.dims.height-=e.timelineHeight+e.margin[2]+e.timelinePadding),e.xDomain=e.getXDomain(),e.filteredDomain&&(e.xDomain=e.filteredDomain),e.yDomain=e.getYDomain(),e.seriesDomain=e.getSeriesDomain(),e.xScale=e.getXScale(e.xDomain,e.dims.width),e.yScale=e.getYScale(e.yDomain,e.dims.height),e.updateTimeline(),e.setColors(),e.legendOptions=e.getLegendOptions(),e.transform="translate("+e.dims.xOffset+", "+e.margin[0]+")";var t=window.location.href;e.clipPathId="clip"+h.id().toString(),e.clipPath="url("+t+"#"+e.clipPathId+")"})},e.prototype.updateTimeline=function(){this.timeline&&(this.timelineWidth=this.width,this.legend&&(this.timelineWidth=this.dims.width),this.timelineXDomain=this.getXDomain(),this.timelineXScale=this.getXScale(this.timelineXDomain,this.timelineWidth),this.timelineYScale=this.getYScale(this.yDomain,this.timelineHeight),this.timelineTransform="translate("+this.dims.xOffset+", "+-this.margin[2]+")")},e.prototype.getXDomain=function(){for(var t=[],e=0,n=this.results;e<n.length;e++)for(var i=n[e],o=0,r=i.series;o<r.length;o++){var a=r[o];t.includes(a.name)||t.push(a.name)}this.scaleType=this.getScaleType(t);var s=[];if("time"===this.scaleType){t=t.map(function(t){return l(t).toDate()});var c=Math.min.apply(Math,t),p=Math.max.apply(Math,t);s=[c,p]}else if("linear"===this.scaleType){t=t.map(function(t){return Number(t)});var c=Math.min.apply(Math,t),p=Math.max.apply(Math,t);s=[c,p]}else s=t;return this.xSet=t,s},e.prototype.getYDomain=function(){for(var t=[],e=0,n=this.results;e<n.length;e++)for(var i=n[e],o=0,r=i.series;o<r.length;o++){var a=r[o];t.includes(a.value)||t.push(a.value)}var s=Math.min.apply(Math,t),c=Math.max.apply(Math,t);return this.autoScale||(s=Math.min(0,s)),[s,c]},e.prototype.getSeriesDomain=function(){return this.results.map(function(t){return t.name})},e.prototype.getXScale=function(t,e){var n;return"time"===this.scaleType?n=d.default.scaleTime().range([0,e]).domain(t):"linear"===this.scaleType?n=d.default.scaleLinear().range([0,e]).domain(t):"ordinal"===this.scaleType&&(n=d.default.scalePoint().range([0,e]).padding(.1).domain(t)),n},e.prototype.getYScale=function(t,e){return d.default.scaleLinear().range([e,0]).domain(t)},e.prototype.getScaleType=function(t){for(var e=!0,n=!0,i=0,o=t;i<o.length;i++){var r=o[i];this.isDate(r)||(e=!1),"number"!=typeof r&&(n=!1)}return e?"time":n?"linear":"ordinal"},e.prototype.isDate=function(t){return t instanceof Date},e.prototype.updateDomain=function(t){this.filteredDomain=t,this.xDomain=this.filteredDomain,this.xScale=this.getXScale(this.xDomain,this.dims.width)},e.prototype.updateHoveredVertical=function(t){this.hoveredVertical=t.value},e.prototype.hideCircles=function(){this.hoveredVertical=null},e.prototype.onClick=function(t,e){e&&(t.series=e.name),this.select.emit(t)},e.prototype.trackBy=function(t,e){return e.name},e.prototype.setColors=function(){var t;t="ordinal"===this.schemeType?this.seriesDomain:this.yDomain,this.colors=new c.ColorHelper(this.scheme,this.schemeType,t,this.customColors)},e.prototype.getLegendOptions=function(){var t={scaleType:this.schemeType,colors:void 0,domain:[]};return"ordinal"===t.scaleType?(t.domain=this.seriesDomain,t.colors=this.colors):(t.domain=this.yDomain,t.colors=this.colors.scale),t},e.prototype.updateYAxisWidth=function(t){var e=t.width;this.yAxisWidth=e,this.update()},e.prototype.updateXAxisHeight=function(t){var e=t.height;this.xAxisHeight=e,this.update()},e.prototype.onActivate=function(t){var e=this.activeEntries.findIndex(function(e){return e.name===t.name&&e.value===t.value});e>-1||(this.activeEntries=[t].concat(this.activeEntries),this.activate.emit({value:t,entries:this.activeEntries}))},e.prototype.onDeactivate=function(t){var e=this.activeEntries.findIndex(function(e){return e.name===t.name&&e.value===t.value});this.activeEntries.splice(e,1),this.activeEntries=this.activeEntries.slice(),this.deactivate.emit({value:event,entries:this.activeEntries})},o([a.Input(),r("design:type",Object)],e.prototype,"legend",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"state",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"xAxis",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"yAxis",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"autoScale",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"showXAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"showYAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"xAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"yAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"timeline",void 0),o([a.Input(),r("design:type",Boolean)],e.prototype,"gradient",void 0),o([a.Input(),r("design:type",Boolean)],e.prototype,"showGridLines",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"curve",void 0),o([a.Input(),r("design:type",Array)],e.prototype,"activeEntries",void 0),o([a.Input(),r("design:type",String)],e.prototype,"schemeType",void 0),o([a.Output(),r("design:type",a.EventEmitter)],e.prototype,"activate",void 0),o([a.Output(),r("design:type",a.EventEmitter)],e.prototype,"deactivate",void 0),o([a.HostListener("mouseleave"),r("design:type",Function),r("design:paramtypes",[]),r("design:returntype",void 0)],e.prototype,"hideCircles",null),e=o([a.Component({selector:"ngx-charts-area-chart",template:'\n <ngx-charts-chart\n [view]="[width, height]"\n [showLegend]="legend"\n [legendOptions]="legendOptions"\n [activeEntries]="activeEntries"\n (legendLabelClick)="onClick($event)"\n (legendLabelActivate)="onActivate($event)"\n (legendLabelDeactivate)="onDeactivate($event)">\n <svg:defs>\n <svg:clipPath [attr.id]="clipPathId">\n <svg:rect\n [attr.width]="dims.width + 10"\n [attr.height]="dims.height + 10"\n [attr.transform]="\'translate(-5, -5)\'"/>\n </svg:clipPath>\n </svg:defs>\n <svg:g [attr.transform]="transform" class="area-chart chart">\n <svg:g ngx-charts-x-axis\n *ngIf="xAxis"\n [xScale]="xScale"\n [dims]="dims"\n [showGridLines]="showGridLines"\n [showLabel]="showXAxisLabel"\n [labelText]="xAxisLabel"\n (dimensionsChanged)="updateXAxisHeight($event)">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf="yAxis"\n [yScale]="yScale"\n [dims]="dims"\n [showGridLines]="showGridLines"\n [showLabel]="showYAxisLabel"\n [labelText]="yAxisLabel"\n (dimensionsChanged)="updateYAxisWidth($event)">\n </svg:g>\n <svg:g [attr.clip-path]="clipPath">\n <svg:g *ngFor="let series of results; trackBy:trackBy">\n <svg:g ngx-charts-area-series\n [xScale]="xScale"\n [yScale]="yScale"\n [colors]="colors"\n [data]="series"\n [activeEntries]="activeEntries"\n [scaleType]="scaleType"\n [gradient]="gradient"\n [curve]="curve"\n />\n </svg:g>\n <svg:g ngx-charts-area-tooltip\n [xSet]="xSet"\n [xScale]="xScale"\n [yScale]="yScale"\n [results]="results"\n [height]="dims.height"\n [colors]="colors"\n (hover)="updateHoveredVertical($event)"\n />\n <svg:g *ngFor="let series of results">\n <svg:g ngx-charts-circle-ceries\n [xScale]="xScale"\n [yScale]="yScale"\n [colors]="colors"\n [activeEntries]="activeEntries"\n [data]="series"\n [scaleType]="scaleType"\n [visibleValue]="hoveredVertical"\n (select)="onClick($event, series)"\n (activate)="onActivate($event)"\n (deactivate)="onDeactivate($event)"\n />\n </svg:g>\n </svg:g>\n </svg:g>\n <svg:g ngx-charts-timeline\n *ngIf="timeline && scaleType === \'time\'"\n [attr.transform]="timelineTransform"\n [results]="results"\n [view]="[timelineWidth, height]"\n [height]="timelineHeight"\n [scheme]="scheme"\n [customColors]="customColors"\n [legend]="legend"\n [scaleType]="scaleType"\n (onDomainChange)="updateDomain($event)">\n <svg:g *ngFor="let series of results; trackBy:trackBy">\n <svg:g ngx-charts-area-series\n [xScale]="timelineXScale"\n [yScale]="timelineYScale"\n [colors]="colors"\n [data]="series"\n [scaleType]="scaleType"\n [gradient]="gradient"\n [curve]="curve"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ', changeDetection:a.ChangeDetectionStrategy.OnPush}),r("design:paramtypes",[])],e)}(p.BaseChartComponent);e.AreaChartComponent=u},"./src/area-chart/area-chart.module.ts":function(t,e,n){"use strict";var i=this&&this.__decorate||function(t,e,n,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,n,a):o(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},o=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(0),a=n("./src/area-chart/area-chart.component.ts");e.AreaChartComponent=a.AreaChartComponent;var s=n("./src/area-chart/area-chart-normalized.component.ts");e.AreaChartNormalizedComponent=s.AreaChartNormalizedComponent;var c=n("./src/area-chart/area-chart-stacked.component.ts");e.AreaChartStackedComponent=c.AreaChartStackedComponent;var p=n("./src/area-chart/area-series.component.ts");e.AreaSeriesComponent=p.AreaSeriesComponent;var l=n("./src/common/chart-common.module.ts"),h=function(){function t(){}return t=i([r.NgModule({imports:[l.ChartCommonModule],declarations:[a.AreaChartComponent,s.AreaChartNormalizedComponent,c.AreaChartStackedComponent,p.AreaSeriesComponent],exports:[a.AreaChartComponent,s.AreaChartNormalizedComponent,c.AreaChartStackedComponent,p.AreaSeriesComponent]}),o("design:paramtypes",[])],t)}();e.AreaChartModule=h},"./src/area-chart/area-series.component.ts":function(t,e,n){"use strict";var i=this&&this.__decorate||function(t,e,n,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,n,a):o(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},o=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(0),a=n("./src/d3.ts"),s=n("./src/utils/sort.ts"),c=function(){function t(){this.stacked=!1,this.normalized=!1,this.select=new r.EventEmitter}return t.prototype.ngOnChanges=function(t){this.update()},t.prototype.update=function(){var t=this;this.updateGradient();var e,n,i=function(e){var n=e.name;return t.xScale(n)};this.stacked||this.normalized?(e=a.default.area().x(i).y0(function(e,n){return t.yScale(e.d0)}).y1(function(e,n){return t.yScale(e.d1)}),n=a.default.area().x(i).y0(function(e){return t.yScale.range()[0]}).y1(function(e){return t.yScale.range()[0]})):(e=a.default.area().x(i).y0(function(){return t.yScale.range()[0]}).y1(function(e){return t.yScale(e.value)}),n=a.default.area().x(i).y0(function(e){return t.yScale.range()[0]}).y1(function(e){return t.yScale.range()[0]})),e.curve(this.curve),n.curve(this.curve),this.opacity=.8;var o=this.data.series;o="linear"===this.scaleType?s.sortLinear(o,"name"):"time"===this.scaleType?s.sortByTime(o,"name"):s.sortByDomain(o,"name","asc",this.xScale.domain()),this.path=e(o),this.startingPath=n(o)},t.prototype.updateGradient=function(){if("linear"===this.colors.scaleType)if(this.hasGradient=!0,this.stacked||this.normalized){var t=this.data.series.map(function(t){return t.d0}),e=this.data.series.map(function(t){return t.d1}),n=Math.max.apply(Math,e),i=Math.min.apply(Math,t);this.gradientStops=this.colors.getLinearGradientStops(n,i)}else{var o=this.data.series.map(function(t){return t.value}),n=Math.max.apply(Math,o);this.gradientStops=this.colors.getLinearGradientStops(n)}else this.hasGradient=!1,this.gradientStops=void 0},t.prototype.isActive=function(t){if(!this.activeEntries)return!1;var e=this.activeEntries.find(function(e){return t.name===e.name});return void 0!==e},t.prototype.isInactive=function(t){if(!this.activeEntries||0===this.activeEntries.length)return!1;var e=this.activeEntries.find(function(e){return t.name===e.name});return void 0===e},i([r.Input(),o("design:type",Object)],t.prototype,"data",void 0),i([r.Input(),o("design:type",Object)],t.prototype,"xScale",void 0),i([r.Input(),o("design:type",Object)],t.prototype,"yScale",void 0),i([r.Input(),o("design:type",Object)],t.prototype,"colors",void 0),i([r.Input(),o("design:type",Object)],t.prototype,"scaleType",void 0),i([r.Input(),o("design:type",Boolean)],t.prototype,"stacked",void 0),i([r.Input(),o("design:type",Boolean)],t.prototype,"normalized",void 0),i([r.Input(),o("design:type",Object)],t.prototype,"gradient",void 0),i([r.Input(),o("design:type",Object)],t.prototype,"curve",void 0),i([r.Input(),o("design:type",Array)],t.prototype,"activeEntries",void 0),i([r.Output(),o("design:type",Object)],t.prototype,"select",void 0),t=i([r.Component({selector:"g[ngx-charts-area-series]",template:'\n <svg:g ngx-charts-area\n class="area-series"\n [data]="data"\n [path]="path"\n [fill]="colors.getColor(data.name)"\n [stops]="gradientStops"\n [startingPath]="startingPath"\n [opacity]="opacity"\n [gradient]="gradient || hasGradient"\n [class.active]="isActive(data)"\n [class.inactive]="isInactive(data)"\n />\n ',changeDetection:r.ChangeDetectionStrategy.OnPush}),o("design:paramtypes",[])],t)}();e.AreaSeriesComponent=c},"./src/area-chart/index.ts":function(t,e,n){"use strict";function i(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}i(n("./src/area-chart/area-chart.module.ts")),i(n("./src/area-chart/area-chart.component.ts")),i(n("./src/area-chart/area-chart-normalized.component.ts")),i(n("./src/area-chart/area-chart-stacked.component.ts")),i(n("./src/area-chart/area-series.component.ts"))},"./src/bar-chart/bar-chart.module.ts":function(t,e,n){"use strict";var i=this&&this.__decorate||function(t,e,n,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,n,a):o(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},o=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},r=n(0),a=n("./src/common/chart-common.module.ts"),s=n("./src/bar-chart/bar.component.ts");e.BarComponent=s.BarComponent;var c=n("./src/bar-chart/bar-horizontal.component.ts");e.BarHorizontalComponent=c.BarHorizontalComponent;var p=n("./src/bar-chart/bar-horizontal-2d.component.ts");e.BarHorizontal2DComponent=p.BarHorizontal2DComponent;var l=n("./src/bar-chart/bar-horizontal-normalized.component.ts");e.BarHorizontalNormalizedComponent=l.BarHorizontalNormalizedComponent;var h=n("./src/bar-chart/bar-horizontal-stacked.component.ts");e.BarHorizontalStackedComponent=h.BarHorizontalStackedComponent;var d=n("./src/bar-chart/bar-vertical.component.ts");e.BarVerticalComponent=d.BarVerticalComponent;var u=n("./src/bar-chart/bar-vertical-2d.component.ts");e.BarVertical2DComponent=u.BarVertical2DComponent;var g=n("./src/bar-chart/bar-vertical-normalized.component.ts");e.BarVerticalNormalizedComponent=g.BarVerticalNormalizedComponent;var m=n("./src/bar-chart/bar-vertical-stacked.component.ts");e.BarVerticalStackedComponent=m.BarVerticalStackedComponent;var f=n("./src/bar-chart/series-horizontal.component.ts");e.SeriesHorizontal=f.SeriesHorizontal;var y=n("./src/bar-chart/series-vertical.component.ts");e.SeriesVerticalComponent=y.SeriesVerticalComponent;var v=function(){function t(){}return t=i([r.NgModule({imports:[a.ChartCommonModule],declarations:[s.BarComponent,c.BarHorizontalComponent,p.BarHorizontal2DComponent,l.BarHorizontalNormalizedComponent,h.BarHorizontalStackedComponent,d.BarVerticalComponent,u.BarVertical2DComponent,g.BarVerticalNormalizedComponent,m.BarVerticalStackedComponent,f.SeriesHorizontal,y.SeriesVerticalComponent],exports:[s.BarComponent,c.BarHorizontalComponent,p.BarHorizontal2DComponent,l.BarHorizontalNormalizedComponent,h.BarHorizontalStackedComponent,d.BarVerticalComponent,u.BarVertical2DComponent,g.BarVerticalNormalizedComponent,m.BarVerticalStackedComponent,f.SeriesHorizontal,y.SeriesVerticalComponent]}),o("design:paramtypes",[])],t)}();e.BarChartModule=v},"./src/bar-chart/bar-horizontal-2d.component.ts":function(t,e,n){"use strict";var i=this&&this.__extends||function(t,e){function n(){this.constructor=t}for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)},o=this&&this.__decorate||function(t,e,n,i){var o,r=arguments.length,a=r<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(r<3?o(a):r>3?o(e,n,a):o(e,n))||a);return r>3&&a&&Object.defineProperty(e,n,a),a},r=this&&this.__metadata||function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},a=n(0),s=n("./src/common/view-dimensions.helper.ts"),c=n("./src/common/color.helper.ts"),p=n("./src/common/base-chart.component.ts"),l=n("./src/d3.ts"),h=function(t){function e(){t.apply(this,arguments),this.legend=!1,this.showGridLines=!0,this.activeEntries=[],this.activate=new a.EventEmitter,this.deactivate=new a.EventEmitter,this.margin=[10,20,10,20],this.xAxisHeight=0,this.yAxisWidth=0}return i(e,t),e.prototype.update=function(){var e=this;t.prototype.update.call(this),this.zone.run(function(){e.dims=s.calculateViewDimensions({width:e.width,height:e.height,margins:e.margin,showXAxis:e.xAxis,showYAxis:e.yAxis,xAxisHeight:e.xAxisHeight,yAxisWidth:e.yAxisWidth,showXLabel:e.showXAxisLabel,showYLabel:e.showYAxisLabel,showLegend:e.legend,legendType:e.schemeType}),e.formatDates(),e.groupDomain=e.getGroupDomain(),e.innerDomain=e.getInnerDomain(),e.valuesDomain=e.getValueDomain(),e.groupScale=e.getGroupScale(),e.innerScale=e.getInnerScale(),e.valueScale=e.getValueScale(),e.setColors(),e.legendOptions=e.getLegendOptions(),e.transform="translate("+e.dims.xOffset+" , "+e.margin[0]+")"})},e.prototype.getGroupScale=function(){var t=.2;return l.default.scaleBand().rangeRound([this.dims.height,0]).paddingInner(t).paddingOuter(t/2).domain(this.groupDomain)},e.prototype.getInnerScale=function(){var t=.2;return l.default.scaleBand().rangeRound([0,this.groupScale.bandwidth()]).paddingInner(t).domain(this.innerDomain)},e.prototype.getValueScale=function(){return l.default.scaleLinear().range([0,this.dims.width]).domain(this.valuesDomain)},e.prototype.getGroupDomain=function(){for(var t=[],e=0,n=this.results;e<n.length;e++){var i=n[e];t.includes(i.name)||t.push(i.name)}return t},e.prototype.getInnerDomain=function(){for(var t=[],e=0,n=this.results;e<n.length;e++)for(var i=n[e],o=0,r=i.series;o<r.length;o++){var a=r[o];t.includes(a.name)||t.push(a.name)}return t},e.prototype.getValueDomain=function(){for(var t=[],e=0,n=this.results;e<n.length;e++)for(var i=n[e],o=0,r=i.series;o<r.length;o++){var a=r[o];t.includes(a.value)||t.push(a.value)}var s=Math.min.apply(Math,[0].concat(t)),c=Math.max.apply(Math,t);return[s,c]},e.prototype.groupTransform=function(t){return"translate(0, "+this.groupScale(t.name)+")"},e.prototype.onClick=function(t,e){e&&(t.series=e.name),this.select.emit(t)},e.prototype.trackBy=function(t,e){return e.name},e.prototype.setColors=function(){var t;t="ordinal"===this.schemeType?this.innerDomain:this.valuesDomain,this.colors=new c.ColorHelper(this.scheme,this.schemeType,t,this.customColors)},e.prototype.getLegendOptions=function(){var t={scaleType:this.schemeType,colors:void 0,domain:[]};return"ordinal"===t.scaleType?(t.domain=this.innerDomain,t.colors=this.colors):(t.domain=this.valuesDomain,t.colors=this.colors.scale),t},e.prototype.updateYAxisWidth=function(t){var e=t.width;this.yAxisWidth=e,this.update()},e.prototype.updateXAxisHeight=function(t){var e=t.height;this.xAxisHeight=e,this.update()},e.prototype.onActivate=function(t,e){var n=Object.assign({},t);e&&(n.series=e.name);var i=this.activeEntries.findIndex(function(t){return t.name===n.name&&t.value===n.value&&t.series===n.series});i>-1||(this.activeEntries=[n].concat(this.activeEntries),this.activate.emit({value:n,entries:this.activeEntries}))},e.prototype.onDeactivate=function(t,e){var n=Object.assign({},t);e&&(n.series=e.name);var i=this.activeEntries.findIndex(function(t){return t.name===n.name&&t.value===n.value&&t.series===n.series});this.activeEntries.splice(i,1),this.activeEntries=this.activeEntries.slice(),this.deactivate.emit({value:t,entries:this.activeEntries})},o([a.Input(),r("design:type",Object)],e.prototype,"legend",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"xAxis",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"yAxis",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"showXAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"showYAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"xAxisLabel",void 0),o([a.Input(),r("design:type",Object)],e.prototype,"yAxisLabel",void 0),o([a.Input(),r("design:type",Boolean)],e.prototype,"gradient",void 0),o([a.Input(),r("design:type",Boolean)],e.prototype,"showGridLines",void 0),o([a.Input(),r("design:type",Array)],e.prototype,"activeEntries",void 0),o([a.Input(),r("design:type",String)],e.prototype,"schemeType",void 0),o([a.Output(),r("design:type",a.EventEmitter)],e.prototype,"activate",void 0),o([a.Output(),r("design:type",a.EventEmitter)],e.prototype,"deactivate",void 0),e=o([a.Component({selector:"ngx-charts-bar-horizontal-2d",template:'\n <ngx-charts-chart\n [view]="[width, height]"\n [showLegend]="legend"\n [legendOptions]="legendOptions"\n [activeEntries]="activeEntries"\n (legendLabelActivate)="onActivate($event)"\n (legendLabelDeactivate)="onDeactivate($event)"\n (legendLabelClick)="onClick($event)">\n <svg:g [attr.transform]="transform" class="bar-chart chart">\n <svg:g ngx-charts-grid-panel-series\n [xScale]="valueScale"\n [yScale]="groupScale"\n [data]="results"\n [dims]="dims"\n orient="horizontal">\n </svg:g>\n <svg:g ngx-charts-x-axis\n *ngIf="xAxis"\n [xScale]="valueScale"\n [dims]="dims"\n [showGridLines]="showGridLines"\n [showLabel]="showXAxisLabel"\n [labelText]="xAxisLabel"\n (dimensionsChanged)="updateXAxisHeight($event)">\n </svg:g>\n <svg:g ngx-charts-y-axis\n *ngIf="yAxis"\n [yScale]="groupScale"\n [dims]="dims"\n [showLabel]="showYAxisLabel"\n [labelText]="yAxisLabel"\n (dimensionsChanged)="updateYAxisWidth($event)">\n </svg:g>\n <svg:g\n *ngFor="let group of results; trackBy:trackBy"\n [@animationState]="\'active\'"\n [attr.transform]="groupTransform(group)">\n <svg:g ngx-charts-series-horizontal\n [xScale]="valueScale"\n [activeEntries]="activeEntries"\n [yScale]="innerScale"\n [colors]="colors"\n [series]="group.series"\n [dims]="dims"\n [gradient]="gradient"\n (select)="onClick($event, group)"\n (activate)="onActivate($event, group)"\n (deactivate)="onDeactivate($event, group)"\n />\n </svg:g>\n </svg:g>\n </ngx-charts-chart>\n ',changeDetection:a.ChangeDetectionStrategy.OnPush,animations:[a.trigger("animationState",[a.transition("* => void",[a.style({opacity:1,tr