cahrt框架 ios_iOS - Charts(一) - BarChartView

platform:ios,'10.0'

inhibit_all_warnings!

use_frameworks!

target ‘iOS_Charts’ do

pod 'Charts'

#pod 'ChartsRealm'

end

纯OC工程,pod install 报错,尝试新建一个swift类,生成桥接文件,继续执行 pod install即可,报错内容如下:

ChartsRealm does not specify a Swift version and none of the targets (iOS_Charts) integrating it have the SWIFT_VERSION attribute set. Please contact the author or set the SWIFT_VERSION attribute in at least one of the targets that integrate this pod.

RealmSwift does not specify a Swift version and none of the targets (iOS_Charts) integrating it have the SWIFT_VERSION attribute set. Please contact the author or set the SWIFT_VERSION attribute in at least one of the targets that integrate this pod.

Charts系列

本系列文章Charts版本号3.4.0,最新代码移步 demo

BarChartView部分属性代码

#import "GWLBarChartViewController.h"

typedef NS_ENUM(NSInteger, BarChartViewType) {

BarChartViewTypeSingle = 1 << 0,//单柱

BarChartViewTypeGroup = 1 << 1,//分组

BarChartViewTypeStacked = 1 << 2,//堆叠式

};

@interface GWLBarChartViewController ()

/// 默认垂直显示,水平柱状图使用 HorizontalBarChartView

@property (strong, nonatomic) BarChartView *barChartView;

@property (assign, nonatomic) BarChartViewType barChartViewType;

/// 圆柱 数据

@property (strong, nonatomic) NSArray *datas;

/// 圆柱 x轴标题

@property (strong, nonatomic) NSArray *titles;

/// 堆叠式圆柱 单个圆柱各层颜色数组

@property (strong, nonatomic) NSArray *stackColors;

/// 堆叠式圆柱 图例文字数组

@property (strong, nonatomic) NSArray *stackLabels;

///maskView

@property (strong, nonatomic) UIView *maskView;

@end

@implementation GWLBarChartViewController

- (void)viewDidLoad {

[super viewDidLoad];

self.title = @"BarChartView";

self.view.backgroundColor = [UIColor whiteColor];

[self loadData];

// [self loadStackedData];

// [self loadGroupData];

[self setupBarChartView];

}

// 单层数据

- (void)loadData {

self.barChartViewType = BarChartViewTypeSingle;

self.titles = @[@"12",@"2",@"3",@"4",@"5",@"6.000",@"7",@"8",@"9",@"10",@"11",@"12"];

self.datas = @[@"11",@"42",@"23",@"42",@"15",@"46.000",@"30",@"8",@"39",@"19",@"31",@"12"];

}

// stacked数据

- (void)loadStackedData {

self.barChartViewType = BarChartViewTypeStacked;

self.titles = @[@"4", @"6", @"7",@"433333333333333333333",@"4", @"6", @"7",@"4",@"4", @"6", @"7",@"4"];

self.datas = @[@[@"12", @"32", @"23"], @[@"32",@"12",@"23"], @[@"12", @"23",@"32"],@[@"12", @"32", @"23"],@[@"12", @"32", @"23"], @[@"32",@"12",@"23"], @[@"12", @"23",@"32"],@[@"12", @"32", @"23"],@[@"12", @"32", @"23"], @[@"32",@"12", @"23"], @[@"12", @"23",@"32"],@[@"12", @"32", @"23"]];

self.stackLabels = @[@"2", @"5", @"8"];

self.stackColors = @[[UIColor orangeColor], [UIColor grayColor], [UIColor cyanColor]];

}

//分组数据

- (void)loadGroupData {

self.barChartViewType = BarChartViewTypeGroup;

self.datas = @[@[@"99", @"32", @"23", @"35", @"78", @"13"], @[@"12", @"33", @"58", @"03", @"48", @"29"], @[@"08", @"59", &#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值