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

Partition layout : traversing 2 kinds of children #97

Closed
b-barry opened this issue Aug 21, 2017 · 0 comments
Closed

Partition layout : traversing 2 kinds of children #97

b-barry opened this issue Aug 21, 2017 · 0 comments

Comments

@b-barry
Copy link

b-barry commented Aug 21, 2017

Hello,

At first, I would like to thank you for your great work on this library. It helped me a lot of for all my data visualization usecase.

However, I got a special kind of hierarchical data that I wondering if it is possible to solve it with d3-hierarchy ( partition).

In JSON, I have to 2 fields that can be used as "children", "childs" and "details".

[
  {
    "name": "Element name 1",
    "value": 218110166.51914096,
    "percent": 0.34384346972710306,
    "childs": [
      {
        "name": "Element name 2",
        "value": 218110166.51914096,
        "percent": 100.0,
        "childs": null,
        "details": null
      }
    ],
    "details": [
      {
        "name": "Element name 40",
        "value": 131343750.0,
        "percent": 60.218994875909885,
        "childs": null,
        "details": null
      },
      {
        "name": "Element name 41",
        "value": 59933784.924403764,
        "percent": 27.478675515634013,
        "childs": null,
        "details": null
      }
    ]
  }
]

Based on some conditions, I have to navigate through "childs" or "details".
I use the partition layout to traverse the tree either by "childs" or "details" by implementing the partition.children callback function.
This works well by I stay with one side of the tree untouched after the traversing.
For my usecase, at the beginning, I need to navigate through the two fields by keeping all the state of the previous navigation. So traversing through all "childs" like it was "children", the same thing for "details"
I didn't find any function in API that can help to achieve this kind of behavior.
Do it possible to perform this double navigation with the partition layout ?

Thanks for your help

@b-barry b-barry changed the title Traversing 2 kinds of children Aug 21, 2017
@b-barry b-barry closed this as completed Aug 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant