iOS实现折线图、柱状图、圆饼图
来源:互联网 发布:linux 虚机网络不通 编辑:程序博客网 时间:2024/05/16 01:20
最近项目中用到一些图表展示数据,闲下来封装了一下,支持折线图、柱状图、 饼状图、环形图,其中折线图、柱状图支持tap手势缩放、pan手势缩放。代码地址:https://github.com/Rochang/LCChartView。
使用方法:
/* 每种图形样式都支持颜色,文字的自定义设置,修复对应的属性即可 */// 数据 LCChartViewModel *model0 = [LCChartViewModel modelWithColor:RandomColor plots:[self randomArrayWithCount:12] project:@"1组"]; LCChartViewModel *model1 = [LCChartViewModel modelWithColor:RandomColor plots:[self randomArrayWithCount:12] project:@"2组"]; LCChartViewModel *model2 = [LCChartViewModel modelWithColor:RandomColor plots:[self randomArrayWithCount:12] project:@"3组"]; LCChartViewModel *model3 = [LCChartViewModel modelWithColor:RandomColor plots:[self randomArrayWithCount:12] project:@"4组"]; LCChartViewModel *model4 = [LCChartViewModel modelWithColor:RandomColor plots:[self randomArrayWithCount:12] project:@"5组"];// 折线图 LCChartView *chartViewLine = [LCChartView chartViewWithType:LCChartViewTypeLine]; chartViewLine.frame = CGRectMake(0, 64, self.view.LC_width, 250); [self.chartViewLine showChartViewWithYAxisMaxValue:1000 dataSource:@[model0, model1]];// 柱状图 LCChartView *chartViewLine = [LCChartView chartViewWithType:LCChartViewTypeBar]; chartViewLine.frame = CGRectMake(0, 64, self.view.LC_width, 250); [self.chartViewLine showChartViewWithYAxisMaxValue:1000 dataSource:@[model, model1, model2, model3, model4]];// 饼状图 LCPieViewModel *modelP0 = [LCPieViewModel modelWithValue:arc4random_uniform(100) color:[UIColor redColor] text:@"1组"]; LCPieViewModel *modelP1 = [LCPieViewModel modelWithValue:arc4random_uniform(100) color:[UIColor grayColor] text:@"2组"]; LCPieViewModel *modelP2 = [LCPieViewModel modelWithValue:arc4random_uniform(100) color:[UIColor blueColor] text:@"3组"]; LCPieView *pieView = [LCPieView pieView]; pieView.frame = CGRectMake(0, 650, self.view.LC_width, 200); [pieView showPieViewWithDataSource:@[modelP0, modelP1, modelP2]];// 环形图LCArcView *arcView = [[LCArcView alloc] initWithFrame:CGRectMake(0, 900, self.view.LC_width, 150)];[arcView showArcViewWithBgStartAngle:0 endBgAngle:M_PI * 2 bgAnimation:NO StartAngle:0 endAngle:M_PI animaion:YES];
阅读全文
0 0
- iOS实现折线图、柱状图、圆饼图
- Jquery根据table画折线图\柱状图\圆饼图
- iOS 柱状图 折线图
- iOS画柱状图,折线图
- iOS 圆饼图 点击
- jsp+vml 实现柱状图、饼图、折线图
- android实现折线图和柱状图
- 柱状图/ 折线图 总结
- jfreechart柱状图+折线图
- 折线图柱状图封装
- 自定义折线图/柱状图
- <Android开发代码库>achartengine实现柱状图、圆饼图、线图等
- <Android开发代码库>achartengine实现柱状图、圆饼图、线图等
- 分组折线图、柱状图实现(多条折线图、柱状图同时显示)实现方式
- JS Charts生成网页的柱状图,圆饼图以及曲线图
- iOS图形绘制 UIBezierPath 绘制折线图、柱状图、饼形图
- JFreeChart折线图,饼图,柱状图
- jschart 柱状图 饼状图 折线图
- Python中pip升级
- iOS开发证书与配置文件的使用
- MySql存储过程
- 数据库视频之小总
- 学习计划
- iOS实现折线图、柱状图、圆饼图
- 读取通达信本地数据,并保存在mongodb数据库
- java.util.concurrent.Exchanger应用范例与原理浅析
- java向https链接发送post请求
- jmeter 定时器详解
- 实时显示
- git 撤销本地修改
- Maven学习总结----Maven入门
- 33、Selenium + Python 实现 UI 自动化测试-正片5