Class: Watch

STX. Watch


new Watch()

This class is maintained for legacy implementations only (not using web components). New implementations should use functionality included in the web components (stxUI.js)
Native implementation of watch lists. Uses a STX.StorageManager object for saving and loading lists

Version:
  • ChartIQ Advanced Package

Members


<static> currentList :number

The index into the STX.Watch.lists array of the currently selected list

Type:
  • number
Version:
  • ChartIQ Advanced Package

<static> currentSymbol :Number

The index into the currently selected list of the currently selected symbol

Type:
  • Number
Version:
  • ChartIQ Advanced Package

<static> lists :Array

The array of available lists. If you modify this directly then be sure to call STX.Watch.refreshDisplay

Type:
  • Array
Version:
  • ChartIQ Advanced Package

Methods


<static> createSymbolEntry(listEntry, text)

Updates the HTML with the symbol or list name

Parameters:
Name Type Description
listEntry object

DOM element to update

text string

The symbol or list name

Version:
  • ChartIQ Advanced Package

<static> deleteCurrentList()

Deletes the current list

Version:
  • ChartIQ Advanced Package

<static> enableList(location)

Enables the selected list

Parameters:
Name Type Description
location number

The index into the list array to enable

Version:
  • ChartIQ Advanced Package

<static> enableSymbol(location, dontChangeChart)

Enables a symbol in the list using the selectCallback function to activate a new symbol. See STX.Watch.initialize for instructions on how to assign a selectCallback function.

Parameters:
Name Type Description
location number

The index in the current list of the symbol to enable

dontChangeChart boolean

If true then the chart will not update, otherwise the chart is updated via the lookup widget ( selectCallback )

Version:
  • ChartIQ Advanced Package

<static> initialize(stxStorageManager, stxLookupWidget)

Initializes the watch list functionality. This requires an STX.StorageManager object to store changes and an STX.LookupWidget to enable symbol changes when users select symbols from their watch list. Call this method when you initialize the UI. You may need to call refreshDisplay() if HTML changes are made after STX.Watch is initialized.

Parameters:
Name Type Description
stxStorageManager object

STX.StorageManager for getting and saving watch lists

stxLookupWidget object

STX.LookupWidget for changing the chart

Version:
  • ChartIQ Advanced Package
Example
function selectCallback(that, result, filter){

	// This is where you would translate the symbol entered by the user
	// if your externally displayed symbols are different than what the chart needs to request from your quotefeed.
	// Remember to set `stxx.chart.symbolDisplay` as needed so the right description is displayed on the chart label.
	// Set `symbol` as needed before calling `newChart()`

	symbol = result.toUpperCase();
	if(symbol) {
		STXLoader(true);
		stxx.newChart(symbol, null, null, finishedLoadingNewChart(stxx.chart.symbol, symbol)); // Send just a stock symbol to newChart
	}
}

var config={
	selectCallback: selectCallback,     // Function used to act on the symbol selected. Normally used to create a new chart with the new symbol.
    stx: stxx                           // the chart object -- needed for translations
};

var stxLookupWidget=new STX.LookupWidget(config);
stxLookupWidget.init();

STX.Watch.initialize(STX.StorageManager, stxLookupWidget);

<static> move(distance)

Moves the symbol selector up or down by the suggested distance

Parameters:
Name Type Description
distance number

Distance to move. Negative number to move up the list.

Version:
  • ChartIQ Advanced Package

<static> openEditListDialog()

Opens the dialog to edit an existing list

Version:
  • ChartIQ Advanced Package

<static> openNewListDialog()

Opens the dialog to create a new list

Version:
  • ChartIQ Advanced Package

<static> refreshDisplay()

Updates the display of the watch lists. This is called whenever the screen is resized or the panel is opened or closed in order that the iscroll can update itself.

Version:
  • ChartIQ Advanced Package

<static> saveEditList()

Called from the new and edit list dialogs to save the updated list when the user hits the "save" button

Version:
  • ChartIQ Advanced Package