我想可视化我的公司的组织结构图在一个HTML窗口小部件,以取代目前使用的绘制PDF。
原则上,使用highchart或googleVis包似乎是可行的。不幸的是,当前的组织结构图有一些独立的节点被放置在顶层旁边,请参见我的示例图片中的"右侧/左侧的其他单元”。
此外,在左手还有更多的独立节点,参见第一个示例图片中的“其他独立单元”。这些节点可以与其他节点之一垂直对齐并向下流动。或者,它们可以是与顶部没有连接的另一个部门,如第二个示例图片所示。
有没有一个好的方法来做到这一点?MWE的图片是从这个问题:How can we plot Highcarts organization chart in R language?
手动添加节点x1c 0d1x的示例图片
附加独立部门
的示例图片
来自其他问题的MWE:
library(highcharter)
library(dplyr)
highchart() %>%
hc_chart(type = 'organization', inverted = TRUE) %>%
hc_title(text = 'Highcharts Org Chart') %>%
hc_add_series(
name = 'Highsoft',
data = list(
list(from = 'Shareholders', to = 'Board'),
list(from = 'Board', to = 'CEO'),
list(from = 'CEO', to = 'CTO'),
list(from = 'CEO', to = 'CPO'),
list(from = 'CEO', to = 'CSO'),
list(from = 'CEO', to = 'CMO'),
list(from = 'CEO', to = 'HR'),
list(from = 'CTO', to = 'Product'),
list(from = 'CTO', to = 'Web'),
list(from = 'CSO', to = 'Sales'),
list(from = 'CMO', to = 'Market')
),
levels = list(
list(level = 0, color = 'silver', dataLabels = list(color = 'black'), height = 55),
list(level = 1, color = 'silver', dataLabels = list(color = 'black'), height = 55),
list(level = 2, color = '#980104'),
list(level = 4, color = '#359154')
),
nodes = list(
list(id = 'Shareholders'),
list(id = 'Board'),
list(id = 'CEO', title = 'CEO', name = 'Grethe Hjetland', image = 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12132317/Grethe.jpg'),
list(id = 'HR', title = 'HR/CFO', name = 'Anne Jorunn Fjarestad', color = '#007ad0', image = 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12132314/AnneJorunn.jpg', column = 3, offset = '75%'),
list(id = 'CTO', title = 'CTO', name = 'Christer Vasseng', color = '#007ad0', image = 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12140620/Christer.jpg', column = 4, layout = 'hanging'),
list(id = 'CPO', title = 'CPO', name = 'Torstein Honsi', image = 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12131849/Torstein1.jpg', column = 4),
list(id = 'CSO', title = 'CSO', name = 'Anita Nesse', image = 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/12132313/Anita.jpg', column = 4, layout = 'hanging'),
list(id = 'CMO', title = 'CMO', name = 'Vidar Brekke', image = 'https://wp-assets.highcharts.com/www-highcharts-com/blog/wp-content/uploads/2018/11/13105551/Vidar.jpg', column = 4, layout = 'hanging'),
list(id = 'Product', name = 'Product developers'),
list(id = 'Web', name = 'Web devs, sys admin'),
list(id = 'Sales', name = 'Sales team'),
list(id = 'Market', name = 'Marketing team')
),
colorByPoint = TRUE,
color = '#007ad0',
dataLabels = list(color = 'white'),
borderColor = 'white',
nodeWidth = 65
) %>%
hc_tooltip(outside = TRUE)
1条答案
按热度按时间46scxncf1#
简单的插图
说明如何实现这一点的最简单方法是从示例中删除
list(from = 'CEO', to = 'CTO')
行。这就断开了CEO和CTO之间的联系,但是节点仍然在原来的位置上,因为它们的位置是在
column
参数中指定的(最后,当图表反转时,它对应于行)。适用于您的目标
因此,对于左侧/右侧其他装置:
data
中:创建链接OU1-〉OU1和OU2-〉OU2nodes
中:指定column = 0
的两个节点对于独立单元:
data
中:用户界面-〉UI1和用户界面-〉UI2链接nodes
中:三个节点,指定顶部的column = 4
和layout = 'hanging'