Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Dave Landry edited this page Oct 3, 2014 · 1 revision

A number of methods have the ability to only show specific slices of that data using mute and solo filters.

When both mute and solo parameters are passed to a given method, only the solo parameter is used.

Muting data refers to the act of hiding specific data points. The data points that are muted will not be displayed on the screen. Many of the methods in d3plus can accept "mute" parameters. The "mute" parameter can accept any of the approved filtering values listed here.

Soloing data refers to the act of only showing specific data points. The data points that are soloed will be the only nodes displayed on the screen. Many of the methods in d3plus can accept "solo" parameters. The "solo" parameter can accept any of the approved filtering values listed here.

Both mute and solo parameters accept the same type of values. They are:

By passing only a value, the value will be added to the list of values to match. If the value passed is already present in the list, it will be removed from the list (an easy way to toggle filtering specific data points).

For example, to hide all data with a .id( ) of "Boston", we would call the following method:

.id({ "mute" : "Boston" })

When filtering on the .id( ) method, all nesting levels are checked for matches (if nesting is applicable).

Additionally, you can pass functions as a way of filtering data. For example, to only show data with a size greater than 0.5, where "weight" is our size value, we can pass this function to "solo":

.size({ "solo" : function(node) {
	return node.weight > 0.5
}})

If you have multiple filters you would like to pass to a method, you can pass an array of values/functions. In this example, we will hide all data with a .id( ) matching 3 specific names:

.id({ "mute" : [ "Alex" , "Dave" , "Mario" ] })

When passing an array to one of the filters, it will completely overwrite any previous filter parameters.

In order to reset all solo or mute data, you simply pass an empty array to the applicable method. In this example, we are resetting the solo for .id( ):

.id({ "solo" : [] })

Clone this wiki locally