-
naruka17December 26, 2017 at 8:17 am #8129
Team,
I am able to generate d3 vizuly chart. Now I have one requirement. I am providing filter options to user, where user will select option and based on values I have to show nodes.
For example, in tree chart (available on your site), If user select amount< $100 then only those nodes should be visible having amount <$100.Thanks
ChetanvizulyJanuary 4, 2018 at 12:37 pm #8131Hello Chetan,
I just saw this post, sorry about the delayed response.
To do the above you would want to apply a filter to the data set you are passing into the tree. Once you filter the data you would simply do something like this:
viz.data(myFilteredData).update();
Cheers,
Tom
ankit255February 4, 2018 at 6:19 am #8141Code below fails when I add the filter line – any ideas? ‘Dt’ is a variable.
viz.data(data) // Expects hierarchical array of objects. .width(600) // Width of component .height(600) // Height of component .children(function (d) { return d.values }) // Denotes the property that holds child object array .key(function (d) { return d.id }) // Unique key .value(function (d) { return Number(d["agg_" + valueField]) }) // The property of the datum that will be used for the branch and node size .fixedSpan(-1) // fixedSpan > 0 will use this pixel value for horizontal spread versus auto size based on viz width .branchPadding(.07) .filter(function (d) { return d.Dept== Dt;}) .label(function (d) { // returns label for each node. return trimLabel(d.key)}) .on("measure",onMeasure) // Make any measurement changes .on("mouseover",onMouseOver) // mouseover callback - all viz components issue these events .on("mouseout",onMouseOut) // mouseout callback - all viz components issue these events .on("click",onClick);
vizulyFebruary 5, 2018 at 10:13 am #8142Hello Chetan,
The Weighted Tree does not support a filter operation directly as you are declaring it.
What you would want to do is apply that filter to your data array directly before passing it into the tree.
Cheers,
Tom
-
|
You must be logged in to reply to this topic.