官网矩形:https://echarts.apache.org/zh/option.html#graphic.elements-rect
const rectObj = {
id: 'rect_id',
type: 'rect',
style: {
fill: {
type: 'linear',
x: 0,
y: 0,
x2: 1,
y2: 0,
colorStops: [
{
offset: 0, color: 'yellow'
},
{
offset: 1, color: 'pink'
}
]
}
},
shape: {
x: 20,
y: 20,
width: 40,
height: 60,
r: 2
},
textContent: {
style: {
text: 'rect',
fill: '#ffffff',
fontSize: 12,
font: 'Microsoft YaHei',
fontWeight: 400,
lineHeight: 32
},
z: 100
},
textConfig: {
position: 'inside'
},
z: 100
};