A TransitionedSelection is a selection that can have transitions. It extends both Selection and transitions, allowing powerful animation possibilities.
When setting values like styles and attributes, unlike a typical selection when those changes are immediate, the values are animated and interpolated over a given duration.
Adds the given class to each element backed by this selection.
this selection
Appends an element with the given name to each element backed by this selection. A new selection is returned containing just the appended element.
When used in templates, this is typically used in the added method to add the SVGElements to entities, although it can also be used for appending a child to any element in the DOM.
returns a new Selection backed by the appended element
thinkmap.selectAll('div').append('h1');
Sets or Gets an attribute for each element in this selection with the given value.
If the value is null, the attribute will be removed. If the value is undefined, the value of the attribute is returned for the first element in this selection.
the name of the element
if a value is used to set the attribute, then the Selection is returned. Else the value of the attribute is returned.
selection.attr('width',200);
thinkmap.selectAll('a').attr('href','www.thinkmap.com');
Sets or Gets an attribute using the given namespace on each element in this Selection.
If the value argument is null, the attribute is removed. If the value argument is undefined, the value of the attribute for the first element in this selection is returned.
the namespace used for the attribute
the name of the attribute
if a value is used to set the attribute, then the Selection is returned. Else the value of the attribute is returned.
Calls a function on each element backed by this selection
The function that is called on each node element in this function. The function is passed the graph entity representing this element (if it exists), the index number of the node in the group, and the index number of the group in the selection.
this selection
Calls a function on each element backed by this selection.
The difference between forEach and each, is you can call forEach with an optional this argument where in the each function, the "this" will always be the node the function is currently operating on. Typically, when dealing with selections that represent entities in a display, you would use each. For general Elements in a selection, it is preferred to use forEach.
The function that is called on each node element in this function. The function is passed an element, the index number of the element in the group, and the index number of the group in the selection.The function is also passed the is passed the entity representing this element (if it exists)
returns this Selection
Sets or Gets the innerHTML of all elements backed by this Selection.
If the value is null, the innerHTML will be an empty string. If the value is undefined, then the innerHTML for the first Element in this selection is returned.
If no arguments are passed in, the innerHTML of the first element in this selection is returned
returns this selection if a value is defined, else the innerHTML of the first element in this selection is returned
Removes the given event handler from each element in this selection
the event type
the event handler to be removed
This referes to the event listener's useCapture flag. If true, this listener will be notified toward the front of the listener chain ("capture"). If False, the listener will be notified toward the end of the listener chain ("bubble"). By default, events are notified in the order they are defined.
this Selection
Adds an event listener to all Elements backed by this selection.
the event's name
the function to call for the given event. The function has the event name, the Element it was fired on, and the index of the element in this selection.
This referes to the event listener's useCapture flag. If true, this listener will be notified toward the front of the listener chain ("capture"). If False, the listener will be notified toward the end of the listener chain ("bubble"). By default, events are notified in the order they are defined.
this selection
Adds an event listeners that can only be fired 'once' on each element in the selection.
Once an element in this selection has had that event fired, the event listener is removed only for that element. Other elements in that selection can still have the event fired however.
the event to listener for
the function to be called back when the event fires
this selection
Removes each element backed by this Selection from their parent node.
this selection
Removes each element backed by this Selection from their parent node.
this selection
Removes the given class from all elements backed by this Selection
this selection
Returns a new selection using the given selector.
This works exactly as thinkmap.select() but instead uses this selection as the root to perform the selection rather than a given Element
the new selection
Performs a selectAll with the given selector on each element backed by this selection
returns the result of the select all as a new selection
Sets or gets the given style for each element backed by this selection.
If the value is null, the style will be removed. If the value is undefined, then the style for the first Element in this selection is returned.
Using this method to set the style is analogous to calling style.setProperty on a DOM element.
the name of the style
the string value of the style or a function that returns the value
the priority of the css style (e.g. '!important')
thinkmap.selectAll('div').style('border','1px solid #000');
Sets or Gets the textContent of all elements backed by this Selection.
If the value is null, the textContent will be an empty string. If the value is undefined, then the textConent for the first Element in this selection is returned.
If no arguments are passed in, the text of the first element in this selection is returned
returns this selection if a value is defined, else the textContent first element in this selection is returned
Toggles the given class of and on for each element backed by this Selection
this selection
Returns a TransitionedSelection which allows one to perform transitions on selections.
Ensures that this transition does not begin until the given future completes.
this transition
Adds an animator function with a name. These animator functions are called on each tick of the transition.
The name serves as a key to ensure that no two transitions conflict with each other.
the name associated with this animator function. The name serves as a key to prevent animator functions from conflicting
Sets or gets the function to execute when this transition completes
returns this transition if setting the atEnd function, else the current atEnd function is returned
Sets or gets the delay for this transition.
The delay can be either a number or a function that returns a number for each individual item in this transition.
If no delay is explicitly set, the default delay for transitions is used.
returns this transition if setting the delay, else the current delay is returned
Sets or gets the duration for this transition.
The duration can be either a number or a function that returns a number for each individual item in this transition.
If no duration is explicitly set, the default duration for transitions is used.
returns this transition if setting the duration, else the current duration is returned
Sets or gets the easing function to be used on this Transition.
the easing function used for this transition
this Transition if setting the easing function or the current Easing function
Lends the methods of this Transition to another object. Because many classes depend on animation and we can only extend once, this is a handy way to offer the methods of transition to another object that needs them for managing animations
the object to lend the methods to
this transition
Sets or gets the function to execute on each 'tick' or 'step' of this transition
returns this transition if setting the tick function, else the current tick function is returned
Binds a this argument to the future which will be passed to listeners when this Future is called.
returns this future
Cancels this future, causing it to go into the Future.CANCELLED state.
the optional value that will be passed to this futures cancel listeners
returns this Future
Fails this future, with the given reason. Users should never call this method directly.
returns this future
Fulfills this future which marks the future as being successfully completed.
an optional value that was created by the future.
Register a function to be called if this Future completes. The function will be called with the value of the future as the argument.
Note this API does not currently support removing the listener.
this future
Register a function to be called if this Future fails.
Note this API does not currently support removing the listener.
this future
Register a function to be called as progress events occur on this Future. The function will be called with the value of the progress as the argument.
Note this API does not currently support removing the listener.
this future
Progresses this future, with the given arguments. Users should never call this method directly.
optional value that will be passed this future's progress listeners
returns this future
Registers a set of listeners that are called as this future progresses. And returns a new future that is fulfilled by the return value of the oncomplete handler. In this way, Futures can be chained.
the function to call when this Future is complete.
the function to call if this Future encounters an error. This will only be called one or zero times.
the function to call as this Future progresses. This is not guaranteed to be called.
thinkmap.async.later(function() { return 5; },2000)
.then(function(x) { return v + 2; })
.then(function(v) { alert(v); });
Add a listener to this EventSource
the name of the event to listen for
the callback to add
this eventsource
Dispatch an event from this EventSource, supplying arguments to the listeners via an Array, rather than var-args.
the name of the event to dispatch
this EventSource
Dispatch an event from this EventSource
the name of the event to dispatch
optional arguments sent to the event listeners
this EventSource
Fire an event from this EventSource
the name of the event to dispatch
optional arguments sent to the event listeners
this EventSource
Remove a listener from this EventSource
the name of the event to remove the listener for
the callback to remove
this eventsource
fired when this future completes. The arguments to this event are the arguments used to fulfill (complete) this future
fired when this future is cancelled. The arguments to this event are the arguments passed to the cancel method of this future
fired when this future encounters an error. The arguments to this event are the error which caused this future from being unable to complete.
fired when this future has been notified of progress. The arguments to this event are the arguments passed to this futures progress method.