Skip to main content

Rich Function View

RichFunctionView is an advanced UI editor to create a complex full-featured interface for your script.

It has all the features of the basic scripting. In addition, it allows you to:

Package dependency

The RichFunctionViewEditor is a part of the Compute2 package. Ensure that the Compute2 package is installed before working with RichFunctionViewEditor

Enabling RichFunctionView UI editor

To enable RichFunctionView, add editor: Compute2:RichFunctionViewEditor tag to your following code as it is shown:

rich-function-demo

Ensure computations are correct

Features of the RichFunctionView affect GUI only and do not affect computations. Use the RichFunctionView only when you are sure that the script works as expected.

Enhance inputs and outputs

Visualize input data

You can add viewers for input dataframes to review input data before starting computations, same way as for output viewers.

input-viewers

You can specify input viewer's properties to control their appearance. Viewer's properties are listed in the braces right after the viewer's name. A full list of the viewer's properties may be found by right-clicking on it and selecting the Properties... menu item.

RichFunctionView supports the block option to control the viewer's width. By default, any viewer occupies all available space.

viewers-block

Group scalar outputs

You can use the category keyword to group scalar output parameters. In the case of output parameters, the category tag specifies the output tab used to show the output parameter values. The following code generates UI with three output tabs:

output-categories

tip

The view includes 4 tabs in total since there is a separate tab for input dataframe viewers.

Automatic script rerun

You can run scripts automatically on UI opening and/or on any input change. This feature is useful for fast prototyping. We recommend using it only on fast Javascript scripts only to avoid repeatable runs of computational-heavy code.

The automatic function calls are not saved, so to save results to the run history you should press the Save button manually.

run-on-input

Provide custom docs and export data

Add the readme

You can add a customized readme file to your script. The linked Markdown file will be available by clicking icon on the ribbon panel. The readme file will appear inside the panel on the right side.

rfv-help

Export results

You can use the one-click export feature to save the entire script run to a local file. To generate the export file, Select Export icon on the top panel. Automatic export saves all input and output values with their captions, units, and even viewers' screenshots.

This feature is available for all scripts using the RichFunctionView. To disable it, add the meta.features tag to the script header.

export-demo

Review and compare historical script runs

Save and access run history

When enabled (by default), the server saves each script run. The saved script run includes both the input and output values of the run. To review the history of runs, click on the History button on the top panel.

The history panel appears on the right side. To load the run into the UI, click on the corresponding card. The historical runs are immutable. Thus, if you load a historical run, change input values, and then rerun it, the platform will create a new historical run.

history

To disable history, add the following line to your code:

Your script header
//meta.features: {"history": false}

Compare historical runs

You may compare historical runs using history panel. Select the historical runs of the interest and click icon to open the comparison view.

Datagrok provides defauls set of viewers to compare all kinds of the output data.

tip

Click on the column header with table data (e.g. Temp. vs time) to see convenient comparison chart.

comparsion-view

Model parameters optimization

With RichFunctionView you can use the powerful built-in optimization functions.

Sensitivity analysis

Sensitivity analysis automatically runs the computation multiple times with varying inputs, and analyzes the relationship between inputs and outputs.

Enable this feature and click SA icon on the top panel.

sens-analysis

Parameters fitting

The parameters fitting solves an inverse problem to the sensitivity analysis: finding the input conditions that lead to a specified output of the model. It computes inputs minimizing deviation measured by loss function.

High-intensity computation

Both Sensitivity analysis and Parameter optimization trigger many simultaneous runs of the model. We recommend using these features on fast Javascript and WebAssembly scripts to avoid repeatable running of heavy server-side code.