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

View end node type and value #5

Open
Fr33maan opened this issue Apr 18, 2014 · 2 comments
Open

View end node type and value #5

Fr33maan opened this issue Apr 18, 2014 · 2 comments

Comments

@Fr33maan
Copy link

I can see in the given example that json structure is assumed as following :

var flare_data = {
 "name": "flare",
 "children": [
  {
   "name": "analytics",
   "children": [ 
.......

I see on the sample app that 'name' field is used for display node name.

I would like to use a JSON structure like this :

var flare_data = {
 flare : {
   analytics : {
    cluster : {
       agglomerativeCluster : 'myPersonnalString',
       communityStructure : [{string1 : 'myPersonnalString'}, {string2 : 'myPersonnalString'}],
    },
    graph : {}
  },
  animate : {}
}

Then i would like this to be samely displayed as in app example.

I would like to know how easy it will be to make 'JSON structure switchin ' improvement

@Fr33maan Fr33maan changed the title set an end node as a string View end node type and value Apr 18, 2014
@jaredly
Copy link
Owner

jaredly commented Apr 18, 2014

The flare_data structure was just a nice way to get started. In the model, nodes look like:

{
  id: "id",
  collapsed: bool,
  parent: "id",
  children: ["id", "id", ...],
  data: {
    name: "Some awesome node", // <-- this is what is actually displayed
    done: bool, // also used visually
    // you can add any extra data you want here.
  }
}

There's a root node id, and everything is filled in from there by traversing the children.

If I understand correctly, you want to be able to have full JSON loading & export?

This could be accomplished by adding a type attribute to the data object (it is supported to add arbitrary values to data, which are preserved).

You would need to write a custom Node class that was aware of the type attribute and displayed things accordingly, but I think it would be totally doable.

@Fr33maan
Copy link
Author

@jaredly "If I understand correctly, you want to be able to have full JSON loading & export?"

Exactly, i want to have a tool that is able to load/edit a JSON with no need of a particular structure.

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

2 participants