用echarts画桑基图的简单示例

来源:互联网 发布:asm算法步骤 编辑:程序博客网 时间:2024/05/29 09:07
<!DOCTYPE html><html><head> <title>Sankey</title> <meta http-equiv="X-UA-Compatible" content="IE=edge"/> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="apple-mobile-web-app-capable" content="yes"/> <script src="js/jquery-1.11.0.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/echarts/3.5.3/echarts.min.js"></script></head><body><div class="container"><div class="line"><div id="main" style="height:400px;"></div></div></div><script type="text/javascript">var data = [{name: '数据1',value: 10}, {name: '数据2',value: 20},{name: '数据3', value: 20}, {name: '数据4',value: 10}]var links = [{ source: '数据1',target: '数据3',value:9}, {source: '数据2',target: '数据3',value:11},{ source: '数据1', target: '数据4',value:1}, {source: '数据2',target: '数据4',value:9}] var myChart = echarts.init(document.getElementById('main')); var option = { title: { text: 'Sankey Diagram' }, tooltip: { trigger: 'item', triggerOn: 'mousemove' }, series: [ { type: 'sankey', layout: 'none', data: data, links: links, itemStyle: { normal: { borderWidth: 1, borderColor: '#aaa' } }, lineStyle: { normal: { color: 'source', curveness: 0.5 } } } ] } myChart.setOption(option);</script></body></html>

0 0
原创粉丝点击