Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

@276509842
Copy link

276509842 commented Feb 2, 2016

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
Copy link
Contributor

pissang commented Feb 2, 2016

linklineStyle 也需要区分 normalemphasis

@100pah
Copy link
Member

100pah commented Feb 2, 2016

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

@100pah 100pah closed this as completed in c2b70f0 Feb 2, 2016
@100pah 100pah reopened this Feb 2, 2016
@pissang pissang closed this as completed Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants