iOS 数组~画饼图-添加数据优化
来源:互联网 发布:gta5低特效优化补丁 编辑:程序博客网 时间:2024/06/05 15:28
//联系人:石虎 QQ:1224614774 昵称:嗡嘛呢叭咪哄
一、概念
- (void)viewDidLoad {
[superviewDidLoad];
//初始化
SHPieChart *chart = [[SHPieChart alloc]initWithFrame:CGRectMake(0,40, SHSCREEN_WIDTH, SHSCREEN_HEIGHT /3.0f )];
chart.backgroundColor = [UIColor orangeColor];
[self.view addSubview:chart];
}
二、最基本的写法-也是最笨的方法
// 常见方法
- (void)commonMethods{
//创建数据模块
SHChartPointItem *item1 = [SHChartPointItem chartPoinItemWithRawX:@"敲代码" andRowY:@"0.33"];
SHChartPointItem *item2 = [SHChartPointItem chartPoinItemWithRawX:@"调程序" andRowY:@"0.34"];
SHChartPointItem *item3 = [SHChartPointItem chartPoinItemWithRawX:@"吃饭费" andRowY:@"0.23"];
SHChartPointItem *item4 = [SHChartPointItem chartPoinItemWithRawX:@"其他" andRowY:@"0.1"];
pieChartData.items = @[item1,item2,item3,item4].mutableCopy;
pieChartData.fillColors = @[[UIColor redColor],[UIColor blueColor],[UIColor cyanColor],[UIColor yellowColor]].mutableCopy;
chart.pieChartData = pieChartData;
[chart strokeChart];
}
三、推荐方法
//推荐方法
- (void)recommendedApproach{
NSArray *titleArray =@[@"0.33",@"0.34", @"0.23",@"0.1",@"0.33",@"0.34", @"0.23",@"0.1"];
NSMutableArray *itemArrayM = [NSMutableArrayarray];
SHPieChartData *pieChartData = [[SHPieChartData alloc]init];
for (int i =0; i < titleArray.count; i++) {
SHChartPointItem *item = [SHChartPointItem chartPoinItemWithRawX:@"" andRowY:titleArray[i]];
[itemArrayM addObject:item];
}
pieChartData.items = itemArrayM.mutableCopy;
chart.pieChartData = pieChartData;
[chart strokeChart];
}
谢谢!!!
- iOS 数组~画饼图-添加数据优化
- iOS之画饼图
- iOS 画饼状图
- iOS 画饼图
- 三 iOS之 画饼图
- 根据数据库数据画饼图
- IOS数组无法添加数据
- IOS数组无法添加数据
- 画饼图
- 画饼图
- 画饼图
- 画饼图
- 【python 可视化】数据透视表的用法及画饼图
- IOS开发-画饼图画柱状图
- asp.net画饼图
- Pie画饼图
- Flot画饼图
- asp.net画饼图
- OC 递归
- MFC鼠标事件-OnMouseMove移动OnMouseWheel缩放
- LeetCode(2) -- Remove Linked List Elements
- linux添加新磁盘和创建分区
- java--面向对象之封装(有参构造和无参构造)
- iOS 数组~画饼图-添加数据优化
- 多态
- Spring(一)---Spring概述
- java 枚举
- 《Windows核心编程》读书笔记二十章 DLL高级技术
- java中的pass方法
- BBB学习(三):SD卡安装系统镜像(1):安装流程
- 如何设计出用户喜爱的API
- Spring源码分析2 — XML配置文件的解析流程