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.
-
selected (property) sets if the view is selected. BOOL YES or NO.
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];
[sparkline release];
Be sure to include CKSparkline.m and CKSparkline.h into your application project.