Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
feiyiding
Frequent Visitor

Where and how to put the button to enable interactivity for my custom tree visual?

I'm working on building a custom tree visual using d3.js. I have finished the tree now and I want to move on to enable the interactivity so that I can use my custom visual to slice other visuals. So, for my tree, I have a lot of nodes and I want to add a button to each node for doing the slicer thing I want. Here is my node:

            var node = svg.selectAll('g.node')
                .data(nodesfunction (d) { return d["id"] || (d["id"] = ++i); });
 
            var nodeEnter = node.enter().append('g')
                .attr('class''node')
                .attr("transform"function (d) {
                    return "translate(" + source.y0 + "," + source.x0 + ")";
                })
                .on('click'click);
 
         function click(d) {
            if (d.children) {
                d["_children"] = d.children;
                d.children = null;
            } else {
                d.children = d["_children"];
                d["_children"] = null;
            }
            if (d.parent) {
                d.parent.children.forEach(function (element) {
                    if (d !== element) {
                        collapse(element);
                    }
                });
            }
            updateTree(d);
        }

PS: I'm using table DataViewMapping. 

Can someone please help me with this?

1 REPLY 1
v-shex-msft
Community Support
Community Support

Hi @feiyiding,

I don't think you can simply achieve these effects. It means you need to cache each node with two different types of records(filtered and unfiltered ), and it should be responded if these actions are activated.

In addition, you also need to consider the conflict and effects between the filtered and unfiltered records about different node interactions. (this is the hard part)
Regards,

Xiaoxin sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Kudoed Authors