目录
1.PYSearchViewController(一个封装好的搜索页面)
1.PYSearchViewController(一个封装好的搜索页面)
集成
pod 'PYSearch'
#import <PYSerach/PYSearch.h>
创建
创建方式1
PYSearchViewController *searchC=[PYSearchViewController searchViewControllerWithHotSearches:@[@"hot1",@"hot2"] searchBarPlaceholder:@"请输入商品名" didSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText) {
// 点击商品后 调用
//
VC
searchViewController.searchResultController= VC;
searchViewController.searchResultShowMode = PYSearchResultShowModePush;
}];
创建方式2
[PYSearchViewController searchViewControllerWithHotSearches:nil searchBarPlaceholder:nil];
// 默认(false):先 热门搜索 后 历史搜索
[searchC setSwapHotSeachWithSearchHistory:true];
// 历史搜索
// 不显示(默认:true,显示)
[searchC setShowSearchHistory:false];
// 标题
[searchC setSearchHistoryTitle:@"搜索历史 标题"];
// 缓存路径(有默认路径)
[searchC setSearchHistoriesCachePath:@"缓存路径"];
// 最大个数(默认:20)
[searchC setSearchHistoriesCount:15];
// style(默认:占据1行)
[searchC setSearchHistoryStyle:PYSearchHistoryStyleDefault];
/*
PYSearchHistoryStyleDefault = PYSearchHistoryStyleCell 默认
PYSearchHistoryStyleCell, 默认
PYSearchHistoryStyleNormalTag 自适应+灰色
PYSearchHistoryStyleColorfulTag 自适应+颜色
PYSearchHistoryStyleBorderTag 自适应+边框
PYSearchHistoryStyleARCBorderTag 自适应+圆边框
*/
// 当style为默认时,且没数据时
UIButton *emptyButton=searchC.emptyButton;
UILabel *emptyL=searchC.emptySearchHistoryLabel;
//
// 热门搜索
// 不显示(默认:true,显示)
[searchC setShowHotSearch:false];
// 标题
[searchC setHotSearchTitle:@"热门搜索 标题"];
// 内容
[searchC setHotSearches:@[@"222",@"111"]];
// style
[searchC setHotSearchStyle:PYHotSearchStyleDefault];
/*
PYHotSearchStyleColorfulTag, // colorful tag without border, color of background is randrom and can be custom by `colorPol`
PYHotSearchStyleBorderTag, // border tag, color of background is `clearColor`
PYHotSearchStyleARCBorderTag, // broder tag with ARC, color of background is `clearColor`
PYHotSearchStyleRankTag, // rank tag, color of background can be custom by `rankTagBackgroundColorHexStrings`
PYHotSearchStyleRectangleTag, // rectangle tag, color of background is `clearColor`
PYHotSearchStyleDefault = PYHotSearchStyleNormalTag // 默认
PYHotSearchStyleNormalTag, // 默认:自适应+灰
*/
// 搜索
// 删除搜素关键字中的空格(默认:true)
[searchC setRemoveSpaceOnSearchString:true];
// searchBar
UISearchBar *searchBar=[searchC searchBar];
// searchBar backgroundColor
[searchC setSearchBarBackgroundColor:[UIColor blueColor]];
// 设置placeholder颜色
[searchVC.searchBar setValue:[UIColor whiteColor] forKeyPath:@"_searchField.placeholderLabel.textColor"];
// 设置输入框字体颜色
[searchVC.searchBar setValue:[UIColor whiteColor] forKeyPath:@"_searchField.textColor"];
// 设置光标颜色
searchVC.searchBar.tintColor = [UIColor whiteColor];
// tf
UITextField *textField = [searchVC.searchBar valueForKey:@"_searchField"];
textField.textAlignment = 0;
// 修改放大镜颜色
UIImageView *leftView = (UIImageView *)textField.leftView;
leftView.image = [leftView.image imageWithGradientTintColor:[UIColor whiteColor]];
// 修改删除按钮颜色
UIButton *rightBtn = [textField valueForKey:@"_clearButton"];
UIImage *image = rightBtn.imageView.image;
[rightBtn setImage:[image imageWithGradientTintColor:[UIColor whiteColor]] forState:UIControlStateNormal];
// cancelButton
UIBarButtonItem *cancelButtonItem=[searchC cancelButton];
// 建议TableView
UITableView *tableView=[searchC searchSuggestionView];
// 建议数组
[searchC setSearchSuggestions:@[]];
// 隐藏
[searchC setSearchSuggestionHidden:false];
// 搜索内容改变后是否显示(默认:false)
[searchC setShowSearchResultWhenSearchTextChanged:true];
// 当搜索框再次成为第一响应者时是否显示(默认)
[searchC setShowSearchResultWhenSearchBarRefocused:false];
// 搜索后调用
[searchC setDidSearchBlock:^(PYSearchViewController *searchViewController, UISearchBar *searchBar, NSString *searchText){
//
}];
dele
[searchC setDelegate:self];
[searchC setDataSource:self];
#pragma mark dele PYSearchViewControllerDelegate
// 输入框文本发生变化 时调用
-(void)searchViewController:(PYSearchViewController *)searchViewController searchTextDidChange:(UISearchBar *)searchBar searchText:(NSString *)searchText{
//
}
// 点击搜索按钮时调用
-(void)searchViewController:(PYSearchViewController *)searchViewController didSearchWithSearchBar:(UISearchBar *)searchBar searchText:(NSString *)searchText{
}
// 点击热门搜索的某项时调用
-(void)searchViewController:(PYSearchViewController *)searchViewController didSelectHotSearchAtIndex:(NSInteger)index searchText:(NSString *)searchText{
}
// 点击历史搜索的某项时调用
-(void)searchViewController:(PYSearchViewController *)searchViewController didSelectSearchHistoryAtIndex:(NSInteger)index searchText:(NSString *)searchText{
}
// 点击搜索建议某项时调用
-(void)searchViewController:(PYSearchViewController *)searchViewController didSelectSearchSuggestionAtIndexPath:(NSIndexPath *)indexPath searchBar:(UISearchBar *)searchBar{
}
// 点击取消按钮
- (void)didClickCancel:(PYSearchViewController *)searchViewController{
//
[[searchViewController navigationController] popViewControllerAnimated:YES];
}
#pragma mark dataSource PYSearchViewControllerDataSource
// 建议 CELL
-(UITableViewCell *)searchSuggestionView:(UITableView *)searchSuggestionView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
}
// 建议 组数
-(NSInteger)numberOfSectionsInSearchSuggestionView:(UITableView *)searchSuggestionView{
}
// 建议 每组行数
-(NSInteger)searchSuggestionView:(UITableView *)searchSuggestionView numberOfRowsInSection:(NSInteger)section{
}
// 建议 行高
-(CGFloat)searchSuggestionView:(UITableView *)searchSuggestionView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
}
2.PNChart(第三方统计图)
集成
pod 'PNChart'
#import <PNChart/PNChart.h>
PNGenericChart 基类
// 是否动画
[pieChart setDisplayAnimated:false];
// 下方itemView(用来标示各个)
UIView *legend = [pieChart getLegendWithMaxWidth:200];
[legend setFrame:CGRectMake(130, 350, legend.frame.size.width, legend.frame.size.height)];
[self.view addSubview:legend];
[pieChart setHasLegend:false];
[pieChart setLegendFont:[UIFont systemFontOfSize:12]];
[pieChart setLegendStyle:PNLegendItemStyleStacked];
[pieChart setLegendPosition:PNLegendPositionTop];
[pieChart setLegendFontColor:[UIColor blueColor]];
- 饼状图 PNPieChart :PNGenericChart
// 创建饼状图(frame,itemArr),每一项上标有 10% 文本详情
PNPieChart *pieChart=[[PNPieChart alloc]initWithFrame:CGRectMake((CGFloat) (SCREEN_WIDTH / 2.0 - 100), 135, 200.0, 200.0) items:items];
// 填充颜色
[pieChart strokeChart];
[pieChart setDelegate:self]; // <PNChartDelegate>
[self.view addSubview:pieChart];
// 项数组(%值,颜色,文本详情)
NSArray *items = @[[PNPieChartDataItem dataItemWithValue:10 color:PNLightGreen],
[PNPieChartDataItem dataItemWithValue:20 color:PNFreshGreen description:@"WWDC"],
[PNPieChartDataItem dataItemWithValue:40 color:PNDeepGreen description:@"GOOG I/O"],
];
// 设置饼状图上文字详情的font/textColor/shadowColor/shadowOffset
[pieChart setDescriptionTextFont:[UIFont systemFontOfSize:12]];
[pieChart setDescriptionTextColor:[UIColor whiteColor]];
[pieChart setDescriptionTextShadowColor:[UIColor blackColor]];
[pieChart setDescriptionTextShadowOffset:CGSizeMake(10, 10)];
// 动画时间
[pieChart setDuration:2.0];
// 是否只显示10%,不显示文本
[pieChart setShowOnlyValues:true];
// 是否只显示10不显示%
[pieChart setShowAbsoluteValues:true];
// 小于某值时不显示值
[pieChart setLabelPercentageCutoff:0.2];
// 是否隐藏值
[pieChart setHideValues:true];
// 点击某项时是否高亮(默认:true)
[pieChart setShouldHighlightSectorOnTouch:false];
// 是否允许多选
[pieChart setEnableMultipleSelection:true];
// 子类覆写recompute方法自定义内圆/外圆 corner
[pieChart setOuterCircleRadius:0.0];
[pieChart setInnerCircleRadius:0.0];
- 进度图 PNCircleChart : UIView
创建方式
PNCircleChart *circleChart=[[PNCircleChart alloc]initWithFrame:CGRectZero];
// frame,总数,当前数,?
PNCircleChart *circleChart=[[PNCircleChart alloc]initWithFrame:CGRectZero total:@100 current:@60 clockwise:true];
// frame,总数,当前数,?,是否阴影,阴影颜色
PNCircleChart *circleChart=[[PNCircleChart alloc]initWithFrame:CGRectZero total:@100 current:@60 clockwise:true shadow:true shadowColor:[UIColor blueColor]];
// frame,总数,当前数,?,是否阴影,阴影颜色,是否展示数字%
PNCircleChart *circleChart=[[PNCircleChart alloc]initWithFrame:CGRectZero total:@100 current:@60 clockwise:true shadow:true shadowColor:[UIColor blueColor] displayCountingLabel:true];
// frame,总数,当前数,?,是否阴影,阴影颜色,是否展示数字%,?
PNCircleChart *circleChart=[[PNCircleChart alloc]initWithFrame:CGRectZero total:@100 current:@60 clockwise:true shadow:true shadowColor:[UIColor blueColor] displayCountingLabel:true overrideLineWidth:@5];
[self.circleChart strokeChart];
[self.view addSubview:self.circleChart];
// type
[circleChart setChartType:PNChartFormatTypeDollar];
// totle
[circleChart setTotal:@100];
// current
[circleChart setCurrent:@50];
// 动画时间
[circleChart setDuration:0.35];
// 是否显示动画
[circleChart setDisplayAnimated:true];
// 是否显示数字%
[circleChart setDisplayCountingLabel:true];
// lineWidth
[circleChart setLineWidth:@2];
// bgColor
[circleChart setBackgroundColor:[UIColor whiteColor]];
// strokeColor
[circleChart setStrokeColor:[UIColor clearColor]];
[circleChart setStrokeColorGradientStart:[UIColor blueColor]];
显示数字%的label
UICountingLabel *countL=circleChart.countingLabel;
[countL setCurrentValue:50];
count.currentValue
// format
[countL setFormat:@"%d%%"];
[countL setFormatBlock:^(CGFloat value){
return [NSString stringWithFormat:@"%d%%",(int)value];
}];
[countL setAttributedFormatBlock:^(CGFloat value){
return [[NSAttributedString alloc]initWithString:[NSString stringWithFormat:@"%d%%",(int)value]];
}];
// 动画的速度
[countL setMethod:UILabelCountingMethodEaseInOut];
// 动画的时间
[countL setAnimationDuration:0.35];
// 动画完后调用
[countL setCompletionBlock:^{
}];
// 更新值
[countL countFrom:0 to:50];
[countL countFromZeroTo:50];
[countL countFromCurrentValueTo:50];
[countL countFrom:0 to:50 withDuration:0.35];
[countL countFromZeroTo:50 withDuration:0.35];
[countL countFromCurrentValueTo:50 withDuration:0.35];
更新值
[circleChart updateChartByCurrent:@50];
[circleChart updateChartByCurrent:@50 byTotal:@100];
// ?
[circleChart growChartByAmount:@1];
// ?
[circleChart setCircle:[CAShapeLayer new]];
[circleChart setCircleBackground:[CAShapeLayer new]];
[circleChart setGradientMask:[CAShapeLayer new]];
- 点点点图PNScatterChart: PNGenericChart
// 创建
PNScatterChart *scatChart=[[PNScatterChart alloc]initWithFrame:CGRectZero];
[scatChart setDelegate:self]; // <PNChartDelegate>
[scatChart setup];
[self.view addSubview:scatterChart];
// 动画时间
[scatChart setDuration:0.25];
// 是否显示label(默认:true)
[scatChart setShowLabel:true];
[scatChart setShowCoordinateAxis:true];
[scatChart setAxisColor:[UIColor whiteColor]];
[scatChart setAxisWidth:2];
//
[scatChart setAxisX_maxValue:10];
[scatChart setAxisX_minValue:1];
[scatChart setAxisY_maxValue:10];
[scatChart setAxisY_minValue:1];
[scatChart setAxisXWithMinimumValue:0 andMaxValue:100 toTicks:6];
[scatChart setAxisYWithMinimumValue:0 andMaxValue:100 toTicks:6];
[scatChart setAxisXLabel:@[@"x1",@"x2",@"x3",@"x4"]];
[scatChart setAxisYLabel:@[@"y1",@"y2",@"y3",@"y4"]];
// xy label格式
[scatChart setXLabelFormat:@"xxx %d"];
[scatChart setYLabelFormat:@"yyy %d"];
// 描述文本Font(默认:18)
[scatChart setDescriptionTextFont:[UIFont systemFontOfSize:18]];
// 描述文本Color(默认:white)
[scatChart setDescriptionTextColor:[UIColor whiteColor]];
// 描述文本shadowColor(默认:0.4)
[scatChart setDescriptionTextShadowColor:[UIColor colorWithWhite:0.4 alpha:1]];
// 描述文本shdowOffset(默认:0,1)
[scatChart setDescriptionTextShadowOffset:CGSizeMake(0, 1)];
[scatChart drawLineFromPoint:CGPointZero ToPoint:CGPointZero WithLineWith:2.0 AndWithColor:[UIColor blueColor]];
data
NSArray *data01Array = [self randomSetOfObjects];
PNScatterChartData *data01 = [PNScatterChartData new];
data01.strokeColor = PNGreen; // 点边框色
data01.fillColor = PNFreshGreen; // 点填充色
data01.size = 2; // 点大小
data01.itemCount = [data01Array[0] count]; // 点count
data01.inflexionPointStyle = PNScatterChartPointStyleCircle; // 点style(圆形/方形)
__block NSMutableArray *XAr1 = [NSMutableArray arrayWithArray:data01Array[0]];
__block NSMutableArray *YAr1 = [NSMutableArray arrayWithArray:data01Array[1]];
data01.getData = ^(NSUInteger index) {
CGFloat xValue;
xValue = [XAr1[index] floatValue];
CGFloat yValue = [YAr1[index] floatValue];
return [PNScatterChartDataItem dataItemWithX:xValue AndWithY:yValue];
};
- (NSArray *)randomSetOfObjects {
NSMutableArray *array = [NSMutableArray array];
NSString *LabelFormat = @"%1.f";
NSMutableArray *XAr = [NSMutableArray array];
NSMutableArray *YAr = [NSMutableArray array];
for (int i = 0; i < 25; i++) {
[XAr addObject:[NSString stringWithFormat:LabelFormat, (((double) arc4random() / ARC4RANDOM_MAX) * (self.scatterChart.AxisX_maxValue - self.scatterChart.AxisX_minValue) + self.scatterChart.AxisX_minValue)]];
[YAr addObject:[NSString stringWithFormat:LabelFormat, (((double) arc4random() / ARC4RANDOM_MAX) * (self.scatterChart.AxisY_maxValue - self.scatterChart.AxisY_minValue) + self.scatterChart.AxisY_minValue)]];
}
[array addObject:XAr];
[array addObject:YAr];
return array;
}
// data
[scatChart setChartData:@[data01]];
[scatChart updateChartData:@[data01]];
- 雷达图 PNRadarChart:PNGenericChart
创建
PNRadarChart *radarChart=[[PNRadarChart alloc]initWithFrame:CGRectZero];
PNRadarChart *radarChart=[[PNRadarChart alloc]initWithFrame:CGRectZero items:items valueDivider:1];
//
[radarChart strokeChart];
[self.view addSubview:radarChart];
// 数据
NSArray *items = @[[PNRadarChartDataItem dataItemWithValue:3 description:@"Art"],
[PNRadarChartDataItem dataItemWithValue:2 description:@"Math"],
[PNRadarChartDataItem dataItemWithValue:8 description:@"Sports"],
[PNRadarChartDataItem dataItemWithValue:5 description:@"Literature"],
[PNRadarChartDataItem dataItemWithValue:4 description:@"Other"],
];
[radarChart setChartData:items];
// ? 默认:1
[radarChart setValueDivider:1.0];
// maxValue
[radarChart setMaxValue:5];
// 网Color (默认:灰色)
[radarChart setWebColor:[UIColor grayColor]];
// 字体Color(默认:黑色)
[radarChart setFontColor:[UIColor blueColor]];
// 字体 style
[radarChart setLabelStyle:PNRadarChartLabelStyleCircle];
// 字体Size
[radarChart setFontSize:18];
// 实体Color(默认:绿色)
[radarChart setPlotColor:[UIColor redColor]];
// graduationColor(默认:橘黄色) ?
[radarChart setGraduationColor:[UIColor orangeColor]];
// ?
[radarChart setIsLabelTouchable:true];
[radarChart setIsShowGraduation:true];
- 柱状图 PNBarChart :PNGenericChart
// 创建柱状图
PNBarChart *barChart = [[PNBarChart alloc] initWithFrame:CGRectMake(0, 135.0, SCREEN_WIDTH, 200.0)];
// 统计图内边距
[barChart setChartMarginTop:10];
[barChart setChartMarginBottom:10];
[barChart setChartMarginLeft:10];
[barChart setChartMarginRight:10];
[barChart updateChartData:@[]];
[barChart setDelegate:self]; // <PNChartDelegate>
[barChart strokeChart];
[self.view addSubview:barChart];
柱子
// 设置柱子颜色
[barChart setStrokeColor:[UIColor blueColor]];
[barChart setStrokeColors:@[[UIColor redColor],[UIColor blueColor]]];
// 柱宽
[barChart setBarWidth:30];
// 柱子圆角
[barChart setBarRadius:10.0];
// 柱子底部颜色(默认:灰)
[barChart setBarBackgroundColor:[UIColor blueColor]];
// 是否显示柱子上的数字(默认:true)
[barChart setIsShowNumbers:true];
// 柱子是否炫光显示
[barChart setIsGradientShow:true];
坐标轴
// 是否显示坐标轴
[barChart setShowChartBorder:false];
// 坐标轴Color
[barChart setChartBorderColor:[UIColor blueColor]];
坐标轴文本
// y坐标轴文本距上
[barChart setLabelMarginTop:100];
// 是否显示xy坐标轴文本(默认:true)
[barChart setShowLabel:false];
// x坐标轴文本宽,y坐标轴文本宽
[barChart setXLabelWidth:50];
[barChart setYChartLabelWidth:50];
// xy坐标轴文本Color
[barChart setLabelTextColor:[UIColor blueColor]];
// xy坐标轴文本Font
[barChart setLabelFont:[UIFont systemFontOfSize:12]];
// y坐标轴文本Format
[barChart setYLabelFormatter:^(CGFloat value){
return [NSString stringWithFormat:@"$%d",(int)value];
}];
// y坐标轴文本 前缀/后缀
[barChart setYLabelPrefix:@"前缀"];
[barChart setYLabelSuffix:@"后缀"];
// xy坐标轴文本
[barChart setXLabels:@[@"2", @"3", @"4", @"5", @"2", @"3", @"4", @"5"]];
[barChart setYLabels:@[@"22",@"33",@"44"]];
// y值
[barChart setYValues:@[@10.82, @1.88, @6.96, @33.93, @10.82, @1.88, @6.96, @33.93]];
//
[barChart setBars:[NSMutableArray new]];
// ?
[barChart setShowLevelLine:false];
[barChart setChartBottomLine:[CAShapeLayer new]];
[barChart setChartLevelLine:[CAShapeLayer new]];
[barChart setChartLeftLine:[CAShapeLayer new]];
[barChart setXLabelSkip:2];
[barChart setYMaxValue:100];
[barChart setYMinValue:50];
[barChart setYLabelSum:10];
[barChart setBarColorGradientStart:[UIColor blueColor]];
[barChart setRotateForXAxisText:true];
- 折线图 PNLineChart: PNGenericChart
// 创建
PNLineChart *lineChart=[[PNLineChart alloc]initWithFrame:CGRectZero];
[lineChart strokeChart];
[self.view addSubview:lineChart];
// 是否显示坐标轴
[lineChart setShowCoordinateAxis:true];
// 坐标轴宽
[lineChart setAxisWidth:35];
// 坐标轴颜色
[lineChart setAxisColor:[UIColor blueColor]];
// 距离文本margin
[lineChart setChartMarginTop:10];
[lineChart setChartMarginLeft:10];
[lineChart setChartMarginRight:10];
[lineChart setChartMarginBottom:10];
// dele
[lineChart setDelegate:self]; // <PNChartDelegate>
// x坐标轴 text/width/font/color
[lineChart setXLabels:@[@"x1",@"x2"]];
[lineChart setXLabels:@[@"",@"",@""] withWidth:35];
[lineChart setXLabelWidth:35];
[lineChart setXLabelFont:[UIFont systemFontOfSize:18]];
[lineChart setXLabelColor:[UIColor blueColor]];
[lineChart setXUnit:@""];
[lineChart setXChartLabels:[NSMutableArray new]];
// y坐标轴 num/?/text/font/color/max/min
[lineChart setYLabelNum:10];
[lineChart setYChartLabels:[NSMutableArray new]];
[lineChart setYLabels:@[@"y1",@"y2"]];
[lineChart setYLabelFont:[UIFont systemFontOfSize:18]];
[lineChart setYLabelColor:[UIColor blueColor]];
[lineChart setYValueMax:10];
[lineChart setYValueMin:0];
// y文本格式
[lineChart setYLabelFormat:@"%1.1f"];
[lineChart setYLabelBlockFormatter:^(CGFloat x){
return [NSString stringWithFormat:@"xxx %d",(int)x];
}];
//
[lineChart setYUnit:@""];
[lineChart setYGridLinesColor:[UIColor grayColor]];
// ?
[lineChart setShowSmoothLines:true];
// ?
[lineChart setThousandsSeparator:true];
// pathArr
[lineChart setPathPoints:[NSMutableArray new]];
//
[lineChart setChartCavanWidth:35];
[lineChart setChartCavanHeight:35];
//
[lineChart setShowLabel:true];
[lineChart setShowGenYLabels:true];
[lineChart setShowYGridLines:true];
[lineChart setYGridLinesColor:[UIColor blueColor]];
//
CGSize size=[PNLineChart sizeOfString:@"" withWidth:50 font:[UIFont systemFontOfSize:10]];
CGPoint point=[PNLineChart midPointBetweenPoint1:CGPointZero andPoint2:CGPointZero];
CGPoint point2=[PNLineChart controlPointBetweenPoint1:CGPointZero andPoint2:CGPointZero];
下方itemView(标示每条线的view)
// 下方itemView
UIView *legend = [self.lineChart getLegendWithMaxWidth:320];
[legend setFrame:CGRectMake(30, 340, legend.frame.size.width, legend.frame.size.width)];
[self.view addSubview:legend];
// style
[lineChart setLegendStyle:PNLegendItemStyleStacked];
// font
[lineChart setLegendFont:[UIFont systemFontOfSize:10]];
// color
[lineChart setLegendFontColor:[UIColor redColor]];
data
// Line Chart #1
// data
NSArray *data01Array = @[@15.1, @60.1, @110.4, @10.0, @186.2, @197.2, @276.2];
// 反转
data01Array = [[data01Array reverseObjectEnumerator] allObjects];
PNLineChartData *data01 = [PNLineChartData new];
data01.rangeColors = @[
[[PNLineChartColorRange alloc] initWithRange:NSMakeRange(10, 30) color:[UIColor redColor]],
[[PNLineChartColorRange alloc] initWithRange:NSMakeRange(100, 200) color:[UIColor purpleColor]]
];
data01.dataTitle = @"Alpha"; // 下方显示文本
data01.color = PNFreshGreen; // 下方显示线颜色
data01.pointLabelColor = [UIColor blackColor]; //
data01.alpha = 0.3f; //
data01.showPointLabel = YES; //
data01.pointLabelFont = [UIFont fontWithName:@"Helvetica-Light" size:9.0]; //
data01.itemCount = data01Array.count; // count
data01.inflexionPointColor = PNRed; // 连接点颜色
data01.inflexionPointStyle = PNLineChartPointStyleTriangle; // 连接点style
// 数->PNLineChartDataItem
data01.getData = ^(NSUInteger index) {
CGFloat yValue = [data01Array[index] floatValue];
return [PNLineChartDataItem dataItemWithY:yValue];
};
// data
[lineChart setChartData:@[data01]];
// 更新data
[lineChart updateChartData:@[data0]];
[lineChart.chartData enumerateObjectsUsingBlock:^(PNLineChartData *obj, NSUInteger idx, BOOL *stop) {
obj.pointLabelColor = [UIColor blackColor];
}];