AMVennDiagramView
is a view can display the diagram like Venn diagram. It displays two circles whose area ratio is almost an accurate.
Create vennDiagramView.
let vennDiagramView = AMVennDiagramView(frame: view.bounds)
view.addSubview(vennDiagramView)
vennDiagramView.setupVennDiagram(value1: 1000, value2: 500, commonValue: 200)
vennDiagramView.dataSource = self
Conform to the protocol in the class implementation.
// MARK:- Required
func vennDiagramView(_ vennDiagramView: AMVennDiagramView, fillColorForSection section: Int) -> UIColor
func vennDiagramView(_ vennDiagramView: AMVennDiagramView, strokeColorForSection section: Int) -> UIColor
// MARK:- Optional
func vennDiagramView(_ vennDiagramView: AMVennDiagramView, titleForSection section: Int, value: CGFloat) -> String // default is empty
func titleForCommonArea(in vennDiagramView: AMVennDiagramView, value: CGFloat) -> String // default is empty
func vennDiagramView(_ vennDiagramView: AMVennDiagramView, textColorForSection section: Int) -> UIColor // default is black
func textColorForCommonArea(in vennDiagramView: AMVennDiagramView) -> UIColor // default is black
func vennDiagramView(_ vennDiagramView: AMVennDiagramView, textFontForSection section: Int) -> UIFont // default is System 17.0
func textFontForCommonArea(in vennDiagramView: AMVennDiagramView) -> UIFont // default is System 17.0
section
of value1
is 0
. section
of value2
is 1
.
Add this to your Podfile.
pod 'AMVennDiagramView'
Add this to your Cartfile.
github "adventam10/AMVennDiagramView"
MIT