Giter Club home page Giter Club logo

amchart's Introduction

AMChart

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

Demo

charts

Usage

AMBarChartView

bar

let barChartView = AMBarChartView(frame: view.bounds)

// customize here

barChartView.dataSource = self
view.addSubview(barChartView)

Conform to the protocol in the class implementation.

func numberOfSections(in barChartView: AMBarChartView) -> Int
func barChartView(_ barChartView: AMBarChartView, numberOfRowsInSection section: Int) -> Int
func barChartView(_ barChartView: AMBarChartView, valueForRowAtIndexPath indexPath: IndexPath) -> CGFloat
func barChartView(_ barChartView: AMBarChartView, colorForRowAtIndexPath indexPath: IndexPath) -> UIColor
func barChartView(_ barChartView: AMBarChartView, titleForXlabelInSection section: Int) -> String

Customization

AMBarChartView can be customized via the following properties.

@IBInspectable public var yAxisMaxValue: CGFloat = 1000
@IBInspectable public var numberOfYAxisLabel: Int = 6
@IBInspectable public var axisColor: UIColor = .black
@IBInspectable public var axisWidth: CGFloat = 1.0
@IBInspectable public var barSpace: CGFloat = 8
@IBInspectable public var yAxisTitleFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var xAxisTitleFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var yLabelsFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var xLabelsFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var yAxisTitleColor: UIColor = .black
@IBInspectable public var xAxisTitleColor: UIColor = .black
@IBInspectable public var yLabelsTextColor: UIColor = .black
@IBInspectable public var xLabelsTextColor: UIColor = .black
@IBInspectable public var isHorizontalLine: Bool = false
@IBInspectable public var yAxisTitle: String = ""
@IBInspectable public var xAxisTitle: String = ""
public var yAxisDecimalFormat: AMDecimalFormat = .none
public var animationDuration: CFTimeInterval = 0.6

AMLineChartView

line

let lineChartView = AMLineChartView(frame: view.bounds)

// customize here

lineChartView.dataSource = self
view.addSubview(lineChartView)

Conform to the protocol in the class implementation.

func numberOfSections(in lineChartView: AMLineChartView) -> Int
func numberOfRows(in lineChartView: AMLineChartView) -> Int
func lineChartView(_ lineChartView: AMLineChartView, valueForRowAtIndexPath indexPath: IndexPath) -> CGFloat
func lineChartView(_ lineChartView: AMLineChartView, colorForSection section: Int) -> UIColor
func lineChartView(_ lineChartView: AMLineChartView, titleForXlabelInRow row: Int) -> String
func lineChartView(_ lineChartView: AMLineChartView, pointTypeForSection section: Int) -> AMPointType

Customization

AMLineChartView can be customized via the following properties.

@IBInspectable public var yAxisMaxValue: CGFloat = 1000
@IBInspectable public var yAxisMinValue: CGFloat = 0
@IBInspectable public var numberOfYAxisLabel: Int = 6
@IBInspectable public var axisColor: UIColor = .black
@IBInspectable public var axisWidth: CGFloat = 1.0
@IBInspectable public var yAxisTitleFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var xAxisTitleFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var yLabelsFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var xLabelsFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var yAxisTitleColor: UIColor = .black
@IBInspectable public var xAxisTitleColor: UIColor = .black
@IBInspectable public var yLabelsTextColor: UIColor = .black
@IBInspectable public var xLabelsTextColor: UIColor = .black
@IBInspectable public var isHorizontalLine: Bool = false
@IBInspectable public var yAxisTitle: String = ""
@IBInspectable public var xAxisTitle: String = ""
public var yAxisDecimalFormat: AMDecimalFormat = .none
public var animationDuration: CFTimeInterval = 0.6

AMPieChartView

pie

let pieChartView = AMPieChartView(frame: view.bounds)

// customize here

pieChartView.delegate = self
pieChartView.dataSource = self
view.addSubview(pieChartView)

Conform to the protocol in the class implementation.

/// DataSource
func numberOfSections(in pieChartView: AMPieChartView) -> Int
func pieChartView(_ pieChartView: AMPieChartView, valueForSection section: Int) -> CGFloat
func pieChartView(_ pieChartView: AMPieChartView, colorForSection section: Int) -> UIColor

/// Delegate
func pieChartView(_ pieChartView: AMPieChartView, didSelectSection section: Int) {
    // use selected section here
}

func pieChartView(_ pieChartView: AMPieChartView, didDeSelectSection section: Int) { 
    // use deselected section here
}

Customization

AMPieChartView can be customized via the following properties.

@IBInspectable public var isDounut: Bool = false
@IBInspectable public var centerLabelFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var centerLabelTextColor: UIColor = .black
@IBInspectable public var centerLabelText: String = ""
public var animationDuration: CFTimeInterval = 0.4
public var selectedAnimationDuration: CFTimeInterval = 0.3
public var centerLabelAttributedText: NSAttributedString? = nil

AMRadarChartView

radar

let radarChartView = AMRadarChartView(frame: view.bounds)

// customize here

radarChartView.dataSource = self
view.addSubview(radarChartView)

Conform to the protocol in the class implementation.

/// Required
func numberOfSections(in radarChartView: AMRadarChartView) -> Int
func numberOfRows(in radarChartView: AMRadarChartView) -> Int
func radarChartView(_ radarChartView: AMRadarChartView, valueForRowAtIndexPath indexPath: IndexPath) -> CGFloat
func radarChartView(_ radarChartView: AMRadarChartView, fillColorForSection section: Int) -> UIColor
func radarChartView(_ radarChartView: AMRadarChartView, strokeColorForSection section: Int) -> UIColor

/// Optional
func radarChartView(_ radarChartView: AMRadarChartView, titleForVertexInRow row: Int) -> String
func radarChartView(_ radarChartView: AMRadarChartView, fontForVertexInRow row: Int) -> UIFont // default is System 15.0
func radarChartView(_ radarChartView: AMRadarChartView, textColorForVertexInRow row: Int) -> UIColor // default is black

Customization

AMRadarChartView can be customized via the following properties.

@IBInspectable public var axisMaxValue: CGFloat = 5.0
@IBInspectable public var axisMinValue: CGFloat = 0.0
@IBInspectable public var numberOfAxisLabels: Int = 6
@IBInspectable public var axisColor: UIColor = .black
@IBInspectable public var axisWidth: CGFloat = 1.0
@IBInspectable public var axisLabelsFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var axisLabelsTextColor: UIColor = .black
@IBInspectable public var isDottedLine: Bool = false
public var axisDecimalFormat: AMDecimalFormat = .none
public var animationDuration: CFTimeInterval = 0.6

AMScatterChartView

scatter

let scatterChartView = AMScatterChartView(frame: view.bounds)

// customize here

scatterChartView.dataSource = self
view.addSubview(scatterChartView)

Conform to the protocol in the class implementation.

func numberOfSections(in scatterChartView: AMScatterChartView) -> Int
func scatterChartView(_ scatterChartView: AMScatterChartView, numberOfRowsInSection section: Int) -> Int
func scatterChartView(_ scatterChartView: AMScatterChartView, valueForRowAtIndexPath indexPath: IndexPath) -> AMScatterValue
func scatterChartView(_ scatterChartView: AMScatterChartView, colorForSection section: Int) -> UIColor
func scatterChartView(_ scatterChartView: AMScatterChartView, pointTypeForSection section: Int) -> AMPointType

Customization

AMScatterChartView can be customized via the following properties.

@IBInspectable public var yAxisMaxValue: CGFloat = 1000
@IBInspectable public var yAxisMinValue: CGFloat = 0
@IBInspectable public var numberOfYAxisLabel: Int = 6
@IBInspectable public var xAxisMaxValue: CGFloat = 1000
@IBInspectable public var xAxisMinValue: CGFloat = 0
@IBInspectable public var numberOfXAxisLabel: Int = 6
@IBInspectable public var axisColor: UIColor = .black
@IBInspectable public var axisWidth: CGFloat = 1.0
@IBInspectable public var yAxisTitleFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var xAxisTitleFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var yLabelsFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var xLabelsFont: UIFont = .systemFont(ofSize: 15)
@IBInspectable public var yAxisTitleColor: UIColor = .black
@IBInspectable public var xAxisTitleColor: UIColor = .black
@IBInspectable public var yLabelsTextColor: UIColor = .black
@IBInspectable public var xLabelsTextColor: UIColor = .black
@IBInspectable public var isHorizontalLine: Bool = false
@IBInspectable public var yAxisTitle: String = ""
@IBInspectable public var xAxisTitle: String = ""
public var yAxisDecimalFormat: AMDecimalFormat = .none
public var xAxisDecimalFormat: AMDecimalFormat = .none
public var animationDuration: CFTimeInterval = 0.6

Installation

CocoaPods

Add this to your Podfile.

pod 'AMChart'

Carthage

Add this to your Cartfile.

github "adventam10/AMChart"

License

MIT

amchart's People

Contributors

adventam10 avatar ezefranca avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.