从父子数据绘制树或组织图 [英] Draw a tree or organization chart from parent child data

查看:278
本文介绍了从父子数据绘制树或组织图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在包含GroupID(TreeID)的表格中有父子资讯。



从这个表中我想得到这样的:





绘制树的目的是仅供查看。该表有成千上万个groupID /树结构。



我使用的是.NET平台。



我继续?

  create table parent_child(GroupID varchar(100)null,
Level varchar(100)null,
Name varchar(100)null,
ID varchar(100)null,
ParentID varchar(100)null,
Top_Parent varchar(100)null)
$ b b insert into parent_child(GroupID,Level,Name,ID,ParentID,Top_Parent)values
('1234','4','James','6712','921','1005'),
('1234','3','Peter','11','206','1005'),
('1234','3','Royden','14'
('1234','3'),
('1234','3','Lila','237','589','1005' ,'Julie','921','589','1005'),
('1234','2','Sandy','206','1005','1005' $ b('1234','2','Tom','589','1005','1005'),
('1234','1','Sam','1005' NA','1005')


解决方案

> WPF的图树形图控件 (在代码项目)解释了如何实现您的想法,在 WPF Silverlight



代码项目网站的屏幕截图:







我希望这篇文章有帮助!


I have parent-child information in a table with GroupID (TreeID.)

From this table I want to derive something like this:

The purpose of drawing a tree is for viewing only. The table has thousands of groupID/tree structures.

I am using the .NET platform.

How should I proceed?

create table parent_child (GroupID varchar(100) null,   
                           Level varchar(100) null, 
                           Name varchar(100) null,  
                           ID varchar(100) null,    
                           ParentID varchar(100) null,  
                           Top_Parent varchar(100) null)

 insert into parent_child (GroupID,Level, Name,ID,ParentID,Top_Parent) values 
     ('1234', '4', 'James', '6712', '921', '1005'), 
     ('1234', '3', 'Peter', '11', '206', '1005'),
     ('1234', '3', 'Royden', '14', '206', '1005'), 
     ('1234', '3', 'Lila', '237', '589', '1005'),
     ('1234', '3', 'Julie', '921', '589', '1005'), 
     ('1234', '2', 'Sandy', '206', '1005', '1005'), 
     ('1234', '2', 'Tom', '589', '1005', '1005'), 
     ('1234', '1', 'Sam', '1005', 'NA', '1005')

解决方案

The article A Graph Tree Drawing Control for WPF (at The Code Project) explains how to achieve what you have in mind, both in WPF and Silverlight. Kudo's to the guy who made the code available - it's well written and very easy to customize.

Screenshot from The Code Project site:

You will have to write the logic to convert your table data to a compatible data structure.

I hope the article helps!

这篇关于从父子数据绘制树或组织图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆