Namespace LABKEY.vis.TimeChartHelper
Namespace used to encapsulate functions related to creating study Time Charts. Used in the
Time Chart Wizard and when exporting Time Charts as scripts.
Defined in: timeChartHelper.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
LABKEY.vis.TimeChartHelper.loadVisDependencies
Loads all of the required dependencies for a Time Chart.
|
Method Attributes | Method Name and Description |
---|---|
<inner> |
generateAcrossChartAxisRanges(config, data, seriesList, nounSingular)
Generates axis range min and max values based on the full Time Chart data.
|
<inner> |
generateAes(config, visitMap, individualColumnAliases, intervalKey, nounColumnName)
Generates the aesthetic map object needed by the visualization API to render the chart.
|
<inner> |
generateApplyClipRect(config)
Determine whether or not the chart needs to clip the plotted lines and points based on manually set axis ranges.
|
<inner> |
generateIntervalKey(config, individualColumnAliases, aggregateColumnAliases, nounSingular)
Generate the x-axis interval column alias key.
|
<inner> |
generateLabels(mainTitle, axisArr)
Generate the main title and axis labels for the chart based on the specified x-axis and y-axis (left and right) labels.
|
<inner> |
generateLayers(config, visitMap, individualColumnAliases, aggregateColumnAliases, aggregateData, seriesList, intervalKey, nounColumnName)
Generate an array of LABKEY.vis.Layer objects based on the selected chart series list.
|
<inner> |
generateNumberFormats(config, data, defaultNumberFormat)
Generate the number format functions for the left and right y-axis and attach them to the chart data object
|
<inner> |
generatePlotConfigs(config, data, seriesList, applyClipRect, maxCharts, nounColumnName)
Generates plot configs to be passed to the LABKEY.vis.Plot function for each chart in the report.
|
<inner> |
generateScales(config, tickMap, numberFormats)
Generates an object containing LABKEY.vis.Scale objects used for the chart.
|
<inner> |
generateSeriesList(measures)
Generate the list of series to be plotted in a given Time Chart.
|
<inner> |
generateTickMap(visitMap)
Generate that x-axis tick mark mapping for a visit based chart.
|
<inner> |
getAxisIndex(axes, axisName, side)
Get the index in the axes array for a given axis (ie left y-axis).
|
<inner> |
getChartData(config)
Get the data needed for the specified Time Chart based on the chart config.
|
<inner> |
validateChartConfig(config)
Verifies the information in the chart config to make sure it has proper measures, axis info, subjects/groups, etc.
|
<inner> |
validateChartData(data, config, seriesList, limit)
Verifies that the chart data contains the expected interval values and measure/dimension data.
|
Field Detail
<static>
LABKEY.vis.TimeChartHelper.loadVisDependencies
Loads all of the required dependencies for a Time Chart.
Method Detail
<inner>
generateAcrossChartAxisRanges(config, data, seriesList, nounSingular)
Generates axis range min and max values based on the full Time Chart data. This will be used when plotting multiple
charts that are set to use the same axis ranges across all charts in the report.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- {Object} data
- The data object, from getChartData.
- {Array} seriesList
- The list of series that will be plotted for a given chart, from generateSeriesList.
- {String} nounSingular
- The singular name of the study subject noun (i.e. Participant).
<inner>
{Object}
generateAes(config, visitMap, individualColumnAliases, intervalKey, nounColumnName)
Generates the aesthetic map object needed by the visualization API to render the chart. See LABKEY.vis.Plot
and LABKEY.vis.Layer.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- {Object} visitMap
- For visit based charts, the study visit information map.
- {Array} individualColumnAliases
- The array of column aliases for the individual subject data.
- {String} intervalKey
- The x-axis interval column alias key (i.e. Days, Weeks, etc.), from generateIntervalKey.
- {String} nounColumnName
- The name of the study subject noun column (i.e. ParticipantId).
- Returns:
- {Object}
<inner>
{boolean}
generateApplyClipRect(config)
Determine whether or not the chart needs to clip the plotted lines and points based on manually set axis ranges.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- Returns:
- {boolean}
<inner>
{String}
generateIntervalKey(config, individualColumnAliases, aggregateColumnAliases, nounSingular)
Generate the x-axis interval column alias key. For date based charts, this will be a time interval (i.e. Days, Weeks, etc.)
and for visit based charts, this will be the column alias for the visit field.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- {Array} individualColumnAliases
- The array of column aliases for the individual subject data.
- {Array} aggregateColumnAliases
- The array of column aliases for the group/cohort aggregate data.
- {String} nounSingular
- The singular name of the study subject noun (i.e. Participant).
- Returns:
- {String}
<inner>
{Object}
generateLabels(mainTitle, axisArr)
Generate the main title and axis labels for the chart based on the specified x-axis and y-axis (left and right) labels.
- Parameters:
- {String} mainTitle
- The label to be used as the main chart title.
- {Array} axisArr
- An array of axis information including the x-axis and y-axis (left and right) labels.
- Returns:
- {Object}
<inner>
{Array}
generateLayers(config, visitMap, individualColumnAliases, aggregateColumnAliases, aggregateData, seriesList, intervalKey, nounColumnName)
Generate an array of LABKEY.vis.Layer objects based on the selected chart series list.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- {Object} visitMap
- For visit based charts, the study visit information map.
- {Array} individualColumnAliases
- The array of column aliases for the individual subject data.
- {Array} aggregateColumnAliases
- The array of column aliases for the group/cohort aggregate data.
- {Array} aggregateData
- The array of group/cohort aggregate data, from getChartData.
- {Array} seriesList
- The list of series that will be plotted for a given chart, from generateSeriesList.
- {String} intervalKey
- The x-axis interval column alias key (i.e. Days, Weeks, etc.), from generateIntervalKey.
- {String} nounColumnName
- The name of the study subject noun column (i.e. ParticipantId).
- Returns:
- {Array}
<inner>
generateNumberFormats(config, data, defaultNumberFormat)
Generate the number format functions for the left and right y-axis and attach them to the chart data object
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- {Object} data
- The data object, from getChartData.
- {Object} defaultNumberFormat
<inner>
{Array}
generatePlotConfigs(config, data, seriesList, applyClipRect, maxCharts, nounColumnName)
Generates plot configs to be passed to the LABKEY.vis.Plot function for each chart in the report.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- {Object} data
- The data object, from getChartData.
- {Array} seriesList
- The list of series that will be plotted for a given chart, from generateSeriesList.
- {boolean} applyClipRect
- A boolean indicating whether or not to clip the plotted data region, from generateApplyClipRect.
- {int} maxCharts
- The maximum number of charts to display in one report.
- {String} nounColumnName
- The name of the study subject noun column (i.e. ParticipantId).
- Returns:
- {Array}
<inner>
{Object}
generateScales(config, tickMap, numberFormats)
Generates an object containing LABKEY.vis.Scale objects used for the chart.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- {Object} tickMap
- For visit based charts, the x-axis tick mark mapping, from generateTickMap.
- {Object} numberFormats
- The number format functions to use for the x-axis and y-axis (left and right) tick marks.
- Returns:
- {Object}
<inner>
{Array}
generateSeriesList(measures)
Generate the list of series to be plotted in a given Time Chart. A series will be created for each measure and
dimension that is selected in the chart.
- Parameters:
- {Array} measures
- The array of selected measures from the chart config.
- Returns:
- {Array}
<inner>
{Object}
generateTickMap(visitMap)
Generate that x-axis tick mark mapping for a visit based chart.
- Parameters:
- {Object} visitMap
- For visit based charts, the study visit information map.
- Returns:
- {Object}
<inner>
{number}
getAxisIndex(axes, axisName, side)
Get the index in the axes array for a given axis (ie left y-axis).
- Parameters:
- {Array} axes
- The array of specified axis information for this chart.
- {String} axisName
- The chart axis (i.e. x-axis or y-axis).
- {String} side Optional
- The y-axis side (i.e. left or right).
- Returns:
- {number}
<inner>
getChartData(config)
Get the data needed for the specified Time Chart based on the chart config. Makes calls to the
LABKEY.Query.Visualization.getData to get the individual subject data and grouped aggregate data.
Calls the success callback function in the config when it has received all of the requested data.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
<inner>
{Object}
validateChartConfig(config)
Verifies the information in the chart config to make sure it has proper measures, axis info, subjects/groups, etc.
Returns an object with a success parameter (boolean) and a message parameter (string). If the success pararameter
is false there is a critical error and the chart cannot be rendered. If success is true the chart can be rendered.
Message will contain an error or warning message if applicable. If message is not null and success is true, there is a warning.
- Parameters:
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- Returns:
- {Object}
<inner>
{Object}
validateChartData(data, config, seriesList, limit)
Verifies that the chart data contains the expected interval values and measure/dimension data. Also checks to make
sure that data can be used in a log scale (if applicable). Returns an object with a success parameter (boolean)
and a message parameter (string). If the success pararameter is false there is a critical error and the chart
cannot be rendered. If success is true the chart can be rendered. Message will contain an error or warning
message if applicable. If message is not null and success is true, there is a warning.
- Parameters:
- {Object} data
- The data object, from getChartData.
- {Object} config
- The chart configuration object that defines the selected measures, axis info, subjects/groups, etc.
- {Array} seriesList
- The list of series that will be plotted for a given chart, from generateSeriesList.
- {int} limit
- The data limit for a single report.
- Returns:
- {Object}