CKSparkline is an open source library that provides your application easy access to Sparkline Graphs. Sparklines are well suited to visualizing information in the screen resolution available to the iPhone and iPod Touch.
-
data (property) sets the datasource for the view. Datasource is provided as a NSArray containing NSNumber objects.
-
lineColor (property) sets the color used for line display. Color is supplied as a UIColor object.
-
highlightedColor (property) sets the color to be used for line display when the view is selected. Color is supplied as a UIColor object.
-
lineWidth (property) sets the width used for line display.
-
selected (property) sets if the view is selected. BOOL YES or NO.
-
drawPoints (property) draws an ellipse at each data point, with the final point drawn in red.
-
drawArea (property) fills the area below the line.
Include CKSparkline.m and CKSparkline.h in your application's Xcode project.
CKSparkline *sparkline = [[CKSparkline alloc]
initWithFrame:CGRectMake(0.0, 0.0, 100.0, 30.0)];
// Sample data
sparkline.data = [NSArray arrayWithObjects:
[NSNumber numberWithFloat:2.0],
[NSNumber numberWithFloat:4.5],
[NSNumber numberWithFloat:5.2],
[NSNumber numberWithFloat:7.1],
[NSNumber numberWithFloat:2.3],
[NSNumber numberWithFloat:3.9],
[NSNumber numberWithFloat:1.2],
nil];
[parentView addSubview:sparkline];