ChartIQView

public class ChartIQView : UIView
extension ChartIQView: WKScriptMessageHandler
extension ChartIQView: WKNavigationDelegate

The ChartIQ view.

Public Properties

  • The ChartIQ delegate.

    Declaration

    Swift

    public weak var delegate: ChartIQDelegate?
  • The ChartIQ dataSource.

    Declaration

    Swift

    public weak var dataSource: ChartIQDataSource?
  • The ChartIQ URL.

    Declaration

    Swift

    public static var chartIQUrl: String { get }
  • The ChartIQ refresh interval.

    Declaration

    Swift

    public static var chartIQRefreshInterval: Int { get }
  • The ChartIQ voiceover fields.

    Declaration

    Swift

    public static var chartIQVoiceoverFields: [String : Bool] { get }
  • The ChartIQ data method.

    Declaration

    Swift

    public var dataMethod: ChartIQDataMethod { get }
  • The ChartIQ symbol.

    Declaration

    Swift

    public var symbol: String { get }
  • The ChartIQ interval.

    Declaration

    Swift

    public var interval: String { get }
  • The ChartIQ timeUnit.

    Declaration

    Swift

    public var timeUnit: ChartIQTimeUnit { get }
  • The ChartIQ periodicity.

    Declaration

    Swift

    public var periodicity: Int { get }
  • The ChartIQ chart type.

    Declaration

    Swift

    public var chartType: ChartIQChartType { get }
  • The ChartIQ chart aggregation type.

    Declaration

    Swift

    public var chartAggregationType: ChartIQChartAggregationType? { get }
  • The ChartIQ chart scale.

    Declaration

    Swift

    public var chartScale: ChartIQScale { get }
  • The ChartIQ isExtendedHours property.

    Declaration

    Swift

    public var isExtendedHours: Bool { get }
  • The ChartIQ isInvertYAxis property.

    Declaration

    Swift

    public var isInvertYAxis: Bool { get }

Public Initializers

  • Init ChartIQ view with frame.

    Declaration

    Swift

    override public init(frame: CGRect)

    Parameters

    frame

    The ChartIQ view frame.

  • Init ChartIQ view with coder.

    Declaration

    Swift

    public required init?(coder aDecoder: NSCoder)

    Parameters

    coder

    The ChartIQ view coder.

Public Helpers

  • Helper to get the current WebView.

    Declaration

    Swift

    public func getWebView() -> WKWebView

    Return Value

    The current WebView.

  • Cleans up the message handlers in order to avoid a memory leak. Should be called when the view is about to get deallocated (e.g. the deinit of its superview).

    Declaration

    Swift

    public func cleanup()
  • Sets your WebView URL here.

    Declaration

    Swift

    public static func start(url: String)

    Parameters

    url

    The starting URL.

  • Sets ChartIQ URL.

    Declaration

    Swift

    public func setChartIQUrl(_ url: String)

    Parameters

    url

    The ChartIQ URL.

  • Sets ChartIQ refresh Interval.

    Declaration

    Swift

    public func setRefreshInterval(_ refreshInterval: Int)

    Parameters

    refreshInterval

    The ChartIQ refresh Interval.

  • Sets ChartIQ voiceover fields.

    Declaration

    Swift

    public func setVoiceoverFields(_ voiceoverFields: [String : Bool])

    Parameters

    voiceoverFields

    The ChartIQ voiceover fields.

Public Chart Controls

  • Sets the data method to “push” or “pull”.

    Declaration

    Swift

    public func setDataMethod(_ method: ChartIQDataMethod)

    Parameters

    method

    The ChartIQ data method.

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

    Declaration

    Swift

    public func setChartType(_ chartType: ChartIQChartType)

    Parameters

    chartType

    The ChartIQ chart type.

  • Sets the base aggregation type. This function should not be used to set chartTypes. Instead use setChartType.

    Declaration

    Swift

    public func setAggregationType(_ aggregationType: ChartIQChartAggregationType)

    Parameters

    aggregationType

    The ChartIQ aggregation type.

  • Sets the periodicity and interval for the chart. Interval describes the raw data interval (1, 5, 30, “day”) while period describes the multiple of that interval (7 minutes, 3 days, 7 X 5 minutes). This method sets the new periodicity and creates a new dataSet.

    Declaration

    Swift

    public func setPeriodicity(_ period: Int, interval: String, timeUnit: ChartIQTimeUnit = .minute)

    Parameters

    period

    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.

    interval

    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’.

    timeUnit

    The ChartIQ time unit. If not set, will default to “minute”. “hour” is NOT a valid timeUnit. Use timeUnit:“minute”, interval:60 instead.

  • Renders a chart for a particular instrument from the data passed in or fetches new data from the attached CIQ.QuoteFeed. This is the method that should be called every time a new chart needs to be drawn for a different instrument.

    Declaration

    Swift

    public func loadChart(_ symbol: String)

    Parameters

    symbol

    The symbol for the new chart.

Series

  • Returns an array of all the series.

    Declaration

    Swift

    public func getActiveSeries() -> [ChartIQSeries]

    Return Value

    Array of ChartIQSeries models.

  • Adds a series of data to the chart. A series can be displayed (for instance like a comparison chart) or it can be hidden (for instance to drive a study).

    Declaration

    Swift

    public func addSeries(_ series: ChartIQSeries, isComparison: Bool)

    Parameters

    series

    The ChartIQSeries model to add.

    isComparison

    The bool value used for ???.

  • Detaches a series from all associated renderers in the chart, removing the actual series data from masterData.

    Declaration

    Swift

    public func removeSeries(_ symbol: String)

    Parameters

    symbol

    The series symbol to remove.

  • Sets series parameters on the chart.

    Declaration

    Swift

    public func setSeriesParameter(_ symbol: String, parameterName: String, value: String)

    Parameters

    symbol

    The String Object. The name of symbol for series.

    parameterName

    The String Object. The name of parameter to modify.

    value

    The String Object. The value for parameter.

Scale

  • Get ChartIQ chart scale.

    Declaration

    Swift

    public func getChartScale() -> String?
  • Sets ChartIQ chart scale.

    Declaration

    Swift

    public func setScale(_ scale: ChartIQScale)

    Parameters

    scale

    The ChartIQ chart scale.

  • Change a css style on the chart.

    Declaration

    Swift

    public func setChartStyle(_ object: String, attribute: String, value: String)

    Parameters

    object

    The object whose style you wish to change (stx_grid, stx_xaxis, etc).

    attribute

    The style name of the object you wish to change.

    value

    The value to assign to the attribute.

  • Set a property value on the chart.

    Declaration

    Swift

    public func setChartProperty(_ property: String, value: Any)

    Parameters

    property

    The property name of the object you wish to change.

    value

    The value to assign to the property.

  • Get a property value on the chart.

    Declaration

    Swift

    public func getChartProperty(_ property: String) -> String?

    Parameters

    property

    The property name of the object you wish to receive.

  • Change a property value on the chart engine.

    Declaration

    Swift

    public func setEngineProperty(_ property: String, value: Any)

    Parameters

    property

    The property name of the object you wish to change.

    value

    The value to assign to the property.

  • Get a property value on the chart engine.

    Declaration

    Swift

    public func getEngineProperty(_ property: String) -> String?

    Parameters

    property

    The property name of the object you wish to receive.

  • Will toggle the crosshairs on or off.

    Declaration

    Swift

    public func enableCrosshairs(_ enable: Bool)

    Parameters

    enable

    The boolean value, true if need to enable crosshairs, false if need to disable crosshairs.

  • Checks if crosshairs is on.

    Declaration

    Swift

    public func isCrosshairsEnabled() -> Bool

    Return Value

    True if crosshair is on.

  • Checks if chart has finished loading.

    Declaration

    Swift

    public func isChartAvailable() -> Bool

    Return Value

    True if the chart has finished loading.

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

    Declaration

    Swift

    public func getHudDetails() -> ChartIQCrosshairHUD?

    Return Value

    The ChartIQCrosshairHUD model.

  • Sets ChartIQ theme for the chart. Sets 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.

    Declaration

    Swift

    public func setTheme(_ theme: ChartIQTheme)

    Parameters

    theme

    The ChartIQ theme.

  • Resize chart.

    Declaration

    Swift

    public func resizeChart()
  • Clears out a chart, eliminating all references including the resizeTimer, quoteDriver, styles and eventListeners.

    Declaration

    Swift

    public func clearChart()
  • Will toggle the extended hours on or off.

    Declaration

    Swift

    public func setExtendHours(_ isExtended: Bool)

    Parameters

    isExtended

    The boolean value, true if need to extend hours, false if need to disable extending.

  • Will toggle the invert y-axis on or off.

    Declaration

    Swift

    public func setInvertYAxis(_ isInverted: Bool)

    Parameters

    isInverted

    The boolean value, true if need to invert y-axis, false if need to disable inverting.

  • Get the language translations for the App

    Declaration

    Swift

    public func getTranslations(_ languageCode: String) -> [String : Any]

    Parameters

    languageCode

    The language locale code value.

  • Set the language of the chart

    Declaration

    Swift

    public func setLanguage(_ languageCode: String)

    Parameters

    languageCode

    The language locale code value.

Public Chart Data

  • Sets the chart data by push.

    Declaration

    Swift

    public func push(_ data: [ChartIQData])

    Parameters

    data

    An array of properly formatted OHLC quote objects to create a chart.

  • Uses this method to stream OHLC data into a chart.

    Declaration

    Swift

    public func pushUpdate(_ data: [ChartIQData])

    Parameters

    data

    An array of properly formatted OHLC quote objects to append.

Public Studies

  • Returns an array of all the studies with a shortName derived from the key.

    Declaration

    Swift

    public func getAllStudies() -> [ChartIQStudy]

    Return Value

    Array of ChartIQStudy models.

  • Lists studies added on the Chart.

    Declaration

    Swift

    public func getActiveStudies() -> [ChartIQStudy]

    Return Value

    The array of ChartIQStudy models.

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

    Declaration

    Swift

    public func getStudyParameters(_ study: ChartIQStudy, type: ChartIQStudyParametersType) -> Any?

    Parameters

    study

    The ChartIQStudy model.

    type

    What to return for the study. ChartIQStudyParametersType incapsulate values: “inputs”, “outputs”, “parameters”.

    Return Value

    The JSON Object or nil if an error occur.

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

    Declaration

    Swift

    public func setStudyParameter(_ studyName: String, key: String, value: String)

    Parameters

    studyName

    The name of the study from the chart engine’s layout.

    key

    The parameter name that must be defined in DialogHelper.

    value

    The value to set in the studies corresponding DialogHelper.

  • Sets study parameters.

    Declaration

    Swift

    public func setStudyParameters(_ study: ChartIQStudy, parameters: [String : String])

    Parameters

    study

    The ChartIQStudy model.

  • Adds a specific study to the chart.

    Throws

    ChartIQStudyError.

    Declaration

    Swift

    public func addStudy(_ study: ChartIQStudy,
                         forClone: Bool = false,
                         inputs: [String: Any]? = nil,
                         outputs: [String: Any]? = nil) throws

    Parameters

    study

    The ChartIQStudy model.

    forClone

    The Bool value indicating whether a study will be added for cloning or for adding.

    inputs

    Inputs for the study instance. If nil, it will use the paramters defined in CIQ.Studies.DialogHelper.

    outputs

    Outputs for the study instance. If nil, it will use the paramters defined in CIQ.Studies.DialogHelper.

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

    Declaration

    Swift

    public func removeStudy(_ study: ChartIQStudy)

    Parameters

    study

    The ChartIQStudy model.

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

    Declaration

    Swift

    public func removeAllStudies()

Public Drawings

  • Gets current draw tool.

    Declaration

    Swift

    public func getCurrentDrawTool() -> ChartIQDrawingTool?

    Return Value

    The ChartIQDrawingTool.

  • Enables drawing on the chart.

    Declaration

    Swift

    public func enableDrawing(_ tool: ChartIQDrawingTool)

    Parameters

    tool

    The ChartIQDrawingTool.

  • Will restore the drawing tool or tools to default configuration.

    Declaration

    Swift

    public func restoreDefaultDrawingConfig(_ tool: ChartIQDrawingTool, all: Bool)

    Parameters

    tool

    The ChartIQDrawingTool. May be nil if need to reset all drawing tools and the “all” parameter need to be equal “true”.

    all

    The boolean value, true if need to reset all drawing tools, false if need to disable concrete drawing tool.

  • Gets drawing parameters for a drawing tool.

    Declaration

    Swift

    public func getDrawingParameters(_ tool: ChartIQDrawingTool) -> [String : Any]?

    Parameters

    tool

    The ChartIQDrawingTool.

    Return Value

    The dictionary value of drawing parameters.

  • Sets drawing parameters on the chart.

    Declaration

    Swift

    public func setDrawingParameter(_ parameterName: String, value: Any)

    Parameters

    parameterName

    The parameter name.

    value

    The parameter value.

  • The alternative version of the setDrawingParameter method. This method make the work with the most common type of parameters for drawing tools easier, offering a typed parameter ChartIQDrawingParameterType. As well as not a typed version of the method sets drawing parameters on the chart.

    Declaration

    Swift

    public func setDrawingParameter(_ parameter: ChartIQDrawingParameterType, value: Any)

    Parameters

    value

    The parameter value.

  • Delete the selected drawing on the chart.

    Declaration

    Swift

    public func deleteDrawing()
  • Clone the selected drawing on the chart.

    Declaration

    Swift

    public func cloneDrawing()
  • Manage drawing layer on the chart.

    Declaration

    Swift

    public func manageLayerDrawing(_ layer: ChartIQLayer)

    Parameters

    layer

    The ChartIQLayer parameter.

  • Undo the last drawing on the chart.

    Declaration

    Swift

    public func undoDrawing() -> Bool

    Return Value

    The bool value indicates if the drawing was the latest.

  • Redo the last drawing on the chart.

    Declaration

    Swift

    public func redoDrawing() -> Bool

    Return Value

    The bool value indicates if the drawing was the latest.

  • Disables drawing on the chart.

    Declaration

    Swift

    public func disableDrawing()
  • Clears drawing on the chart.

    Declaration

    Swift

    public func clearDrawing()
  • Description Call any javascript function on the Chart Engine namespace

    Declaration

    Swift

    public func invoke(_ functionName: String, args: Any...) -> Any

    Parameters

    functionName

    The function name.

    args

    The Arguments.

WebKit Script Message Handler

  • Undocumented

    Declaration

    Swift

    public func userContentController(_ userContentController: WKUserContentController,
                                      didReceive message: WKScriptMessage)

WebKit Navigation Delegate

  • Undocumented

    Declaration

    Swift

    public func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!)