Guest User

Untitled

a guest
Feb 24th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import {Component, OnInit, ViewChild, Input, ElementRef} from '@angular/core';
  2.  
  3. import {ChartService, ComparisonData} from '../../core/services/chart.service';
  4.  
  5. @Component({
  6. selector: 'custom-chart',
  7. template: '<canvas #myCanvas></canvas>'
  8. })
  9. export class CustomComponent implements OnInit {
  10.  
  11. @ViewChild('myCanvas') canvasRef: ElementRef;
  12. @Input() data: ComparisonData;
  13.  
  14. constructor(
  15. private chartService: ChartService
  16. ) {}
  17.  
  18. ngOnInit(): void {
  19. this.chartService.drawComparisonChart(this.canvasRef, this.data);
  20. }
  21. }
Add Comment
Please, Sign In to add comment