-
使用v-chart
<v-chart :option="option" autoresize ref="chartRef"/>
-
option实现
const option = reactive({ grid: { top: '2%', left: 90, right: '4%', bottom: '3%', containLabel: false, // 图表不包含label 如果设置成true,label小于80时则不能撑满,使用rich也不好实现 }, yAxis: { type: 'category', inverse: true, data: props.barData?.map(m => m.name), axisLabel: { interval: 0, width: 80, overflow: 'truncate', // 超出部分隐藏 }, axisTick: { show: false // 隐藏刻度线 }, splitLine: { show: false // 隐藏分隔线 } }, })