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", &#