ECharts瀑布图

效果图:

fba4f5e610cd4f708d8ea900223a4700.png

 具体代码:

<html>
 <head>
  <meta charset="utf-8">
  <title></title>
  <script src="http://cdn.bootcss.com/echarts/4.8.0/echarts.js"></script>
 </head>
 <body>
  <div id="main" style="width: 800px;height: 400px;"></div>
  <script type="text/javascript">
   var myChart=echarts.init(document.getElementById("main"));
   var option = {
	   color:'#f5ceff',

    tooltip: {
     trigger: 'axis',
     axisPointer: {
       type: 'shadow'
     },
    },
    grid: {
     left: '3%',
     right: '4%',
     bottom: '3%',
     containLabel: true
    },
    xAxis: {
     type: 'category',
     splitLine: { show: false },
     data: ['1', '2', '3', '4', '5', '6']
    },
    yAxis: {
     type: 'value'
    },
    series: [
     {
       name: 'Placeholder',
       type: 'bar',
       stack: 'Total',  //瀑布图的形式
       itemStyle: {
      borderColor: 'transparent',
      color: 'transparent'  //透明
       },
       emphasis: {
      itemStyle: {
        borderColor: 'transparent',
        color: 'transparent'
      }
       },
       data: [0, 17, 14, 12, 3, 0]
     },
     {
       name: 'Life Cost',
       type: 'bar',
       stack: 'Total',
       label: {
      show: true,
      position: 'inside'
       },
       data: [29, 12, 3, 2, 9, 3]
     }
      ]
    };
    myChart.setOption(option);
  </script>
 </body>
</html>

想要使用该图表,只需要  复制以上代码 

 引入 ECharts 文件可以用上面代码中的方法

<script src="http://cdn.bootcss.com/echarts/4.8.0/echarts.js"></script>


也可以下载 echarts.js  在页面文件中引入即可. 

echarts.js 下载链接:    http://echarts.baidu.com/download.html
 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值