1

如何apexchart在 Angular 7 中使用?有人可以在打字稿中实现它吗?我正在 Angular 中搜索它的打字稿实现,但我无法做到。我的 Angular 版本是 7.2.4。

4

3 回答 3

0

您可以在以下链接中找到使用 Angular 实现 ApexCharts 的正确步骤。 https://apexcharts.com/docs/angular-charts/

有关为 ApexCharts 设置项目的详细信息,请参阅此博客,您还可以查看一个示例来生成不同类型的图表。

中型博客

于 2020-06-24T08:07:35.483 回答
0

npm 上似乎有 Apexcharts 的包装器。欲了解更多信息:https ://github.com/apexcharts/ng-apexcharts

使用示例:https ://ngapexcharts-demo.stackblitz.io/

于 2019-05-03T16:44:50.647 回答
0

根据https://apexcharts.com/docs/installation上的 Apexcharts 文档

首先:你需要安装包:npm i apexcharts

再次根据文档,您需要定义要用作的 ApexCharts 类型: import ApexCharts from 'apexcharts'

如果这对您有用,请继续。但是,如果您收到“...没有默认导出”错误,则需要如下定义:
import ApexCharts from 'apexcharts/dist/apexcharts.common.js'

然后你需要一个 html 元素来绑定你的图表:

最后以适当的方法创建图表选项并按如下方式呈现:

const options = {
  chart: {
    height: 300,
    type: 'line'
  },
  series: [{
    name: 'sales',
    data: [30, 40, 35, 50, 49, 60, 70, 91, 125]
  }],
  xaxis: {
    categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]
  }
}

const chart = new ApexCharts(document.querySelector("#chart"), options);
chart.render();

您的图表将如下图所示

于 2020-01-16T14:17:40.263 回答