kevinzhow

Add delegate readme

Showing 1 changed file with 39 additions and 1 deletions
... ... @@ -31,7 +31,6 @@ You will need LLVM 3.0 or later in order to build PNChart.
### Copy the PNChart folder to your project
#### Line Chart
[![](https://dl.dropboxusercontent.com/u/1599662/line.png)](https://dl.dropboxusercontent.com/u/1599662/line.png)
... ... @@ -76,6 +75,45 @@ You will need LLVM 3.0 or later in order to build PNChart.
```
#### Callback
```objective-c
#import "PNChart.h"
//For LineChart
PNChart * lineChart = [[PNChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
lineChart.backgroundColor = [UIColor clearColor];
[lineChart setXLabels:@[@"SEP 1",@"SEP 2",@"SEP 3",@"SEP 4",@"SEP 5",@"SEP 6",@"SEP 7"]];
[lineChart setYValues:@[@1,@24,@12,@18,@30,@10,@21]];
[lineChart strokeChart];
lineChart.delegate = self;
[viewController.view addSubview:lineChartLabel];
[viewController.view addSubview:lineChart];
viewController.title = @"Line Chart";
```
```objective-c
#import "PNChart.h"
//For DelegateMethod
-(void)userClickedOnLineKeyPoint:(CGPoint)point andPointIndex:(NSInteger)index{
NSLog(@"Click Key on line %f, %f and index is %d",point.x, point.y,index);
}
-(void)userClickedOnLinePoint:(CGPoint)point {
NSLog(@"Click on line %f, %f",point.x, point.y);
}
```
## License
This code is distributed under the terms and conditions of the [MIT license](LICENSE).
... ...