HighchartsNoData import Highcharts from "highcharts"; import HighchartsNoData from "highcharts/modules/no-data-to-display"; HighchartsNoData(Highcharts); const config = highchartsNoData(); Highcharts.chart(el, config); export function highchartsNoData() { return { title: { text: '' }, credits: { enabled: false }, chart: { backgroundColor: "rgba(18 ,126, 250,0.2)", marginLeft: 60 }, lang: { noData: "暂无数据" }, noData: { attr: {}, //Object,没有数据标签的 SVG 属性集合 position: { x: 0, y: 0, align: "center", verticalAlign: "middle" }, style: { fontSize: "1rem", fontWeight: "bold", color: "#fff" }, useHTML: false } }; } chartsNoData const myChart = echarts.init(document.getElementById("el")); myChart.setOption(echartsNoData); export const echartsNoData = () => { return { title: { text: "暂无数据", x: "center", y: "center", textStyle: { color: "#ccc", fontWeight: "normal", fill: "#9d9d9d", fontWeight: "bold", text: "暂无数据", fontFamily: "Microsoft YaHei", fontSize: "1rem" } } }; }