代码例子效果: 下载地址:http://download.csdn.net/detail/qqmcy/6983187
LineChartViewDemo.h
#import <UIKit/UIKit.h>
@interface LineChartViewDemo : UIView
//横竖轴距离间隔
@property (assign) NSInteger hInterval;
@property (assign) NSInteger vInterval;
//横竖轴显示标签
@property (nonatomic, strong) NSArray *hDesc;
@property (nonatomic, strong) NSArray *vDesc;
//点信息
@property (nonatomic, strong) NSArray *array;
@property (nonatomic, strong) NSArray* array1;
@end
LineChartViewDemo.m
#import "LineChartViewDemo.h"
#import "EColumnChartLabel.h"
#define KlineHeight 30
@interface LineChartViewDemo()
{
CALayer *linesLayer;
UIView *popView;
UILabel *disLabel;
int x;
int y;
}
@end
@implementation LineChartViewDemo
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
self.backgroundColor = [UIColor clearColor];
x = frame.size.width;
y = frame.size.height;
_hInterval = 10;
_vInterval = 50;
linesLayer = [[CALayer alloc] init];
linesLayer.masksToBounds = YES;
linesLayer.contentsGravity = kCAGravityLeft;
linesLayer.backgroundColor = [[UIColor redColor] CGColor];
//[self.layer addSublayer:linesLayer];
//PopView