用线性渐变,
style: api.style({
stroke: new echarts.graphic.LinearGradient(
0,
0,
0,
1,
[
{
offset: 0,
color: 'red',
},
{
offset: 0.2,
color: 'red',
},
{
offset: 0.2,
color: 'transparent',
},
{
offset: 0.4,
color: 'transparent',
},
{
offset: 0.4,
color: 'red',
},
{
offset: 0.6,
color: 'red',
},
{
offset: 0.6,
color: 'transparent',
},
{
offset: 0.8,
color: 'transparent',
},
{
offset: 0.8,
color: 'red',
},
{
offset: 1,
color: 'red',
},
],
false
),
lineWidth: 4,
}),