您使用的是旧版本的 ApexCharts (2.2.4)。我建议您使用此 CDN 链接将其替换为最新版本 - https://cdn.jsdelivr.net/npm/apexcharts
这是图表的更新配置
var options = {
chart: {
type: "bar",
stacked: true,
height: 300
},
plotOptions: {
bar: {
barHeight: "90%",
distributed: true,
horizontal: true
}
},
stroke: {
width: 1,
colors: ["#fff"]
},
series: [
{
name: "Monday 7th January 2019",
data: [0.02, 0.01, 0.01]
},
{
name: "Tuesday 8th January 2019",
data: [0.02, 0.01, 0.01]
},
{
name: "Wednesday 9th January 2019",
data: [0.01, 0.02, 0.0]
}
],
xaxis: {
categories: ["England", "Scotland", "Wales"],
title: {
text: "Average"
},
labels: {
formatter: function(val) {
return val;
}
}
},
dataLabels: {
enabled: false
},
yaxis: {},
tooltip: {
theme: "light",
x: {
show: true
}
}
};
var chart = new ApexCharts(document.querySelector("#statChart"), options);
chart.render();
产生这个结果
工作CodePen 示例