-
Notifications
You must be signed in to change notification settings - Fork 106
/
StackAreaTableViewCell.m
65 lines (56 loc) · 2.23 KB
/
StackAreaTableViewCell.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
//
// StackAreaTableViewCell.m
// RecordLife
//
// Created by 谢俊逸 on 11/05/2017.
// Copyright © 2017 谢俊逸. All rights reserved.
//
#import "StackAreaTableViewCell.h"
#import <XJYChart/XJYChart.h>
@implementation StackAreaTableViewCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style
reuseIdentifier:(NSString*)reuseIdentifier {
if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
NSMutableArray* itemArray = [[NSMutableArray alloc] init];
// NSMutableArray* numbersArray = [NSMutableArray new];
NSMutableArray* numbersArray= [@[
@[@45,@73,@155,@72,@53],
@[@88,@97,@245,@166,@99],
@[@81,@112,@133,@111,@90],
] mutableCopy];
NSArray* colorArray = @[
[UIColor blueberryColor], [UIColor pastelGreenColor], [UIColor dangerColor],
];
for (int i = 0; i < 3; i++) {
XLineChartItem* item =
[[XLineChartItem alloc] initWithDataNumberArray:numbersArray[i]
color:colorArray[i]];
[itemArray addObject:item];
}
XStackAreaLineChartConfiguration* configuration =
[[XStackAreaLineChartConfiguration alloc] init];
configuration.lineMode = CurveLine;
XLineChart* lineChart =
[[XLineChart alloc] initWithFrame:CGRectMake(0, 0, 375, 200)
dataItemArray:itemArray
dataDiscribeArray:[NSMutableArray arrayWithArray:@[
@"January", @"February", @"March", @"April", @"May"
]]
topNumber:@750
bottomNumber:@0
graphMode:StackAreaLineGraph
chartConfiguration:configuration];
[self.contentView addSubview:lineChart];
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
return self;
}
@end