折线点和折线颜色

  1. itemStyle: {
  2. normal: {
  3. color: "#386db3",//折线点的颜色
  4. lineStyle: {
  5. color: "#386db3"//折线的颜色
  6. }
  7. }
  8. }

渐变效果:

image.png

  1. import echarts from 'echarts' // 需引入
  2. ...
  3. series: [
  4. {
  5. name: '行业一',
  6. type: 'line',
  7. stack: 'Total',
  8. smooth: true,
  9. itemStyle: {
  10. normal: {
  11. color: 'rgb(255, 0, 135)',// 折线点颜色
  12. lineStyle: {
  13. color: 'rgb(255, 0, 135)',// 折线颜色
  14. }
  15. }
  16. },
  17. areaStyle: {
  18. opacity: 0.8,
  19. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  20. {
  21. offset: 0,
  22. color: 'rgb(255, 0, 135)'
  23. },
  24. {
  25. offset: 1,
  26. color: 'rgb(135, 0, 135)'
  27. }
  28. ])
  29. },
  30. data: [120, 132, 101, 134, 90, 230, 210]
  31. },
  32. {
  33. name: '行业二',
  34. type: 'line',
  35. stack: 'Total',
  36. smooth: true,
  37. itemStyle: {
  38. normal: {
  39. color: 'rgb(128, 255, 165)',
  40. lineStyle: {
  41. color: 'rgb(128, 255, 165)',
  42. }
  43. }
  44. },
  45. areaStyle: {
  46. opacity: 0.8,
  47. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  48. {
  49. offset: 0,
  50. color: 'rgb(128, 255, 165)'
  51. },
  52. {
  53. offset: 1,
  54. color: 'rgb(1, 191, 236)'
  55. }
  56. ])
  57. },
  58. data: [220, 182, 191, 234, 290, 330, 310]
  59. },
  60. {
  61. name: '行业三',
  62. type: 'line',
  63. stack: 'Total',
  64. smooth: true,
  65. itemStyle: {
  66. normal: {
  67. color: 'rgb(55, 162, 255)',
  68. lineStyle: {
  69. color: 'rgb(55, 162, 255)',
  70. }
  71. }
  72. },
  73. areaStyle: {
  74. opacity: 0.8,
  75. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
  76. {
  77. offset: 0,
  78. color: 'rgb(55, 162, 255)'
  79. },
  80. {
  81. offset: 1,
  82. color: 'rgb(116, 21, 219)'
  83. }
  84. ])
  85. },
  86. data: [820, 932, 901, 934, 1290, 1330, 132]
  87. }
  88. ]
  1. color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ // 关键点方法
  2. {
  3. offset: 0,
  4. color: 'rgb(128, 255, 165)'
  5. },
  6. {
  7. offset: 1,
  8. color: 'rgb(1, 191, 236)'
  9. }
  10. ]) // 数组, 用于配置颜色的渐变过程.
  11. // 每一项为一个对象, 包含offset和color两个参数. offset的范围是0 ~ 1,
  12. // 用于表示位置

color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
4个参数用于配置渐变色的起止位置, 这4个参数依次对应右/下/左/上四个方位. 而0 0 0 1则代表渐变色从正上方开始