文件名称:ios自定义折线图(带动画效果)
文件大小:3KB
文件格式:ZIP
更新时间:2017-11-02 04:43:44
ios,折线图
用法: //***************用法************* NSMutableArray *dataTitleArray=[[NSMutableArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",@"8",@"9", nil]; NSMutableArray *dataArray=[[NSMutableArray alloc] initWithObjects:@"86",@"2",@"45",@"92",@"65",@"15",@"37",@"51",@"94",nil]; myLineChat *mylinechart=[[myLineChat alloc] initWithFrame:CGRectMake(10,150, 300, 300)]; mylinechart.backgroundColor=[UIColor clearColor]; mylinechart.titleArray=dataTitleArray; mylinechart.valueArray=dataArray; mylinechart.lineChartBgColor=[UIColor whiteColor]; mylinechart.lineTitleWidth=30; mylinechart.lineBetweenWidth=30; mylinechart.lineWidth=2; mylinechart.lineHeight=150; mylinechart.lineColor=[UIColor purpleColor]; [mylinechart initWithView]; [self.view addSubview:mylinechart]; 参数说明: CAShapeLayer *lineChart:折线线条 UIColor *lineChartBgColor:折线图背景颜色 NSMutableArray *valueArray:折线图值数组 NSMutableArray *titleArray:折线图标题数组(x轴标题) float lineWith,lineTitleWidth,lineBetweenWidth,lineHeight:分别为折线图折线的宽度、标题宽度、折线间隔宽度、折线高度。 UIColor *lineColor:折线图折线颜色 参数方法: -(void)initWithView; 必选方法,在设置完所有属性后调用。
【文件预览】:
myLineChat.h
myLineChat.m