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

我在绘制关系图时设置了is_draggable=True,但除了layout="force"时,其他情况都无法拖动图上的节点 #57

Open
oldpiao opened this issue Jun 27, 2024 · 0 comments

Comments

@oldpiao
Copy link

oldpiao commented Jun 27, 2024

def draw(self, title="", width='100%', height='700px', layout="force", **kwargs):
      dg = Graph(init_opts=opts.InitOpts(width=width, height=height)).add(
          "",
          self.nodes,
          self.edges,
          self.categories,  # 类别
          is_draggable=True,
          layout=layout,  # 布局算法,可选,默认为 "force",可选值为 "force"、"circular" 和 "tree"、 "none"
          repulsion=4000,  # 实体间的排斥力
          edge_symbol=[None, 'arrow'],  # 单向箭头,circle、arrow两个取值分别为圆形和箭头,可以给链各个方向设置
          edge_symbol_size=5,  # 箭头大小
          # linestyle_opts=opts.LineStyleOpts(curve=0.2),  # 线类型,弯曲0.3
          # label_opts=opts.LabelOpts(rich={"normal": {"fontSize": 12}, "emphasis": {"fontSize": 18}}),
      ).set_global_opts(
          legend_opts=opts.LegendOpts(orient="vertical", pos_left="2%", pos_top="40px"),
          title_opts=opts.TitleOpts(title=title),
      )
      if self.category_color_map is not None:
          dg.set_colors([self.category_color_map[i.get("name")] for i in self.categories])
      return dg
streamlit_echarts.st_pyecharts(dg, height="600px", key=random.randint(1000, 100000000))

目前是除了force模式以外都不支持is_draggable=True的设置吗?以及之后是否会考虑添加对该功能的支持?
同样的写法,直接存储为HTML的图是可以拖动的。
大家是否有遇到同样的问题,是否有其他可用的替代方案?

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

1 participant