参考链接(https://www.jianshu.com/p/2afc2b3627d7

    1. series: [{
    2. data: [100, 25, 50, 15, 70],
    3. type: 'bar',
    4. itemStyle: {
    5. normal: {
    6. //每根柱子颜色设置
    7. color: function(params) {
    8. let colorList = [
    9. "#4C94FE",
    10. "#C773FF",
    11. "#B36F50",
    12. "#5D9DA6",
    13. "#E2B602",
    14. ];
    15. return colorList[params.dataIndex];
    16. }
    17. }
    18. }
    19. }],

    运行结果:
    柱状图-设置每根柱子颜色 - 图1