一、第一种

  1. series: [{
  2. name: downDate[0].name,
  3. type: 'bar',
  4. data: downDate,
  5. itemStyle: {
  6. color: colors[0]
  7. },
  8. barWidth: '30%',
  9. itemStyle: {
  10. normal: {
  11. barBorderRadius: [10, 10, 0, 0],
  12. color: new eCharts.graphic.LinearGradient(
  13. 0, 0, 0, 1, [
  14. { offset: 0, color: '#06B5D7' }, //柱图渐变色
  15. { offset: 1, color: '#454EF0' }, //柱图渐变色
  16. ]
  17. )
  18. },
  19. }
  20. },

二、还有是这样设置的

  1. itemStyle: {
  2. normal: {
  3. color: new eCharts.graphic.LinearGradient(
  4. 0, 0, 0, 1, [
  5. { offset: 0, color: '#06B5D7' }, //柱图渐变色
  6. { offset: 0.5, color: '#44C0C1' }, //柱图渐变色
  7. { offset: 1, color: '#71C8B1' }, //柱图渐变色
  8. ]
  9. )
  10. },
  11. emphasis: {
  12. color: new eCharts.graphic.LinearGradient(
  13. 0, 0, 0, 1, [
  14. { offset: 0, color: '#71C8B1' }, //柱图高亮渐变色
  15. { offset: 0.7, color: '#44C0C1' }, //柱图高亮渐变色
  16. { offset: 1, color: '#06B5D7' } //柱图高亮渐变色
  17. ]
  18. )
  19. }