先上效果图
再上具体参数
const option = {
xAxis: {
type: 'category',
data: ['1月','2月','3月'],
axisLabel: {
textStyle: {
color: '#E6F7FF',
fontSize: '14px'
}
}
},
yAxis: {
type: 'value',
splitLine: {
lineStyle: {
type: "solid",
color: ["rgba(255,255,255,0.1)"],
},
show: true,
},
axisLabel: {
textStyle: {
color: '#E6F7FF',
fontSize: '14px'
}
}
},
grid: {
left: '40px', // 左侧内边距
right: 0, // 右侧内边距
bottom: '40px', // 底部内边距
top: '30px',
},
series: [
{
data: [1,2,3],
type: 'bar',
barWidth: '13.91px',
itemStyle: {
color: {
type: "linearGradient", // 设置渐变类型
shadowColor: "#159AFF",
x1: 0,
y1: 0,
x2: 1,
y2: 1,
colorStops: [
{
// 设置渐变颜色
offset: 0,
color: "rgba(0, 58, 255, 0.2)", // 结束颜色为蓝色
},
{
offset: 1,
color: "#159AFF", // 起始颜色为红色
},
],
},
},
shadowColor: 'inset 0px 3px 0px 0px #159AFF',
silent: true,
markPoint: {
data:[
{
symbol: "rect",
symbolSize: [14, 2.5],
xAxis: '1月', //x轴内容
yAxis: '1', // y轴高度
itemStyle: {
color: "rgba(21, 154, 255, 1)",
}
},
{
symbol: "rect",
symbolSize: [14, 2.5],
xAxis: '2月', //x轴内容
yAxis: '2', // y轴高度
itemStyle: {
color: "rgba(21, 154, 255, 1)",
}
},
{
symbol: "rect",
symbolSize: [14, 2.5],
xAxis: '3月', //x轴内容
yAxis: '3', // y轴高度
itemStyle: {
color: "rgba(21, 154, 255, 1)",
}
}
]
}
}
]
}
}