I want to display a subtitle below my main text in the center of the pie chart to let users know what the number represents. Is this possible? Right now I have a number that I converted to a string.
Below is my code:
func setCenter(days: Int){
let circleColor = UIColor.black
var textColor = UIColor.white
pieChart.holeRadiusPercent = 0.3
pieChart.transparentCircleRadiusPercent = 0.0
let dayString = String(describing: days)
let centerText = NSAttributedString(string: dayString , attributes: [
NSForegroundColorAttributeName:textColor,NSFontAttributeName: UIFont(name: "SubwayLogo",size:30)!])
pieChart.centerAttributedText = centerText
pieChart.centerTextRadiusPercent = 1.0
pieChart.holeColor = circleColor
}
Let me know if you need to see other parts of the code. Thanks!
Nvm, I figured it out. You have to create 2 mutable attributed strings and then concatenate them with the second having a "\n"
Make sure to play around with the spacing and sizes of the 2 mutable strings. I added an extra space before dayString to get it to align, pieChart is a little finicky.