view src/app/visualisations/instants/instants.component.ts @ 405:3ace7672638b

Angular DI can't figure out these are derived from WavesComponent. Add provider for base.
author Lucas Thompson <dev@lucas.im>
date Sun, 04 Jun 2017 20:15:20 +0100
parents afe2fa4a3215
children 64ed45a0bad3
line wrap: on
line source
/**
 * Created by lucast on 31/05/2017.
 */
import {WavesComponent} from '../waves-base.component';
import {
  ChangeDetectionStrategy,
  Component,
  Input,
} from '@angular/core';
import {Instant} from '../FeatureUtilities';
import Waves from 'waves-ui-piper';

@Component({
  selector: 'ugly-instants',
  templateUrl: '../waves-template.html',
  styleUrls: ['../waves-template.css'],
  changeDetection: ChangeDetectionStrategy.OnPush,
  providers: [
    {provide: WavesComponent, useExisting: InstantsComponent}
  ]
})
export class InstantsComponent extends WavesComponent<Instant[]> {
  @Input() set instants(instants: Instant[]) {
    this.feature = instants;
  }

  protected get featureLayers(): Layer[] {
    return [
      new Waves.helpers.TickLayer(
        this.feature,
        {
          height: this.height,
          color: this.colour,
          labelPosition: 'bottom',
          shadeSegments: true
        }
      )
    ];
  }
}