<!DOCTYPE html><html><head>??? <meta charset="utf-8"? name=”viewport” content=”width=device-width, initial-scale=1″ >??? <title>ECharts</title>??? <!-- 引入 echarts.js -->??? <script src="echarts.js"></script></head><body style="? height: 100%;width: auto;white-space: nowrap;">??? <!-- 為ECharts準備一個具備大?。▽捀撸┑腄om -->??? <div id="main" style="? height: 500px;width: auto;? white-space: nowrap">??? </div>??? <script type="text/javascript">??????? // 基于準備好的dom,初始化echarts實例??????? var myChart = echarts.init(document.getElementById('main'));var i = 1;option = {?? ???? title: {??????? text: ''??? },??? tooltip: {},??? animationDurationUpdate: 5000,??? animationEasingUpdate: 'quinticInOut',??? series : [??????? {??????????? type: 'graph',??????????? layout: 'none',??????????? symbolSize: 50,??????????? roam: true,??????????? label: {??????????????? normal: {??????????????????? show: true??????????????? }??????????? },??????????? edgeSymbol: ['circle', 'arrow'],??????????? edgeSymbolSize: [4, 10],??????????? edgeLabel: {??????????????? normal: {??????????????????? textStyle: {??????????????????????? fontSize: 20??????????????????? }??????????????? }??????????? },???????? ???????????? data: [??????????? {?? ?name: "漏洞"+i,?????????? ??? ?x: i+00,?????????? ??? ?y: i+00,?????????? ??? ???????????? }?????????? ???????? ?? ? ??? ? ? ? ???????????? ],??????????? // links: [],??????????? links: [{??????????????? symbolSize: [5, 20],??????????????? label: {??????????????????? normal: {??????????????????????? show: true??????????????????? }??????????????? },??????????????? lineStyle: {??????????????????? normal: {??????????????????????? width: 5,??????????????????????? curveness: 0.2??????????????????? }??????????????? }??????????? }, {??????????????? source: '漏洞1',??????????????? target: '漏洞2',??????????????? label: {??????????????????? normal: {??????????????????????? show: true??????????????????? }??????????????? },??????????????? lineStyle: {??????????????????? normal: { curveness: 0.2 }??????????????? }??????????? }, {??????????????? source: '漏洞2',??????????????? target: '漏洞1',?????????????????? label: {??????????????????? normal: {??????????????????????? show: true??????????????????? }??????????????? },??????????? }, {??????????????? source: '業(yè)務1',??????????????? target: '服務2'??????????? }, {??????????????? source: '服務2',??????????????? target: '服務1'??????????? }, {??????????????? source: '服務1',??????????????? target: '漏洞1'??????????? }, {??????????????? source: '服務3',??????????????? target: '漏洞1'??????????? }],??????????? lineStyle: {??????????????? normal: {??????????????????? opacity: 0.9,??????????????????? width: 2,??????????????????? curveness: 0??????????????? }??????????? }??????? }??? ]};??????? // 使用剛指定的配置項和數(shù)據(jù)顯示圖表。??????? myChart.setOption(option);??? </script></body></html>
Js 在option ={ data:[]}中怎么使用循環(huán);
慕UI1458911
2017-09-26 10:56:50