尝试使用最新版本的ApexCharts库,检查是否已解决此问题。
如果问题仍然存在,请使用以下代码设置标记:
options: {
chart: {
type: 'bar',
height: 350
},
plotOptions: {
bar: {
dataLabels: {
position: 'top', // 文本位置
offsetY: -10, // 偏移量
}
}
},
dataLabels: {
enabled: true,
formatter: function (val) {
return val + "%";
},
offsetY: -20,
style: {
fontSize: '12px',
colors: ["#304758"]
}
},
series: [{
name: 'Series 1',
data: [44, 55, 41, 67, 22, 43]
}, {
name: 'Series 2',
data: [13, 23, 20, 8, 13, 27]
}, {
name: 'Series 3',
data: [11, 17, 15, 15, 21, 14]
}, {
name: 'Series 4',
data: [21, 7, 25, 13, 22, 8]
}],
xaxis: {
categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun'],
position: 'top', // 文本位置
axisBorder: {
show: false
},
axisTicks: {
show: false
},
crosshairs: {
fill: {
type: 'gradient',
gradient: {
colorFrom: '#D8E3F0',
colorTo: '#BED1E6',
stops: [0, 100],
opacityFrom: 0.4,
opacityTo: 0.5,
}
}
},
tooltip: {
enabled: true,
}
},
yaxis: {
axisBorder: {
show: false
},
axisTicks: {
show: false,