多柱状图

描述:当前是关于Echarts图表中的 柱状图 示例。
 
            option = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'cross',
      crossStyle: {
        color: '#999'
      }
    }
  },
  legend: {
    data: ['Evaporation', 'Precipitation', 'Temperature']
  },
  xAxis: [
    {
      type: 'category',
      data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'],
    }
  ],
  yAxis: [
    {
      type: 'value',
      name: 'Precipitation',
    }
  ],
  series: [
    {
      name: 'Evaporation',
      type: 'bar',
      data: [
        2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3
      ],
      itemStyle: {
        //定义柱子的样式
        // color:params=>color[params.dataIndex],//定义每根柱子的不同颜色(不渐变)
        //不同柱子颜色渐变
        color: (params) => ({
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: '#5470c6', // 柱子最高度% 处的颜色
            },
            {
              offset: 1,
              color: '#fff', // X轴处的颜色
            },
          ],
          global: false, // 缺省为 false
        }),
      },
    },
    {
      name: 'Precipitation',
      type: 'bar',
      data: [
        2.6, 5.9, 9.0, 26.4, 28.7, 70.7, 175.6, 182.2, 48.7, 18.8, 6.0, 2.3
      ],
      itemStyle: {
        //定义柱子的样式
        // color:params=>color[params.dataIndex],//定义每根柱子的不同颜色(不渐变)
        //不同柱子颜色渐变
        color: (params) => ({
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: '#fac858', // 柱子最高度% 处的颜色
            },
            {
              offset: 1,
              color: '#fff', // X轴处的颜色
            },
          ],
          global: false, // 缺省为 false
        }),
      },
    },
    {
      name: 'Temperature',
      type: 'bar',
      data: [2.0, 2.2, 3.3, 4.5, 6.3, 10.2, 20.3, 23.4, 23.0, 16.5, 12.0, 6.2],
      itemStyle: {
        //定义柱子的样式
        // color:params=>color[params.dataIndex],//定义每根柱子的不同颜色(不渐变)
        //不同柱子颜色渐变
        color: (params) => ({
          type: 'linear',
          x: 0,
          y: 0,
          x2: 0,
          y2: 1,
          colorStops: [
            {
              offset: 0,
              color: '#91cc75', // 柱子最高度% 处的颜色
            },
            {
              offset: 1,
              color: '#fff', // X轴处的颜色
            },
          ],
          global: false, // 缺省为 false
        }),
      },
    }
  ]
};