TKChart Class Reference
Inherits from | TKView : UIView |
Declared in | TKChart.h |
Overview
TKChart is a versatile charting component that offers great performance, drawing capabilities and intuitive object model. Thanks to the public API you can set up complex charts with stunning animations and appearance easily through code. TKChart supports various series types: bar, column, line, spline, area, pie, donut and scatter. These series can also be stacked where appropriate. Among its supported features are pan/zoom funcionality, multiple axes and animations that use CoreAnimations and UIKit dynamics.
Tasks
Accessing Views and Styling
-
legend
property -
title
property -
plotView
property -
gridStyle
property -
insets
property -
plotViewInsets
property -
theme
property -
handleDoubleTap
property -
allowPanDeceleration
property -
zoomMode
property
Selection
-
selectionMode
property -
dataPointSelectionMode
property -
seriesSelectionMode
property -
selectedSeries
property -
selectedPoints
property -
– select:
-
– deselect:
Configuring TKChart Animations
-
allowAnimations
property -
animationDuration
property -
– animate
Managing the Delegate and the Data Source
-
delegate
property -
dataSource
property
Configuring Axes
-
xAxis
property -
yAxis
property -
axes
property -
– addAxis:
-
– removeAxis:
Configuring Series
-
series
property -
– addSeries:
-
– dequeueReusableSeriesWithIdentifier:
-
– removeSeries:
-
trackball
property -
allowTrackball
property
Configuring Annotations
-
annotations
property -
– addAnnotation:
-
– removeAnnotation:
-
– removeAllAnnotations
-
– updateAnnotations
Data manipulation
Properties
allowAnimations
Determines whether TKChart allows animations.
@property (nonatomic) BOOL allowAnimations
Declared In
TKChart.h
allowPanDeceleration
Determines whether an inertia should be added when panning the chart.
@property (nonatomic) BOOL allowPanDeceleration
Declared In
TKChart.h
allowTrackball
Determines whether TKChart allows the trackball behavior.
@property (nonatomic, assign) BOOL allowTrackball
Declared In
TKChart.h
animationDuration
Determines the animation duration. This value is used by default animations in TKChart.
@property (nonatomic) CFTimeInterval animationDuration
Declared In
TKChart.h
annotations
Returns the chart annotations
@property (nonatomic, strong, readonly, nonnull) NSArray *annotations
Declared In
TKChart.h
axes
An array that contains the axes of the chart.
@property (nonatomic, strong, readonly, nonnull) NSArray *axes
Return Value
All axes of the chart.
Declared In
TKChart.h
dataPointSelectionMode
Returns a value that determines the data point selection mode.
@property (nonatomic, assign) TKChartSelectionMode dataPointSelectionMode
Declared In
TKChart.h
dataSource
Sets data-source delegate.
@property (nonatomic, assign, nullable) id<TKChartDataSource> dataSource
Return Value
The data-source delegate.
Declared In
TKChart.h
delegate
A delegate for styling the chart and receiving notifications.
@property (nonatomic, weak, nullable) id<TKChartDelegate> delegate
Declared In
TKChart.h
gridStyle
Returns TKChart style.
@property (nonatomic, strong, readonly, nonnull) TKChartGridStyle *gridStyle
Declared In
TKChart.h
handleDoubleTap
Determines whether a Double-tap gesture will be handled by the chart to reset the current Zoom and Pan values.
@property (nonatomic, assign) BOOL handleDoubleTap
Declared In
TKChart.h
insets
TKChart content insets relative to its view size.
@property (nonatomic, assign) UIEdgeInsets insets
Declared In
TKChart.h
legend
Returns TKChart legend view.
@property (nonatomic, strong, readonly, nonnull) TKChartLegendView *legend
Declared In
TKChart.h
plotView
Returns TKChart plot view.
@property (nonatomic, strong, readonly, nonnull) TKChartPlotView *plotView
Declared In
TKChart.h
plotViewInsets
The chart’s plot view insets relative to size.
@property (nonatomic) UIEdgeInsets plotViewInsets
Declared In
TKChart.h
selectedPoints
Returns an array containing instances of TKChartSelectionInfo containing the selected points in the chart;
@property (nonatomic, strong, readonly, nonnull) NSArray<__kindofTKChartSelectionInfo*> *selectedPoints
Declared In
TKChart.h
selectedSeries
Returns the selected series.
@property (nonatomic, strong, readonly, nonnull) NSArray<__kindofTKChartSeries*> *selectedSeries
Declared In
TKChart.h
selectionMode
Returns a value indicating whether the user can select single or multiple series/data points.
@property (nonatomic, assign) TKChartSelectionMode selectionMode
Declared In
TKChart.h
series
A read-only array of the TKChartSeries objecs displayed on the chart.
@property (nonatomic, strong, readonly, nonnull) NSArray<__kindofTKChartSeries*> *series
Declared In
TKChart.h
seriesSelectionMode
Returns a value that determines the series selection mode.
@property (nonatomic, assign) TKChartSelectionMode seriesSelectionMode
Declared In
TKChart.h
theme
TKChart theme. The theme is used to style the chart when no palletes and custom styles are applied. The defaulf value is
@property (nonatomic, strong, nonnull) TKTheme *theme
Return Value
TKChart theme. The theme is used to style the chart when no palletes and custom styles are applied. The defaulf value is
Declared In
TKChart.h
title
Returns TKChart title view.
@property (nonatomic, strong, readonly, nonnull) TKChartTitleView *title
Declared In
TKChart.h
trackball
Returns the chart’s crosshair
@property (nonatomic, strong, readonly, nonnull) TKChartTrackball *trackball
Declared In
TKChart.h
xAxis
TKChart main x-axis.
@property (nonatomic, strong, nullable) TKChartAxis *xAxis
Declared In
TKChart.h
Instance Methods
addAnnotation:
Adds annotation to the chart
- (void)addAnnotation:(TKChartAnnotation *__nonnull)annotation
Parameters
- annotation
The annotation that will be added.
Declared In
TKChart.h
addAxis:
Adds an axis to the chart.
- (void)addAxis:(TKChartAxis *__nonnull)axis
Parameters
- axis
The axis that should be added to the chart.
Declared In
TKChart.h
addSeries:
Adds a series to the chart.
- (void)addSeries:(TKChartSeries *__nonnull)series
Parameters
- series
The series that should be added to the chart.
Declared In
TKChart.h
animate
Causes the chart to animate its content. The allowAnimations property should be set to true before calling this method. You can customise TKChart animations by handling the chart:animationForSeries:withState:inRect: method of TKChartDelegate.
- (void)animate
Declared In
TKChart.h
beginUpdates
Begins a series of method calls that insert, delete, or select dataPoints and series of the receiver.
- (void)beginUpdates
Declared In
TKChart.h
dequeueReusableSeriesWithIdentifier:
Returns a reusable chart-view series object located by its identifier.
- (id __nullable)dequeueReusableSeriesWithIdentifier:(NSString *__nonnull)identifier
Parameters
- identifier
The string identifying the cell object to be reused. This parameter must not be nil.
Declared In
TKChart.h
deselect:
Deselect a series or data point depending on the series selectionMode property.
- (void)deselect:(TKChartSelectionInfo *__nonnull)info
Parameters
- info
The selection information object.
Declared In
TKChart.h
endUpdates
Concludes a series of method calls that insert, delete, select, or reload dataPoints and series of the receiver.
- (void)endUpdates
Declared In
TKChart.h
hitTestForPoint:
Returns the data point located at specified coordinates.
- (TKChartSelectionInfo *__nullable)hitTestForPoint:(CGPoint)point
Parameters
- point
The point to be used for hit testing.
Declared In
TKChart.h
paletteItemForPoint:inSeries:
Returns a palette item that should be used to present specific point
- (TKChartPaletteItem *__nullable)paletteItemForPoint:(NSUInteger)index inSeries:(TKChartSeries *__nonnull)series
Declared In
TKChart.h
paletteItemForSeries:atIndex:
Returns a palette item that should be used to present specific series.
- (TKChartPaletteItem *__nullable)paletteItemForSeries:(TKChartSeries *__nonnull)series atIndex:(NSUInteger)index
Declared In
TKChart.h
reloadData
Reloads the data-source and rebuilds the UI. Call this method to reload all the data that is used to construct the chart.
- (void)reloadData
Declared In
TKChart.h
removeAllAnnotations
Removes all annotations from the chart
- (void)removeAllAnnotations
Declared In
TKChart.h
removeAnnotation:
Removes annotation from the chart
- (void)removeAnnotation:(TKChartAnnotation *__nonnull)annotation
Parameters
- annotation
The annotation that will be removed.
Declared In
TKChart.h
removeAxis:
Removes an axis from the chart.
- (BOOL)removeAxis:(TKChartAxis *__nonnull)axis
Parameters
- axis
The axis that should be removed from the chart.
Declared In
TKChart.h
removeSeries:
Removes the specified series from the chart.
- (void)removeSeries:(TKChartSeries *__nonnull)series
Parameters
- series
The series that should be removed from the chart.
Declared In
TKChart.h
select:
Selects a series or data point depending on the series selectionMode property.
- (void)select:(TKChartSelectionInfo *__nullable)info
Parameters
- info
The selection information object.
Declared In
TKChart.h
visualPointForSeries:dataPointIndex:
Returns a visual point element at a specific point index and series. Visual points can be modified only when animations are allowed. The animate method should be called to reflect all changes made in visual points.
- (TKChartVisualPoint *__nullable)visualPointForSeries:(TKChartSeries *__nonnull)series dataPointIndex:(NSInteger)dataPointIndex
Parameters
- series
The series that contains the requested point.
- dataPointIndex
The point index of the requested point.
Declared In
TKChart.h
visualPointsForSeries:
Returns an array containing the visual point elements for a given series. Visual points can be modified only when animations are allowed. The animate method should be called to reflect all changes made in visual points.
- (NSArray<__kindofTKChartVisualPoint*> *__nullable)visualPointsForSeries:(TKChartSeries *__nonnull)series
Parameters
- series
The series that contains the requested points.
Declared In
TKChart.h