此问题可能是由于缺少正确的库或未正确配置导出模块而引起的。请确保您有最新版本的amcharts4-exporting和amcharts4-extensions库,并在引用amcharts4时正确配置导出模块。
例如,以下代码演示如何正确配置导出模块:
import * as am4core from "@amcharts/amcharts4/core"; import * as am4charts from "@amcharts/amcharts4/charts"; import * as am4themes_animated from "@amcharts/amcharts4/themes/animated"; import * as am4plugins_export from "@amcharts/amcharts4/plugins/export"; import am4themes_myTheme from "./myTheme";
// Activate theme am4core.useTheme(am4themes_myTheme); am4core.useTheme(am4themes_animated);
// Create chart let chart = am4core.create("chartdiv", am4charts.XYChart);
// Add data and configure chart
// Add export menu chart.exporting.menu = new am4plugins_export.ExportMenu(); chart.exporting.menu.align = "left"; chart.exporting.menu.verticalAlign = "bottom";