需要在项目中安装 am4themes_animated 包,并在需要使用该主题的文件中添加正确的导入语句。例如:
安装 am4themes_animated:
npm install am4themes_animated
在需要使用该主题的文件中添加导入语句:
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
在使用 amCharts 绘图之前,需要调用 am4core.useTheme 函数来加载主题:
import * as am4core from "@amcharts/amcharts4/core";
import * as am4charts from "@amcharts/amcharts4/charts";
import am4themes_animated from "@amcharts/amcharts4/themes/animated";
// 加载主题
am4core.useTheme(am4themes_animated);
// 创建图表
let chart = am4core.create("chartdiv", am4charts.XYChart);
// ...
下一篇:am5728debian