Angular 5 ChartJS 2.5-无法正确解析符号“图表”。无法发布

时间:2018-09-20 19:48:13

标签: angular visual-studio-2017 chart.js resharper

我在程序中实现了ChartJS。我得到了错误

  

符号“图表”无法正确解析,可能是因为它位于无法访问的模块中。

我将此归类为ReSharper错误,因为我能够进行编译和发布。但是,现在我正在尝试实现动态数据更新,这很适合我。

this.chart = new Chart(this.bin.id + "_canvas",  //<--- 'Chart' IS HIGHLIGHTED IN RED
  {                                              //(symbol 'Chart' cannot be resolved)
    type: "line",
    data: {
      labels: timestamps,
      datasets: [
        {
          data: measurements,
          borderColor: "#3cba9f",
          fill: false
        }
      ]
    },
    //etc...
  }
);

这很好。但是,如果我尝试这样做:

this.chart.data.datasets.push({    //<<--- 'Data' is highlighted in red
  data: newData,                   // (Symbol 'Data' cannot be resolved)
  borderColor: "#f2897d",
  fill: false
});

this.chart.update();               //<<--- 'Update()' is throwing an error
                                   // (Property 'update()' does not exist on type 'any[]'.)

我在CLI中看到了重复出现的错误。当我尝试发布时,它会失败。

Visual Studio还说import { Chart } from "chart.js"变灰了,并说“从未使用过导入'图表'。”

0 个答案:

没有答案