Comments (10)
I don't know if anyone is still struggling with this, but this is how I solved it.
First this is the example of data
const ds = {
id: 'n1',
children: [
{
id: 'n2',
name: 'NODE-2',
children: [
{ id: 'n3', name: 'NODE-3' },
{ id: 'n4', name: 'NODE-4' },
{ id: 'n5', name: 'NODE-5' },
{ id: 'n6', name: 'NODE-6' }
]
},
{
id: 'n7',
name: 'NODE-7',
children: [
{ id: 'n8', name: 'NODE-8' },
]
},
]
};
and this is the css
#n1,
#n1 + ul > li::before,
#n1 + ul > li > div::before {
display: none;
}
from orgchart.
Hi @hemavidal , I' m sorry to say "multiple roots" is in conflict with the core idea of building up orghcart, so I'm not planning to add this feature.
While, there is an exception that you could create a fake root node(hidden element) and regard its child nodes as multiple root nodes. In fact, this is the simplest case of multiple roots chart. If this is your scenario, you can apply this trick.
from orgchart.
Thanks dabeng! I will try this solution!
from orgchart.
Hi!
For anyone wondering, this was my solution for this problem:
/* Hide the very first 3 rows (that represent the pseudo root element) */
.orgchart > table > tbody > tr:nth-child(-n+3) {
display: none;
}
/* in the .node class of the root, search for the first children of root and
hide their topEdge arrow which is associated to the pseudo root elemen */
.orgchart > table > tbody > tr.nodes > td > table > tbody > tr > td > div.node > i.topEdge {
display: none;
}
from orgchart.
Hi @Elektropepi
Can you post an example of how the data?
from orgchart.
I am also looking for a solution.
from orgchart.
You could share an example of how you did it, please
from orgchart.
I need create a root node, but it. in center screen an left right tree
sheet-- --sheet
| --Root --|
sheet-- --sheet
datasource = {
left: children[ 'Name':'a','Title':'b'] //l2r
right:: children[ 'Name':'c','Title':'d'] //r2l
this posible wiht you proyect.?
from orgchart.
Hi @Elektropepi
Can you post an example of how the data?
First of all, Thanks to @Elektropepi
This is the example object of Chart.
this.ds = {
id: 'null',
name: '',
title: '',
children: [
{
id: '1',
name: 'John',
title: 'CEO',
children: [
...
]
},
{
id: '2',
name: 'John',
title: 'New Employee',
}
]
}
And you add style.
/* Hide the very first 3 rows (that represent the pseudo root element) */
.orgchart > table > tbody > tr:nth-child(-n+3) {
display: none;
}
/* in the .node class of the root, search for the first children of root and
hide their topEdge arrow which is associated to the pseudo root elemen */
.orgchart > table > tbody > tr.nodes > td > table > tbody > tr > td > div.node > i.topEdge {
display: none;
}
It works well for me.
from orgchart.
In case anyone is still struggling with this, my approach was:
Before rendering the chart i did this to hide the links:
.linkUpdate(function (d) {
if (d.depth === 1) {
d3.select(this)
.attr('display', 'none');
} <br>
})
And this to hide the fake root node:
.nodeUpdate(function (d) {
if (d.depth === 0) {
d3.select(this)
.attr('display', 'none');
}
})
from orgchart.
Related Issues (20)
- Wrong line drawing when using text-center: left; HOT 1
- 如何通过参数设置隐藏兄弟节点 HOT 1
- 请问大佬data-prop-compact.html这个demo是不是有异常 HOT 3
- not able export chart in png roper
- ajaxURL HOT 2
- Sort siblings HOT 1
- orgchart with nodes of different widths don't work HOT 1
- drag & drop the nodes of orgchart don't work
- multiple-layers chart don't work HOT 1
- specific children of a certain branch of the chart to be displayed as vertical. the possibility to set VerticalLevel by data don't work. HOT 1
- I want to using 'compact' and 'verticalLevel' option together.
- Option to see that nodes have relations (parent/son/sibling) although they may not be visible without hovering over nodes individually HOT 2
- If you call oc.init(...) multiple times, some values are not reset resulting in unexpected behavior.
- Combining collapsed and hybrid modes
- options.compact() does not prevail over data.compact (as documented)
- Copying and pasting a CDN link directly can result in errors.
- 为增加兄弟节点函数增加指定增加到右边的参数选项
- rendering graph in bullet list format HOT 1
- orgchart() undefined
- Wrap Edges in button tags (Accessibility)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orgchart.