До сих пор у меня есть заполненный круг, и об этом. Я пытаюсь составить круговую диаграмму, которая представляет количество удовлетворенных и неудовлетворенных клиентов и представляет ее. Я чрезвычайно новичок в CG, и мне было интересно, кто-то может прокрутить достаточно кода, чтобы дать мне идею или направить меня.
Должен ли я иметь нижний круг, представляющий количество довольных клиентов, а затем добавить еще один круг поверх него, чтобы показать неудовлетворенных клиентов? Я подхожу к нему правильным образом?
Вот мой код.
override func drawRect(rect: CGRect) {
// Get current context
let context = UIGraphicsGetCurrentContext()
// Set color
CGContextSetStrokeColorWithColor(context,UIColor(red: 0.2, green: 0.4, blue: 1, alpha: 1.0).CGColor)
let rectangle = CGRectMake((frame.size.width / 3) - 50, frame.size.height / 2 + 40,220,220)
CGContextAddEllipseInRect(context,rectangle)
CGContextSetFillColorWithColor(context, UIColor(red: 0.2, green: 0.4, blue: 1, alpha: 1.0).CGColor)
CGContextFillPath(context)
CGContextStrokePath(context)
}
EDIT
Кроме того, теперь я начинаю видеть, что мне, возможно, придется покрыть мой круг дугой, основанной на общем недовольстве клиента. Как увеличить или уменьшить размер дуги покрытия на основе количества людей?
Любая помощь будет чрезвычайно оценена!