Mercurial > hg > ugly-duckling
annotate src/app/visualisations/vertical-binned.component.ts @ 473:de23ea6bcd0d
Add vertical binned scale for matrix shapes. Requires waves-ui-piper
update
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Fri, 30 Jun 2017 12:08:50 +0100 |
parents | |
children |
rev | line source |
---|---|
cannam@473 | 1 /** |
cannam@473 | 2 * Created by lucas on 01/06/2017. |
cannam@473 | 3 */ |
cannam@473 | 4 import {VerticalBinNameRenderer} from './waves-base.component'; |
cannam@473 | 5 import { |
cannam@473 | 6 ChangeDetectionStrategy, |
cannam@473 | 7 Component, |
cannam@473 | 8 ContentChildren, |
cannam@473 | 9 QueryList, |
cannam@473 | 10 AfterViewInit |
cannam@473 | 11 } from '@angular/core'; |
cannam@473 | 12 |
cannam@473 | 13 @Component({ |
cannam@473 | 14 selector: 'ugly-vertical-binned', |
cannam@473 | 15 template: '<ng-content></ng-content>', |
cannam@473 | 16 changeDetection: ChangeDetectionStrategy.OnPush |
cannam@473 | 17 }) |
cannam@473 | 18 export class VerticalBinnedComponent implements AfterViewInit { |
cannam@473 | 19 |
cannam@473 | 20 @ContentChildren( |
cannam@473 | 21 VerticalBinNameRenderer |
cannam@473 | 22 ) bounded: QueryList<VerticalBinNameRenderer>; |
cannam@473 | 23 protected cachedBinNames: string[]; |
cannam@473 | 24 |
cannam@473 | 25 ngAfterViewInit(): void { |
cannam@473 | 26 this.bounded.forEach(component => { |
cannam@473 | 27 this.cachedBinNames = component.binNames; |
cannam@473 | 28 if (this.cachedBinNames) { |
cannam@473 | 29 component.renderNames(this.cachedBinNames); |
cannam@473 | 30 } |
cannam@473 | 31 }); |
cannam@473 | 32 } |
cannam@473 | 33 } |