Skip to content

Commit 4ab6d79

Browse files
committed
Fix #747 ✈️✈️✈️
1 parent 667709b commit 4ab6d79

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

AAChartKitDemo/ChartsDemo/CustomStyleChartVC.m

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ - (AAChartModel *)setUpAAChartModelWithIndex:(NSUInteger)index {
110110
case 23: return [self configurePentagonRadarChart];
111111
case 24: return [self configureHexagonRadarChart];
112112
case 25: return [self adjustYAxisMaxAndMinValues];
113+
case 26: return [self customSpecialStyleDataLabelOfSingleDataElementChart];
113114

114115
default:
115116
return nil;
@@ -903,6 +904,55 @@ - (AAChartModel *)adjustYAxisMaxAndMinValues {
903904

904905

905906

907+
- (AAChartModel *)customSpecialStyleDataLabelOfSingleDataElementChart {
908+
NSDictionary *gradientColorDic1 =
909+
[AAGradientColor gradientColorWithDirection:AALinearGradientDirectionToTop
910+
startColorString:@"rgba(255,215,0,0.1)" // gold color, alpha: 0.1
911+
endColorString:@"rgba(255,215,0, 0.6)"]; // gold color, alpha: 0.6
912+
913+
NSString *formatStr = [NSString stringWithFormat:@"%@%@",
914+
@"<span style=""color:#FFFFFF;font-weight:thin;font-size:25px"">▲{y}</span>",
915+
@"<span style=""color:#FFFFFF;font-weight:thin;font-size:17px""> m</span>"
916+
];
917+
918+
AADataElement *singleSpecialData = AADataElement.new
919+
.dataLabelsSet(AADataLabels.new
920+
.enabledSet(true)
921+
.useHTMLSet(true)
922+
.formatSet(formatStr)
923+
.styleSet(AAStyle.new
924+
.fontWeightSet(AAChartFontWeightTypeBold)
925+
.colorSet(AAColor.whiteColor)
926+
.fontSizeSet(@"16px"))
927+
.ySet(@(-35))
928+
.alignSet(AAChartAlignTypeCenter)
929+
.verticalAlignSet(AAChartVerticalAlignTypeTop)
930+
.overflowSet(@"none")
931+
.cropSet(false)
932+
)
933+
.ySet(@26.5);
934+
935+
return AAChartModel.new
936+
.chartTypeSet(AAChartTypeAreaspline)
937+
.titleSet(@"")
938+
.backgroundColorSet(@"#4b2b7f")
939+
.yAxisTitleSet(@"")//设置Y轴标题
940+
.dataLabelsEnabledSet(false)//是否显示值
941+
.tooltipEnabledSet(true)
942+
.markerRadiusSet(@0)
943+
.xAxisVisibleSet(false)
944+
.yAxisVisibleSet(false)
945+
.seriesSet(@[
946+
AASeriesElement.new
947+
.nameSet(@"Virtual Data")
948+
.lineWidthSet(@6)
949+
.colorSet(@"rgba(255,215,0,1)")
950+
.fillColorSet((id)gradientColorDic1)// gold color, alpha: 1.0
951+
.dataSet(@[@7.0, @6.9, @2.5, @14.5, @18.2, singleSpecialData, @5.2, @26.5, @23.3, @45.3, @13.9, @9.6])
952+
]);
953+
}
954+
955+
906956

907957
@end
908958

AAChartKitDemo/ChartsDemo/FirstViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,8 @@ - (NSArray *)chartTypeNameArr {
318318
@"Quadrangle Radar Chart---四角形雷达图",
319319
@"Pentagon Radar Chart---五角形雷达图",
320320
@"Hexagon Radar Chart----六角形雷达图",
321-
@"adjustYAxisMaxAndMinValues----调整 X 轴和 Y 轴最大值"
321+
@"adjustYAxisMaxAndMinValues----调整 X 轴和 Y 轴最大值",
322+
@"custom Special Style DataLabel Of Single Data Element Chart",
322323
],
323324
/*混合类型图表*/
324325
@[@"Arearange Mixed Line---面积范围均线图",

0 commit comments

Comments
 (0)