title: how to render canvas in angular4
body: <p>I have working with angular4 and ng2 chart. i need to show the text inside the canvas center of doughnut chart.I am new to angular4 canvas.</p>
  
  <pre><code>Here is my app.component:
  
      export class AppComponent {
  
        @ViewChild("layout") layout: ElementRef; 
  
  
        ngAfterViewInit() {
  
          let canvas = this.layout.nativeElement;
  
          let context: CanvasRenderingContext2D = this.layout.nativeElement.getContext("2d");
          var x = canvas.width / 2;
          var y = canvas.height / 2;
  
          context.font = '90pt Calibri';
          context.textAlign = 'center';
          context.fillStyle = 'blue';
          context.fillText('Hello Worldetrereygerhg!', x, y);
  
        }
  
  
  here is my app.component.html
  
  
  &lt;div style="display: block; background-color: #e2d8d8;"&gt;
    &lt;canvas  baseChart
                [data]="doughnutChartData"
                [colors]="doughnutChartColors"
                [labels]="doughnutChartLabels"
                [chartType]="doughnutChartType"
                (chartHover)="chartHovered1($event)"
                (chartClick)="chartClicked1($event)"  #layout &gt;&lt;/canvas&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>i have tried the above code nothing works?the text is not showing anywhere in the canvas.
      How to add the text center of dough nut chart.?</p>
  
  <pre><code>Library using:
  
  [https://valor-software.com/ng2-charts/][1] 
  Doughnut
  
  
    [1]: https://valor-software.com/ng2-charts/
  </code></pre>