Giter VIP home page Giter VIP logo

fklinechart's Introduction

FKLineChart

Installation

CocoaPods

Add the following entry to your Podfile:

pod 'FKLineChart'

Then run:

pod install

Don't forget to import FKLineChart in every file you'd like to use line chart :

import FKLineChart

Usage

1- Add a UIView to your storyboard and set its custom class FKLineChart.

2- Create an outlet of view you created.

@IBOutlet weak var lineChart: FKLineChart!

3- Create an array that holds FKLineChartPoint objects. For this there are three options:

If you want to see info board when you tap a point, then use third one.

4- After you created the array like this:

var pointsArray: [FKLineChartPoint] = [
        FKLineChartPoint(percentage: 30, color: .red, firstText: "First 1", secondText: "Second 1"),
        FKLineChartPoint(percentage: 50, color: .yellow, firstText: "First 2", secondText: "Second 2"),
        FKLineChartPoint(percentage: 40, color: .green, firstText: "First 3", secondText: "Second 3"),
        FKLineChartPoint(percentage: 70, color: .cyan, firstText: "First 4", secondText: "Second 4"),
        FKLineChartPoint(percentage: 60, color: .orange, firstText: "First 5", secondText: "Second 5"),
    ]

Now you can show line chart:

override func viewDidLoad() {
        super.viewDidLoad()
        
        lineChart.showChart(points: pointsArray)
}

Result

Advance Usage

You can customize your chart as you wish! :

lineChart.lineWidth = 2.0
lineChart.lineColor = .black
lineChart.circleLineWidth = 2.0
lineChart.circleRadius = 5.0
lineChart.infoBoardBackgroundColor = UIColor(red: 15/255, green: 5/255, blue: 42/255, alpha: 1)
lineChart.infoBoardSeperatorColor = UIColor(red: 37/255, green: 27/255, blue: 63/255, alpha: 1)
lineChart.infoBoardWidth = 85
lineChart.infoBoardHeight = 50

And if you want, you can change texts colors:

lineChart.usePointColorForTextColor = false
lineChart.firstTextColor = .white
lineChart.secondTextColor = .red

fklinechart's People

Contributors

furkankurnaz avatar pauliusvindzigelskis 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.