Empirical
|
#include <selection.h>
Public Member Functions | |
SelectionOrTransition () | |
SelectionOrTransition (int id) | |
SelectionOrTransition (const SelectionOrTransition< DERIVED > &s) | |
DERIVED | Select (std::string selector) const |
DERIVED | SelectAll (std::string selector) const |
DERIVED & | Call (std::string function) |
DERIVED | Filter (std::string selector) const |
DERIVED & | Each (std::string function) |
void | Remove () |
DERIVED | Merge (DERIVED &other) |
int | GetID () const |
void | Log () const |
Setters | |
There are three main types of values you might want to change about a selection: attributes (use Additional traits you can set include text and html. Advanced note: In D3.js, the same functions are used to set and get values (depending on whether an argument is passed). Because C++ needs to have clearly defined return types we need separate getters for each return type. | |
DERIVED & | SetAttr (std::string name, std::string value) |
DERIVED & | SetStyle (std::string name, std::string value, bool priority=false) |
DERIVED & | SetText (std::string text) |
DERIVED & | SetProperty (std::string name, std::string value) |
DERIVED & | SetHtml (std::string value) |
DERIVED & | SetClassed (std::string classname, bool value) |
Getters | |
There are three main types of values you might want to access about a selection: attributes (use Additional traits you can set include text and html. Advanced note: In D3.js, the same functions are used to set and get values (depending on whether an argument is passed). Because C++ needs to have clearly defined return types (and because different macros are required to return different types from Javascript), we need separate getters for each return type. | |
std::string | GetAttrString (std::string name) const |
Get the value of this object's [name] attribute when it's a string. More... | |
int | GetAttrInt (std::string name) const |
Get the value of this object's [name] attribute when it's an int. More... | |
double | GetAttrDouble (std::string name) const |
Get the value of this object's [name] attribute when it's a double. More... | |
std::string | GetStyleString (std::string name) const |
Get the value of this object's [name] style when it's a string. More... | |
int | GetStyleInt (std::string name) const |
Get the value of this object's [name] style when it's an int. More... | |
double | GetStyleDouble (std::string name) const |
Get the value of this object's [name] style when it's a double. More... | |
std::string | GetText () const |
Get this object's text. More... | |
std::string | GetHtml () |
std::string | GetPropertyString (std::string name) |
int | GetPropertyInt (std::string name) |
double | GetPropertyDouble (std::string name) |
bool | Empty () const |
Returns true if there are no elements in this selection (or all elements are null) More... | |
int | Size () const |
Returns number of elements in this selection. More... | |
Protected Attributes | |
int | id |
You probably never want to instantiate this class. Its sole purpose is to hold code for methods that are common to selections and transitions.
Developer note: It's also handy if you want to allow a function to accept either a selection or transition. This is a good idea any time you are only using methods that are applicable to either, and the person calling the function may want to animate its results.
|
inline |
|
inline |
|
inline |
|
inline |
Call the given function once on the entire selection/transition. [function] can either be a C++ function or a string with the name of a Javascript function in the d3, emp, or current window namespace. To get around the problem of passing selections into C++, this function assumes that the function you are passing expects a single argument: an int, representing the id of the selection to be operated on (which you can then convert to a selection object with D3::Selection(i)
).
|
inline |
Call the given function on each element of the selection/transition. [function] can either be a C++ function or a string with the name of a Javascript function in the d3, emp, or current window namespace.
|
inline |
Returns true if there are no elements in this selection (or all elements are null)
|
inline |
Returns a new selection/transition, representing the current selection/transition filtered by [selector]. [selector] can be a C++ function that returns a bool, a string representing a function in either the d3, emp, or window namespaces that returns a bool, or a string containing a selector to filter by.
For more information see the D3 documentation
|
inline |
Get the value of this object's [name] attribute when it's a double.
|
inline |
Get the value of this object's [name] attribute when it's an int.
|
inline |
Get the value of this object's [name] attribute when it's a string.
|
inline |
Get this object's html
Advanced note: This is implemented differently for selection vs transitions. As such, calling it on a SelectionOrTransition object directly is not supported.
|
inlineinherited |
|
inline |
Get the value of this object's [name] property when it's a double
Advanced note: This is implemented differently for selection vs transitions. As such, calling it on a SelectionOrTransition object directly is not supported.
|
inline |
Get the value of this object's [name] property when it's an int
Advanced note: This is implemented differently for selection vs transitions. As such, calling it on a SelectionOrTransition object directly is not supported.
|
inline |
Get the value of this object's [name] property when its a string
Advanced note: This is implemented differently for selection vs transitions. As such, calling it on a SelectionOrTransition object directly is not supported.
|
inline |
Get the value of this object's [name] style when it's a double.
|
inline |
Get the value of this object's [name] style when it's an int.
|
inline |
Get the value of this object's [name] style when it's a string.
|
inline |
Get this object's text.
|
inlineinherited |
|
inline |
|
inline |
Remove the elements in this selection/transition from the document For transitions, this happens at the end of the transition.
|
inline |
Create a new selection/transition containing the first element matching the [selector] string that are within this current selection/transition
|
inline |
Create a new selection/transition containing all elements matching the [selector] string that are within this current selection/transition
|
inline |
Assigns [value] to the selection's [name] attribute. Value can be any primitive type, a string, a function object, or a lambda. If a string is passed, it can be a normal string, or the name of a function in d3, emp (such as one created with JSWrap), or the local window. If it is a function name, that function will be run, receiving bound data, if any, as input
|
inline |
Change whether or not element in this selection have the [classname] class. Example: Add the data-point class with selection.SetClassed("data-point", true); Advanced note: This is implemented differently for selection vs transitions. As such, calling it on a SelectionOrTransition object directly is not supported.
|
inline |
Sets this selection's inner html to the specified string, or the string returned by running the specified function on the element's bound data
Advanced note: This is implemented differently for selection vs transitions. As such, calling it on a SelectionOrTransition object directly is not supported.
|
inline |
Sets special properties of DOM elements (e.g. "checked" for checkboxes) Value can be a number, function, string, or string naming a Javascript function See the d3 documentation for more information.
Advanced note: This is implemented differently for selection vs transitions. As such, calling it on a SelectionOrTransition object directly is not supported.
|
inline |
Sets the selection's [name] style to [value]. This is the same idea as SetAttr, except for CSS styles. Value can be any primitive type, a string, a function object, or a lambda. If a string is passed, it can be a normal string, or the name of a function in d3, emp (such as one created with JSWrap), or the local window. If it is a function name, that function will be run, receiving bound data, if any, as input
There is a third optional argument, a boolean indicating whether you want to give this setting priority.
|
inline |
Sets this selection's text to the specified string, or the string returned by running the specified function on the element's bound data
|
inline |
Returns number of elements in this selection.
|
protectedinherited |