Skip to content

Commit

Permalink
Fix #773 Custom Chart Style When Every Data Value Is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
AAChartModel committed Dec 23, 2019
1 parent 3809d37 commit 1e6f95c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
24 changes: 24 additions & 0 deletions AAChartKitDemo/ChartsDemo/DrawChartWithAAOptionsVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ - (AAOptions *)configureChartOptions {
case 35: return [self customAreaChartTooltipStyleLikeHTMLTable];//自定义 tooltip 提示框为 HTML 表格样式
case 36: return [self adjustPieChartTitleAndDataLabelFontStyle2];//自定义饼图的标题和 DataLabels
case 37: return [self customChartStyleWhenNoData];//数据为空的情况下,配置图表的 x 轴 y 轴等样式
case 38: return [self customChartStyleWhenEveryDataValueIsZero];//所有数据都为 0 的情况下, 配置图表的 x 轴 y 轴等样式

}
return nil;
Expand Down Expand Up @@ -2342,4 +2343,27 @@ - (AAOptions *)customChartStyleWhenNoData {
return aaOptions;
}

- (AAOptions *)customChartStyleWhenEveryDataValueIsZero {
AAChartModel *aaChartModel= AAChartModel.new
.chartTypeSet(AAChartTypeAreaspline)
.titleSet(@"Custom Chart Style When Every Data Value Is 0")
.categoriesSet(@[
@"Java", @"Swift", @"Python", @"Ruby", @"PHP", @"Go",@"C",
@"C#", @"C++", @"Perl", @"R", @"SQL"])
.yAxisTitleSet(@"摄氏度 (℃)")
.seriesSet(@[
AASeriesElement.new
.nameSet(@"Tokyo Hot")
.dataSet(@[@0, @0, @0, @0, @0, @0, @0, @0, @0, @0, @0, @0, ]),
]);

AAOptions *aaOptions = [AAOptionsConstructor configureChartOptionsWithAAChartModel:aaChartModel];

aaOptions.yAxis
.minSet(@0)
.minRangeSet(@1);

return aaOptions;
}

@end
1 change: 1 addition & 0 deletions AAChartKitDemo/ChartsDemo/FirstViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ - (NSArray *)chartTypeNameArr {
@"custom Area Chart Tooltip Style Like HTML Table---自定义 tooltip 提示框为 HTML 表格样式",
@"adjust Pie Chart Title And Data Label Font Style---自定义饼图的标题和 DataLabels",
@"custom Chart Style When No Data---数据为空的情况下,配置图表的 x 轴 y 轴等样式",
@"custom Chart Style When Every Data Value Is 0---所有数据都为 0 的情况下, 配置图表的 x 轴 y 轴等样式",
],
/*同时显示多个 AAChartView*/
@[@"同时显示多个 AAChartView",
Expand Down

0 comments on commit 1e6f95c

Please sign in to comment.