This app uses Chaise assuming Chaise is at the same level as deriva-webapps folder.
The plot-config.js file has the following parameters which can be modified when using this app.
The config file specify the parameters for a particular key i.e. rbk-config
- page_title(optional): Title of the plot app. DEPRECATED, use
headTitleinstead - headTitle: Title of the plot app.
- top_right_link_text: text to show for the link in top right corner to show plot with all controls. Only supported for violin plot currently
- plots: An array of the plots to be shown.
Each object in the plots array can have the following parameters:
plot_title: Title to be displayed above the line plot. DEPRECATED, useplotly.layout.titleinsteadx_axis_label: Label to be displayed along the x-axis. DEPRECATED, useplotly.layout.xaxis.titleinsteady_axis_label: Label to be displayed along the y-axis. DEPRECATED, useplotly.layout.yaxis.titleinsteadplot_type: The type of plot to be displayed i.ebar,pie,scatter,histogram,violin, andheatmapapp_styles: the styles to attach to different parts of the app pagewidth: A decimal value between 0 and 1 for how much space the grid layout should fill on the plot pagemax_width: A string value representing the width in pixels of the plot container excluding the navbar (i.e.1500px)max_height: A string value representing the height in pixels of the plot container excluding the navbar (i.e.1200px)
config: the config for the plotbargap: Distance between the bins in the histogram - Only valid for plot type as histogramshowlegend: To show the legend or not. DEPRECATED, define inplotly.layoutheight: Height of the plot - DEPRECATED, define inplotly.layout.heightinsteadwidth: width of the plot - DEPRECATED, useplotly.layout.widthinsteadslice_label: label to be shown on slice of a pie - only for pie chart // Default: "none", Available: "percent" or "value"x_axis_type: type to be used for x_axis - DEPRECATED, useplotly.layout.xaxis.typeinsteady_axis_type: type to be used for y_axis - DEPRECATED, useplotly.layout.yaxis.typeinsteadmargin: have l as an attribute which specifies left margin, similarly "r","t" and "b" for right, top and bottom - DEPRECATED, define in plotly.layoutx_axis_thousands_separator: to separate number by , after 4 digits // bool : true or falsey_axis_thousands_separator: to separate number by , after 4 digits // bool : true or falseformat_data_x: false // default : false: to use the formatting of string for data or not. (Currently on valid for a particular case)format_data_y: false // default : false: to use the hack for data or not (Currently on valid for a particular case)format_data: false // default : false: to use the hack for data or not for 1d plot (Currently on valid for a particular case)xbins: property used forplot_type: "histogram-vertical" to define how many bins to use for the xaxisybins: property used forplot_type: "histogram-horizontal" to define how many bins to use for the yaxistitle_display_markdown_pattern: markdown template string to be generated for use as plot title- overrides
plotly.layout.title
- overrides
xaxis: object for options to override properties specific to the xaxis. The following attributes are currently supported:title_display_markdown_pattern: markdown template string to be generated for use as the xaxis title- overrides
plotly.layout.xaxis.title
- overrides
tick_display_markdown_pattern: markdown template string to be generated for use as the tick label for the x-axis
yaxis: object for options to override properties specific to the yaxis. The following attributes are currently supported:title_display_markdown_pattern: markdown template string to be generated for use as the yaxis title- overrides
plotly.layout.yaxis.title
- overrides
tick_display_markdown_pattern: markdown template string to be generated for use as the tick label for the y-axis
disable_default_legend_click: to suppress the default legend click event which toggles the corresponding trace in the chart display to show/hide. default value is false- violin plot specific options:
- NOTE: options are not necessarily exclusive to other types, but only implemented for violin plots for now
xaxis.group_keys: array of objects for "group by" dropdown to change how the data is grouped for each violin in the plot. Each object in the list consists of:column_name: (required) the name of the column returned with the datatitle_display_pattern: string for use in the "group by" dropdown- overrides
plotly.layout.xaxis.title
- overrides
title_display_markdown_pattern: markdown template string to be generated for the x-axis title- overrides
title_display_patternandplotly.layout.xaxis.title
- overrides
tick_display_markdown_pattern: markdown template string to be generated for use as the tick label for each violindefault: set to true for whichever option should be selected by defaultgraphic_link_pattern: array of patterns to turn into links to use for clicking on the chart displaylegend_markdown_pattern: array of patterns to turn into display values to use for display in the legend
xaxis.default_all_studies_group: thecolumn_namevalue fromxaxis.group_keysarray to use as a default when "all studies" is selected on page load- takes precedence over
defaultproperty from the list ofgroup_keysONLY when "all studies" is selected
- takes precedence over
yaxis.group_key: similar to x-axis, this matches thecolumn_namereturned with the data for measuring data on the yaxis
plotly.config: the config is ignored if plotly.config is provided. For available options, see the documentation here- avoid using
plotly_config, this property will be DEPRECATED in the future
- avoid using
plotly.layout: thelayoutobject passed directly to plotly when provided. For available options, see the documentation hereplotly.data: thedataobject passed directly to plotly when provided. For available options, see the documentation here for the plot type trying to be displayed.gene_uri_pattern: For violin plot only. The url from which the gene data is fetched after applying handlebars templating. This parameter is required to fetch the data for the gene selector and initialize the plot.study_uri_pattern: For violin plot only. The url from which the study data is fetched after applying handlebars templating. This parameter is required to fetch the data for the study selector and display and to initialize the plot.traces: Contains the information about each dataset and how to map that data to plotly.- Properties available to most plot types:
url_pattern: The url from which the data has to be fetcheduri: The url from which the data has to be fetched. DEPRECATED, usetraces.url_patterninsteadlegend: An array of values to be shown in the legendx_col: An array of column names for the x valuesx_col_pattern: array of user control(user_controls) patterns to turn into display values to use for x column name for x values. If bothx_colandx_col_patternare provided, thex_col_patternwill take priority.y_col: An array of column names for the y valuesy_col_pattern: array of user control(user_controls) patterns to turn into display values to use for y column name for y values. If bothy_colandy_col_patternare provided, they_col_patternwill take priority.orientation: Optional parameter for displaying the bar chart horizontally // default: 'h'textfont: It will work till the bar size can accommodate the font sizehovertemplate_display_pattern: To show customized hover text on plots using given template patternresponse_format: The type of file that is passed into url_pattern. It expectscsvorjson.
- Extra properties for pie and histogram charts:
data_col: A column name as a string or array of column names for the data aggregation. used instead of x_col or y_xollegend_col: An array of column names for the legend
- Extra properties for pie and bar charts:
legend_markdown_pattern: array of patterns to turn into display values to use for display in the legend.graphic_link_pattern: Link to use to navigate user when clicking on pie slice
- Extra properties for heatmap charts:
z_col: An array of column names for the z values to use as the aggregated value for the(x, y)combinationz_col_pattern: array of user control(user_controls) patterns to turn into display values to use as the aggregated value for the(x, y)combination. If bothz_colandz_col_patternare provided, thez_col_patternwill take priority.
- 1d plot has very similar properties. Keeping separate to preserve old documentation:
uri: The url from which the data has to be fetched.legend: An array of values to be shown in the legenddata_col: The column name for the valueslegend_col: An array of column names for the legend to be shown for the respective valuesshow_percentage: To show the percentage or not on slices
- Properties available to most plot types:
plotlyButtonsToRemove: The button to be removed shown by plotly by defualt. DEPRECATED, useplotly.config.modeBarButtonsToRemoveinsteaduser_controls: Contains information about each user control (data for the control, default value, etc)uid: Key for referencing this user control; in other configuration propertieslabel: Name to display next to this user control with given styles applied. Also note that label object can be used to generate a markdown user controlmarkdown_pattern: markdown template string to be generated for the control label/markdown user control,styles: CSS styles that can be applied on the labelfont_size: Allows same values as property in CSSmax_width: Allows same values as property in CSS
classes: An array of chaise classes of styles that needs to be applied on the user controltype: The type of control to display, more info below about control typesurl_param_key(Optional): Parameter name or object of parameter names from url params that ire associated with this user controlrequest_info: Data for the user controlurl_pattern(Optional): String that allows for handlebars templating for fetching data for this user controldata: Values to use in the user control if no query_pattern is provideddefault_values: The initial value(s) to use for this user control on page loadvalue_key: Column to use for templating in queriesselected_value_pattern: A pattern string to show in the user control for each selected option
grid_layout_config: Properties for responsive gridwidth: Width in pixels, not needed if using responsive grid layout componentauto_size: Whether the height and width grows/shrinks to fit content in it's parent containerbreakpoints: Map to identify when a different layout configuration should be used based on grid size. More details in the Plot Funcitonality Document.cols: Number of columns to show, object used for breakpointsmargin: Margin between grid components in pixelscontainer_padding: Padding inside of each grid component in pixelsrow_height: Height of each row in pixelsis_draggable: Controls ability to move all componentsis_resizable: Controls ability to resize all componentslayouts: Array of layout objects for each item that will be placed inside the grid. The number ofcolsdefined ingrid_layout_configis the total number ofgrid units.source_uid: Corresponds to the component key (uid) from user_controls (or plots if global layouts),x: Grid index in grid units for the x position,y: Grid index in grid units for the y position,w: Number of grid units the width of the component spans,h: Number of grid units the height of the component spans, NOTE: In order for the grid to have consistent heights for components, when an item spans multiple grid units, it must also span margins. So you must add the height or width of the margin you are spanning for each unit. So actual pixel height is(rowHeight * h) + (marginH * (h - 1)is_draggable(Optional): Can the component be moved around, overridesstatic,is_resizable(Optional): Can the component be resized, overridesstatic,static(Optional): If true, impliesisDraggable: falseandisResizeable: false,min_w(Optional): Min width in grid units,max_w(Optional): Max width in grid units,min_h(Optional): Min height in grid units,max_h(Optional): Max height in grid units
If any of the above (Presentation or data) values is not mentioned, the app will throw an error. If you don't want to set a value, set it to null.
tick_display_markdown_pattern, legend_markdown_pattern, and graphic_link_pattern can access data relative to $row or $self. All markdown patterns can access data relative to the $trace (not supported for violin plots).
Below is the structure of the template parameters object that the ermrestJS templating environment uses.
For violin type plots, 2 url parameters can be provided to initialize the app's content, Study and NCBI_GeneID. Using these supplied parameters, Study and Gene information is fetched and added to the templating environment as $url_parameters.Study and $url_parameters.Gene. This is specific to the data in RBK/Gudmap. When setting the tick_display_markdown_pattern, legend_markdown_pattern, and graphic_link_pattern, the current row of data is added to the template environment as $row.
For all other plot types, the data for each user control is added into $control_values for each selected value. When setting the tick_display_markdown_pattern, legend_markdown_pattern, and graphic_link_pattern, the current row of data is added to the template environment as $self. Note, this is the same concept as violin plots but has a different name. Currently when templating per row from traces, $self.data is used. When templating for each row for a user control, $self.values is used. Avoid using $self.data since this will be deprecated in the near future.
violin template parameters:
{
$url_parameters: {
Study: [{data: Tuple.data}, ...],
Gene: {data: Tuple.data}
},
// each row of data for graph added before templating each time
$row: response.data[index]
}
default template parameters:
{
$url_parameters: {
config: '<config-name>',
<param_name>: <value>
},
$control_values: {
<userControl.uid>: {
values: {...}
},
...
},
// each row of data for graph added before templating each time
// OR each row of data for a user control added
$self: {
data: response.data[index],
values: response.data[index]
}
}
The file plot-config-sample.js contains examples for different plot types, including violin, pie, bar, histogram, and scatter. More examples can be found in the division repo recipes for rbk dev/staging/production.
Refer to installation guide.