Arguments: |
|
---|
Constructs a landing page describing one or more other applications on a server. cfg.specFile points to a JSON file containing a single object with two fields, apps and external. The apps field is a list of objects, each of which has three fields: name, giving the title (and link text) for an application; path, giving the link target for the app; and description, containing descriptive HTML text that will describe the application within the list. The external field also contains a list of objects, with the following fields: name, as before; link, containing a link to the external webpage for the project; institution, giving the name of the organization that hosts the external project; institution_link, giving a link target for the institution; and description, as before.
This function lists out the projects in the JSON file columnwise into two columns (specified by cfg.leftColumn, cfg.rightColumn, cfg.leftExternalColumn, and cfg.rightExternalColumn), placing links and descriptive text appropriately.
Returns the height of the drawer handle icon (for use in laying out drawer elements).
Arguments: |
|
---|
Returns a function that can be used as the open/close callback for a control panel. The function causes the height of the control panel element to toggle between full height (open) and zero height (closed).
Arguments: |
|
---|
Constructs an SVG color legend in the <g> element specified by cfg.legend, mapping colors from the elements of cfg.categories through the function cfg.cmap_func.
Returns the version as string of the form "x.y.z".
The identity function: function (d) { return d; }.
Returns true if x is a number.
Returns true if x is a boolean.
Returns true if x is an array.
Returns true if x is an object.
Returns true if x is a string.
Arguments: |
|
---|
Returns a function which takes an object and returns a value according to the spec.
Returns true if any of the elements in the array values are NaN.
Returns a new function which first calls f1 then calls f2. All arguments are passed to each function.
Returns true if tangelo.version() returns a version >= the version specified in reqvstr.
Arguments: |
|
---|
Finds the two extreme values in field field of collection in database on Mongo server host, then calls callback passing these two values as arguments.
This function could be used, for example, to find the earliest and latest events in a Mongo collection, then use that information to set up a date selector element in the webpage.
Returns true if all arguments are defined, and false otherwise.
Constructs a key/value store object, initializing it with the information found in inputSpec.
If inputSpec is a Javascript object, its contents are used directly as the initialization data for the defaults object. Otherwise, if inputSpec is a string, it is treated as the path to a JSON file that encodes a single Javascript object - this file is loaded via ajax and its contents then used as the initialization data.
If ajax is used to load the initialization data, callback - if specified - will be invoked on the newly created defaults object when the ajax call finishes. This can be used to specify, for example, the continuation of the containing function so as to ensure that the object is created and ready when the continuation is invoked (in other words, using the callback is the asynchronous version of returning the new object directly from the call to the defaults function).
The defaults object has two methods: get(key) returns the value associated to key (or undefined if key is not present); set(key, value) associates value to key.
This object can be used to set up default configuration options for a web application. The following example shows one useful pattern:
tangelo.util.defaults("defaults.json", function (config) {
var opt = {
color: "red",
fontsize: 12
};
for (o in opt) {
config.set(o, config.get(o) || opt[o]);
}
.
.
.
});
This code snippet reads in values from a file and fills in hardcoded default values for anything missing in the file. This pattern can be deployed somewhere, and the site maintainer can supply a defaults.json file to vary the default values. If the file is omitted, then the hardcoded defaults will kick in.
Returns a unique string ID for use as, e.g., ids for dynamically generated html elements, etc.
Arguments: |
|
---|
Converts an array of nodes with ids and child lists into a nested tree structure. The nested tree format with a standard children attribute is the required format for other Tangelo functions such as tangelo.vis.dendrogram().
As an example, evaluating:
var tree = tangelo.data.tree({
data: [
{name: "a", childNodes: [{child: "b", child: "c"}]},
{name: "b", childNodes: [{child: "d"}]},
{name: "c"},
{name: "d"}
],
id: {field: "name"},
idChild: {field: "child"},
children: {field: "childNodes"}
});
will return the following nested tree (note that the original childNodes attributes will also remain intact):
{
name: "a",
children: [
{
name: "b",
children: [
{
name: "d"
}
]
},
{
name: "c"
}
]
}
Arguments: |
|
---|
Appends the specified arbitrary HTML content under the specified element.
Arguments: |
|
---|
Creates a double-handled range slider control appended to the specified parent element.
Arguments: |
|
---|
Creates a drop-down selection menu (HTML <select> element) with the specified options.
Arguments: |
|
---|
Constructs an interactive dendrogram.
Updates the dendrogram attributes based on the attributes set in spec. The possible content of spec matches the constructor options.
Resets the view by expanding all collapsed nodes and resetting the root to the full tree.
Downloads the view in the specified format. Currently only the "pdf" format is supported.