Skip to content

Commit c8f1fbc

Browse files
authored
Merge pull request #1613 from AAChartModel/dev
Dev
2 parents cef69e0 + 439ca73 commit c8f1fbc

File tree

97 files changed

+3468
-1054
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+3468
-1054
lines changed

AAChartKitDemo.xcodeproj/project.pbxproj

Lines changed: 270 additions & 84 deletions
Large diffs are not rendered by default.

AAChartKitDemo/AppDelegate.m

Lines changed: 544 additions & 12 deletions
Large diffs are not rendered by default.

AAChartKitDemo/Demo/AAChartListVC/AAChartModelListVC.m

Lines changed: 191 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77
//
88

99
#import "AAChartModelListVC.h"
10+
#import "BasicChartVC.h"
11+
#import "SpecialChartVC.h"
12+
#import "CustomStyleChartVC.h"
13+
#import "MixedChartVC.h"
1014
#import "CustomStyleForScatterChartVC.h"
1115
#import "CustomStyleForBubbleChartVC.h"
16+
#import "CustomTableViewCell.h"
17+
#import "AAEasyTool.h"
1218

1319
@interface AAChartModelListVC ()
1420

@@ -19,36 +25,215 @@ @implementation AAChartModelListVC
1925
- (void)viewDidLoad {
2026
[super viewDidLoad];
2127
// Do any additional setup after loading the view.
28+
self.title = @"AAChartModel";
2229

2330
self.sectionTitleArr = @[
31+
@"Basic Type---基础类型",
32+
@"Special Type---特别类型",
33+
@"Custom Style---自定义风格样式图表",
34+
@"Mixed Type Chart---混合图表",
2435
@"Scatter Chart With Custom Style | 一些自定义风格样式散点图",
2536
@"Bubble Chart With Custom Style | 一些自定义风格样式气泡图",
2637
];
2738

2839
self.chartTypeTitleArr = @[
40+
/*Basic Type*/
41+
@[
42+
@"Column Chart---柱形图",
43+
@"Bar Chart---条形图",
44+
@"Area Chart---折线填充图",
45+
@"Areaspline Chart---曲线填充图",
46+
@"Line Chart---折线图",
47+
@"Spline Chart---曲线图",
48+
@"Step Line Chart---直方折线图",
49+
@"Step Area Chart---直方折线填充图",
50+
@"Scatter Chart---散点图"
51+
],
52+
/*Special Type*/
53+
@[
54+
@"Pie Chart---扇形图",
55+
@"Bubble Chart---气泡图",
56+
@"Packed Bubble Chart---紧凑气泡图",
57+
@"Scatter Chart---散点图",
58+
@"Area Range Chart---折线区域面积图",
59+
@"Area Spline range Chart---曲线区域面积图",
60+
@"Column Pyramid Chart---柱形金字塔图",
61+
@"Column Range Chart---柱形范围图",
62+
@"Box Plot Chart---箱线图",
63+
@"Water Fall---瀑布图",
64+
@"Pyramid Chart---金字塔图",
65+
@"Funnel Chart---漏斗图",
66+
@"Error Bar Chart---误差图",
67+
@"Gauge Chart---仪表盘图",
68+
@"Polygon Chart---多边形图",
69+
],
70+
/*Custom Style*/
71+
@[
72+
@"Colorful Column Chart---多彩条形图",
73+
@"Colorful Gradient Color Chart---多彩颜色渐变条形图",
74+
@"Discontinuous Data Chart---数值不连续的图表",
75+
@"Mixed Line Chart---虚实线混合折线图",
76+
@"Colorful Column Chart---多彩柱形图",
77+
@"Gradient Color Bar Chart---颜色渐变条形图",
78+
@"configureXAxisHaveAAZonesElementChart--- X 轴阈值分割区",
79+
@"configureYAxisHaveAAZonesElementChart--- Y 轴带有阈值分割区",
80+
@"Step Line Chart---直方折线图",
81+
@"Step Area Chart---直方折线填充图",
82+
@"Nightingale Rose Chart---南丁格尔玫瑰图",
83+
@"Specific Data Customize Datalabel---指定 data 元素自定义 Datalabel",
84+
@"Chart With Shadow Style---带有阴影效果の图表",
85+
@"Colorful gradient Areaspline Chart---多层次渐变区域填充图",
86+
@"Colorful gradient Spline Chart---多层次渐变曲线图",
87+
@"Gradient Color Areaspline Chart---半透明渐变效果区域填充图",
88+
@"Special Style Marker Of Single Data Element Chart---指定单个数据元素的 Marker 为特殊样式",
89+
@"Special Style Column Of Single Data Element Chart---指定单个数据元素的 Column 为特殊样式",
90+
@"configure Area Chart Threshold---自定义阈值",
91+
@"custom Scatter Chart Marker Symbol Content---自定义散点图的标志点内容",
92+
@"custom Line Chart Marker Symbol Content---自定义折线图的标志点内容",
93+
@"Area Chart with minus---带有负数的区域填充图",
94+
@"splineChartHoverLineWithNoChangeAndCustomMarkerStatesHoverStyle---曲线图禁用选中变粗&&自定义选中后的 marker 样式",
95+
@"Pentagon Radar Chart---五角形雷达图",
96+
@"Hexagon Radar Chart---六角形雷达图",
97+
@"adjustYAxisMaxAndMinValues---调整 X 轴和 Y 轴最大值",
98+
@"custom Special Style DataLabel Of Single Data Element Chart---指定单个数据元素的 DataLabel 为特殊样式",
99+
@"custom Bar Chart Hover Color and Select Color---自定义条形图手指滑动颜色和单个长条被选中颜色",
100+
@"custom Line Chart Chart Hover And Select Halo Style---自定义直线图手指略过和选中的 Halo 样式",
101+
@"custom Spline Chart Marker States Hover Style---自定义曲线图手指略过时的 Marker 样式",
102+
@"customNormalStackingChartDataLabelsContentAndStyle---自定义堆积柱状图 DataLabels 的内容及样式",
103+
@"upsideDownPyramidChart---倒立的金字塔图",
104+
@"doubleLayerPieChart---双层嵌套扇形图",
105+
@"doubleLayerDoubleColorsPieChart---双层嵌套双颜色主题扇形图",
106+
@"disableSomeOfLinesMouseTrackingEffect---针对部分数据列关闭鼠标或手指跟踪行为",
107+
@"configureColorfulShadowChart---彩色阴影效果的曲线图",
108+
@"configureColorfulDataLabelsStepLineChart---彩色 DataLabels 的直方折线图",
109+
@"configureColorfulGradientColorAndColorfulDataLabelsStepAreaChart---彩色渐变效果且彩色 DataLabels 的直方折线填充图",
110+
@"disableSplineChartMarkerHoverEffect---禁用曲线图的手指滑动 marker 点的光圈变化放大的效果",
111+
@"configureMaxAndMinDataLabelsForChart---为图表最大值最小值添加 DataLabels 标记",
112+
@"customVerticalXAxisCategoriesLabelsByHTMLBreakLineTag---通过 HTML 的换行标签来实现图表的 X 轴的 分类文字标签的换行效果",
113+
@"noMoreGroupingAndOverlapEachOtherColumnChart---不分组的相互重叠柱状图📊",
114+
@"noMoreGroupingAndNestedColumnChart---不分组的嵌套柱状图📊",
115+
@"topRoundedCornersStackingColumnChart---顶部为圆角的堆积柱状图📊",
116+
@"freeStyleRoundedCornersStackingColumnChart---各个圆角自由独立设置的堆积柱状图📊",
117+
@"customColumnChartBorderStyleAndStatesHoverColor---自定义柱状图 border 样式及手指掠过图表 series 元素时的柱形颜色",
118+
@"customLineChartWithColorfulMarkersAndLines---彩色连接点和连接线的折线图📈",
119+
@"customLineChartWithColorfulMarkersAndLines2---彩色连接点和连接线的多组折线的折线图📈",
120+
@"drawLineChartWithPointsCoordinates---通过点坐标来绘制折线图",
121+
@"configureSpecialStyleColumnForNegativeDataMixedPositiveData---为正负数混合的柱形图自定义特殊样式效果",
122+
@"configureMultiLevelStopsArrGradientColorAreasplineMixedLineChart---多层次半透明渐变效果的曲线填充图混合折线图📈",
123+
@"connectNullsForSingleAASeriesElement---为单个 AASeriesElement 单独设置是否断点重连",
124+
@"lineChartsWithLargeDifferencesInTheNumberOfDataInDifferentSeriesElement---测试有多组数据时, 数据量较大时, 不同组数据量差距较大时的折线图📈",
125+
@"customAreasplineChartWithColorfulGradientColorZones---彩色渐变区域填充图📈",
126+
@"noMoreGroupingAndNestedColumnClickedChangeColorChart---不分组的嵌套柱状图,点击后变色📊",
127+
@"noMoreGroupingAndNestedColumnClickedChangeColorChart2---不分组的嵌套柱状图,点击后变色📊2"
128+
],
129+
/*Mixed Type Chart*/
130+
@[
131+
@"Arearange Mixed Line---面积范围均线图",
132+
@"Columnrange Mixed Line---柱形范围图混合折线图",
133+
@"Stacking Column Mixed Line---堆积柱形图混合折线图",
134+
@"Dash Style Types Mixed---多种类型曲线混合图",
135+
@"All Line Dash Style Types Mixed Chart---所有类型曲线混合图",
136+
@"Negative Color Mixed Column Chart---基准线以下异色混合柱状图📊",
137+
@"scatterMixedLine---散点图混合折线图",
138+
@"Negative Color Mixed Bubble Chart---基准线以下异色混合气泡图",
139+
@"Polygon Mixed Scatter---多边形混合散点图",
140+
@"Polar Chart Mixed---极地混合图",
141+
@"configure Column Mixed Scatter Chart---柱形图混合散点图",
142+
@"Negative Color Mixed Areaspline chart---基准线以下异色混合曲线填充图",
143+
@"Negative Color Mixed Area chart---基准线以下异色混合直线填充图",
144+
@"Area Chart Mixed Step Area Chart---折线填充和直方折线填充混合图"
145+
],
29146

30147
/*Custom Style For Scatter Chart*/
31148
@[
32-
@"customScatterChartMarkerSymbolContent",
33-
@"drawLineMixedScatterChartWithPointsCoordinates2",
149+
@"customScatterChartMarkerSymbolContent---自定义散点图的标志点内容",
150+
@"drawLineMixedScatterChartWithPointsCoordinates2---通过点坐标绘制折线混合散点图",
34151
],
35152
/*Custom Style For Bubble Chart*/
36153
@[
37-
@"negativeColorMixedBubbleChart",
38-
@"showAARadialGradientPositionAllEnumValuesWithBubbleChart",
154+
@"negativeColorMixedBubbleChart---基准线以下异色混合气泡图",
155+
@"showAARadialGradientPositionAllEnumValuesWithBubbleChart---气泡图径向渐变位置枚举示例",
39156
],
40157
];
41158

42159
self.view.backgroundColor = [UIColor whiteColor];
43160
[self setUpMainTableView];
44161
}
45162

163+
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
164+
CustomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CustomTableViewCell"];
165+
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
166+
167+
cell.numberLabel.text = [NSString stringWithFormat:@"%ld", indexPath.row + 1];
168+
cell.numberLabel.layer.masksToBounds = true;
169+
cell.numberLabel.layer.cornerRadius = 10;
170+
UIColor *numBgColor = [AAEasyTool colorWithHexString:@[@"#5470c6",
171+
@"#91cc75",
172+
@"#fac858",
173+
@"#ee6666",
174+
@"#73c0de",
175+
@"#3ba272",
176+
@"#fc8452",
177+
@"#9a60b4",
178+
@"#ea7ccc"][indexPath.section % 9]];
179+
cell.numberLabel.backgroundColor = numBgColor;
180+
cell.numberLabel.textColor = UIColor.whiteColor;
181+
182+
NSString *textStr = self.chartTypeTitleArr[(NSUInteger)indexPath.section][(NSUInteger)indexPath.row];
183+
NSArray<NSString *> *textStrArr = [textStr componentsSeparatedByString:@"---"];
184+
cell.titleLabel.text = textStrArr.firstObject;
185+
cell.subtitleLabel.text = textStrArr.count > 1 ? textStrArr[1] : @"";
186+
187+
if (indexPath.row % 2 == 0) {
188+
cell.backgroundColor = [AAEasyTool colorWithHexString:@"#FFF0F5"];
189+
} else {
190+
cell.backgroundColor = UIColor.whiteColor;
191+
}
192+
193+
return cell;
194+
}
195+
46196
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
47197
NSUInteger row = (NSUInteger) indexPath.row;
48198
NSUInteger section = (NSUInteger) indexPath.section;
49199

50200
switch (section) {
51-
case 0: {
201+
case 0: {
202+
BasicChartVC *vc = BasicChartVC.new;
203+
vc.chartType = row;
204+
vc.hidesBottomBarWhenPushed = YES;
205+
[self.navigationController pushViewController:vc animated:YES];
206+
}
207+
break;
208+
209+
case 1: {
210+
SpecialChartVC *vc = SpecialChartVC.new;
211+
vc.selectedIndex = row;
212+
vc.navigationItemTitleArr = self.chartTypeTitleArr[section];
213+
vc.hidesBottomBarWhenPushed = YES;
214+
[self.navigationController pushViewController:vc animated:YES];
215+
}
216+
break;
217+
218+
case 2: {
219+
CustomStyleChartVC *vc = CustomStyleChartVC.new;
220+
vc.selectedIndex = row;
221+
vc.navigationItemTitleArr = self.chartTypeTitleArr[section];
222+
vc.hidesBottomBarWhenPushed = YES;
223+
[self.navigationController pushViewController:vc animated:YES];
224+
}
225+
break;
226+
227+
case 3: {
228+
MixedChartVC *vc = MixedChartVC.new;
229+
vc.selectedIndex = row;
230+
vc.navigationItemTitleArr = self.chartTypeTitleArr[section];
231+
vc.hidesBottomBarWhenPushed = YES;
232+
[self.navigationController pushViewController:vc animated:YES];
233+
}
234+
break;
235+
236+
case 4: {
52237
CustomStyleForScatterChartVC *vc = CustomStyleForScatterChartVC.new;
53238
vc.selectedIndex = row;
54239
vc.navigationItemTitleArr = self.chartTypeTitleArr[section];
@@ -57,7 +242,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
57242
}
58243
break;
59244

60-
case 1: {
245+
case 5: {
61246
CustomStyleForBubbleChartVC *vc = CustomStyleForBubbleChartVC.new;
62247
vc.selectedIndex = row;
63248
vc.navigationItemTitleArr = self.chartTypeTitleArr[section];
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

0 commit comments

Comments
 (0)