option = { grid: { left: "5%", right: "5%", bottom: "12%", top: "5%", containLabel: true }, tooltip: { show: true, textStyle: { fontWeight: "bold", fontSize: 16 } }, yAxis: [ { type: "category", inverse: true, axisLabel: { show: true, color: "#8f919e", fontSize: 15 }, splitLine: { show: false, lineStyle: { color: "#e7e9ef" } }, axisLine: { show: true, lineStyle: { color: "#707070", width: 0 } }, axisTick: { show: false }, data: ["苹果", "草莓", "西瓜", "葡萄", "榴莲"] } ], xAxis: [ { type: "value", axisTick: { show: false }, min: 0, axisLine: { show: true, lineStyle: { color: "#707070", width: 0 } }, splitLine: { show: true, lineStyle: { color: "#e7e9ef", type: "dashed" } }, nameTextStyle: { color: "red" }, name: "", axisLabel: { inside: false, textStyle: { color: "#8f919e", fontSize: 14 }, interval: 0 } } ], series: [ { type: "bar", stack: "1", barWidth: 12, barBorderRadius: 30, showBackground: true, backgroundStyle: { color: 'rgba(228, 237, 248, 1)', borderRadius: 7 }, itemStyle: { normal: { barBorderRadius: 20, color: function() { return { type: "linear", x: 1, y: 0, x2: 0, y2: 0, colorStops: [ { offset: 0, color: "#457fff" // 0% 处的颜色 }, { offset: 0.9, color: "#0f0" // 100% 处的颜色 } ] }; } } }, data: [50, 150, 100, 200, 300] } ] };