Class: DialogHelper

CIQ.Studies. DialogHelper


new DialogHelper(params)

Generates an object that can be used to create a dialog for creating or modifying a study. The object will then contain arrays for inputs, outputs and parameters. Each input will describe a form field that should be generated. Each output will describe a color swatch that should be generated. The results of the dialog would then be passed to CIQ.Studies.addStudy.

Parameters:
Name Type Description
params object

Object containing the following:

Properties
Name Type Argument Description
name string <optional>

The libraryEntry key for the study to add. The libraryEntry is the object that defines the prototype for a study. May contain attributes which are used to help construct the input fields of the study dialog. See documentation of CIQ.Studies.studyLibrary and DialogHelper Object. Not needed if params.sd is present.

sd studyDescriptor <optional>

A study descriptor; when requesting values for an existing study. If present, takes precedence over params.name. You may set the 'panelName' parameter to "panel" (sd.parameters.panelName), and this method will provide in the parameters object an array of valid panels, which you can present to the user as options to move the study to a different panel.

stx CIQ.CIQ.ChartEngine

A chart object

Examples
var helper=new CIQ.Studies.DialogHelper({name:"stochastics",stx:stxx});
console.log('Inputs:',JSON.stringify(helper.inputs));
console.log('Outputs:',JSON.stringify(helper.outputs));
console.log('Parameters:',JSON.stringify(helper.parameters));
// how to set 'panelName' to get a list of all available panels as part of the parameters object
var sd = CIQ.Studies.addStudy(stxx, "Aroon");
sd.parameters.panelName='panel';
var dialogHelper = new CIQ.Studies.DialogHelper({"stx":stxx,"sd":sd});
console.log('Parameters:',JSON.stringify(dialogHelper.parameters));

Methods


updateStudy(updates)

Update (or add) the study attached to the DialogHelper.

Once added or modified, the new study descriptor will be stored in the sd object of the DialogHelper.

Parameters:
Name Type Description
updates Object

If updating, it should contain an object with updates to the inputs, outputs and parameters object used in CIQ.Studies.addStudy. A new study ID will be created using the default format or parameters.replaceID, if provided.

Examples
var helper=new CIQ.Studies.DialogHelper({sd:sd, stx:stx});
helper.updateStudy({inputs:{Period:60}});
var updatedStudy = helper.sd;
// add the study
var initialStudy = CIQ.Studies.addStudy(stxx, "Aroon");

// move it to the primary (chart) panel
var dialogHelper = new CIQ.Studies.DialogHelper({"stx":stxx,"sd": initialStudy});
dialogHelper.updateStudy({"parameters":{"panelName":"chart"}});

// capture the updated study descriptor for future use ( the initialStudy can not be used any more as the actual study has changed when it was moved )
var updatedStudy = dialogHelper.sd;

// move the updated study back to its own panel
var dialogHelper = new CIQ.Studies.DialogHelper({"stx":stxx,"sd":updatedStudy});
dialogHelper.updateStudy({"parameters":{"panelName":"Own panel"}});