From 4ab6d79e850e5cc2721d599ccc777151fe454ae2 Mon Sep 17 00:00:00 2001
From: AnAn <2236368544@qq.com>
Date: Wed, 16 Oct 2019 15:00:20 +0800
Subject: [PATCH] =?UTF-8?q?Fix=20#747=20=20=E2=9C=88=EF=B8=8F=E2=9C=88?=
=?UTF-8?q?=EF=B8=8F=E2=9C=88=EF=B8=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ChartsDemo/CustomStyleChartVC.m | 50 +++++++++++++++++++
.../ChartsDemo/FirstViewController.m | 3 +-
2 files changed, 52 insertions(+), 1 deletion(-)
diff --git a/AAChartKitDemo/ChartsDemo/CustomStyleChartVC.m b/AAChartKitDemo/ChartsDemo/CustomStyleChartVC.m
index 2e1bfaa89..cf73e7e08 100644
--- a/AAChartKitDemo/ChartsDemo/CustomStyleChartVC.m
+++ b/AAChartKitDemo/ChartsDemo/CustomStyleChartVC.m
@@ -110,6 +110,7 @@ - (AAChartModel *)setUpAAChartModelWithIndex:(NSUInteger)index {
case 23: return [self configurePentagonRadarChart];
case 24: return [self configureHexagonRadarChart];
case 25: return [self adjustYAxisMaxAndMinValues];
+ case 26: return [self customSpecialStyleDataLabelOfSingleDataElementChart];
default:
return nil;
@@ -903,6 +904,55 @@ - (AAChartModel *)adjustYAxisMaxAndMinValues {
+- (AAChartModel *)customSpecialStyleDataLabelOfSingleDataElementChart {
+ NSDictionary *gradientColorDic1 =
+ [AAGradientColor gradientColorWithDirection:AALinearGradientDirectionToTop
+ startColorString:@"rgba(255,215,0,0.1)" // gold color, alpha: 0.1
+ endColorString:@"rgba(255,215,0, 0.6)"]; // gold color, alpha: 0.6
+
+ NSString *formatStr = [NSString stringWithFormat:@"%@%@",
+ @"▲{y}",
+ @" m"
+ ];
+
+ AADataElement *singleSpecialData = AADataElement.new
+ .dataLabelsSet(AADataLabels.new
+ .enabledSet(true)
+ .useHTMLSet(true)
+ .formatSet(formatStr)
+ .styleSet(AAStyle.new
+ .fontWeightSet(AAChartFontWeightTypeBold)
+ .colorSet(AAColor.whiteColor)
+ .fontSizeSet(@"16px"))
+ .ySet(@(-35))
+ .alignSet(AAChartAlignTypeCenter)
+ .verticalAlignSet(AAChartVerticalAlignTypeTop)
+ .overflowSet(@"none")
+ .cropSet(false)
+ )
+ .ySet(@26.5);
+
+ return AAChartModel.new
+ .chartTypeSet(AAChartTypeAreaspline)
+ .titleSet(@"")
+ .backgroundColorSet(@"#4b2b7f")
+ .yAxisTitleSet(@"")//设置Y轴标题
+ .dataLabelsEnabledSet(false)//是否显示值
+ .tooltipEnabledSet(true)
+ .markerRadiusSet(@0)
+ .xAxisVisibleSet(false)
+ .yAxisVisibleSet(false)
+ .seriesSet(@[
+ AASeriesElement.new
+ .nameSet(@"Virtual Data")
+ .lineWidthSet(@6)
+ .colorSet(@"rgba(255,215,0,1)")
+ .fillColorSet((id)gradientColorDic1)// gold color, alpha: 1.0
+ .dataSet(@[@7.0, @6.9, @2.5, @14.5, @18.2, singleSpecialData, @5.2, @26.5, @23.3, @45.3, @13.9, @9.6])
+ ]);
+}
+
+
@end
diff --git a/AAChartKitDemo/ChartsDemo/FirstViewController.m b/AAChartKitDemo/ChartsDemo/FirstViewController.m
index 721b7e523..2e0fe2680 100644
--- a/AAChartKitDemo/ChartsDemo/FirstViewController.m
+++ b/AAChartKitDemo/ChartsDemo/FirstViewController.m
@@ -318,7 +318,8 @@ - (NSArray *)chartTypeNameArr {
@"Quadrangle Radar Chart---四角形雷达图",
@"Pentagon Radar Chart---五角形雷达图",
@"Hexagon Radar Chart----六角形雷达图",
- @"adjustYAxisMaxAndMinValues----调整 X 轴和 Y 轴最大值"
+ @"adjustYAxisMaxAndMinValues----调整 X 轴和 Y 轴最大值",
+ @"custom Special Style DataLabel Of Single Data Element Chart",
],
/*混合类型图表*/
@[@"Arearange Mixed Line---面积范围均线图",