Methods
clone(data) → {*}
The "just-clone" library only really works for objects and arrays. If given a string, it would mess things up quite a lot.
Parameters:
Name | Type | Description |
---|---|---|
data |
object |
- Source:
Returns:
- Type
- *
getLinkedData(shared_options, entities, dependencies, consolidateopt) → {Promise.<Array.<Object>>}
Perform a request for data from a set of providers, taking into account dependencies between requests.
This can be a mix of network requests or other actions (like join tasks), provided that the provider be some
object that implements a method instance.getData
Each data layer in LocusZoom will translate the internal configuration into a format used by this function. This function is never called directly in custom user code. In locuszoom, Requester Handles You
TODO Future: It would be great to add a warning if the final element in the DAG does not reference all dependencies. This is a limitation of the current toposort library we use.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
shared_options |
object | Options passed globally to all requests. In LocusZoom, this is often a copy of "plot.state" |
||
entities |
Map | A lookup of named entities that implement the method |
||
dependencies |
Array.<String> | A description of how to fetch entities, and what they depend on, like |
||
consolidate |
boolean |
<optional> |
true | Whether to return all results (almost never used), or just the last item in the resolved DAG. This can be a pitfall in common usage: if you forget a "join/consolidate" task, the last result may appear to be missing some data. |
- Source:
Returns:
- Type
- Promise.<Array.<Object>>
Type Definitions
eventCallback(eventData)
Parameters:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
eventData |
object | A description of the event Properties
|
- Source:
externalDataCallback(new_data, plot)
A user-defined callback function that can receive (and potentially act on) new plot data.
Parameters:
Name | Type | Description |
---|---|---|
new_data |
Object | The body resulting from a data request. This represents the same information that would be passed to a data layer making an equivalent request. |
plot |
Object | A reference to the plot object. This can be useful for listeners that react to the structure of the data, instead of just displaying something. |
- Source:
externalErrorCallback(err)
A user-defined callback function that can respond to errors received during a previous operation
Parameters:
Name | Type | Description |
---|---|---|
err |
A representation of the error that occurred |
- Source:
Events
any_lz_event
Fields common to every event emitted by LocusZoom. This is not an actual event that should ever be used directly; see list below.
Note: plot-level listeners can be defined for this event, but you should almost never do this. Use the most specific event name to describe the thing you are interested in.
Listening to 'any_lz_event' is only for advanced usages, such as proxying (repeating) LZ behavior to a piece of wrapper code. One example is converting all LocusZoom events to vue.js events.
Type:
- object
Properties:
Name | Type | Description |
---|---|---|
sourceID |
string | The fully qualified ID of the entity that originated the event, eg |
target |
Plot | Panel | A reference to the plot or panel instance that originated the event. |
data |
object | null | Additional data provided. (see event-specific documentation) |
- Source:
data_from_layer
One particular data layer has completed a request for data. This event is primarily used internally by the subscribeToData
function, and the syntax may change in the future.
Properties:
Name | Type | Description | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
data |
object |
Properties
|
- Source:
- See:
Listeners of This Event:
data_rendered
A request for new data has completed, and all data has been rendered in the plot.
- Source:
- See:
Listeners of This Event:
data_requested
A request for new or cached data was initiated. This can be used for, eg, showing data loading indicators.
- Source:
- See:
Listeners of This Event:
element_clicked
Indicates whether an element was clicked. (regardless of the behavior associated with clicking)
- Source:
- See:
-
- event:element_selection for a more specific and more frequently useful event
- event:any_lz_event
element_selection
Indicate whether the element was selected (or unselected)
Properties:
Name | Type | Description |
---|---|---|
data |
object | An object with keys { element, active }, representing the datum bound to the element and the selection status (boolean) |
- Source:
- See:
-
- event:element_clicked if you are interested in tracking clicks that result in other behaviors, like links
- event:any_lz_event
layout_changed
An action occurred that changed, or could change, the layout. Many rerendering operations can fire this event and it is somewhat generic: it includes resize, highlight, and rerender on new data. Caution: Direct layout mutations might not be captured by this event. It is deprecated due to its limited utility.
- Deprecated:
- Yes
- Source:
- See:
match_requested
Indicate whether a match was requested from within a data layer.
Properties:
Name | Type | Description |
---|---|---|
data |
object | An object of |
- Source:
- See:
Listeners of This Event:
panel_removed
A panel was removed from the plot. Commonly initiated by the "remove panel" toolbar widget.
Properties:
Name | Type | Description |
---|---|---|
data |
string | The id of the panel that was removed (eg 'genes') |
- Source:
- See:
region_changed
The plot region has changed. Reports the actual coordinates of the plot after the zoom event. If plot.applyState is called with an invalid region (eg zooming in or out too far), this reports the actual final coordinates, not what was requested. The actual coordinates are subject to region min/max, etc.
Properties:
Name | Type | Description |
---|---|---|
data |
object | The {chr, start, end} coordinates of the requested region. |
- Source:
- See:
set_ldrefvar
A new LD reference variant has been selected (usually by clicking within a GWAS scatter plot) This event only fires for manually selected variants. It does not fire if the LD reference variant is automatically selected (eg by choosing the most significant hit in the region)
Properties:
Name | Type | Description |
---|---|---|
data |
object | { ldrefvar } The variant identifier of the LD reference variant |
- Source:
- See:
state_changed
The user has requested any state changes, eg via plot.applyState
. This reports the original requested values even
if they are overridden by plot logic. Only triggered when a state change causes a re-render.
Properties:
Name | Type | Description |
---|---|---|
data |
object | The set of all state changes requested |
- Source:
- See:
-
- event:any_lz_event
- event:region_changed for a related event that provides more accurate information in some cases