Commit 2aa5f1c6 authored by lmj_521aiau@163.com's avatar lmj_521aiau@163.com

no message

parent 2666579b
......@@ -13,6 +13,8 @@
@interface StatisticsViewController ()<AAChartViewEventDelegate>
@property (nonatomic, strong) WKClearPhotoManager *photoMgr;
@property (nonatomic, assign) NSInteger total;
@property (nonatomic, assign) AAChartModel *aaChartModel;
@property (nonatomic, strong) AAChartView *aaChartView;
......@@ -35,10 +37,6 @@
self.view.backgroundColor = [UIColor whiteColor];
self.aaChartView.scrollEnabled = NO;
[self.view addSubview:self.aaChartView];
self.aaChartModel = [self configureTheChartModel:chartType];
[self.aaChartView aa_drawChartWithChartModel:_aaChartModel];
}
- (WKClearPhotoManager *)photoMgr {
......@@ -52,191 +50,53 @@
[MBProgressHUD showLoading:@"正在查询,请稍后..." toView:self.view];
if (self.photoMgr.currentIndex <= 0) {
self.photoMgr.pauseAction = false;
__weak typeof(self) weakSelf = self;
[self.photoMgr loadPhotoWithProcess:^(NSInteger current, NSInteger total) {
NSInteger similarLiveCount = 0;
for (NSArray *items in self.photoMgr.similarLiveArray) {
similarLiveCount += items.count;
}
NSInteger similarCount = 0;
for (NSArray *items in self.photoMgr.similarArray) {
similarCount += items.count;
}
CGFloat f = (similarCount+similarLiveCount+self.photoMgr.snapshotArray.count+self.photoMgr.locationArray.count) != 0 ? similarCount/(float)(similarCount+similarLiveCount+self.photoMgr.snapshotArray.count+self.photoMgr.locationArray.count) : 0;
CGFloat ff = (similarCount+similarLiveCount+self.photoMgr.snapshotArray.count+self.photoMgr.locationArray.count) != 0 ? similarLiveCount/(float)(similarCount+similarLiveCount+self.photoMgr.snapshotArray.count+self.photoMgr.locationArray.count) : 0;
ICContactManageViewCell *cell = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:0 inSection:0]];
cell.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.photoMgr.snapshotArray.count];
self.photoMgr.pauseAction = true;
[self.photoMgr loadPhotoWithProcess:^(NSInteger current, NSInteger total) {
total = self.total;
} completionHandler:^(BOOL success, NSError *error) {
ICContactManageViewCell *cell1 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:4 inSection:0]];
cell1.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)similarLiveCount];
cell1.progressView.strokeStart = ff;
ICContactManageViewCell *cell2 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:2 inSection:0]];
cell2.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)similarCount];
cell2.progressView.strokeStart = f;
ICContactManageViewCell *cell3 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:1 inSection:0]];
cell3.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.photoMgr.locationArray.count];
} completionHandler:^(BOOL success, NSError *error) {
// [weakSelf configData];
PHAsset *asset = self.photoMgr.fetchResult.lastObject;
if (asset) {
[self.headerView.startTimeButton setTitle:[self stringWithDate: asset.creationDate] forState:UIControlStateNormal];
}
// self.assetArr = self.photoMgr.assetArr;
ICContactManageViewCell *cell = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:0 inSection:0]];
ICContactManageViewCell *cell1 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:2 inSection:0]];
ICContactManageViewCell *cell2 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:4 inSection:0]];
cell.progressView.strokeStart = 1;
cell1.progressView.strokeStart = 1;
cell2.progressView.strokeStart = 1;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
cell.progressView.strokeStart = 0;
cell1.progressView.strokeStart = 0;
cell2.progressView.strokeStart = 0;
});
self.screenshotArray = self.photoMgr.snapshotArray;
self.similarPhotoArray = self.photoMgr.similarArray;
self.similarLiveArray = self.photoMgr.similarLiveArray;
[MBProgressHUD hideHUDForView:self.view];
[self loadLocationAssets];
[self.tableView reloadData];
}];
[MBProgressHUD hideHUDForView:self.view];
[self loadLocationAssets];
}];
} else if (self.photoMgr.currentIndex >= self.photoMgr.fetchResult.count-3) {
PHAsset *asset = self.photoMgr.fetchResult.lastObject;
if (asset) {
[self.headerView.startTimeButton setTitle:[self stringWithDate: asset.creationDate] forState:UIControlStateNormal];
}
if (self.photoMgr.similarLiveArray.count) {
}
if (self.photoMgr.similarArray.count) {
}
ICContactManageViewCell *cell = [self.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:0 inSection:0]];
cell.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.photoMgr.snapshotArray.count];
NSInteger similarLiveCount = 0;
for (NSArray *items in self.photoMgr.similarLiveArray) {
similarLiveCount += items.count;
}
ICContactManageViewCell *cell1 = [self.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:4 inSection:0]];
cell1.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)similarLiveCount];
NSInteger similarCount = 0;
for (NSArray *items in self.photoMgr.similarArray) {
similarCount += items.count;
}
ICContactManageViewCell *cell2 = [self.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:2 inSection:0]];
cell2.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)similarCount];
ICContactManageViewCell *cell3 = [self.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:1 inSection:0]];
cell3.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.photoMgr.locationArray.count];
self.screenshotArray = self.photoMgr.snapshotArray;
self.similarPhotoArray = self.photoMgr.similarArray;
self.similarLiveArray = self.photoMgr.similarLiveArray;
[MBProgressHUD hideHUDForView:self.view];
[self loadLocationAssets];
[self.tableView reloadData];
return;
} else {
self.photoMgr.pauseAction = true;
__weak typeof(self) weakSelf = self;
[self.photoMgr loadPhotoWithProcess:^(NSInteger current, NSInteger total) {
PHAsset *asset = self.photoMgr.fetchResult.lastObject;
if (asset) {
[self.headerView.startTimeButton setTitle:[self stringWithDate: asset.creationDate] forState:UIControlStateNormal];
}
NSInteger similarLiveCount = 0;
for (NSArray *items in self.photoMgr.similarLiveArray) {
similarLiveCount += items.count;
}
NSInteger similarCount = 0;
for (NSArray *items in self.photoMgr.similarArray) {
similarCount += items.count;
}
CGFloat f = (similarCount+similarLiveCount+self.photoMgr.snapshotArray.count+self.photoMgr.locationArray.count) != 0 ? similarCount/(float)(similarCount+similarLiveCount+self.photoMgr.snapshotArray.count+self.photoMgr.locationArray.count) : 0;
CGFloat ff = (similarCount+similarLiveCount+self.photoMgr.snapshotArray.count+self.photoMgr.locationArray.count) != 0 ? similarLiveCount/(float)(similarCount+similarLiveCount+self.photoMgr.snapshotArray.count+self.photoMgr.locationArray.count) : 0;
ICContactManageViewCell *cell = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:0 inSection:0]];
cell.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.photoMgr.snapshotArray.count];
ICContactManageViewCell *cell1 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:4 inSection:0]];
cell1.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)similarLiveCount];
cell1.progressView.strokeStart = ff;
ICContactManageViewCell *cell2 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:2 inSection:0]];
cell2.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)similarCount];
cell2.progressView.strokeStart = f;
ICContactManageViewCell *cell3 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:1 inSection:0]];
cell3.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.photoMgr.locationArray.count];
total = self.total;
} completionHandler:^(BOOL success, NSError *error) {
PHAsset *asset = self.photoMgr.fetchResult.lastObject;
if (asset) {
[self.headerView.startTimeButton setTitle:[self stringWithDate: asset.creationDate] forState:UIControlStateNormal];
}
// self.assetArr = self.photoMgr.assetArr;
ICContactManageViewCell *cell = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:0 inSection:0]];
ICContactManageViewCell *cell1 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:2 inSection:0]];
ICContactManageViewCell *cell2 = [weakSelf.tableView cellForRowAtIndexPath:[ NSIndexPath indexPathForRow:4 inSection:0]];
cell.progressView.strokeStart = 1;
cell1.progressView.strokeStart = 1;
cell2.progressView.strokeStart = 1;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
cell.progressView.strokeStart = 0;
cell1.progressView.strokeStart = 0;
cell2.progressView.strokeStart = 0;
});
self.screenshotArray = self.photoMgr.snapshotArray;
self.similarPhotoArray = self.photoMgr.similarArray;
self.similarLiveArray = self.photoMgr.similarLiveArray;
[MBProgressHUD hideHUDForView:self.view];
[self loadLocationAssets];
[self.tableView reloadData];
}];
}
}
- (AAChartModel *)configureTheChartModel:(NSString *)chartType {
NSMutableArray * counts = [NSMutableArray new];
for (int x = 0; x < 12; x++){
int f = (random()%30)+1;
int ff = (random()%f);
NSArray * count = @[[NSNumber numberWithDouble:f/1.0-(random()%10)/10.0], [NSNumber numberWithDouble:ff-10+(random()%10)/10.0]];
[counts addObject:count];
}
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *comps = [calendar components:NSCalendarUnitMonth | NSCalendarUnitDay fromDate:[NSDate date]];
- (void)loadLocationAssets {
NSMutableArray * months = [NSMutableArray new];
for (NSInteger x = 12-comps.month-1; x <= 12 ; x++) {
NSString * month = [NSString stringWithFormat:@"去年%@", [self month:x]];
[months addObject:month];
}
for (NSInteger x = 1; x <= comps.month ; x++) {
[months addObject:[self month:x]];
}
[MBProgressHUD showLoading:@"正在查询,请稍后..." toView:self.view];
[self.photoMgr loadLocationPhotoWithProcess:^(NSInteger current, NSInteger total) {
NSLog(@"loadLocationPhotoWithProcess %ld", (long)current);
} completionHandler:^(BOOL success, NSError *error) {
[MBProgressHUD hideHUDForView:self.view];
self.aaChartModel = [self configureTheChartModel:nil];
[self.aaChartView aa_drawChartWithChartModel:self.aaChartModel];
}];
}
- (AAChartModel *)configureTheChartModel:(NSString *)chartType {
NSInteger f = self.photoMgr.similarLiveArray.count;
NSInteger ff = self.photoMgr.similarArray.count;
NSInteger fff = self.photoMgr.snapshotArray.count;
NSInteger ffff = self.photoMgr.locationArray.count;
NSInteger fffff = self.total -f -ff-fff-ffff;
AASeriesElement *element = AASeriesElement.new
.nameSet(@"语言热度值")
.innerSizeSet(@"20%")//内部圆环半径大小占比
......@@ -248,15 +108,14 @@
.enabledSet(false)//禁用点击区块之后出现的半透明遮罩层
))
.dataSet(@[
@[@"Firefox", @3336.2],
@[@"IE", @26.8],
@[@"IE", [NSNumber numberWithInteger:f]],
@{@"sliced": @true,
@"selected": @true,
@"name": @"Chrome",
@"y": @666.8, },
@[@"Safari", @88.5],
@[@"Opera", @46.0],
@[@"Others", @223.0],
@"y": [NSNumber numberWithInteger:ff]},
@[@"Safari", [NSNumber numberWithInteger:fff]],
@[@"Opera", [NSNumber numberWithInteger:ffff]],
@[@"Others", [NSNumber numberWithInteger:fffff]],
]);
return AAChartModel.new
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment