Echart初始化问题

时间:2019-03-11 18:17:51

标签: charts set option options init

当我在angular 6 vs代码编译器中初始化echart时显示错误:

  

[ts]
  类型'Element'的参数不能分配给类型'HTMLDivElement | HTMLCanvasElement'。
    类型“元素”缺少类型“ HTMLCanvasElement”中的以下属性:高度,宽度,getContext,toBlob和其他114个属性。 [2345]

import { Component,OnInit, AfterViewInit,AfterContentInit,AfterViewChecked} 
from '@angular/core';
import { Title }     from '@angular/platform-browser';
import { HttpClient } from "@angular/common/http";
import * as echarts from 'echarts';
import { graphic } from 'echarts';
export class BarChart1Component implements OnInit, AfterViewChecked {
    var chart = document.querySelector("#chart1");
    this.myChart = echarts.init(chart);
    this.myChart.setOption(this.options);
}

0 个答案:

没有答案