用echarts畫桑基圖的簡單示例

<!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>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章