Skip to content

Commit

Permalink
Fix #747 ✈️✈️✈️
Browse files Browse the repository at this point in the history
  • Loading branch information
AAChartModel committed Oct 16, 2019
1 parent 667709b commit 4ab6d79
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
50 changes: 50 additions & 0 deletions AAChartKitDemo/ChartsDemo/CustomStyleChartVC.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:@"%@%@",
@"<span style=""color:#FFFFFF;font-weight:thin;font-size:25px"">▲{y}</span>",
@"<span style=""color:#FFFFFF;font-weight:thin;font-size:17px""> m</span>"
];

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

3 changes: 2 additions & 1 deletion AAChartKitDemo/ChartsDemo/FirstViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -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---面积范围均线图",
Expand Down

0 comments on commit 4ab6d79

Please sign in to comment.