graph图,link自定义样式不能覆盖option中的lineStyle,另外无法实现有向线段 #2558

Closed
276509842 opened this Issue Feb 2, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@276509842

links.lineStyle不能覆盖option.lineStyle,无法实现link的自定义样式。

另外,关系图能否提供线段两头的symbol配置功能。

function createNodes(count) {
    var nodes = [];
    for (var i = 0; i < count; i++) {
        nodes.push({
            id: i
        });
    }
    return nodes;
}

function createEdges(count) {
    var edges = [];
    if (count === 2) {
        return [[0, 1]];
    }
    for (var i = 0; i < count; i++) {
        edges.push([i, (i + 1) % count]);
    }
    return edges;
}

var datas = [];
for (var i = 4; i < 5; i++) {
    datas.push({
        nodes: createNodes(i + 2),
        edges: createEdges(i + 2)
    });
}

option = {
    series: datas.map(function (item, idx) {
        return {
            type: 'graph',
            layout: 'force',
            animation: false,
            data: item.nodes,
            color: ['#c23531', '#314656', '#61a0a8', '#dd8668', '#91c7ae', '#6e7074', '#61a0a8', '#bda29a', '#44525d', '#c4ccd3'],

            //left: (idx % 4) * 25 + '%',
            //top: Math.floor(idx / 4) * 25 + '%',
            //width: '25%',
            //height: '25%',
            lineStyle: {
              normal: {
                //   symbol: ['circle', 'arrow'],
                //   symbolSize: 5
                width: 5
              }

            },
            force: {
                // initLayout: 'circular'
                // gravity: 0
                repulsion: 11800,
                edgeLength: 5
            },
            links: item.edges.map(function (e) {
                return {
                    source: e[0],
                    target: e[1],
                    width: 10,
                    lineStyle: {
                        width: 10,
                          color: '#f00'
                        //   symbol: ['circle', 'arrow'],
                        //   symbolSize: 5


                    },
                };
            })
        };
    })
};
@pissang

This comment has been minimized.

Show comment
Hide comment
@pissang

pissang Feb 2, 2016

Contributor

linklineStyle 也需要区分 normalemphasis

Contributor

pissang commented Feb 2, 2016

linklineStyle 也需要区分 normalemphasis

@100pah

This comment has been minimized.

Show comment
Hide comment
@100pah

100pah Feb 2, 2016

Member

有向图的箭头现在还不能支持,后续加。

Member

100pah commented Feb 2, 2016

有向图的箭头现在还不能支持,后续加。

@100pah 100pah closed this in c2b70f0 Feb 2, 2016

@100pah 100pah reopened this Feb 2, 2016

@pissang pissang closed this Apr 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment