Latest 0.2.1
Homepage https://github.com/yasirfolio3/EasyBarChart
License MIT
Platforms ios 9.0, requires ARC
Authors

CI Status
Version
License
Platform
EasyBarChart hero
EasyBarChart hero
EasyBarChart hero
EasyBarChart hero

Features

  1. This pod allows you to create multiple bar charts
  2. Ease of use has been the utmost priority as seen by the example.
  3. It supports both iPad and iPhone resolutions and in all orientations
  4. Please follow the example project for proper implementation especially for orientation changes.

Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Use this code to generate Charts:

@IBOutlet weak var collectionView: UICollectionView!
var items = [BarDataModel]()
var barDataSource: BarDataSource!

override func viewDidLoad() {
    super.viewDidLoad()

    self.populateTemporaryItems() 
    barDataSource = BarDataSource(items: items, collectionView: collectionView, cellHeightToWidthRatio: 5)
    collectionView.dataSource = barDataSource
    collectionView.reloadData()
}

//Method to fill items Array
func populateTemporaryItems() {
    for n in 0...20{
        let barModel = BarDataModel()
        barModel.showArrow = (n % 2 == 0)
        barModel.barSize = 50
        barModel.backgroundImage = UIImage(named: "paper")!
        barModel.separatorColor = UIColor.red
        barModel.categoryImage = UIImage(named: "png")!
        barModel.topLabelText = "50"
        barModel.topLabelTextColor = UIColor.white
        barModel.topLabelBackgroundColor = UIColor.red
        barModel.bottomLabelText = "Title"

        self.items.append(barModel)
    }
}

Use these methods in your viewcontroller to handle orientation and device changes:

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    barDataSource.recalculateCellSizes()
}

override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
    super.viewWillTransition(to: size, with: coordinator)
    barDataSource.recalculateCellSizes()
}

Requirements

Swift 4.1
XCode 9.3

Installation

EasyBarChart is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'EasyBarChart'

Author

yasirfolio3, [email protected]

License

EasyBarChart is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "EasyBarChart",
    "version": "0.2.1",
    "summary": "Pod to create bar charts.",
    "swift_version": "4.1",
    "description": "This CocoaPod provides a simple interface to create multiple bar charts through UICollectionView.",
    "homepage": "https://github.com/yasirfolio3/EasyBarChart",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "yasirfolio3": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yasirfolio3/EasyBarChart.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "9.0"
    },
    "requires_arc": true,
    "source_files": "EasyBarChart/Classes/**/*"
}

Pin It on Pinterest

Share This