echarts象形柱图1

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <style>
            .con{
                position: absolute;
                width: 505px;
                height:260px;
                /* background-color: aquamarine; */
            }
            .con-po{
                      position: absolute;
                      width: 2px;
                      height: 134px;
                      background-color: #cecece;
                      top: 39px;
                      right: 157px;
            }
            .con-r{
                 position: absolute;
                 top: 2px;
                 left: 148px;
                 color: #717171;
            }
            .con-num{
                position: relative;
                top: 39px;
                left: 148px;
                color: #717171;
                font-size: 14px;
            }
            .con-bg{
                position: relative;
                background-color: aqua;
                width: 90%;
                height: 90%;
                top: 0px;
                    left: 0px;
                    right: 0px;
                    bottom: 0px;
            }
            
        </style>
    </head>
    <body>
        <div class="con">
            <div class="con-bg">
                
            </div>
            <div id="main" style="width:100%;height: 100%;"></div>
        </div>
         <script src="js/echarts.min.js"></script>
        <script>
            var chartDom = document.getElementById('main');
            var myChart = echarts.init(chartDom);
            var option;
        
            option = {
                    // backgroundColor: 'red',
              tooltip: {
                trigger: 'axis',
                axisPointer: {
                  // type: 'none'
                },
                formatter: function (params) {
                  // return params[0].name + ': ' + params[0].value;
                   return  "" + params[0].value;
                }
              },
              xAxis: {
                data: ['规划设计', 'EPC', '硬件'],
                axisTick: { show: false },
                axisLine: { show: true },
                axisLabel: {
                  show: true ,
                  color: '#808080'
                },
                
              },
              yAxis: {
                splitLine: { show: false },
                axisTick: { show: false },
                axisLine: { show: true },
                axisLabel: { show: true },
                 type: 'value',
                        axisLabel: {
                            // formatter: '{value} /个' // 这里的 '单位' 是你想要显示的单位
                        }
              },
              color: ['#e54035'],
              series: [
                {
                markPoint: {
                    itemStyle: {
                        //通常情况下:
                        normal: {
                           // color:'rgba(0,0,0,0)'

color: {
                                                                    type: 'linear',
                                                                    x: 0,
                                                                    y: 0,
                                                                    x2: 1,
                                                                    y2: 0,
                                                                    colorStops: [{
                                                                        offset: 0,
                                                                        color: '#F4515E' // 0% 处的颜色
                                                                    }, {
                                                                        offset: 1,
                                                                        color: '#21c3ae' // 100% 处的颜色
                                                                    }],
                                                                    globalCoord: false // 缺省为 false
                                                                
                        },
                        },
                    },
                        
                      data: [{
                        type: "max"
                      }],
                      symbol: "pin"
                    },
                  name: 'hill',
                  type: 'pictorialBar',
                  barCategoryGap: '-38%',
                 
                       // symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
                     symbol: 'path://M0 ,10 L10,10 C6.5,10 5.5,9 5,0 C4.5,5 4.5,10 0.8,10 z',
                  itemStyle: {
                    opacity:1,
                
                  },
                  emphasis: {
                    itemStyle: {
                      opacity: 1,
                    
                    }
                  },
                  data: [
                      123, 300, 225],
                  z: 10,
                 
                
                  itemStyle: {
                                  //通常情况下:
                                  normal: {
                                     // label: {
                                        //     show: true,  //开启显示
                                        //     position: 'top',  //在上方显示
                                            
                                     // },
                                      // barBorderRadius: 8,
                                      //每个柱子的颜色即为colorList数组里的每一项,如果柱子数目多于colorList的长度,则柱子颜色循环使用该数组
                                      color: function (params) {
                                          var colorList = [
                                              ['#529ADB', '#F1F5F8'],
                                              ['#52DBAC', '#F2F8F5'],
                                              ['#52DBD6', '#E5F8F6'],
                                           
                                          ];
                                          var index = params.dataIndex;
                                          if (params.dataIndex >= colorList.length) {
                                              index = params.dataIndex - colorList.length;
                                          }
                                          return new echarts.graphic.LinearGradient(0, 0, 0, 1,
                                              [{
                                                      offset: 0,
                                                      color: colorList[index][0]
                                                  },
                                                  {
                                                      offset: 1,
                                                      color: colorList[index][1]
                                                  }
                                              ]);
                                      }
                                  },
                              },
                },
                
              ]
            };
            option && myChart.setOption(option);
        </script>
    </body>
</html>

markpoint背景白色字体黑色 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值