Cannot read properties of null (reading 'getContext') at new EchartsDropdownComponent

πŸ‘:0

You should place the chart creation code inside the method ngAfterViewInit and don’t forget to specify the chart type.

export class EchartsDropdownComponent implements AfterViewInit, OnChanges {

  ngAfterViewInit() {
    myChart = new Chart('myChart', {
      type: 'scatter', // <- define the chart type
      data: {
        datasets: [{
          label: 'Scatter Dataset',
          ...
  }

Leave a comment