Contains calls that allow native iOS and Android applications to interface with the charting library without having to clutter Swift / Objective C or Java/Kotlin source code with unnecessary JavaScript.
Please note that all functions and variables are exposed globally on the WebView.
All methods were designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.
Members
-
chartAvailable :boolean
-
Set to true when the chart has been created, ensuring to the native mobile side that it is okay to interact with the chart.
Type:
- boolean
- Default Value:
-
- false
-
dayCss :string
-
Represents the class attribute for CIQ's default light theme.
Type:
- string
- Default Value:
-
- "ciq-day"
-
isAndroid :boolean
-
Set to true when an Android device is being used.
Type:
- boolean
- Default Value:
-
- false
-
nightCss :string
-
Represents the class attribute for CIQ's default dark theme.
Type:
- string
- Default Value:
-
- "ciq-night"
-
quoteFeedCallbacks :object
-
Uses a unique string:function mapping to ensure that the quote feed calls the correct callback.
Type:
- object
Methods
-
addDrawingListener()
-
Sets a callback Listener with a type of "drawing".
For more information on adding event callbacks to the chart, see CIQ.ChartEngine#addEventListener.
-
addLayoutListener()
-
Sets a callback Listener with a type of "layout".
For more information on adding event callbacks to the chart, see CIQ.ChartEngine#addEventListener.
-
addMeasureListener()
-
Sets a callback Listener to send the
mMeasure
text to the mobile client side for ease of display.For more information on adding event callbacks to the chart, see CIQ.ChartEngine#addEventListener.
-
addSeries(symbol, hexColor, isComparison)
-
Native wrapper for CIQ.ChartEngine#addSeries.
Can set a Series as a comparison and specify line color.
Parameters:
Name Type Description symbol
string Symbol to set.
hexColor
string Color for your symbol to be displayed as.
isComparison
boolean Tells the chart whether the symbol should be compared to the main symbol
-
addStudy(studyName [, inputs] [, outputs] [, parameters])
-
Native wrapper for CIQ.Studies.addStudy.
Adds a specific study to the chart.
Parameters:
Name Type Argument Description studyName
string Study to add from the CIQ.Studies.studyLibrary.
inputs
string <optional>
The JSON stringified list of study inputs.
outputs
string <optional>
The JSON stringified list of study outputs.
parameters
string <optional>
The JSON stringified list of study parameters.
-
addStudyAsSignal(studyName)
-
Helper function to add the study requested by the signal.
Parameters:
Name Type Description studyName
String The name of the study to add to the chart.
- Since:
-
8.8.0
Returns:
JSON string of a slimmed down version of the study descriptor.
- Type
- string
-
attachQuoteFeed( [params])
-
Native wrapper for CIQ.ChartEngine#attachQuoteFeed.
The quote feed cannot be defined in native mobile but in JavaScript. All this function does is allow the parameters of a quote feed to be set. If you attach a quote feed using this function do not accidentally attach another quote feed in your HTML template.
Make sure the parameter names match up with the CIQ.ChartEngine#attachQuoteFeed.
Parameters:
Name Type Argument Description params
string <optional>
JSON string that defines all the optional parameters for CIQ.ChartEngine#attachQuoteFeed.
-
cloneDrawing()
-
Helper function to find the current highlighted drawing and clone it.
-
deleteDrawing()
-
Helper function to find the current highlighted drawing and delete it.
-
determineOs()
-
Determines where the chart is being loaded based on the userAgent.
If not loaded on Android, then enables proxy logging automatically.
-
enableCrosshairs(boolean)
-
Toggles the crosshairs on or off.
Parameters:
Name Type Description boolean
Specifies whether the crosshairs are on or off.
-
getActiveSignals()
-
Helper function to retrieve all the current active signals on the chart.
- Since:
-
8.8.0
Returns:
JSON string of a slimmed down version of the study descriptor.
- Type
- string
-
getActiveStudies()
-
Returns the active studies in the chart engine's layout.
Note: For Android devices, returns a raw, unstringified array of studies.
Returns:
The JSON stringified list of studies.
- Type
- string | array
-
getAllSeries()
-
Gets all the current series on the chart.
Returns:
JSON string of the series with
color
andisComparison
fields.- Type
- string
-
getChartProperty(property)
-
Helper function that retrieves a chart value from the given property.
Parameters:
Name Type Description property
string Field name to retrieve a value for.
Returns:
JSON string or Java/Kotlin object representation of the field value.
- Type
- string | object
-
getCurrentVectorParameters()
-
Returns the
currentVectorParameters
object of the engine instance.Returns:
The
currentVectorParameters
object of the chart engine (see CIQ.ChartEngine#currentVectorParameters.- Type
- object
-
getDrawingParameters(toolName)
-
Helper function to retrieve the drawing parameters for the given tool.
Parameters:
Name Type Description toolName
string Name of the drawing tool.
Returns:
JSON string of the current drawing parameters.
- Type
- string
-
getEngineProperty(property)
-
Helper function that retrieves a chart engine value from the given property.
Parameters:
Name Type Description property
string Field name to retrieve a value for.
Returns:
JSON string or Java/Kotlin object representation of the field value.
- Type
- string | object
-
getHudDetails()
-
Gathers the necessary information for any HUD based on cursor position and returns that data.
This function will provide Open, High, Low, Close and Volume for a given quote.
-
getLayoutProperty(property)
-
Helper function that retrieves a chart layout value from the given property.
Parameters:
Name Type Description property
string Field name to retrieve a value for.
Returns:
JSON string or Java/Kotlin object representation of the field value.
- Type
- string | object
-
getSlimSd(studyName)
-
Helper function to return a subset of properties, from the specified study, used in setting parameters for a specific signal.
Parameters:
Name Type Description studyName
String The name of the study to add to the chart.
- Since:
-
8.8.0
Returns:
JSON string of a slimmed down version of the study descriptor.
- Type
- string
-
getStudyList()
-
Returns an array of all the studies in the CIQ.Studies.studyLibrary with a short name derived from the key.
Used for gathering all available studies a user can access.
Returns:
Array of studies with the short name of study.
- Type
- array
-
getStudyParameters(studyName [, prop])
-
Returns the default parameters of a study if it is not active, or the actual parameters for an active study.
Note: For Android devices, returns the raw, unstringified parameters.
Parameters:
Name Type Argument Default Description studyName
string Study to get parameters for.
prop
string | boolean <optional>
"outputs" What to return for the study. Valid values: "inputs", "outputs", "parameters", or true (see 6.1.0 history note below).
- Since:
-
6.1.0 Second parameter changed from boolean
isInputs
to string or booleanprop
parameter. Ifprop == true
, returns inputs, as before.
Returns:
JSON stringified parameters from CIQ.Studies.DialogHelper.
- Type
- string
-
getSymbol()
-
Returns the chart's main symbol.
Returns:
The chart symbol.
- Type
- string
-
getTranslations(langCode)
-
Gets the translated list for a given language.
Parameters:
Name Type Description langCode
String The I18N language code that is to be retrieved. If no language code is given, all translations are returned.
Returns:
JSON string of the translations.
- Type
- string
-
isChartAvailable()
-
Checks the chart availability.
Returns:
The current chart available state.
- Type
- boolean
-
layerDrawing(layer)
-
Helper function to find the current highlighted drawing and change the layer of the drawing.
Parameters:
Name Type Description layer
String The layer to assign to the drawing (top, bottom, up, or down).
-
loadChart(symbol [, data])
-
Native wrapper for CIQ.ChartEngine#loadChart.
Unlike CIQ.ChartEngine#loadChart, this function only accepts a symbol and data. If you need more functionality you to manually call the library implementation of loadChart.
If a push method is supplying data to
callNewChart
, you will need to make use of thechartIQView.isChartAvailable()
method for your initial data push. The pseudocode in the example gives one instance on how to use the flag.Parameters:
Name Type Argument Description symbol
string The new symbol for your chart.
data
string <optional>
Stringified JSON object of your data.
Example
if (chartIQView.isChartAvailable() { pushData = retrievePushData() chartIQView.push(symbol, pushData) } else { repeat check via polling for the isChartAvailable flag }
-
modifySeries(seriesId, field, value)
-
Native wrapper for CIQ.ChartEngine#modifySeries.
Modifies a property of an existing series.
Parameters:
Name Type Description seriesId
string Id for the series to modify.
field
string The property you want to change.
value
string The value to change the property to.
-
nativeQuoteFeed(parameters, cb)
-
A simple quote feed with data parsing functions.
Parameters:
Name Type Description parameters
object Function parameters.
Properties
Name Type Argument Description start
Date A starting date for requesting data.
end
Date <optional>
An ending date for requesting data.
symbol
string The symbol to fetch data for.
period
number The period from a chart layout.
timeUnit
string <optional>
The time unit from a chart layout.
cb
function Function passed in to handle data after it is parsed.
-
parseData(data [, callbackID] [, moreAvailable] [, upToDate] [, useAsLastSale])
-
Parses JSON data into an array of new OHLC quotes and updates the chart with them.
Calls CIQ.ChartEngine#updateChartData if no callback ID is provided.
Parameters:
Name Type Argument Description data
string JSON object of your data from a query
callbackID
string <optional>
Identifies a custom function to call to update the chart with the parsed data. The function should take an object as a parameter with the properties
quotes
andmoreAvailable
. The parsed data is assigned toquotes
and themoreAvailable
parameter of this function is assigned to themoreAvailable
property, for example:{ quotes: newQuotes, moreAvailable: moreAvailable }
.moreAvailable
boolean <optional>
Set this to false to stop pagination requests if you know that no older data is available.
upToDate
boolean <optional>
Set this to true to stop forward pagination requests if you know that no newer data is available.
useAsLastSale
boolean <optional>
Set this parameter to true to force the data as a last sale price.
-
proxyLogger()
-
Allow console logging in iOS. This will overwrite the default console logging on iOS to return messages via
webkit.messageHandlers
. -
redo()
-
Helper function that determines whether there are any drawings on the redo stack.
Returns:
JSON string of true/false to determine whether there is any drawings to redo.
- Type
- String
-
removeAllStudies()
-
Convenience function to remove all studies on the chart at once.
-
removeSeries(symbol)
-
Native wrapper for CIQ.ChartEngine#removeSeries.
Removes a selected symbol from the chart's series.
Parameters:
Name Type Description symbol
string | object Symbol to remove OR the series object itself.
-
removeSignal(studyName)
-
Helper function to remove the signal from the chart.
Parameters:
Name Type Description studyName
String The name of the study to remove from the chart.
- Since:
-
8.8.0
-
removeStudy(studyName)
-
Removes an active study in the chart engine's layout from the chart.
Parameters:
Name Type Description studyName
String The name of the study as it appears in the chart engine's layout.
-
restoreDefaultDrawingConfig(toolName, all)
-
Helper function to restore the drawing tool to its default settings.
Parameters:
Name Type Description toolName
string Name of the drawing tool.
all
boolean Set to true if you want to restore all drawing configurations.
-
saveSignal(studyName, signalParams, editMode)
-
Helper function to save the signal parameters and make the signal available to display.
Parameters:
Name Type Description studyName
String The name of the study to add to the chart.
signalParams
String JSON string that represents the signal parameters object.
editMode
boolean Determines whether signal is in edit or create mode.
- Since:
-
8.8.0
-
setAggregationType(aggregationType)
-
Native wrapper for CIQ.ChartEngine#setAggregationType.
Valid aggregation types include: Heikin Ashi, Kagi, Renko, Range Bars, Point & Figure.
This function should not be used to set chart types. Instead use CIQ.MobileBridge.setChartType.
Parameters:
Name Type Description aggregationType
string Type of chart to display.
- See:
-
- Chart Styles and Types tutorial
-
setChartAvailable(finished)
-
Sets the state of the loaded chart and, if a mobile message handler exists, send the response back to the native app.
Parameters:
Name Type Description finished
boolean The current chart available state.
-
setChartEngineInBridge(chartEngine)
-
Helper function that sets the chart engine variable for all necessary functions.
By default the sample template uses
stxx
, but setsstxx
tochartEngine
just in case the user changes the name.Parameters:
Name Type Description chartEngine
CIQ.ChartEngine The chart instance.
-
setChartProperty(property, value)
-
Helper function that sets a chart property with a given value.
Parameters:
Name Type Description property
string Field name to set a value for.
value
string | number | boolean Value to assign to the chart property.
-
setChartType(chartType)
-
Native wrapper for CIQ.ChartEngine#setChartType.
Removes any aggregation type and switches your chart to display the new chart type.
Valid chart types include: Candle, Bar, Colored Bar, Line, Hollow Candle, Mountain, and Baseline.
This function should not be used for setting aggregations. Instead use CIQ.MobileBridge.setAggregationType.
Parameters:
Name Type Description chartType
string Type of chart to display.
- See:
-
- Chart Styles and Types tutorial
-
setCurrentVectorParameters(parameter, value)
-
Used to set values of CIQ.ChartEngine#currentVectorParameters.
Parameters:
Name Type Description parameter
string The parameter for which the value is set.
value
string | number | object The value to set.
-
setDrawingParameters(parameterName, value)
-
Wrapper to set vector parameters according to what is selected on the client side.
Parameters:
Name Type Description parameterName
string Name of the drawing field to change.
value
string The value of the field to change.
-
setEngineProperty(property, value)
-
Helper function that sets a chart engine property with a given value.
Parameters:
Name Type Description property
string Field name to set a value for.
value
string | number | boolean what to assign the chart engine property.
-
setLanguage(langCode)
-
Sets the language for the chart.
Parameters:
Name Type Description langCode
String The I18N language code that specifies the language to set.
-
setPeriodicity()
-
Native wrapper for CIQ.ChartEngine#setPeriodicity.
Only accepts arguments individually and passes them into a params object.
Parameters:
Name Type Argument Description params.period
number The number of elements from
masterData
to roll-up together into one data point on the chart (candle,bar, etc). If set to 30 in a candle chart, for example, each candle will represent 30 raw elements ofinterval/timeUnit
type.params.timeUnit
string <optional>
Type of data requested. Valid values are "millisecond", "second", "minute", "day", "week", "month", or 'tick'. If not set, defaults to "minute". "hour" is NOT a valid time unit. Use
timeUnit:"minute", interval:60
instead.params.interval
string <optional>
Further qualifies pre-rolled details of intra-day
timeUnits
("millisecond", "second", "minute") and is converted to “1” if used with "day", "week" or "month" 'timeUnit'. Some feeds provide data that is already rolled up. For example, there may be a feed that provides 5-minute bars. To let the chart know you want that 5-minute bar from your feed instead of having the chart get individual 1-minute bars and roll them up, you would set theinterval
to '5' andtimeUnit
to 'minute'. -
setQuoteFeedInBridge(quoteFeed)
-
Helper function that sets the quote feed variable for all necessary functions.
By default the sample template uses
quoteFeedNativeBridge
, but setsquoteFeedNativeBridge
toquoteFeed
just in case the user changes the name.Parameters:
Name Type Description quoteFeed
The chart quote feed object.
-
setRefreshInterval(newInterval)
-
Convenience function to change the quotefeed refresh interval that is set in the mobile application.
Parameters:
Name Type Description newInterval
number The new refresh interval in seconds.
- Since:
-
8.9.0
-
setStudy(name, key, value)
-
Given an active study name, updates the study based on the key/value pair you pass into a CIQ.Studies.DialogHelper.
If the given key is not found in the dialog helper's inputs, then the key is searched for in the dialog helper's outputs, and the function tries to update the outputs instead.
Parameters:
Name Type Description name
string Name of the study from the chart engine's layout.
key
string Key to set in the study's corresponding dialog helper.
value
string Value to set in the study's corresponding dialog helper.
-
setStudyParameter(studyName, key, value, isInput)
-
Given an active study name, updates the study based on the key/value pair you pass into a CIQ.Studies.DialogHelper.
By default, assumes that the key belongs to the dialog helper outputs unless
isInput
is true.Parameters:
Name Type Description studyName
string Name of the study from the chart engine's layout.
key
string Key to set in the study's corresponding dialog helper.
value
string Value to set in the study's corresponding dialog helper.
isInput
boolean Specifies whether to update inputs instead of outputs.
-
setTheme(theme)
-
Sets the chart theme to "day", "night", or "none" by adding in CSS classes to the chart's context. Also clears the chart container's
backgroundColor
and resets the engine's styles.Adding one class removes the other; to remove both, set the theme to none.
Parameters:
Name Type Description theme
string Theme to set: "day", "night", or "none".
-
toggleExtendedHours(status)
-
Turns the extended hours functionality on or off.
Parameters:
Name Type Description status
boolean true for on, false for off.
-
toggleSignalStudy(studyName)
-
Helper function to toggle the signal on or off.
Parameters:
Name Type Description studyName
String The name of the study to add to the chart.
- Since:
-
8.8.0
-
undo()
-
Helper function that determines whether there are any drawings on the undo stack.
Returns:
JSON string of true/false to determine whether there are any drawings to undo.
- Type
- string