echarts icon indicating copy to clipboard operation
echarts copied to clipboard

用 graphGL 实现 关系图 的几个问题

Open Lily-Jian opened this issue 9 years ago • 6 comments

One-line summary [问题简述]

在使用graphGL实现多点多边关系图时,对比之前的type: 'graph',layout: 'force'布局,想请教以下几个问题: 1.节点标签文字大小显示不全,通过textstyle的fontsize也改不了, 2.节点标签的的文字模糊问题,怎么设置它的透明度? 3.graphGL的整体放大和缩小倍数是默认的吗?可以怎么更改? 4.graphGL的单个节点能否拖拽? 详情请见:http://gallery.echartsjs.com/editor.html?c=xrJ1Udzj4Z&v=1

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: 3.6.2
  • Browser version [浏览器类型和版本]: Firefox
  • OS Version [操作系统类型和版本]: win7 64

Expected behaviour [期望结果]

ECharts option [ECharts配置项]

var uploadedDataURL = "/asset/get/s/data-1499235712572-BkKKrbcNZ.gexf";

myChart.showLoading();

$.get(uploadedDataURL, function(xml) {
    console.log(1111);
    myChart.hideLoading();

    var graph = echarts.dataTool.gexf.parse(xml);
    var categories = [];
    for (var i = 0; i < 15; i++) {
        categories[i] = {
            name: '类目' + i
        };
    }

    graph.nodes.forEach(function(node) {
        node.itemStyle = null;
        node.value = node.symbolSize;
        node.symbolSize /= 1.5;
        node.label = {
            show: node.symbolSize > 0,
            normal: {
                textStyle: {
                    fontSize: 12
                        // fontSize: node.symbolSize>30?node.symbolSize/3:(node.symbolSize>10?node.symbolSize/2:node.symbolSize*2)
                }
            }
        };
        node.category = node.attributes.modularity_class;
        node.draggable = true;
    });
    option = {
        color: ['#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3', '#fcd', '#ccc', ' #F0FFFF', 'blue'],
        title: {
            text: '天龙八部人物关系图',
            subtext: 'Default layout',
            top: 'bottom',
            left: 'right'
        },
        tooltip: {},
        legend: [{
            // selectedMode: 'single',
            data: categories.map(function(a) {
                return a.name;
            })
        }],
        animationDuration: 1500,
        animationEasingUpdate: 'quinticInOut',
        series: [{
            name: '天龙八部人物',
            type: 'graphGL',
            // layout: 'force',
            modularity: true,
            data: graph.nodes,
            links: graph.links,
            categories: categories,
            focusNodeAdjacency: true,
            // roam: true,
            label: {
                normal: {
                    position: 'right',
                    formatter: '{b}',
                    textStyle: {
                        fontSize: 12,
                    }
                }
            },
            lineStyle: {
                normal: {
                    color: 'source',
                    curveness: 0.3
                }
            },
            //       modularity: {
            //     resolution: 10,
            //     // If sort the communities
            //     // sort: false
            // },
            //      forceAtlas2:{
            // preventOverlap: true,
            // scaling: 15,
            //      }

        }]
    };

    myChart.setOption(option);
}, 'xml');

Other comments [其他信息]

graphgl

Lily-Jian avatar Jul 06 '17 01:07 Lily-Jian

1, 2 可以优化下 3. graphGL 的缩放倍数是固定的 4. graphGL 中节点没法拖拽,因为这么大的图拖拽单个节点不太有意义

pissang avatar Jul 06 '17 02:07 pissang

那就问题1.节点标签的文字大小显示不全,表现为头部被截。请问这个怎么解决呢?

Lily-Jian avatar Jul 06 '17 02:07 Lily-Jian

1, 2 可以优化下

pissang avatar Jul 06 '17 02:07 pissang

so sad,我不知道怎么优化啊(;′⌒`),所以想请教大神

Lily-Jian avatar Jul 06 '17 02:07 Lily-Jian

我指的是我们后面版本会优化标签绘制 :)

pissang avatar Jul 06 '17 02:07 pissang

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 03 '20 00:04 stale[bot]