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如何设置圆点和坐标系 #8325

Closed
ghost opened this issue May 11, 2018 · 0 comments
Closed

graph如何设置圆点和坐标系 #8325

ghost opened this issue May 11, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented May 11, 2018

graph类型的图表如何设置圆点和坐标系

需要在绘制graph图表的时候,显示一个网状的直角坐标系,坐标系的原点在画板的左下角位置,坐标系的最大值和最小值是根据后台返回的点的坐标的最大值和最小值来确定。

Version & Environment [版本及环境]

  • ECharts version [ECharts 版本]: echart3
  • Browser version [浏览器类型和版本]: chrome
  • OS Version [操作系统类型和版本]: mac

Expected behaviour [期望结果]

需要在绘制graph图表的时候,显示一个网状的直角坐标系,坐标系的原点在画板的左下角位置,坐标系的最大值和最小值是根据后台返回的点的坐标的最大值和最小值来确定。

ECharts option [ECharts配置项]

data = [
    {
      name: 'a',
      x: 0,
      y: 0
    },
    {
      name: 'b',
      x: 800,
      y: 300
    },
    {
      name: 'c',
      x: 550,
      y: 100
    },
    {
      name: 'd',
      x: 550,
      y: 500
    }
  ];


  links = [
    {
      source: 'b',
      target: 'a'
    },
    {
      source: 'a',
      target: 'b'
    },
    {
      source: 'a',
      target: 'c'
    },
    {
      source: 'b',
      target: 'c'
    },
    {
      source: 'b',
      target: 'd'
    },
    {
      source: 'a',
      target: 'd'
    }
  ];

option = {
 title: {
      text: '绘制结果展示'
    },
    tooltip: {
      show: true,
      formatter: function(params) {
        var data = params.data;
        if (data.name) {
          return `${data.name}(${data.x},${data.y})`;
        } else {
          return `线段${data.source}${data.target}`;
        }
        
      }
    },
    toolbox: {
      show: true,
      right: 20,
      feature: {
        saveAsImage: {
          show: true
        }
      }
    },
    animationDurationUpdate: 1500,
    animationEasingUpdate: 'quinticInOut',
    series: [{
      type: 'graph',
      layout: 'none',
      symbolSize: 50,
      // focusNodeAdjacency: true,
      roam: false,
      label: {
        normal: {
          show: true
        }
      },
      data: data,
      // links: [],
      links: links,
      lineStyle: {
        normal: {
          opacity: 0.9,
          width: 2,
          curveness: 0
        }
      }
    }]
  };
}

Other comments [其他信息]

@ghost ghost closed this as completed May 21, 2018
This issue was closed.
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

0 participants