Jump to content
We've recently updated our Privacy Statement, available here. ×

Is spotfire mods hierarchy merge possible?

Jo HyeongJun

Recommended Posts

Before you ask the question, make the definition as follows.

1. The names of the axes defined in the Mod-manifast.json file in Mods are "Task" and "Group".

2. There are originally four types of columns on the "Task" axis. For example, they are called A, B, C, and D, respectively.

3. The four columns that go in (2) draw a bar on my custom gantt chart.

4. What we want to do is remove the column "D" from the "Task" axis and put it in the "Group" to draw the same chart as the result drawn in (3).

5. The chart I'm currently drawing on the Gantt chart is based on the "Task" axis.

  Data is imported into dataView.hierarchy ("Task").

6. Once again, put A, B, and C columns on the "Task" axis and D columns on the "Group" axis.

7. After that, I want to combine the layers of dataView.hierarchy ("Task") and the layers of dataView.hierarchy ("Group").

8. I think if you do number 7, it will probably be the same as putting all the columns A, B, C, and D in one axis.

I wonder if there is a way to solve the above situation. I hope my explanation was sufficient for you.

Link to comment
Share on other sites


I am not sure that I fully understand the case you want to solve, but I'll give it a try.

First, the visualization mods framework only works for a single dataview, and these dataviews is purely read only from the perspective of the mod developer. So a short answer would be that you cannot combine two dataviews, let alone import data into a dataview as mentioned in step 5.

That being said, I get the impression that you really are struggling in the understanding of what multiple hierarchies mean and how you can leverage from this in a mod visualization. Merging hierarchies could in that context be interpreted as getting the corresponding rows for two or more nodes from different hierarchies.

There is a thread on GitHub about this issue, please read this post.

In your particular example, if you want to group the Gantt task bars into groups the code would need to first loop over all leaf nodes in the "Group" hieararchy. Inside this loop you would loop over all "Task" hiearchy leaves. When determining the rows in the underlying dataview, you now need to take both leaf nodes into account, effectevily creating the intersection of two sets of rows. This is easly done as shown below since the rows can be compared by reference.

let group = await dataView.hierarchy("Group");let task = await dataView.hierarchy("Task"); let groupRoot = await group.root();let taskRoot = await task.root(); groupRoot.leaves().forEach(groupLeaf => { let groupLeafRows = new Set(groupLeaf.rows()); taskRoot.leaves().forEach(taskLeaf => { let intesectingRows = taskLeaf.rows().filter(row => groupLeafRows.has(row)); // Visualize intesectingRows in your Gantt chart })})

Hope that this answers your question.

Link to comment
Share on other sites

Column ABC in the Task layer is 

Each is set as a child node in the order of A > B > C.

Attach an example. (Child_Node_Picture.png)

You want to put the Group layer as a child of the Task layer.

Attach an example. (result_data.png)

result_data.png is the same result as putting all ABCD columns in the Task layer.

Please give me a code to try this.

Also, the data I want should be the buildTasks function parameter inside index.ts and the work should be done.

Attach the source code and example data together.

I need your help.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...