Namespace LABKEY.vis.GenericChartHelper
Namespace used to encapsulate functions related to creating Generic Charts (Box, Scatter, etc.). Used in the
Generic Chart Wizard and when exporting Generic Charts as Scripts.
Defined in: genericChartHelper.js.
Constructor Attributes | Constructor Name and Description |
---|---|
Field Attributes | Field Name and Description |
---|---|
<static> |
LABKEY.vis.GenericChartHelper.loadVisDependencies
Loads all of the required dependencies for a Generic Chart.
|
Method Attributes | Method Name and Description |
---|---|
<inner> |
generateAes(chartType, measures, schemaName, queryName)
Generates the aesthetic map object needed by the visualization API to render the chart.
|
<inner> |
generateAggregateData(data, dimensionName, measureName, aggregate, nullDisplayValue)
|
<inner> |
generateBarGeom(chartOptions)
Generates the Barplot Geom used for bar charts.
|
<inner> |
generateBinGeom(chartOptions)
Generates the Bin Geom used to bin a set of points.
|
<inner> |
generateBoxplotGeom(chartOptions)
Generates the Boxplot Geom used for box plots.
|
<inner> |
Returns a function used to generate the hover text for box plots.
|
<inner> |
generateContinuousAcc(measureName)
Generates an accessor function that returns a value from a row of data for a given measure.
|
<inner> |
generateDiscreteAcc(measureName, measureLabel)
Generates an accessor function that returns a discrete value from a row of data for a given measure and label.
|
<inner> |
generateGeom(chartType, chartOptions)
Generates a Geom based on the chartType.
|
<inner> |
generateGroupingAcc(measureName)
Generates an accesssor function for shape and color measures.
|
<inner> |
generateLabels(labels)
Given the saved labels object we convert it to include all label types (main, x, and y).
|
<inner> |
generateMeasurelessAcc(measureName)
Generates an accessor for boxplots that do not have an x-axis measure.
|
<inner> |
generatePlotConfig(renderTo, chartConfig, labels, aes, scales, data, data)
Generate the plot config for the given chart renderType and config options.
|
<inner> |
generatePointClickFn(measures, schemaName, queryName, fnString)
Generates the function to be executed when a user clicks a point.
|
<inner> |
generatePointGeom(chartOptions)
Generates the Point Geom used for scatter plots and box plots with all points visible.
|
<inner> |
generatePointHover(measures)
Generates a function that returns the text used for point hovers.
|
<inner> |
generateScales(chartType, measures, savedScales, aes, responseData, defaultFormatFn)
Generates an object containing LABKEY.vis.Scale objects used for the chart.
|
<inner> |
getChartType(renderType, xAxisType)
Gets the chart type (i.e.
|
<inner> |
getDefaultLabel(renderType, measureName, properties)
Generate a default label for the selected measure for the given renderType.
|
<static> |
LABKEY.vis.GenericChartHelper.getRenderTypes()
|
<inner> |
validateAxisMeasure(chartType, chartConfig, measureName, aes, scales, data)
Verifies that the axis measure is actually present and has data.
|
<inner> |
validateResponseHasData(response, includeFilterMsg)
Check if the selectRows API response has data.
|
<inner> |
validateXAxis(chartType, chartConfig, aes, scales, data)
Deprecated - use validateAxisMeasure
|
<inner> |
validateYAxis(chartType, chartConfig, aes, scales, data)
Deprecated - use validateAxisMeasure
|
Field Detail
<static>
LABKEY.vis.GenericChartHelper.loadVisDependencies
Loads all of the required dependencies for a Generic Chart.
Method Detail
<inner>
{Object}
generateAes(chartType, measures, schemaName, queryName)
Generates the aesthetic map object needed by the visualization API to render the chart. See LABKEY.vis.Plot
and LABKEY.vis.Layer.
- Parameters:
- {String} chartType
- The chartType from getChartType.
- {Object} measures
- The measures from getMeasures.
- {String} schemaName
- The schemaName from the saved queryConfig.
- {String} queryName
- The queryName from the saved queryConfig.
- Returns:
- {Object}
<inner>
generateAggregateData(data, dimensionName, measureName, aggregate, nullDisplayValue)
- Parameters:
- {Array} data
- The response data from selectRows.
- {String} dimensionName
- The grouping variable to get distinct members from.
- {String} measureName
- The variable to calculate aggregate values over. Nullable.
- {String} aggregate
- MIN/MAX/SUM/COUNT/etc. Defaults to COUNT.
- {String} nullDisplayValue
- The display value to use for null dimension values. Defaults to 'null'.
<inner>
{LABKEY.vis.Geom.BarPlot}
generateBarGeom(chartOptions)
Generates the Barplot Geom used for bar charts.
- Parameters:
- {Object} chartOptions
- The saved chartOptions object from the chart config.
- Returns:
- {LABKEY.vis.Geom.BarPlot}
<inner>
{LABKEY.vis.Geom.Bin}
generateBinGeom(chartOptions)
Generates the Bin Geom used to bin a set of points.
- Parameters:
- {Object} chartOptions
- The saved chartOptions object from the chart config.
- Returns:
- {LABKEY.vis.Geom.Bin}
<inner>
{LABKEY.vis.Geom.Boxplot}
generateBoxplotGeom(chartOptions)
Generates the Boxplot Geom used for box plots.
- Parameters:
- {Object} chartOptions
- The saved chartOptions object from the chart config.
- Returns:
- {LABKEY.vis.Geom.Boxplot}
<inner>
{Function}
generateBoxplotHover()
Returns a function used to generate the hover text for box plots.
- Returns:
- {Function}
<inner>
{Function}
generateContinuousAcc(measureName)
Generates an accessor function that returns a value from a row of data for a given measure.
- Parameters:
- {String} measureName
- The name of the measure.
- Returns:
- {Function}
<inner>
{Function}
generateDiscreteAcc(measureName, measureLabel)
Generates an accessor function that returns a discrete value from a row of data for a given measure and label.
Used when an axis has a discrete measure (i.e. string).
- Parameters:
- {String} measureName
- The name of the measure.
- {String} measureLabel
- The label of the measure.
- Returns:
- {Function}
<inner>
{LABKEY.vis.Geom}
generateGeom(chartType, chartOptions)
Generates a Geom based on the chartType.
- Parameters:
- {String} chartType
- The chart type from getChartType.
- {Object} chartOptions
- The chartOptions object from the saved chart config.
- Returns:
- {LABKEY.vis.Geom}
<inner>
{Function}
generateGroupingAcc(measureName)
Generates an accesssor function for shape and color measures.
- Parameters:
- {String} measureName
- The name of the measure.
- Returns:
- {Function}
<inner>
{Object}
generateLabels(labels)
Given the saved labels object we convert it to include all label types (main, x, and y). Each label type defaults
to empty string ('').
- Parameters:
- {Object} labels
- The saved labels object.
- Returns:
- {Object}
<inner>
{Function}
generateMeasurelessAcc(measureName)
Generates an accessor for boxplots that do not have an x-axis measure. Generally the measureName passed in is the
queryName.
- Parameters:
- {String} measureName
- The name of the measure. In this case it is generally the query name.
- Returns:
- {Function}
<inner>
{Object}
generatePlotConfig(renderTo, chartConfig, labels, aes, scales, data, data)
Generate the plot config for the given chart renderType and config options.
- Parameters:
- renderTo
- chartConfig
- labels
- aes
- scales
- data
- data
- Returns:
- {Object}
<inner>
{Function}
generatePointClickFn(measures, schemaName, queryName, fnString)
Generates the function to be executed when a user clicks a point.
- Parameters:
- {Object} measures
- The measures from the saved chart config.
- {String} schemaName
- The schema name from the saved query config.
- {String} queryName
- The query name from the saved query config.
- {String} fnString
- The string value of the user-provided function to be executed when a point is clicked.
- Returns:
- {Function}
<inner>
{LABKEY.vis.Geom.Point}
generatePointGeom(chartOptions)
Generates the Point Geom used for scatter plots and box plots with all points visible.
- Parameters:
- {Object} chartOptions
- The saved chartOptions object from the chart config.
- Returns:
- {LABKEY.vis.Geom.Point}
<inner>
{Function}
generatePointHover(measures)
Generates a function that returns the text used for point hovers.
- Parameters:
- {Object} measures
- The measures object from the saved chart config.
- Returns:
- {Function}
<inner>
{Object}
generateScales(chartType, measures, savedScales, aes, responseData, defaultFormatFn)
Generates an object containing LABKEY.vis.Scale objects used for the chart.
- Parameters:
- {String} chartType
- The chartType from getChartType.
- {Object} measures
- The measures from generateMeasures.
- {Object} savedScales
- The scales object from the saved chart config.
- {Object} aes
- The aesthetic map object from genereateAes.
- {Object} responseData
- The data from selectRows.
- {Function} defaultFormatFn
- used to format values for tick marks.
- Returns:
- {Object}
<inner>
{String}
getChartType(renderType, xAxisType)
Gets the chart type (i.e. box or scatter).
- Parameters:
- {String} renderType
- The selected renderType, this can be SCATTER_PLOT, BOX_PLOT, or BAR_CHART. Determined at chart creation time in the Generic Chart Wizard.
- {String} xAxisType
- The datatype of the x-axis, i.e. String, Boolean, Number.
- Returns:
- {String}
<inner>
getDefaultLabel(renderType, measureName, properties)
Generate a default label for the selected measure for the given renderType.
- Parameters:
- renderType
- measureName
- - the chart type's measure name
- properties
- - properties for the selected column
<static>
LABKEY.vis.GenericChartHelper.getRenderTypes()
<inner>
{Object}
validateAxisMeasure(chartType, chartConfig, measureName, aes, scales, data)
Verifies that the axis measure is actually present and has 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 parameter 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:
- {String} chartType
- The chartType from getChartType.
- {Object} chartConfig
- The saved chartConfig object.
- {String} measureName
- The name of the axis measure property.
- {Object} aes
- The aes object from generateAes.
- {Object} scales
- The scales object from generateScales.
- {Array} data
- The response data from selectRows.
- Returns:
- {Object}
<inner>
{String}
validateResponseHasData(response, includeFilterMsg)
Check if the selectRows API response has data. Return an error string if no data exists.
- Parameters:
- response
- includeFilterMsg
- true to include a message about removing filters
- Returns:
- {String}
<inner>
validateXAxis(chartType, chartConfig, aes, scales, data)
Deprecated - use validateAxisMeasure
- Parameters:
- chartType
- chartConfig
- aes
- scales
- data
<inner>
validateYAxis(chartType, chartConfig, aes, scales, data)
Deprecated - use validateAxisMeasure
- Parameters:
- chartType
- chartConfig
- aes
- scales
- data