AMVennDiagramView 2.1.0

AMVennDiagramView 2.1.0

Maintained by am10.



  • By
  • am10

AMVennDiagramView

Pod Platform Pod License Pod Version Carthage Compatible Swift Package Manager compatible

AMVennDiagramView is a view can display the diagram like Venn diagram. It displays two circles whose area ratio is almost an accurate.

Demo

2018-02-17 18 31 11

Usage

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.

Installation

CocoaPods

Add this to your Podfile.

pod 'AMVennDiagramView'

Carthage

Add this to your Cartfile.

github "adventam10/AMVennDiagramView"

License

MIT