欢迎光临
我们一直在努力

LineCharts 折线图

建站超值云服务器,限时71元/月

LineCharts 折线图

项目介绍:

  1.   if (_chartView == nil) {
  2.         _chartView = [[YKLineChartView alloc] initWithFrame:CGRectMake(24, 200, self.view.bounds.size.width – 48, 130)];
  3.     }
  4.     [self.view addSubview:_chartView];
  5.    
  6.      //y轴
  7.     YKUIConfig *config = [YKUIConfig new];
  8.     config.yDescFront = [UIFont fontWithName:@"PingFang-SC-Medium" size:10.0f];
  9.     config.yDescColor = [UIColor colorWithRed:204.0f/255.0f green:204.0f/255.0f blue:204.0f/255.0f alpha:1.0f];
  10.     config.ylineColor =  [UIColor colorWithRed:204.0f/255.0f green:204.0f/255.0f blue:204.0f/255.0f alpha:0.3f];
  11.    
  12.     //x轴
  13.     config.xDescFront = [UIFont fontWithName:@"PingFang-SC-Medium" size:10.0f];
  14.     config.xDescColor = [UIColor colorWithRed:204.0f/255.0f green:204.0f/255.0f blue:204.0f/255.0f alpha:1.0f];
  15.     //线
  16.     config.lineWidth = 2;
  17.     config.lineColor = [UIColor orangeColor];
  18.     config.circleWidth = 3;
  19.    
  20.     YKLineDataObject *dataObject = [YKLineDataObject new];
  21.     dataObject.ySuffix = @"K";
  22.     dataObject.xDescriptionDataSource = @[@"周一",@"周二",@"周三",@"周四",@"周五",@"周六",@"周七"];
  23.     dataObject.showNumbers = @[@(1000.2),@(-100.2),@(2000.23),@(600.62),@(700.82),@(800.2),@(100.72)];
  24.     [_chartView setupDataSource:dataObject withUIConfgi:config];

复制代码
使用简单,主要看实现原理,UI可以自己改代码。github地址:https://github.com/klbest1/MyIOSDemo/tree/master/YKCharts

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » LineCharts 折线图
分享到: 更多 (0)