Home > Net >  How to add gradient color in echarts?
How to add gradient color in echarts?

Time:10-12

I made a echart enter image description here

In this enter image description here

It gave this error: enter image description here

What to do?

Thanks in advance.

CodePudding user response:

  areaStyle: {
          color: new graphic.LinearGradient(0, 0, 0, 1, [
            {
              offset: 0,
              color: 'rgb(255, 158, 68)'
            },
            {
              offset: 1,
              color: 'rgb(255, 70, 131)'
            }])
        }

Echart has graphic class, which gives you access to the Gradient Property. You can fine tune it to your needs giving start and end points to the colors in array.

  • Related