Skip to content

Commit 641cce3

Browse files
committed
Add AAOptions Composer provider and list VC
Introduce AAOptionsComposerProvider (header + implementation) that aggregates AAOptions examples from various composer modules, and add AAOptionsComposerChartListVC (header + implementation) which shows those AAOptions in a table of AAChartView cells for quick preview. Update MainVC to import the new list VC and add a menu entry to open it, and update the Xcode project file (project.pbxproj) to include the new source files. This provides a unified preview/test entry for AAOptions examples.
1 parent c756ced commit 641cce3

6 files changed

Lines changed: 391 additions & 1 deletion

File tree

AAChartKitDemo.xcodeproj/project.pbxproj

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@
176176
84F998662EB38C8F00D41382 /* CustomStyleForLineChartComposer2.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F998492EB38C8F00D41382 /* CustomStyleForLineChartComposer2.m */; };
177177
84F9986D2EB8A83000D41382 /* OfficalSamplesChartProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F9986C2EB8A83000D41382 /* OfficalSamplesChartProvider.m */; };
178178
84F998702EB8ACCE00D41382 /* CustomStyleChartModelProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F9986F2EB8ACCE00D41382 /* CustomStyleChartModelProvider.m */; };
179+
85A0C0012F5A100100AA0001 /* AAOptionsComposerProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 85A0C0032F5A100100AA0001 /* AAOptionsComposerProvider.m */; };
180+
85A0C0312F5A300100AA0001 /* AAOptionsComposerChartListVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 85A0C0332F5A300100AA0001 /* AAOptionsComposerChartListVC.m */; };
179181
92445D871FDE1F2A00B3E576 /* MonitorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 92445D861FDE1F2A00B3E576 /* MonitorViewController.m */; };
180182
/* End PBXBuildFile section */
181183

@@ -539,6 +541,10 @@
539541
84F9986C2EB8A83000D41382 /* OfficalSamplesChartProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OfficalSamplesChartProvider.m; sourceTree = "<group>"; };
540542
84F9986E2EB8ACCE00D41382 /* CustomStyleChartModelProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomStyleChartModelProvider.h; sourceTree = "<group>"; };
541543
84F9986F2EB8ACCE00D41382 /* CustomStyleChartModelProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CustomStyleChartModelProvider.m; sourceTree = "<group>"; };
544+
85A0C0022F5A100100AA0001 /* AAOptionsComposerProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AAOptionsComposerProvider.h; sourceTree = "<group>"; };
545+
85A0C0032F5A100100AA0001 /* AAOptionsComposerProvider.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AAOptionsComposerProvider.m; sourceTree = "<group>"; };
546+
85A0C0322F5A300100AA0001 /* AAOptionsComposerChartListVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AAOptionsComposerChartListVC.h; sourceTree = "<group>"; };
547+
85A0C0332F5A300100AA0001 /* AAOptionsComposerChartListVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AAOptionsComposerChartListVC.m; sourceTree = "<group>"; };
542548
92445D851FDE1F2A00B3E576 /* MonitorViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MonitorViewController.h; sourceTree = "<group>"; };
543549
92445D861FDE1F2A00B3E576 /* MonitorViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MonitorViewController.m; sourceTree = "<group>"; };
544550
/* End PBXFileReference section */
@@ -896,6 +902,8 @@
896902
8461422F2C8AF5320032FBD3 /* AAChartModelListVC.m */,
897903
846142072C88330C0032FBD3 /* AAOptionsWithJSForChartEventsListVC.h */,
898904
846142082C88330C0032FBD3 /* AAOptionsWithJSForChartEventsListVC.m */,
905+
85A0C0322F5A300100AA0001 /* AAOptionsComposerChartListVC.h */,
906+
85A0C0332F5A300100AA0001 /* AAOptionsComposerChartListVC.m */,
899907
);
900908
path = AAChartListVC;
901909
sourceTree = "<group>";
@@ -1258,6 +1266,8 @@
12581266
84F9986C2EB8A83000D41382 /* OfficalSamplesChartProvider.m */,
12591267
84F9986E2EB8ACCE00D41382 /* CustomStyleChartModelProvider.h */,
12601268
84F9986F2EB8ACCE00D41382 /* CustomStyleChartModelProvider.m */,
1269+
85A0C0022F5A100100AA0001 /* AAOptionsComposerProvider.h */,
1270+
85A0C0032F5A100100AA0001 /* AAOptionsComposerProvider.m */,
12611271
);
12621272
path = Provider;
12631273
sourceTree = "<group>";
@@ -1414,6 +1424,8 @@
14141424
1E66D200210AF4ED007EAB8C /* AAPlotOptions.m in Sources */,
14151425
272D80B31F91EC9E008A2D20 /* ShowManyChartViewVC.m in Sources */,
14161426
84F9986D2EB8A83000D41382 /* OfficalSamplesChartProvider.m in Sources */,
1427+
85A0C0012F5A100100AA0001 /* AAOptionsComposerProvider.m in Sources */,
1428+
85A0C0312F5A300100AA0001 /* AAOptionsComposerChartListVC.m in Sources */,
14171429
845FC2392EA0CF67002FC670 /* JSFunctionBeforeAndAfterRenderingComposer7.m in Sources */,
14181430
1E66D202210AF4ED007EAB8C /* AALine.m in Sources */,
14191431
848FEAFC265E170C006E4F25 /* TestAAChartViewForXibVC.m in Sources */,
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//
2+
// AAOptionsComposerChartListVC.h
3+
// AAChartKitDemo
4+
//
5+
6+
#import <UIKit/UIKit.h>
7+
8+
NS_ASSUME_NONNULL_BEGIN
9+
10+
@interface AAOptionsComposerChartListVC : UIViewController
11+
12+
@end
13+
14+
NS_ASSUME_NONNULL_END
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
//
2+
// AAOptionsComposerChartListVC.m
3+
// AAChartKitDemo
4+
//
5+
6+
#import "AAOptionsComposerChartListVC.h"
7+
#import "AAChartKit.h"
8+
#import "AAOptionsComposerProvider.h"
9+
10+
static NSString * const kAAOptionsComposerChartCellId = @"AAOptionsComposerChartCell";
11+
12+
@interface AAOptionsComposerChartCell : UITableViewCell
13+
14+
@property (nonatomic, strong, readonly) AAChartView *aaChartView;
15+
16+
@end
17+
18+
@implementation AAOptionsComposerChartCell {
19+
AAChartView *_aaChartView;
20+
}
21+
22+
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
23+
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
24+
if (self) {
25+
self.selectionStyle = UITableViewCellSelectionStyleNone;
26+
self.backgroundColor = UIColor.whiteColor;
27+
28+
_aaChartView = [[AAChartView alloc] initWithFrame:CGRectZero];
29+
_aaChartView.translatesAutoresizingMaskIntoConstraints = NO;
30+
[self.contentView addSubview:_aaChartView];
31+
32+
[NSLayoutConstraint activateConstraints:@[
33+
[_aaChartView.leadingAnchor constraintEqualToAnchor:self.contentView.leadingAnchor],
34+
[_aaChartView.trailingAnchor constraintEqualToAnchor:self.contentView.trailingAnchor],
35+
[_aaChartView.topAnchor constraintEqualToAnchor:self.contentView.topAnchor],
36+
[_aaChartView.bottomAnchor constraintEqualToAnchor:self.contentView.bottomAnchor],
37+
]];
38+
}
39+
return self;
40+
}
41+
42+
- (AAChartView *)aaChartView {
43+
return _aaChartView;
44+
}
45+
46+
@end
47+
48+
@interface AAOptionsComposerChartListVC () <UITableViewDelegate, UITableViewDataSource>
49+
50+
@property (nonatomic, strong) UITableView *tableView;
51+
@property (nonatomic, copy) NSArray<AAOptions *> *optionsItems;
52+
53+
@end
54+
55+
@implementation AAOptionsComposerChartListVC
56+
57+
- (void)viewDidLoad {
58+
[super viewDidLoad];
59+
60+
self.title = @"AAOptions Composer List";
61+
self.view.backgroundColor = UIColor.whiteColor;
62+
63+
self.optionsItems = [AAOptionsComposerProvider aaOptionsComposerItems];
64+
[self setUpTableView];
65+
}
66+
67+
- (void)setUpTableView {
68+
self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewStylePlain];
69+
self.tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
70+
self.tableView.delegate = self;
71+
self.tableView.dataSource = self;
72+
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
73+
self.tableView.backgroundColor = UIColor.whiteColor;
74+
[self.tableView registerClass:[AAOptionsComposerChartCell class] forCellReuseIdentifier:kAAOptionsComposerChartCellId];
75+
[self.view addSubview:self.tableView];
76+
}
77+
78+
#pragma mark - UITableViewDataSource
79+
80+
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
81+
return self.optionsItems.count;
82+
}
83+
84+
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
85+
return 1;
86+
}
87+
88+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
89+
AAOptionsComposerChartCell *cell = [tableView dequeueReusableCellWithIdentifier:kAAOptionsComposerChartCellId forIndexPath:indexPath];
90+
AAOptions *aaOptions = self.optionsItems[(NSUInteger)indexPath.row];
91+
[cell.aaChartView aa_drawChartWithOptions:aaOptions];
92+
return cell;
93+
}
94+
95+
#pragma mark - UITableViewDelegate
96+
97+
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
98+
return 340;
99+
}
100+
101+
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
102+
return 0.01;
103+
}
104+
105+
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
106+
return 0.01;
107+
}
108+
109+
@end

AAChartKitDemo/Demo/AAChartListVC/MainVC.m

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#import "CustomTooltipClickEventCallbackVC.h"
7272
#import "DynamicTooltipAfterClickRequestVC.h"
7373
#import "LineChartViewController.h"
74+
#import "AAOptionsComposerChartListVC.h"
7475

7576
#define AAGrayColor [UIColor colorWithRed:245/255.0 green:246/255.0 blue:247/255.0 alpha:1.0]
7677

@@ -521,6 +522,14 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
521522
}
522523
}
523524
break;
525+
526+
case 31: {
527+
/*AAOptions Composer Provider 测试入口*/
528+
AAOptionsComposerChartListVC *vc = AAOptionsComposerChartListVC.new;
529+
vc.hidesBottomBarWhenPushed = YES;
530+
[self.navigationController pushViewController:vc animated:YES];
531+
}
532+
break;
524533

525534
default:
526535
break;
@@ -561,7 +570,8 @@ - (NSArray *)sectionTypeArr {
561570
@"JS Function For AALegend Click Events---通过 JSFunction 自定义 Legend 图例的点击事件",
562571
@"JS Function For AAChartEvents---通过 JSFunction 自定义 AAChartEvents 的事件",
563572
@"Line Chart Options---通过 AAOptions 自定义折线图",
564-
@"Custom Event Callback Message---完全自定义图表交互事件回调的信息"
573+
@"Custom Event Callback Message---完全自定义图表交互事件回调的信息",
574+
@"AAOptions Composer Provider---AAOptions 统一预览测试入口",
565575
];
566576
}
567577
return _sectionTypeArr;
@@ -933,6 +943,9 @@ - (NSArray *)chartTypeNameArr {
933943
@[@"Custom Click Event Callback Message---自定义点击及滑动事件回调的信息",
934944
@"CustomTooltipClickEventCallbackVC---自定义 tooltip 点击事件",
935945
@"DynamicTooltipAfterClickRequestVC---点击图表📊后请求数据动态更新 tooltip 内容",
946+
],
947+
/*AAOptions Composer Provider 测试*/
948+
@[@"Open AAOptions Composer ChartListVC---统一预览全部 AAOptions 样例",
936949
]
937950

938951
];
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// AAOptionsComposerProvider.h
3+
// AAChartKitDemo
4+
//
5+
6+
#import <Foundation/Foundation.h>
7+
8+
@class AAOptions;
9+
10+
NS_ASSUME_NONNULL_BEGIN
11+
12+
@interface AAOptionsComposerProvider : NSObject
13+
14+
+ (NSArray<AAOptions *> *)aaOptionsComposerItems;
15+
16+
@end
17+
18+
NS_ASSUME_NONNULL_END

0 commit comments

Comments
 (0)