-
-
Notifications
You must be signed in to change notification settings - Fork 750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
同时显示多个图表 #13
Comments
可以同时绘制多个图表,你需要创建多个图表的实例对象,并且注意布局位置,不要把前面的图表给覆盖了 |
请问同时绘制多个是怎么做到的,我的 chartView 和 chartModel 都是分开创建,只出现第一个 |
现已添加同时显示多个 - (void)viewDidLoad {
[super viewDidLoad];
self.title = @"同时显示多个 AAChartView";
self.view.backgroundColor = [UIColor whiteColor];
[self setUpTheAAChartViewOne];
[self setUpTheAAChartViewTwo];
}
//配置第一个 AAChartView
- (void)setUpTheAAChartViewOne {
CGFloat chartViewWidth = self.view.frame.size.width;
CGFloat screenHeight = self.view.frame.size.height;
AAChartView *aaChartView = [[AAChartView alloc]initWithFrame:CGRectMake(0, 60, chartViewWidth, screenHeight/2)];
[self.view addSubview:aaChartView];
AAChartModel *aaChartModel= AAObject(AAChartModel)
.chartTypeSet(AAChartTypeColumn)
.titleSet(@"")
.subtitleSet(@"")
.categoriesSet(@[@"Java",@"Swift",@"Python",@"Ruby", @"PHP",@"Go",@"C",@"C#",@"C++",@"Perl",@"R",@"MATLAB",@"SQL"])
.yAxisTitleSet(@"")
.seriesSet(@[
AAObject(AASeriesElement)
.nameSet(@"2017")
.dataSet(@[@45,@88,@49,@43,@65,@56,@47,@28,@49,@44,@89,@55]),
]
);
[aaChartView aa_drawChartWithChartModel:aaChartModel];
}
//配置第二个 AAChartView
- (void)setUpTheAAChartViewTwo {
CGFloat chartViewWidth = self.view.frame.size.width;
CGFloat screenHeight = self.view.frame.size.height;
AAChartView *aaChartView2 = [[AAChartView alloc]initWithFrame:CGRectMake(0, screenHeight/2+60, chartViewWidth, screenHeight/2-60)];
[self.view addSubview:aaChartView2];
AAChartModel *aaChartModel2= AAObject(AAChartModel)
.chartTypeSet(AAChartTypeArea)
.titleSet(@"")
.subtitleSet(@"")
.categoriesSet(@[@"Java",@"Swift",@"Python",@"Ruby", @"PHP",@"Go",@"C",@"C#",@"C++",@"Perl",@"R",@"MATLAB",@"SQL"])
.yAxisTitleSet(@"")
.seriesSet(@[
AAObject(AASeriesElement)
.nameSet(@"2018")
.dataSet(@[@31,@22,@33,@54,@35,@36,@27,@38,@39,@54,@41,@29]),
]
);
[aaChartView2 aa_drawChartWithChartModel:aaChartModel2];
}
|
更新 AAChartKit 项目的 DEMO 内容,运行工程,点击 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
您好,这个能在同一个页面绘制多个图表么。我同时绘制第一次总是只出现最后一个,前面都绘制不出来
The text was updated successfully, but these errors were encountered: