CWKView Class Reference

Inherits from UIView
Declared in CWKView.h

Overview

  • The ChartworksKit SDK offers a full-featured interactive charting view for your iPhone / iPad applications. Features include the ability to pinch & zoom, tap and hold to reveal information on a given point on a chart and add indicators to get a better understanding of the chart.

Key features of the SDK include:

  • Ability to create a chart view that contains either an upper chart or a view that contains both an upper and a lower chart

  • Extremely easy to add to your applications

  • Ability to pinch & zoom and study various points on the chart.

  • Ability to add all of the major upper & lower indicators without a data refresh

  • Heavily customizable with settings for behaviors, colors, fonts and button imagery

  • Ability to re-direct network traffic outside of the SDK for logging purposes

  • Ability to set custom announcements on the price line

  • Complete Example application that demonstrates the capability of the SDK

CWKView is the main entry point for this SDK. This class handles all of the drawing operations. There are two charts within this view, an upper chart, and a lower chart. The upper chart is designed to render all CWKUpperIndicator types for a given symbol. The lower chart is designed to render all CWKLowerIndicator types for a given symbol.

It is possible to disable the lower chart by using the constructor initWithPosition:upperChartHeight:configuration: this will cause only the upper chart to appear. Please know that setting lower indicators will not do anything if this was used.

Other Methods

  delegate

the primary delegate for the view

@property (nullable, nonatomic, weak) id<CWKViewDelegate> delegate

Declared In

CWKView.h

  dataSource

the view’s datasource delegate

@property (nullable, nonatomic, weak) id<CWKViewDataSource> dataSource

Declared In

CWKView.h

  configuration

the view’s configuration

@property (nonatomic, strong, readonly) CWKConfiguration *configuration

Declared In

CWKView.h

  returnsAnnotationView

Set this to an instance of CWKReturnsAnnotation to override the default Returns Calculator annotation.

@property (nonatomic, strong) UIView<CWKReturnsAnnotationDelegate> *returnsAnnotationView

Declared In

CWKView.h

Initialization

– initWithPosition:upperChartHeight:configuration:

Creates a chart with only an upper chart displayed

- (instancetype)initWithPosition:(CWKPos)position upperChartHeight:(CGFloat)upperChartHeight configuration:(CWKConfiguration *)configuration

Parameters

position

An Chart structure (x, y, width) for positioning the view.

upperChartHeight

The desired view height for the chart.

configuration

The CWKConfiguration object for setting colors and fonts

Return Value

an initialized CWKView object with the given position and height.

Declared In

CWKView.h

– initWithPosition:upperChartHeight:lowerChartHeight:gutterHeight:configuration:

Creates a chart view with an upper chart and a lower chart and with a custom configuration for colors and fonts

- (instancetype)initWithPosition:(CWKPos)position upperChartHeight:(CGFloat)upperChartHeight lowerChartHeight:(CGFloat)lowerChartHeight gutterHeight:(CGFloat)gutterHeight configuration:(CWKConfiguration *)configuration

Parameters

position

An Chart structure (x, y, width) for positioning the view

upperChartHeight

The desired view height for the upper chart

lowerChartHeight

The desired view height for the lower chart

gutterHeight

The desired space between the upper and lower chart

configuration

The CWKConfiguration object for setting colors and fonts

Return Value

an initialized CWKView object with the given position, upper chart height, lower chart height, and configuration.

Discussion

Use this initializer if you want to to establish a view that an instance of a chart view that has a custom configuration; (i.e. use only if you want two charts to appear with a different look)

Declared In

CWKView.h

– initWithConfiguration:

Creates a chart with only an upper chart displayed

- (instancetype)initWithConfiguration:(CWKConfiguration *)configuration

Parameters

configuration

The CWKConfiguration object for setting colors and fonts

Return Value

an initialized CWKView

Declared In

CWKView.h

– initWithLowerChartHeight:configuration:

Creates a chart with an upper and lower chart, with a default gutter height

- (instancetype)initWithLowerChartHeight:(CGFloat)lowerHeight configuration:(CWKConfiguration *)configuration

Parameters

lowerHeight

the height of the lower chart

configuration

the configuration

Return Value

an initialized CWKView

Declared In

CWKView.h

– initWithFrame:configuration:

Creates a chart with only an upper chart displayed

- (instancetype)initWithFrame:(CGRect)frame configuration:(CWKConfiguration *)configuration

Parameters

frame

the chart frame

configuration

The CWKConfiguration object for setting colors and fonts

Return Value

an initialized CWKView

Declared In

CWKView.h

– initWithFrame:lowerChartHeight:configuration:

Creates a chart with an upper and lower chart, with a default gutter height.

- (instancetype)initWithFrame:(CGRect)frame lowerChartHeight:(CGFloat)lowerHeight configuration:(CWKConfiguration *)configuration

Parameters

frame

the chart frame

lowerHeight

the height of the lower chart

configuration

the configuration

Return Value

an initialized CWKView

Declared In

CWKView.h

Move and resize

  gutterHeight

gutterHeight is the space between the upper and lower chart.

@property (nonatomic, assign) CGFloat gutterHeight

Declared In

CWKView.h

  lowerChartTemporarilyHidden

when using the [CWKConfiguration hideLowerChartAutomatically], this boolean will be set to YES when the lower chart is hidden due to no active lower indicators.

@property (nonatomic, assign, readonly) BOOL lowerChartTemporarilyHidden

Declared In

CWKView.h

  hasLowerCharts

this boolean will be set to YES when there is at least one lower chart

@property (nonatomic, assign, readonly) BOOL hasLowerCharts

Declared In

CWKView.h

  animateLowerChartHiding

When using the [CWKConfiguration hideLowerChartAutomatically], This property determines if hiding or showing the lower chart based on indicators should be animated Default = YES

@property (nonatomic, assign) BOOL animateLowerChartHiding

Declared In

CWKView.h

– setPosition:upperChartHeight:lowerChartHeight:gutterHeight:

Move & Resize the chart to a new position, and with a new upper and lower height If a lower chart was not created at the view was instantiated then setting a lowerChartHeight greater than 0 will produce a lower chart.

- (void)setPosition:(CWKPos)position upperChartHeight:(CGFloat)upperChartHeight lowerChartHeight:(CGFloat)lowerChartHeight gutterHeight:(CGFloat)gutterHeight

Parameters

position

An Chart structure (x, y, width) for positioning the view

upperChartHeight

The desired view height for the upper chart

lowerChartHeight

The desired view height for the lower chart

gutterHeight

The desired space between the upper and lower chart

Declared In

CWKView.h

– setUpperChartHeight:lowerChartHeight:gutterHeight:

Resize the chart, with a new upper and lower height If a lower chart was not created at the view was instantiated then setting a lowerChartHeight greater than 0 will produce a lower chart.

- (void)setUpperChartHeight:(CGFloat)upperChartHeight lowerChartHeight:(CGFloat)lowerChartHeight gutterHeight:(CGFloat)gutterHeight

Parameters

upperChartHeight

The desired view height for the upper chart

lowerChartHeight

The desired view height for the lower chart

gutterHeight

The desired space between the upper and lower chart

Declared In

CWKView.h

– setLowerChartHeight:gutterHeight:

Resize the chart, with a new upper and lower height If a lower chart was not created at the view was instantiated then setting a lowerChartHeight greater than 0 will produce a lower chart.

- (void)setLowerChartHeight:(CGFloat)lowerChartHeight gutterHeight:(CGFloat)gutterHeight

Parameters

lowerChartHeight

The desired view height for the lower chart

gutterHeight

The desired space between the upper and lower chart

Declared In

CWKView.h

– upperChartHeight

current upper chart height

- (CGFloat)upperChartHeight

Return Value

current upper chart height

Declared In

CWKView.h

– lowerChartHeight

current lower chart height

- (CGFloat)lowerChartHeight

Return Value

current lower chart height

Declared In

CWKView.h

Setup and draw

– resetZoomAnimated:

Returns the chart to the zoom out state

- (void)resetZoomAnimated:(BOOL)animated

Parameters

animated

Pass YES to have the zoom out be animated, NO to have the zoom be reset without animation.

Declared In

CWKView.h

– resetChartsAndRemoveAnnotations:

Reset the charts so that no data is displayed. Optionally keep annotations.

- (void)resetChartsAndRemoveAnnotations:(BOOL)removeAnnotations

Declared In

CWKView.h

– buildChartRequestForSymbol:compareWithSymbols:upperChartType:lowerIndicator:durationAmount:turnOffAllPriorIndicators:atDataFrequency:

For documentation, see buildChartRequestForSymbol:compareWithSymbols:upperChartType:lowerIndicator:durationAmount:turnOffAllPriorIndicators:atDataFrequency:indicatorsToRequest:

- (nullable NSError *)buildChartRequestForSymbol:(CWKSecuritySymbol *)symbol compareWithSymbols:(nullable NSArray<CWKSecuritySymbol*> *)symbolList upperChartType:(CWKStyle)chartType lowerIndicator:(CWKLowerIndicator)lowerIndicator durationAmount:(CWKDuration)durationAmount turnOffAllPriorIndicators:(BOOL)turnOffAllPriorIndicators atDataFrequency:(CWKFrequency)dataFrequency

Declared In

CWKView.h

– buildChartRequestForSymbol:compareWithSymbols:upperChartType:lowerIndicator:durationAmount:turnOffAllPriorIndicators:atDataFrequency:upperIndicatorsToRequest:lowerIndicatorsToRequest:

Asks the CWKView to retrieve data for a given symbol, how many days in the past, the frequency of data.

- (nullable NSError *)buildChartRequestForSymbol:(CWKSecuritySymbol *)symbol compareWithSymbols:(nullable NSArray<CWKSecuritySymbol*> *)symbolList upperChartType:(CWKStyle)chartType lowerIndicator:(CWKLowerIndicator)lowerIndicator durationAmount:(CWKDuration)durationAmount turnOffAllPriorIndicators:(BOOL)turnOffAllPriorIndicators atDataFrequency:(CWKFrequency)dataFrequency upperIndicatorsToRequest:(nullable NSArray<NSNumber*> *)upperIndicatorsToRequest lowerIndicatorsToRequest:(nullable NSArray<NSNumber*> *)lowerIndicatorsToRequest

Parameters

symbol

An instance of the CWKSecuritySymbol object

symbolList

This is an array that contains CWKSecuritySymbol objects

chartType

This is the base chart type to use for the upper (see CWKStyle enum)

lowerIndicator

This is lower indicator to load as the first lower indicator. Note that if you do not have a lower chart this value is ignored. Set the value to CWKLowerIndicatorNone.

durationAmount

enum The CWKDuration for the chart request

turnOffAllPriorIndicators

This will if set to YES, reset both the upper and lower chart to no indicators being active

dataFrequency

The granularity of data returned.

upperIndicatorsToRequest

An NSArray of CWKUpperIndicator enums to include with the network request. Provide a list of only the indicators needed to reduce the network load. If nil is passed, all indicators will be requested. If an empty array is passed, only Price will be requested.

lowerIndicatorsToRequest

An NSArray of CWKLowerIndicator enums to include with the network request. Provide a list of only the indicators needed to reduce the network load. If nil is passed, all indicators will be requested. If an empty array is passed, only Price will be requested.

Declared In

CWKView.h

– buildChartRequestForSymbol:compareWithSymbols:durationAmount:atDataFrequency:

Asks the CWKView to retrieve data for a given symbol, how many days in the past, the frequency of data.

- (nullable NSError *)buildChartRequestForSymbol:(CWKSecuritySymbol *)symbol compareWithSymbols:(nullable NSArray<CWKSecuritySymbol*> *)symbolList durationAmount:(CWKDuration)durationAmount atDataFrequency:(CWKFrequency)dataFrequency

Parameters

symbol

An instance of the CWKSecuritySymbol object

symbolList

This is an array that contains CWKSecuritySymbol objects

durationAmount

enum The CWKDuration for the chart request

dataFrequency

The granularity of data returned.

Declared In

CWKView.h

– getInformationForSymbol:

Asks for information regarding a specific symbol.

- (void)getInformationForSymbol:(NSString *)symbol

Parameters

symbol

The financial security to provide information for. See chartView:symbolSummaryDictionary:error for more details

Discussion

The returned information will contain information regarding the security type, supported indicators, data frequencies and peers, major indices and sectors. The suggested workflow is to use this method to get information about a given symbol so that you can properly set the parameters for the buildChartRequest methods. Calling this will return data using the chartView:informationDictionary delegate method.

Declared In

CWKView.h

– getInformationForSymbol:parameters:

Asks for information regarding a specific symbol.

- (void)getInformationForSymbol:(NSString *)symbol parameters:(nullable NSDictionary *)parameters

Parameters

symbol

The financial security to provide information for.

parameters

Additional parameters to be URL encoded and added to the API call query string. Note: any keys named “symbol” that may exist will be overwritten with the symbol parameter. See chartView:symbolSummaryDictionary:error for more details

Discussion

The returned information will contain information regarding the security type, supported indicators, data frequencies and peers, major indices and sectors. The suggested workflow is to use this method to get information about a given symbol so that you can properly set the parameters for the buildChartRequest methods. Calling this will return data using the chartView:informationDictionary delegate method.

Declared In

CWKView.h

  chartStyle

Sets the upper chart type.

@property (nonatomic, assign) CWKStyle chartStyle

Parameters

chartStyle

The desired chart style

Discussion

The supported types are: - Candlestick - OHLC (Open-High-Low-Close) - HLC - Mountain - Line - Bar - Dot

Declared In

CWKView.h

– recommendedFrequencyForStartDate:

Returns a CWKFrequency valid for a given start date.

- (CWKFrequency)recommendedFrequencyForStartDate:(NSDate *)start

Declared In

CWKView.h

– recommendedFrequencyForDuration:

Returns a CWKFrequency valid for a given duration.

- (CWKFrequency)recommendedFrequencyForDuration:(CWKDuration)duration

Declared In

CWKView.h

– validFrequenciesForStartDate:

Returns an array of CWKFrequency values for a given start date.

- (NSArray<NSNumber*> *)validFrequenciesForStartDate:(NSDate *)start

Declared In

CWKView.h

– validFrequenciesForDuration:

Returns an array of CWKFrequency values for a given duration

- (NSArray<NSNumber*> *)validFrequenciesForDuration:(CWKDuration)duration

Declared In

CWKView.h

– setStartDate:endDate:frequency:

To set a custom date range, pass a start date and frequency. The end date can also be specified but is optional If the inputs are valid, this method will return true, as well as set these values for the next drawCharts call

- (BOOL)setStartDate:(NSDate *)start endDate:(nullable NSDate *)end frequency:(CWKFrequency)frequency

Declared In

CWKView.h

– setStartDate:frequency:

To set a custom date range, pass a start date and frequency. If the inputs are valid, this method will return true, as well as set these values for the next drawCharts call

- (BOOL)setStartDate:(NSDate *)start frequency:(CWKFrequency)frequency

Declared In

CWKView.h

– setStartDate:endDate:

To set a custom start date and end date, automatically selecting a frequency. If the input is valid, this method will return true, set these values for the next drawCharts call

- (BOOL)setStartDate:(NSDate *)start endDate:(nullable NSDate *)end

Declared In

CWKView.h

– setStartDate:

To set a custom start date, automatically selecting a frequency. If the input is valid, this method will return true, set this value for the next drawCharts call

- (BOOL)setStartDate:(NSDate *)start

Declared In

CWKView.h

– setChartScale:dataFrequency:

Set the chart time scale, please see the CWKDuration enum

- (nullable NSError *)setChartScale:(CWKDuration)durationAmount dataFrequency:(CWKFrequency)dataFrequency

Parameters

durationAmount

Set the Duration (the period of time in number of days using the CWKDuration enum)

dataFrequency

Set the CWKFrequency to any reasonable value for the scale

Return Value

NSError object with error description

The current duration values that are supported are:

  • CWKDurationYTD = 0,
  • CWKDuration1Day = 1,
  • CWKDuration2Day = 2,
  • CWKDuration3Day = 3,
  • CWKDuration5Day = 5,
  • CWKDuration10Day = 10,
  • CWKDuration20Day = 20,
  • CWKDuration1Month = 30,
  • CWKDuration3Month = 90,
  • CWKDuration6Month = 180,
  • CWKDuration9Month = 270,
  • CWKDuration1Year = 365,
  • CWKDuration2Year = 730,
  • CWKDuration3Year = 1095,
  • CWKDuration4Year = 1460,
  • CWKDuration5Year = 1825,
  • CWKDuration10Year = 3650,
  • CWKDuration20Year = 7300,
  • CWKDurationMax = 9999 (will set 20 year)

Discussion

Warning: Once this is called the caller must then call the drawCharts method to the chart in order to update the scale.

Declared In

CWKView.h

  extendedHours

Provide a extended hours data if entitled Default = NO

@property (nonatomic, assign) BOOL extendedHours

Declared In

CWKView.h

– setRealTime:

Provide a real-time quote if the service is properly entitled. Default = NO

- (void)setRealTime:(BOOL)realTime

Declared In

CWKView.h

– drawCharts

Tells the chart to draw itself This will draw the chart and if necessary fetch the data.

- (void)drawCharts

Discussion

This method should only be called in the following cases: - When you are ready to display the initial chart, - When you call chartView:setChartScale - When you call chartView:buildChartRequestForSymbol - When you call chartView:buildIntraDayChartRequestForSymbol

Declared In

CWKView.h

– drawChartsWithFreshData

Tells the chart to draw itself with fresh data

- (void)drawChartsWithFreshData

Discussion

This method should only be called if you want to force a reload of the data, this might be used in the case where there was a network connection loss and you have a refresh button in your application. This method tells the chart you want to purge the existing in memory chart data, fetch more and draw the chart.

See Also

Declared In

CWKView.h

Select upper indicators

– removeComparisonSymbol:

Removes a symbol from the upper chart

- (void)removeComparisonSymbol:(NSString *)name

Parameters

name

The symbol to remove from the upper chart

Discussion

This will remove a symbol that was added as a comparison via the buildChart method. It will not remove the original symbol the chart was built for. It is not necessary to make a call to drawCharts after this method. This will result in the delegate callback -(void) chartView:(CWKView )chartView removedComparison:(NSString ) symbol currentComparisonList:(NSArray *) comparisonList to be called.

Declared In

CWKView.h

– setUpperIndicatorActive:

Activates an individual upper indicator

- (void)setUpperIndicatorActive:(CWKUpperIndicator)upperIndicator

Parameters

upperIndicator

The upper indicator to activate

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setUpperIndicatorsActiveFromList:

Activates a list of upper indicators

- (void)setUpperIndicatorsActiveFromList:(NSArray<NSNumber*> *)indicatorList

Parameters

indicatorList

An NSArray of upper indicator NSNumbers

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setUpperIndicatorInactive:

De-activates an individual upper indicator

- (void)setUpperIndicatorInactive:(CWKUpperIndicator)upperIndicator

Parameters

upperIndicator

The upper indicator to de-activate

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setAllUpperIndicatorsInactive

De-activates all upper indicators

- (void)setAllUpperIndicatorsInactive

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setAllUpperIndicatorsActive

Activates all upper indicators

- (void)setAllUpperIndicatorsActive

Discussion

It is not necessary to make a call to drawCharts after this method.

This is usually intended for debug purposes.

Declared In

CWKView.h

– getActiveUpperIndicators

Gets a list of all enabled upper indicators

- (NSArray<NSNumber*> *)getActiveUpperIndicators

Return Value

a list of UpperIndicator types wrapped in NSNumber that are currently set to active.

Declared In

CWKView.h

– updateUpperIndicatorButtonsWithSymbol:comparisonSymbols:

Refreshes the visible indicator buttons with the symbol & comparison symbols.

- (void)updateUpperIndicatorButtonsWithSymbol:(CWKSecuritySymbol *)symbol comparisonSymbols:(NSArray<CWKSecuritySymbol*> *)comparisonSymbols

Declared In

CWKView.h

Select lower indicators

– setLowerIndicatorActive:

Activates an individual lower indicator

- (void)setLowerIndicatorActive:(CWKLowerIndicator)lowerIndicator

Parameters

lowerIndicator

The lower indicator that will be set active

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setLowerIndicatorsActiveFromList:

Activates a list of lower indicators

- (void)setLowerIndicatorsActiveFromList:(NSArray<NSNumber*> *)indicatorList

Parameters

indicatorList

An NSArray of CWKLowerIndicator types wrapped in NSNumber

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setLowerIndicatorInactive:

De-activates an individual lower indicator

- (void)setLowerIndicatorInactive:(CWKLowerIndicator)lowerIndicator

Parameters

lowerIndicator

The lower indicator to de-activate

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setAllLowerIndicatorsActive

Activates all lower indicators

- (void)setAllLowerIndicatorsActive

Discussion

It is not necessary to make a call to drawCharts after this method.

This is usually intended for debug purposes.

Declared In

CWKView.h

– setAllLowerIndicatorsInactive

De-activates all lower indicators

- (void)setAllLowerIndicatorsInactive

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– getActiveLowerIndicators

Gets a list of all enabled lower indicators

- (NSArray<NSNumber*> *)getActiveLowerIndicators

Return Value

a list of CWKLowerIndicator types wrapped in NSNumber that are currently set to active.

Declared In

CWKView.h

overlay indicators for lower

– setOverlayIndicatorActive:onLowerIndicator:

Activates an individual overlay indicator

- (void)setOverlayIndicatorActive:(CWKUpperIndicator)overlay onLowerIndicator:(CWKLowerIndicator)lowerIndicator

Parameters

overlay

The overlay indicator to activate

lowerIndicator

The lower indicator to activate the overlay on

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setOverlayIndicatorInactive:onLowerIndicator:

De-activates an individual overlay indicator

- (void)setOverlayIndicatorInactive:(CWKUpperIndicator)overlay onLowerIndicator:(CWKLowerIndicator)lowerIndicator

Parameters

overlay

The overlay indicator to de-activate

lowerIndicator

The lower indicator to de-activate the overlay on

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setOverlayIndicatorsActiveFromList:onLowerIndicator:

Activates several overlay indicators

- (void)setOverlayIndicatorsActiveFromList:(NSArray<NSNumber*> *)overlayList onLowerIndicator:(CWKLowerIndicator)lowerIndicator

Parameters

overlayList

The overlay indicators to activate

lowerIndicator

The lower indicator to activate the overlay on

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setAllOverlayIndicatorsInactive

De-activates all lower indicator overlays on all lower indicators

- (void)setAllOverlayIndicatorsInactive

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– setAllOverlayIndicatorsInactiveOnLowerIndicator:

De-activates all lower indicator overlays

- (void)setAllOverlayIndicatorsInactiveOnLowerIndicator:(CWKLowerIndicator)lowerIndicator

Parameters

lowerIndicator

The lower indicator to de-activate the overlay on

Discussion

It is not necessary to make a call to drawCharts after this method.

Declared In

CWKView.h

– getActiveOverlayIndicatorsOnLowerIndicator:

Gets a list of all enabled overlay indicators for a given lower

- (NSArray<NSNumber*> *)getActiveOverlayIndicatorsOnLowerIndicator:(CWKLowerIndicator)lowerIndicator

Return Value

a list of CWKUpperIndicator types wrapped in NSNumber that are currently set to active.

Declared In

CWKView.h

Adding Custom Announcements and Annotations

– addAnnouncement:title:announcementText:borderColor:fillColor:fontColor:image:

Add an announcement marker to the upper chart

- (id)addAnnouncement:(NSDate *)date title:(nullable NSString *)title announcementText:(nullable NSString *)announcementText borderColor:(nullable UIColor *)borderColor fillColor:(nullable UIColor *)fillColor fontColor:(nullable UIColor *)fontColor image:(nullable UIImage *)image

Parameters

date

the date for which to add the announcement

title

the label to display in the announcement

announcementText

text to present in the popover. popover will not show if nil.

borderColor

the color of the border and arrow of the announcement

fillColor

the fill of the announcement box

fontColor

the color of the title

image

the image to display in the box 16*16

Return Value

the id of the announcement.

Discussion

Use this method to add an announcement to the upper chart, the announcement will be placed over the line at the passed date. Tapping the announcement will call the delegate’s announcementTapped: method If description is not nil, tapping the announcement will show a popover with the description.

Declared In

CWKView.h

– removeAnnouncement:

remove an announcement marker from the chart

- (void)removeAnnouncement:(id)announcement

Parameters

announcement

the announcement to remove

Discussion

Use this method to remove a specific announcement from the chart

Declared In

CWKView.h

– removeAllAnnouncements

remove all announcement markers from the chart

- (void)removeAllAnnouncements

Discussion

Use this method to remove all announcements from the chart

Declared In

CWKView.h

– startAnnotationModeForType:

Enable annotation drawing mode where the user can draw an annotation of the specified type on the chart.

- (void)startAnnotationModeForType:(CWKAnnotationType)annotationType

Declared In

CWKView.h

– endAnnotationMode

End annotation drawing mode so the user can interact with the chart again.

- (void)endAnnotationMode

Declared In

CWKView.h

– removeAnnotation:forType:

Remove a specified annotation of the specified type from the chart.

- (void)removeAnnotation:(NSString *)uniqueID forType:(CWKAnnotationType)annotationType

Declared In

CWKView.h

– removeLastAnnotationForType:

Remove the last annotation of the specified type from the chart.

- (void)removeLastAnnotationForType:(CWKAnnotationType)annotationType

Declared In

CWKView.h

– removeAllAnnotationsForType:

Remove all annotations of the specified type from the chart

- (void)removeAllAnnotationsForType:(CWKAnnotationType)annotationType

Declared In

CWKView.h

– trendlineIDsForType:

Returns the unique ID for all annotations of the specified type that are currently on the chart.

- (NSArray *)trendlineIDsForType:(CWKAnnotationType)annotationType

Declared In

CWKView.h

– drawTextAnnotationWithText:atPoint:font:fontColor:borderWidth:borderColor:fillColor:maxWidth:textInset:

Draws a Text Annotation on the upper chart. Typically called from the chartView:textAnnotationCreatedAtPoint: delegate method.

- (void)drawTextAnnotationWithText:(NSString *)text atPoint:(CGPoint)point font:(UIFont *)font fontColor:(UIColor *)fontColor borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor fillColor:(UIColor *)fillColor maxWidth:(CGFloat)maxWidth textInset:(CGFloat)textInset

Parameters

text

The text to show in the annotation

point

The CGPoint at which to draw the text annotation - can pass through the point given by chartView:textAnnotationCreatedAtPoint:

font

The font to draw the text with

fontColor

The color to draw the text with

borderWidth

The width of the border of the text annotation

borderColor

The color of the border of the text annotation

fillColor

the fill / background color of the text annotation

maxWidth

The maximum width to make the text annotation

textInset

The distance to inset the text from the inside edge of the border

Declared In

CWKView.h

– updateTextAnnotationWithUniqueID:withText:

Updates the text of a given text annotation

- (void)updateTextAnnotationWithUniqueID:(NSString *)uniqueID withText:(NSString *)text

Parameters

uniqueID

The ID of the annotation

text

The text to show in the annotation

Declared In

CWKView.h

– addHorizontalLineAnnotationAtValue:withTitle:description:titleFont:titleFontColor:lineWidth:lineColor:borderWidth:borderColor:fillColor:annotationAboveLine:annotationPositionOnLeft:

Add a horizontal line and annotation to the chart. If title is nil or empty, only the line will be drawn.

- (NSString *)addHorizontalLineAnnotationAtValue:(id)value withTitle:(nullable NSString *)title description:(nullable NSString *)description titleFont:(UIFont *)titleFont titleFontColor:(UIColor *)titleFontColor lineWidth:(CGFloat)lineWidth lineColor:(UIColor *)lineColor borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor fillColor:(UIColor *)fillColor annotationAboveLine:(BOOL)annotationAboveLine annotationPositionOnLeft:(BOOL)annotationPositionOnLeft

Parameters

value

The Y-Axis value to draw the horizontal line at

title

The text to show in the annotation box on the chart

description

the text to show in the popover when the annotation is tapped

Return Value

The unique ID of the horizontal line annotation

Declared In

CWKView.h

– startTrendLineMode

Enable TrendLine draw mode where the user can draw a trendline on the upper chart.

- (void)startTrendLineMode

Declared In

CWKView.h

– endTrendLineMode

End Trendline draw mode so the user can interact with the chart again.

- (void)endTrendLineMode

Declared In

CWKView.h

– removeAllTrendlines

Remove all trendlines from the chart

- (void)removeAllTrendlines

Declared In

CWKView.h

– removeLastTrendline

Remove the last trendline added

- (void)removeLastTrendline

Declared In

CWKView.h

– startFibonacciRetracementMode

Start Fibonacci Retracement draw mode where the user can draw a Fibonacci retracement on the upper chart.

- (void)startFibonacciRetracementMode

Declared In

CWKView.h

– endFibonacciRetracementMode

End Fibonacci Retracement draw mode so the user can interact with the chart again.

- (void)endFibonacciRetracementMode

Declared In

CWKView.h

– removeAllFibonacciRetracement

Remove all Fibonacci retracements from the chart

- (void)removeAllFibonacciRetracement

Declared In

CWKView.h

– removeLastFibonacciRetracement

Remove the last Fibonacci retracement added

- (void)removeLastFibonacciRetracement

Declared In

CWKView.h

– removeAllAnnotations

Remove all annotations which are drawn or programmatically added. Does not include custom events.

- (void)removeAllAnnotations

Declared In

CWKView.h

– removeAllCustomAnnotations

Remove all annotations which are programmatically added. Does not include custom events.

- (void)removeAllCustomAnnotations

Declared In

CWKView.h

– removeAllDrawnAnnotations

Remove all annotations which are drawn.

- (void)removeAllDrawnAnnotations

Declared In

CWKView.h

Sharing

– getChartSettingsForTemplate

Returns a dictionary of options that’s suitable for saving a user’s preferences that should be applied to different charts. Includes style, indicators, timeframe Note, you may want to have a different preference based on asset class (Mutual Fund, Equity, Index, etc) due to some indicators working better for some asset classes.

- (NSDictionary<NSString*,id> *)getChartSettingsForTemplate

Declared In

CWKView.h

– getChartSettingsForSave

Returns a dictionary of options that’s suitable for saving an exact chart so that it can be viewed later. Includes symbols (base and comparison), style, indicators, timeframe, and annotations.

- (NSDictionary<NSString*,id> *)getChartSettingsForSave

Declared In

CWKView.h

– getChartSettingsWithOptions:

Returns an NSDictionary of various current chart settings.

- (NSDictionary<NSString*,id> *)getChartSettingsWithOptions:(CWKSaveOption)options

Return Value

NSDictionary of settings: CWKSettingKeyChartStyle = NSString representation of CWKStyle enum (CWKStyleMountain = “CWKStyleMountain”) CWKSettingKeyDuration = NSUInteger of the chart duration CWKSettingKeyFrequency = NSUInteger of the chart frequency CWKSettingKeyUpperIndicators = NSArray of NSString representations of CWKUpperIndicators enum (CWKUpperIndicatorBollinger = “CWKUpperIndicatorBollinger”) CWKSettingKeyLowerIndicators = NSArray of NSString representations of CWKLowerIndicators enum (CWKLowerIndicatorMACD = “CWKLowerIndicatorMACD”)

Discussion

Notes: - CWKSettingKeyFrequency and CWKSettingKeyDuration is a matched pair, meaning both must have values or neither will be set. - Trendlines are stored with coordinates respective to the chart axis, so should be considered tightly coupled with the duration and frequency they were set on.

Declared In

CWKView.h

– setChartSettings:

Configures the chart given an NSDictionary of settings.

- (void)setChartSettings:(nullable NSDictionary<NSString*,id> *)settings

Discussion

Since the implementing view controller may be doing extra work when the symbol is changed or comparisons are added, there are blocks giving full responsibility to the implementer of setting a new base symbol and comparisons. When nil, getInformationForSymbol: will be called.

For settings documentation, see notes and params detailed in getChartSettings:

Declared In

CWKView.h

– prepareForScreenshot

If you would like to take your own screenshot, call this method to prepare the chart for taking a screenshot. Extra buttons that wouldn’t be interactive in a screenshot and be confusing will be disabled. After the screenshot is taken call recoverFromScreenshot

- (void)prepareForScreenshot

Declared In

CWKView.h

– recoverFromScreenshot

If you would like to take your own screenshot, call this method after taking a screenshot. Changes that were made in prepareForScreenshot will be reverted.

- (void)recoverFromScreenshot

Declared In

CWKView.h

– getCombinedChartScreenshot

Returns a screenshot of the upper and lower charts.

- (UIImage *)getCombinedChartScreenshot

Declared In

CWKView.h

– getCombinedChartScreenshotWithGutter:

Returns a screenshot of the upper and lower charts.

- (UIImage *)getCombinedChartScreenshotWithGutter:(CGFloat)gutter

Parameters

gutter

The amount of space to add between the upper and lower charts.

Declared In

CWKView.h

– getUpperChartScreenshot

Returns a screenshot of the upper chart.

- (UIImage *)getUpperChartScreenshot

Declared In

CWKView.h

– getLowerChartScreenshot

Returns a screenshot of the lower chart.

- (UIImage *)getLowerChartScreenshot

Declared In

CWKView.h

– getScreenshotOfView:

If you would like to capture parts of your view hierarchy as well as the chart in the screenshot, use this method Extra buttons controlled by the chart view will be hidden for the screenshot

- (UIImage *)getScreenshotOfView:(UIView *)view

Parameters

view

pass the view you would like a screenshot of. For example you might want a screenshot of your whole view controller.

Declared In

CWKView.h

Chart Information

– getCurrentSecuritySymbol

Returns a the current symbol object - to change this object use the a -buildChartRequest… method

- (CWKSecuritySymbol *)getCurrentSecuritySymbol

Declared In

CWKView.h

– getCurrentDurationAmount

Returns the current chart duration

- (CWKDuration)getCurrentDurationAmount

Declared In

CWKView.h

– getCurrentDataFrequency

Returns the current chart data frequency

- (CWKFrequency)getCurrentDataFrequency

Declared In

CWKView.h

– getEarliestDate

Earliest date in the full range of the chart (not necessarily what is currently visible)

- (nullable NSDate *)getEarliestDate

Declared In

CWKView.h

– getLatestDate

Latest date in the full range of the chart (not necessarily what is currently visible)

- (nullable NSDate *)getLatestDate

Declared In

CWKView.h

– getChartTimeZone

Chart timezone - the timezone used for the display of the chart

- (nullable NSTimeZone *)getChartTimeZone

Declared In

CWKView.h

– getChartDataDurationInDays

The duration of the data. May be lower than duration amount, due to data available For intraday charts, the number of trading days will be returned For interday charts, the number of days that have passed on the calendar will be returned

- (nullable NSNumber *)getChartDataDurationInDays

Declared In

CWKView.h