3d立体柱状图渐变

描述:当前是关于Echarts图表中的 示例。
 
            const CubeLeft = echarts.graphic.extendShape({
        shape: {
          x: 0,
          y: 0,
        },
        buildPath: function (ctx, shape) {
          const xAxisPoint = shape.xAxisPoint;
          const c0 = [shape.x, shape.y];
          const c1 = [shape.x - 9, shape.y - 7];//左上角
          const c2 = [xAxisPoint[0] - 9, xAxisPoint[1] - 10];//右上角
          const c3 = [xAxisPoint[0], xAxisPoint[1]];
          ctx.moveTo(c0[0], c0[1]).lineTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).closePath();
        },
      });
      const CubeRight = echarts.graphic.extendShape({
        shape: {
          x: 0,
          y: 0,
        },
        buildPath: function (ctx, shape) {
          const xAxisPoint = shape.xAxisPoint;
          const c1 = [shape.x, shape.y];
          const c2 = [xAxisPoint[0], xAxisPoint[1]];
          const c3 = [xAxisPoint[0] + 18, xAxisPoint[1] - 2];//右下
          const c4 = [shape.x + 18, shape.y - 1];
          ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
        },
      });
      const CubeTop = echarts.graphic.extendShape({
        shape: {
          x: 0,
          y: 0,
        },
        buildPath: function (ctx, shape) {
          const c1 = [shape.x, shape.y];
          const c2 = [shape.x + 18, shape.y - 1];//右下
          const c3 = [shape.x + 9, shape.y - 8];//右上
          const c4 = [shape.x - 9, shape.y - 7];
          ctx.moveTo(c1[0], c1[1]).lineTo(c2[0], c2[1]).lineTo(c3[0], c3[1]).lineTo(c4[0], c4[1]).closePath();
        },
      });
      echarts.graphic.registerShape('CubeLeft', CubeLeft);
      echarts.graphic.registerShape('CubeRight', CubeRight);
      echarts.graphic.registerShape('CubeTop', CubeTop);
      const VALUE = [180, 380, 780, 980, 780, 380, 180,180,780,380,180,180];
       option = {
        backgroundColor: '#012366',
        grid: {
          left: '5%',
          right: 0,
          bottom: '3%',
          top: '10%',
          containLabel: true,
        },
        xAxis: {
          type: 'category',
         data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月','9月','10月','11月','12月'],//数据
          axisLabel: {
              color: "#DEDEDE"
              },
          axisLine: {
            show: true,
            lineStyle: {
               type:'dashed',//线的类型 虚线
            },
          },
          axisTick:false,
        },
        yAxis: {
          min: 0,//最小
          max: 1200,//最大
          interval: 200,//相差
          name: '单位/万元',//名称
          type: 'value',
          axisLine: {//坐标轴样式
              show: false, //不显示
            },
          axisLabel: {
            color: "#DEDEDE"
            },
            splitLine: {//分隔辅助线
                lineStyle: {
                     type:'dashed',//线的类型 虚线0
                     opacity:0.2//透明度
                },
            },
        },
        series: [
          {
            type: 'custom',
            renderItem: (params, api) => {
              const location = api.coord([api.value(0), api.value(1)]);
              return {
                type: 'group',
                children: [
                  {
                    type: 'CubeLeft',
                    shape: {
                      api,
                      xValue: api.value(0),
                      yValue: api.value(1),
                      x: location[0],
                      y: location[1],
                      xAxisPoint: api.coord([api.value(0), 0]),
                    },
                    style: {
                      fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                        {//左侧面
                          offset: 0,
                          color: 'rgba(0, 109, 171,0.5)',
                        },
                        {
                          offset: 1,
                          color: 'rgba(0, 109, 171,0.2)',
                        },
                      ]),
                    },
                  },
                  {
                    type: 'CubeRight',
                    shape: {
                      api,
                      xValue: api.value(0),
                      yValue: api.value(1),
                      x: location[0],
                      y: location[1],
                      xAxisPoint: api.coord([api.value(0), 0]),
                    },
                    style: {
                      fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                        {
                          offset: 0,
                          color: 'rgba(1, 160, 249,1)',
                        },
                        {
                          offset: 1,
                          color: 'rgba(0, 109, 171,0.5)',
                        },
                      ]),
                    },
                  },
                  {
                    type: 'CubeTop',
                    shape: {
                      api,
                      xValue: api.value(0),
                      yValue: api.value(1),
                      x: location[0],
                      y: location[1],
                      xAxisPoint: api.coord([api.value(0), 0]),
                    },
                    style: {
                      fill: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                        {
                          offset: 0,
                          color: 'rgba(0, 109, 171,0.5)',
                        },
                        {
                          offset: 1,
                          color: 'rgba(0, 109, 171,0.5)',
                        },
                      ]),
                    },
                  },
                ],
              };
            },
            data: VALUE,
          },

        ],
      };