AAChartKit
AAChartKit copied to clipboard
PIE图百分线如何加长
PIE图百分线如何加长
参见 https://github.com/AAChartModel/AAChartKit/issues/247#issuecomment-561595150
配置 AAOptions
- (AAOptions *)adjustPieChartTitleAndDataLabelFontStyle {
AAOptions *aaOptions = AAOptions.new
.chartSet(AAChart.new.typeSet(AAChartTypePie))
.titleSet(AATitle.new
.useHTMLSet(true)
.textSet(@"<span style=""color:#1E90FF;font-weight:thin;font-size:13px"">    近七天 </span> <br> <span style=""color:#A9A9A9;font-weight:thin;font-size:10px""> 运行状态占比 </span>")//标题文本内容
.alignSet(AAChartTitleAlignTypeCenter)//标题水平居中
.verticalAlignSet(AAChartTitleVerticalAlignTypeMiddle)//标题垂直居中
.ySet(@0)//标题相对于垂直对齐的偏移量,取值范围:图表的上边距(chart.spacingTop )到图表的下边距(chart.spacingBottom),可以是负值,单位是px。默认值和字体大小有关。
)
.colorsSet(@[@"#1E90FF",@"#87CEFA",@"#A9A9A9",@"#fd4800",@"#F4A460"])//设置颜色主题
.seriesSet(@[
AASeriesElement.new
.sizeSet(@200)//环形图的半径大小
.innerSizeSet(@"60%")//内部圆环半径大小占比
.allowPointSelectSet(false)//是否允许在点击数据点标记(扇形图点击选中的块发生位移)
.dataLabelsSet(AADataLabels.new
.enabledSet(true)
.useHTMLSet(true)
.distanceSet(@30)//扇形图百分比线的长度
.formatSet(@"<span style=""color:#A9A9A9;font-weight:thin;font-size:10px"">{point.name}</span> <span style=""color:#1E90FF;font-weight:bold;font-size:15px"">{point.percentage:.1f}</span><span style=""color:#1E90FF;font-weight:thin;font-size:10px"">%</span>")
)
.dataSet(@[
@[@"Firefox", @150],
@[@"Opera", @15],
@[@"Others", @35]
]),
]);
return aaOptions;
}
绘图结果
