Latest 0.1.0
Homepage https://github.com/Kyohei-Sakai/PlugAndChugChart
License MIT
Platforms ios 8.0
Authors

PlugAndChugChart is simple scrollable chart written in Swift.

PlugAndChugChart

Features

Platform
Carthage compatible
License
![Language](http://img.shields.io/badge/language-swift 3.0-orange.svg?style=flat
)

  • Several types of chart
  • Scrollabel chart
  • Support @IBDesignable and @IBInspectable
  • Support Swift 3.0

Demo App

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

Open Example/PlugAndChugChart.xcworkspace and run PlugAndChugChart-Example to see a simple demonstration.

Usage

Initialization

PlugAndChugChart is subclass of UIScrollView, and can be initialized in a way same as UIScrollView.

let chart = PlugAndChugChart(frame: CGRect(x: 10, y: 20, width: 200, height: 300))

PlugAndChugChart is available in Interface Builder.
Set custom class of UIScrollView to PlugAndChugChart

@IBOutlet weak var chart: PlugAndChugChart!

Data Setting

You set chartValues and xAxisLabels to display chart on view.

let chartData: [CGFloat] = [30, 50, 19, 22, 46, 10, 1, 66, 35, 49, 38, 17]
let dataLabels: [String] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

chart.chartValues = chartData
chart.xAxisLabels = dataLabels

If you want to set Date type in x-Axis label, have only to set minimumDate.

chart.chartValues = chartData

chart.dataLabelType = .date
chart.minimumDate = Date()

more optional setting

chart.dateStyle = .hour
chart.dateInterval = 2

Chrat Style

PlugAndChugChartStyle have .bar, .round, .jaggy.

chart.style = .round  // default is .bar

Layout

If you customize PlugAndChugChartComponent layout, change layout properties.

chart.setBarWidth(rate: 0.9)
chart.setBarAreaHeight(rate: 0.9)
chart.setMaxChartValue(rate: 0.6)
chart.setComponentArea(width: 100)

Requirements

  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3.0+

Installation

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

pod "PlugAndChugChart"

Author

Kyohei-Sakai, [email protected]

License

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

Latest podspec

{
    "name": "PlugAndChugChart",
    "version": "0.1.0",
    "summary": "PlugAndChugChart is scrollable chart in Swift.",
    "description": "PlugAndChugChart is simple scrollable chart written in Swift.nn- Several types of chartn- Scrollabel chartn- Support @IBDesignable and @IBInspectablen- Support Swift 3.0",
    "homepage": "https://github.com/Kyohei-Sakai/PlugAndChugChart",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Kyohei-Sakai": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Kyohei-Sakai/PlugAndChugChart.git",
        "tag": "0.1.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "PlugAndChugChart/Classes/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This