ecomfe / echarts-dagre

ECharts graph layout extension using dagre.js
12 stars 7 forks source link

layout config using dagre.layout() is not working #4

Open lifan0127 opened 6 years ago

lifan0127 commented 6 years ago

Thanks for creating this handy plugin for echarts.

I was trying to switch the layout from 'TB' to 'LR' but it wasn't working. Then I realized that here may be the reason:

https://github.com/ecomfe/echarts-dagre/blob/master/src/main.js#L44

dagre.layout(dagreGraph, layoutConfig);

According to this issue: https://github.com/dagrejs/dagre/issues/161, I had to change it to:

dagreGraph.setGraph(layoutConfig);
dagre.layout(dagreGraph);

Additionally, the curveness value here is undefined: https://github.com/ecomfe/echarts-dagre/blob/master/src/main.js#L67. I am using echarts v4.

// undefined
var curveness = edgeModel.get('lineStyle.normal.curveness');  

// this works
var curveness = edgeModel.get('lineStyle.curveness');