# UUChart **Repository Path**: perter/UUChart ## Basic Information - **Project Name**: UUChart - **Description**: 一个简单的K线图 - **Primary Language**: Objective-C - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2016-11-23 - **Last Updated**: 2022-08-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README UUChartView Line and Bar charts. You can mark the range of values you want, and show the max or min values in linechart. ![Flipboard playing multiple GIFs](https://github.com/ZhipingYang/UUChartView/raw/master/UUChartViewTests/UUChartView.gif) ## Introduction * UUChart * UULineChart * UUBarChart * UUColor * UUBar ## Usage ### init -(id)initwithUUChartDataFrame:(CGRect)rect withSource:(id)dataSource withStyle:(UUChartStyle)style; #### Select from two styles for UUChartView: UUChartLineStyle UUChartBarStyle ## UUChartDataSource ####required - (NSArray *)UUChart_xLableArray:(UUChart *)chart; //The target array's object's class is equal to NSArray - (NSArray *)UUChart_yValueArray:(UUChart *)chart; ####optional // the colors for lines and bars. - (NSArray *)UUChart_ColorArray:(UUChart *)chart; //CGRange CGRangeMake(CGFloat max, CGFloat min); - (CGRange)UUChartChooseRangeInLineChart:(UUChart *)chart; ####Additional options available for UUChartLineStyle //Mark the range of values with grayColor if you need - (CGRange)UUChartMarkRangeInLineChart:(UUChart *)chart; //You can choose horizonLine which you want to show - (BOOL)UUChart:(UUChart *)chart ShowHorizonLineAtIndex:(NSInteger)index; // Show the label on the max and min values with their colors. - (BOOL)UUChart:(UUChart *)chart ShowMaxMinAtIndex:(NSInteger)index; #### UUChart, based on kevinzhow's [PNChart](https://github.com/kevinzhow/PNChart), was created on 2014-7-24, although UUChart is now very different from PNChart. ### Demo chartView = [[UUChart alloc]initwithUUChartDataFrame:CGRectMake(10, 10, [UIScreen mainScreen].bounds.size.width-20, 150) withSource:self withStyle:indexPath.section==1?UUChartBarStyle:UUChartLineStyle]; [chartView showInView:self.contentView]; //Horizontal Axis Label - (NSArray *)UUChart_xLableArray:(UUChart *)chart { if (path.section==0) { switch (path.row) { case 0: return [self getXTitles:5]; case 1: return [self getXTitles:11]; case 2: return [self getXTitles:7]; case 3: return [self getXTitles:7]; default: break; } }else{ switch (path.row) { case 0: return [self getXTitles:11]; case 1: return [self getXTitles:7]; default: break; } } return [self getXTitles:20]; } - (NSArray *)getXTitles:(int)num { NSMutableArray *xTitles = [NSMutableArray array]; for (int i=0; i