Namespace: NativeLibraryBridge

NativeLibraryBridge

Contains calls that allow a native iOS and Android application to interface with the charting library without having to clutter either Swift/Objective C or Java source 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


<static> dayCss

String representing the class for CIQ's default light theme.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.


<static> isAndroid

Will be set to true when an Android device is bring used.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Default Value:
  • false

<static> nightCss

String representing the class for CIQ's default dark theme.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Methods


<static> addDrawingListener()

Sets a callbackListener with a type of drawing.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

For more info on adding event callbacks to the chart see CIQ.ChartEngine#addEventListener.


<static> addLayoutListener()

Sets a callbackListener with a type of layout.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

For more info on adding event callbacks to the chart see CIQ.ChartEngine#addEventListener.


<static> addSeries(symbol, hexColor, isComparison)

Native wrapper for CIQ.ChartEngine#addSeries.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

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

Boolean telling the chart whether the symbol should be compared to the main symbol


<static> addStudy(studyName, inputs, outputs)

Native wrapper for CIQ.Studies.addStudy.

Adds a specific study to the chart.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Parameters:
Name Type Description
studyName String

Study to add from the CIQ.Studies.studyLibrary

inputs Object

Object containing custom inputs for instantiating the study

outputs Object

Object containing custom outputs for instantiating the study


<static> attachQuoteFeed( [refreshInterval])

Native wrapper for CIQ.ChartEngine#attachQuoteFeed.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Will attach a quoteFeed to the CIQ.ChartEngine

If no refreshInterval is passed in the chart will never update on its own

Parameters:
Name Type Argument Description
refreshInterval Number <optional>

Tells the chart how frequently in seconds to check for updates.


<static> callNewChart(symbol, data)

Native wrapper for CIQ.ChartEngine#loadChart.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

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 the chartIQView.isChartAvailable() method for your initial data push. The pseudocode in the example gives one instance on how to use the flag.

Parameters:
Name Type Description
symbol string

The new symbol for your chart

data array

Static data in an array to load the chart with

Example
if(chartIQView.isChartAvailable() { 
	pushData = retrievePushData()
	chartIQView.push(pushData) 
} else{ repeat check via polling for the isChartAvailable flag }

<static> determineOs()

Determines where the chart is being loaded based on the userAgent.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

If not loaded on Android then enables proxy logging automatically.


<static> enableCrosshairs(boolean)

Will toggle the crosshairs on or off.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Parameters:
Name Type Description
boolean

<static> getActiveStudies()

Returns the active studies in the chart engine's layout.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Note: For Android devices this will return a raw, unstringified, array of studies

Returns:

The JSON stringified list of studies

Type
String

<static> getCurrentVectorParameters()

Will return any currentVectoParameter.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

See:

<static> getHudDetails()

Gathers the necessary information for any HUD based on cursor position and returns that data.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

This function will provide Open, High, Low, Close and Volume for a given quote.


<static> getStudyList()

Returns an array of all the studies in the CIQ.Studies.studyLibrary with a shortName derived from the key.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Used for gathering all available studies a user can access

Returns:

Array of studies with shortName of study

Type
Array

<static> getStudyParameters(studyName, prop)

Will return the default parameters of a study if it is not active, or actual parameters for an active study.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Note: For Android devices this will return the raw unstringified parameters

Parameters:
Name Type Description
studyName string

Study to get parameters for

prop string

What to return for the study. Valid values: "inputs", "outputs", "parameters". Default is "outputs".

Since:
  • 6.1.0 second argument changed from boolean isInputs to string prop. If prop==true, will return inputs, as before.
Returns:

JSON stringified parameters from the DialogHelper

Type
String

<static> getSymbol()

Returns the chart's main symbol.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Returns:

symbol

Type
string

<static> nativeQuoteFeed(parameters, cb)

A simple quotefeed with data parsing functions.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Parameters:
Name Type Description
parameters Object
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

period from a chart layout

timeUnit string <optional>

timeUnit from a chart layout

cb function

Function passed in to handle data after it is parsed.


<static> parseData(data [, callbackID])

Parses JSON data into an array of new OHLC quotes and updates the chart with them.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Will call CIQ.ChartEngine#updateChartData if no callback is provided to automatically update.

Parameters:
Name Type Argument Description
data JSON

JSON object of your data from a query

callbackID function <optional>

A custom function to update


<static> proxyLogger()

Allow console logging in iOS. This will overwrite the default console logging on iOS to return messages via webkit.messageHandlers.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.


<static> removeAllStudies()

Convenience function to remove all studies on the chart at once.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.


<static> removeSeries(symbol)

Native wrapper for CIQ.ChartEngine#removeSeries.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Removes a selected symbol from the chart's series

Parameters:
Name Type Description
symbol string

Symbol to remove OR the series ojbect itself


<static> removeStudy(studyName)

Removes an active study in the chart engine's layout from the chart.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Parameters:
Name Type Description
studyName String

The name of the study as it appears in the chart engines layout


<static> setAggregationType(aggregationType)

Native wrapper for CIQ.ChartEngine#setAggregationType.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Valid aggregation types include: Heikin Ashi, Kagi, Renko, Range Bars, Point & Figure.

This function should not be used to set chartTypes. Instead use setChartType

Parameters:
Name Type Description
aggregationType string

Type of chart to display

See:

<static> setChartType(chartType)

Native wrapper for CIQ.ChartEngine#setChartType.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Will remove any aggregation type and switch your chart to display the new chartType.

Valid chartTypes include: Candle, Bar, Colored Bar, Line, Hollow Candle, Mountain and Baseline.

This function should not be used for setting Aggregations. Instead use setAggregationType

Parameters:
Name Type Description
chartType string

Type of chart to display

See:

<static> setCurrentVectorParameters(parameter, value)

Used to set currentVectoParameters and any values for it.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Parameters:
Name Type Description
parameter
value
See:

<static> setPeriodicity()

Native wrapper for CIQ.ChartEngine#setPeriodicity.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

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 of interval/timeUnit type.

params.timeUnit string <optional>

Type of data requested. Valid values are "millisecond","second","minute","day","week", "month" or 'tick'. If not set, will default to "minute". "hour" is NOT a valid timeUnit. Use timeUnit:"minute", interval:60 instead

params.interval string <optional>

Further qualifies pre-rolled details of intra-day timeUnits ("millisecond","second","minute") and will be 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 the interval to '5' and timeUnit to 'minute'


<static> setStudy(name, key, value)

Given an active study name this will update the study based on key value pair you pass in to a CIQ.Studies.DialogHelper.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

If the given key is not found in the DialogHelpers inputs then the key will be searched for in DialogHelper.outputs and try to update them instead

Parameters:
Name Type Description
name String

Name of the study from the chart engine's layout

key String

Key to set in the studies corresponding DialogHelper

value String

Value to set in the studies corresponding DialogHelper


<static> setStudyParameter(studyName, key, value, isInput)

Given an active study name this will update the study based on key value pair you pass in to a CIQ.Studies.DialogHelper.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

By default this will assume that key belongs to DialogHelper.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 studies corresponding DialogHelper

value String

Value to set in the studies corresponding DialogHelper

isInput Boolean

Boolean telling to update input instead of outputs


<static> setTheme(theme)

Sets the chart theme between 'day' or 'night' or none by adding in CSS classes to the chart's context. Also clears the chart containers backgroundColor and resets the engines styles.

Designed to be used with mobile sample interfaces. See Getting Started on Mobile for more details.

Adding one class will remove the other, to remove both set the theme to none

Parameters:
Name Type Description
theme String

Theme to set either 'day', 'night' or none