UNPKG

@swimlane/ngx-charts

Version:

Declarative Charting Framework for Angular2 and beyond!

58 lines 2.7 kB
"use strict"; var core_1 = require('@angular/core'); var TreeMapCellSeriesComponent = (function () { function TreeMapCellSeriesComponent() { this.select = new core_1.EventEmitter(); } TreeMapCellSeriesComponent.prototype.ngOnChanges = function (changes) { this.cells = this.getCells(); }; TreeMapCellSeriesComponent.prototype.getCells = function () { var _this = this; return this.data.children .filter(function (d) { return d.depth === 1; }) .map(function (d, index) { var label = d.id; return { x: d.x0, y: d.y0, width: d.x1 - d.x0, height: d.y1 - d.y0, fill: _this.colors.getColor(label), label: label, value: d.value, valueType: d.valueType }; }); }; TreeMapCellSeriesComponent.prototype.getTooltipText = function (_a) { var label = _a.label, value = _a.value; return "\n <span class=\"tooltip-label\">" + label + "</span>\n <span class=\"tooltip-val\">" + value.toLocaleString() + "</span>\n "; }; TreeMapCellSeriesComponent.prototype.onClick = function (data) { this.select.emit(data); }; TreeMapCellSeriesComponent.prototype.trackBy = function (index, item) { return item.label; }; TreeMapCellSeriesComponent.decorators = [ { type: core_1.Component, args: [{ selector: 'g[ngx-charts-tree-map-cell-series]', template: "\n <svg:g ngx-charts-tree-map-cell *ngFor=\"let c of cells; trackBy:trackBy\"\n [x]=\"c.x\"\n [y]=\"c.y\"\n [width]=\"c.width\"\n [height]=\"c.height\"\n [fill]=\"c.fill\"\n [label]=\"c.label\"\n [value]=\"c.value\"\n [valueType]=\"c.valueType\"\n (select)=\"onClick($event)\"\n ngx-tooltip\n [tooltipPlacement]=\"'top'\"\n [tooltipType]=\"'tooltip'\"\n [tooltipTitle]=\"getTooltipText(c)\"\n />\n ", changeDetection: core_1.ChangeDetectionStrategy.OnPush },] }, ]; /** @nocollapse */ TreeMapCellSeriesComponent.ctorParameters = function () { return []; }; TreeMapCellSeriesComponent.propDecorators = { 'data': [{ type: core_1.Input },], 'dims': [{ type: core_1.Input },], 'colors': [{ type: core_1.Input },], 'select': [{ type: core_1.Output },], }; return TreeMapCellSeriesComponent; }()); exports.TreeMapCellSeriesComponent = TreeMapCellSeriesComponent; //# sourceMappingURL=tree-map-cell-series.component.js.map