Class Index | File Index

Classes


Namespace LABKEY.Query.Visualization

Visualization static class to programmatically retrieve visualization-ready data. Also allows persistence of various visualization types.
Defined in: Visualization.js.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
LABKEY.Query.Visualization.get(config)
Retrieves a saved visualization.
<static>  
LABKEY.Query.Visualization.getData(config)
Returns a resultset suitable for visualization based on requested measures and dimensions.
<static>  
LABKEY.Query.Visualization.getFromUrl(config)
Retrieves a saved visualization based on identifying parameters found on the current URL.
<static>  
LABKEY.Query.Visualization.getMeasures(config)
Returns the set of plottable measures found in the current container.
<inner>  
getSuccessCallbackWrapper(createMeasureFn, fn, scope)
This is used internally to automatically parse returned JSON and call another success function.
<static>  
LABKEY.Query.Visualization.save(config)
Saves a visualization for future use.
Namespace Detail
LABKEY.Query.Visualization
Method Detail
<static> LABKEY.Query.Visualization.get(config)
Retrieves a saved visualization. See LABKEY.Query.Visualization.save.
Parameters:
config
An object which contains the following configuration properties.
{String} config.name
The name this visualization to be retrieved.
{String} config.schemaName Optional
Optional, but required if config.queryName is provided. Limits the search for the visualization to a specific schema and query. Note that visualization names are unique within a container (regardless of schema and query), so these additional optional parameters are only useful in a small number of circumstances.
{String} config.queryName Optional
Optional, but required if config.schemaName is provided. Limits the search for the visualization to a specific schema and query. Note that visualization names are unique within a container (regardless of schema and query), so these additional optional parameters are only useful in a small number of circumstances.
{Function} config.success
Function called when execution succeeds. Will be called with one arguments:
  • result: an object with two properties:
    • name: The name of the saved visualization
    • description: The description of the saved visualization
    • type: The visualization type
    • schemaName: The schema to which this visualization has been scoped, if any
    • queryName: The query to which this visualization has been scoped, if any
    • visualizationConfig: The configuration object provided to LABKEY.Query.Visualization.save
  • request: the XMLHttpRequest object
  • options: a request options object
{Function} config.failure Optional
Function called when execution fails. Called with the following parameters:
  • errorInfo: an object containing detailed error information (may be null)
  • response: The XMLHttpResponse object

<static> LABKEY.Query.Visualization.getData(config)
Returns a resultset suitable for visualization based on requested measures and dimensions.
Parameters:
config
An object which contains the following configuration properties.
{Array} config.measures
An array of objects with the following structure:
  • measure: Generally an augmented LABKEY.Query.Visualization.Measure, but can be any object with the following properties:
    • schemaName: The name of the schema containing the query that contains this measure.
    • queryName: The name of the query containing this measure.
    • name: The name of the column containing this measure.
    • type: The data type of this measure.
    • isDemographic: Boolean (default false). Indicates whether the measure is Demographic data.
    • alias: String.
    • values: Optional. If provided, results will be filtered to include only the provided values.
    • allowNullResults: Optional, defaults to true. If true, this measure will be joined to other measures via an outer join, which will allow results from other measures at timepoints not present for this measure (possibly resulting in null/blank values for this measure). If false, other measures will be inner joined to this measure, which will produce a dataset without null values for this measure, but which may not include all data from joined measures.
    • aggregate: See LABKEY.Query.Visualization.Aggregate. Required if a 'dimension' property is specified, ignored otherwise. Indicates what data should be returned if pivoting by dimension results in multiple underlying values per series data point.
  • dateOptions: Optional if this measure's axis.timeAxis property is true, ignored otherwise. Has the following child properties. Either zeroDateCol or ZeroDayVisitTag may be specified, but not both.
    • dateCol: A measure object (with properties for name, queryName, and schemaName) of type date specifying the measure date.
    • zeroDateCol: A measure object (with properties for name, queryName, and schemaName) of type date specifiying the zero date, used to align data points in terms of days, weeks, or months.
    • zeroDayVisitTag: String. A VisitTag that will be used to find the ParticipantVisit used to align data points.
    • interval: See LABKEY.Query.Visualization.Interval. The type of interval that should be calculated between the measure date and the zero date (if zeroDateCol is specified) or zero day (if zeroDayVisitTag is specified).
    • useProtocolDay: Boolean (default true). If true, zeroDayVisitTag uses ParticipantVisit.ProtocolDay to calculate offsets; if false ParticipantVisit.Day is used.
  • time: String: "date" indicates this measure is date-based. "time" indicates it is time-based.
  • dimension: Used to pivot a resultset into multiple series. Generally an augmented LABKEY.Query.Visualization.Dimension, but can be any object with the following properties:
    • name: The name of this dimension.
    • schemaName: The name of the schema containing the query that contains this dimension.
    • queryName: The name of the query containing this dimension.
    • type: The data type of this dimension.
    • values: Optional. If provided, results will be filtered to include only the named series.
{Array} config.sorts Optional
Generally an array of augmented LABKEY.Query.Visualization.Dimension or LABKEY.Query.Visualization.Measure objects, but can be an array of any objects with the following properties:
  • name: The name of this dimension.
  • schemaName: The name of the schema containing the query that contains this dimension.
  • queryName: The name of the query containing this dimension.
  • values: Optional. If provided, results will be filtered to include only the specified values.
{Boolean} config.metaDataOnly Optional
Default false. If true, response will no include the actual data rows, just metadata.
{Boolean} config.joinToFirst Optional
Default false. If true, all measures will be joined to the first measure in the array instead of to the previous measure.
{Function} config.success
Function called when execution succeeds. Will be called with three arguments:
{Function} config.failure Optional
Function called when execution fails. Called with the following parameters:
  • errorInfo: an object containing detailed error information (may be null)
  • response: The XMLHttpResponse object

<static> LABKEY.Query.Visualization.getFromUrl(config)
Retrieves a saved visualization based on identifying parameters found on the current URL. Method returns true or false, depending on whether the URL contains a saved visualization identifier. If true, the success or failure callback function will be called just as with LABKEY.Query.Visualization.get. If false, no callbacks will be called. This method allows callers to use a single method to retrieve saved visualizations, regardless of how they are identified on the URL.
Parameters:
config
An object which contains the following configuration properties.
{Function} config.success
Function called when the saved visualization was successfully retrieved. See LABKEY.Query.Visualization.get for details.
{Function} config.failure Optional
Function called when the saved visualization could not be retrieved. See LABKEY.Query.Visualization.get for details.
Returns:
Boolean indicating whether the current URL includes parameters that identify a saved visualization.

<static> LABKEY.Query.Visualization.getMeasures(config)
Returns the set of plottable measures found in the current container.
Parameters:
config
An object which contains the following configuration properties.
{Array} config.filters
An array of LABKEY.Query.Visualization.Filter objects.
{Boolean} config.dateMeasures Optional
Indicates whether date measures should be returned instead of numeric measures. Defaults to false.
{Function} config.success
Function called when execution succeeds. Will be called with one argument:
{Function} config.failure Optional
Function called when execution fails. Called with the following parameters:
  • errorInfo: an object containing detailed error information (may be null)
  • response: The XMLHttpResponse object

<inner> getSuccessCallbackWrapper(createMeasureFn, fn, scope)
This is used internally to automatically parse returned JSON and call another success function. It is based off of LABKEY.Utils.getCallbackWrapper, however, it will call the createMeasureFn function before calling the success function.
Parameters:
createMeasureFn
fn
scope

<static> LABKEY.Query.Visualization.save(config)
Saves a visualization for future use. Saved visualizations appear in the study 'views' webpart. If the visualization is scoped to a specific query, it will also appear in the views menu for that query.
Parameters:
config
An object which contains the following configuration properties.
{String} config.name
The name this visualization should be saved under.
{String} config.type
The type of visualization being saved. Should be an instance of LABKEY.Query.Visualization.Type.
{Object} config.visualizationConfig
An arbitrarily complex JavaScript object that contains all information required to recreate the report.
{Boolean} config.replace Optional
Whether this 'save' call should replace an existing report with the same name. If false, the call to 'save' will fail if another report with the same name exists.
{String} config.description Optional
A description of the saved report.
{String} config.shared Optional
Boolean indicating whether this report is viewable by all users with read permissions to the visualization's folder. If false, only the creating user can see the visualization. Defaults to true.
{Boolean} config.thumbnailType Optional
String indicating whether a thumbnail should be auto-generated ('AUTO'), no thumbnail should be saved ('NONE'), or the existing custom thumbnail should be kept ('CUSTOM')
{Boolean} config.iconType Optional
String indicating whether a icon should be auto-generated ('AUTO'), no icon should be saved ('NONE'), or the existing custom icon should be kept ('CUSTOM')
{String} config.svg Optional
String svg to be used to generate a thumbnail
{String} config.schemaName Optional
Optional, but required if config.queryName is provided. Allows the visualization to be scoped to a particular query. If scoped, this visualization will appear in the 'views' menu for that query.
{String} config.queryName Optional
Optional, but required if config.schemaName is provided. Allows the visualization to be scoped to a particular query. If scoped, this visualization will appear in the 'views' menu for that query.
{Function} config.success
Function called when execution succeeds. Will be called with one arguments:
  • result: an object with two properties:
    • name: the name of the saved visualization
    • visualizationId: a unique integer identifier for this saved visualization
  • request: the XMLHttpRequest object
  • options: a request options object
{Function} config.failure Optional
Function called when execution fails. Called with the following parameters:
  • errorInfo: an object containing detailed error information (may be null)
  • response: The XMLHttpResponse object

Documentation generated by JsDoc Toolkit 2.3.2 on Thu Mar 16 2017 20:36:36 GMT-0000 (UTC)