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

no message

parent 2666579b
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
@interface StatisticsViewController ()<AAChartViewEventDelegate> @interface StatisticsViewController ()<AAChartViewEventDelegate>
@property (nonatomic, strong) WKClearPhotoManager *photoMgr;
@property (nonatomic, assign) NSInteger total;
@property (nonatomic, assign) AAChartModel *aaChartModel; @property (nonatomic, assign) AAChartModel *aaChartModel;
@property (nonatomic, strong) AAChartView *aaChartView; @property (nonatomic, strong) AAChartView *aaChartView;
...@@ -35,10 +37,6 @@ ...@@ -35,10 +37,6 @@
self.view.backgroundColor = [UIColor whiteColor]; self.view.backgroundColor = [UIColor whiteColor];
self.aaChartView.scrollEnabled = NO; self.aaChartView.scrollEnabled = NO;
[self.view addSubview:self.aaChartView]; [self.view addSubview:self.aaChartView];
self.aaChartModel = [self configureTheChartModel:chartType];
[self.aaChartView aa_drawChartWithChartModel:_aaChartModel];
} }
- (WKClearPhotoManager *)photoMgr { - (WKClearPhotoManager *)photoMgr {
...@@ -52,190 +50,52 @@ ...@@ -52,190 +50,52 @@
[MBProgressHUD showLoading:@"正在查询,请稍后..." toView:self.view]; [MBProgressHUD showLoading:@"正在查询,请稍后..." toView:self.view];
if (self.photoMgr.currentIndex <= 0) { if (self.photoMgr.currentIndex <= 0) {
self.photoMgr.pauseAction = false; self.photoMgr.pauseAction = true;
__weak typeof(self) weakSelf = self;
[self.photoMgr loadPhotoWithProcess:^(NSInteger current, NSInteger total) { [self.photoMgr loadPhotoWithProcess:^(NSInteger current, NSInteger total) {
total = self.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];
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) { } 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]; [MBProgressHUD hideHUDForView:self.view];
[self loadLocationAssets]; [self loadLocationAssets];
[self.tableView reloadData];
}]; }];
} else if (self.photoMgr.currentIndex >= self.photoMgr.fetchResult.count-3) { } 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]; [MBProgressHUD hideHUDForView:self.view];
[self loadLocationAssets]; [self loadLocationAssets];
[self.tableView reloadData];
return; return;
} else { } else {
self.photoMgr.pauseAction = true; self.photoMgr.pauseAction = true;
__weak typeof(self) weakSelf = self;
[self.photoMgr loadPhotoWithProcess:^(NSInteger current, NSInteger total) { [self.photoMgr loadPhotoWithProcess:^(NSInteger current, NSInteger total) {
total = self.total;
} completionHandler:^(BOOL success, NSError *error) {
PHAsset *asset = self.photoMgr.fetchResult.lastObject; [MBProgressHUD hideHUDForView:self.view];
if (asset) { [self loadLocationAssets];
[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; - (void)loadLocationAssets {
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]]; [MBProgressHUD showLoading:@"正在查询,请稍后..." toView:self.view];
cell3.countLabel.text = [NSString stringWithFormat:@"%lu", (unsigned long)self.photoMgr.locationArray.count]; [self.photoMgr loadLocationPhotoWithProcess:^(NSInteger current, NSInteger total) {
NSLog(@"loadLocationPhotoWithProcess %ld", (long)current);
} completionHandler:^(BOOL success, NSError *error) { } 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]; [MBProgressHUD hideHUDForView:self.view];
[self loadLocationAssets];
[self.tableView reloadData]; self.aaChartModel = [self configureTheChartModel:nil];
[self.aaChartView aa_drawChartWithChartModel:self.aaChartModel];
}]; }];
}
} }
- (AAChartModel *)configureTheChartModel:(NSString *)chartType { - (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]; NSInteger f = self.photoMgr.similarLiveArray.count;
NSDateComponents *comps = [calendar components:NSCalendarUnitMonth | NSCalendarUnitDay fromDate:[NSDate date]]; NSInteger ff = self.photoMgr.similarArray.count;
NSInteger fff = self.photoMgr.snapshotArray.count;
NSMutableArray * months = [NSMutableArray new]; NSInteger ffff = self.photoMgr.locationArray.count;
for (NSInteger x = 12-comps.month-1; x <= 12 ; x++) { NSInteger fffff = self.total -f -ff-fff-ffff;
NSString * month = [NSString stringWithFormat:@"去年%@", [self month:x]];
[months addObject:month];
}
for (NSInteger x = 1; x <= comps.month ; x++) {
[months addObject:[self month:x]];
}
AASeriesElement *element = AASeriesElement.new AASeriesElement *element = AASeriesElement.new
.nameSet(@"语言热度值") .nameSet(@"语言热度值")
...@@ -248,15 +108,14 @@ ...@@ -248,15 +108,14 @@
.enabledSet(false)//禁用点击区块之后出现的半透明遮罩层 .enabledSet(false)//禁用点击区块之后出现的半透明遮罩层
)) ))
.dataSet(@[ .dataSet(@[
@[@"Firefox", @3336.2], @[@"IE", [NSNumber numberWithInteger:f]],
@[@"IE", @26.8],
@{@"sliced": @true, @{@"sliced": @true,
@"selected": @true, @"selected": @true,
@"name": @"Chrome", @"name": @"Chrome",
@"y": @666.8, }, @"y": [NSNumber numberWithInteger:ff]},
@[@"Safari", @88.5], @[@"Safari", [NSNumber numberWithInteger:fff]],
@[@"Opera", @46.0], @[@"Opera", [NSNumber numberWithInteger:ffff]],
@[@"Others", @223.0], @[@"Others", [NSNumber numberWithInteger:fffff]],
]); ]);
return AAChartModel.new 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