Core Charts | Basic Scrollable Chart Library for iOS

Overview

Core Charts | Basic Chart Library for iOS

CocoaPods Compatible CocoaPods Compatible

HCoreBarChart VCoreBarChart

Getting Started

You need a Cocoapods installed mac, if you are not familiar that visit here CocoaPods

Requirements

  • XCode 8.3+
  • iOS 9.3+

Installation

Add your pod file

pod 'CoreCharts'

and than hit the your command line

pod install 

now you are ready to use CoreCharts

Usage

import where you want to use

import CoreCharts

and than open up your storyboard or xib file and add new UIView drop your main view. afterwards change subclass to Vertical for VCoreBarChart or Horizontal chart for HCoreBarChart

alt text

referance it!

@IBOutlet weak var barChart: VCoreBarChart!

most important setup is ready, now you can use some of featuristic CoreChart's properties.

firstly you need conform your class to data source protocol,

class DemoViewController: UIViewController,CoreChartViewDataSource {

    @IBOutlet weak var barChart: VCoreBarChart!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        barChart.dataSource = self
    }

now, you have two methods, implement it.

func loadCoreChartData() -> [CoreChartEntry]

optional func didTouch(entryData: CoreChartEntry)

loadCoreChartData method is fill your bar charts, you need to convert your data to CoreChartEntry type

func loadCoreChartData() -> [CoreChartEntry] {

        var allCityData = [CoreChartEntry]()
    
        let cityNames = ["Istanbul","Antalya","Ankara","Trabzon","İzmir"]
    
        let plateNumber = [34,07,06,61,35]
        
        for index in 0..<cityNames.count {
            
            let newEntry = CoreChartEntry(id: "\(plateNumber[index])", 
                                          barTitle: cityNames[index], 
                                          barHeight: Double(plateNumber[index]), 
                                          barColor: rainbowColor())
                                          
                                          
            allCityData.append(newEntry)
            
        }
        
        return allCityData

}

CoreChartEntry properties

  • id = when you are use didTouch method and you want to access some data level for bar selection you need here.
  • barTitle = ... you now what it is :)
  • ..and the rest..

One more thing..

optional func didTouch(entryData: CoreChartEntry)

this method is optional and when you want to navigate your chart screens each other through selected your data level

data level means: Running a query on your data structures with id

Finish.

Here is the full code as you have just been told, and already in the demo project.

import CoreCharts

class DemoViewController: UIViewController,CoreChartViewDataSource {

    @IBOutlet weak var barChart: VCoreBarChart!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        barChart.dataSource = self
    }
    
    func didTouch(entryData: CoreChartEntry) {
        print(entryData.barTitle)
    }
    
    func loadCoreChartData() -> [CoreChartEntry] {
        
        return getTurkeyFamouseCityList()
        
    }
    
    
    func getTurkeyFamouseCityList()->[CoreChartEntry] {
        var allCityData = [CoreChartEntry]()
        let cityNames = ["Istanbul","Antalya","Ankara","Trabzon","İzmir"]
        let plateNumber = [34,07,06,61,35]
        
        for index in 0..<cityNames.count {
            
            let newEntry = CoreChartEntry(id: "\(plateNumber[index])", 
                                          barTitle: cityNames[index], 
                                          barHeight: Double(plateNumber[index]), 
                                          barColor: rainbowColor())
                                          
                                         
            allCityData.append(newEntry)
            
        }
        
        return allCityData
        
    }
 
}

Appearance Customization

CoreBarChartsDisplayConfig Class

You can change ui appearance for charts with CoreBarChartsDisplayConfig class and there have properties, here is the how to do this.

Direct use

You can use one shot initializer

import CoreCharts

class DemoViewController: UIViewController,CoreChartViewDataSource {

    @IBOutlet weak var barChart: VCoreBarChart!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        barChart.dataSource = self
        
        barChart.displayConfig = CoreBarChartsDisplayConfig(barWidth: 40.0,
                                                            barSpace: 20.0,
                                                            bottomSpace: 20.0,
                                                            topSpace: 20.0,
                                                            backgroundColor: UIColor.black,
                                                            titleFontSize: 12,
                                                            valueFontSize: 14,
                                                            titleFont: UIFont(),
                                                            valueFont: UIFont(),
                                                            titleLength: 12)
    }

Spesific use

You can use only what you just need.

import CoreCharts

class DemoViewController: UIViewController,CoreChartViewDataSource {

    @IBOutlet weak var barChart: VCoreBarChart!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        barChart.dataSource = self
        
        bbarChart.displayConfig.barWidth = 10
        barChart.displayConfig.barSpace = 20
        barChart.displayConfig.titleFontSize = 15
    }

Contribute are Welcome 🎉

Versioning

We use SemVer for versioning. For the versions available, see the CoreCharts Tagi wagi.

Authors

  • Çağrı ÇOLAK - Sr.iOS Developer - Github
  • Kemal TÜRK - jr.iOS Developer / Android Developer - Github

License

This project is licensed under the MIT - see the LICENSE.md file for details

Bug Report

  • if you catch some bug please use add issue section.

Add new feature

  • you can write a suggestion for the next new feature in the project section.

Other My Repos

  • TextSphere - TextSphere is a small framework for customized TextView
You might also like...
SwiftUICharts - A charts / plotting library for SwiftUI.
SwiftUICharts - A charts / plotting library for SwiftUI.

A charts / plotting library for SwiftUI. Works on macOS, iOS, watchOS, and tvOS and has accessibility features built in.

Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.

One more heads up: As Swift evolves, if you are not using the latest Swift compiler, you shouldn't check out the master branch. Instead, you should go to the release page and pick up whatever suits you.

🎉 SwiftUI stock charts for iOS
🎉 SwiftUI stock charts for iOS

SwiftUI Stock Charts Display interactive stock charts easily 🎉 Instalation In Xcode go to File - Swift packages - Add package dependency Copy and p

🎉 SwiftUI stock charts for iOS
🎉 SwiftUI stock charts for iOS

🎉 SwiftUI stock charts for iOS

An iOS wrapper for ChartJS. Easily build animated charts by leveraging the power of native Obj-C code.
An iOS wrapper for ChartJS. Easily build animated charts by leveraging the power of native Obj-C code.

TWRCharts TWRCharts An Obj-C wrapper for ChartJS. Easily build animated charts by leveraging the power of native code. TWRCharts is yet another charti

Light weight charts view generater for iOS. Written in Swift.
Light weight charts view generater for iOS. Written in Swift.

# ###Light weight charts view generater for iOS. Written in Swift. Requirements iOS 8.0+ XCode 7.3+ Installation CocoaPods $ pod init specify it in yo

LeetStats - iOS iPadOS application to get your Leetcode statistics using their public API while extensively making use of Charts and visualisation to depict data Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.
Beautiful charts for iOS/tvOS/OSX! The Apple side of the crossplatform MPAndroidChart.

Version 4.0.0, synced to MPAndroidChart #f6a398b Just a heads up: Charts 3.0 has some breaking changes. Please read the release/migration notes. Anoth

Aplikasi iOS kasus Covid-19 di U.S dengan Storyboard, Framework Charts dari danielgindi, dan API dari covidtracking.com
Aplikasi iOS kasus Covid-19 di U.S dengan Storyboard, Framework Charts dari danielgindi, dan API dari covidtracking.com

Aplikasi iOS kasus Covid-19 di U.S dengan Storyboard, Framework Charts dari danielgindi, dan API dari covidtracking.com

Comments
  • Set Background Color after Reload

    Set Background Color after Reload

    Thank you for providing CoreChart for use. I've tried the method you mentioned in the Red Background issue, but it didn't work. How can I fix this problem?

    This is my code. I tried to add it before and after reload the data. 螢幕快照 2019-07-30 下午6 12 23

    After reloading 螢幕快照 2019-07-30 下午6 12 36

    opened by TSAI-HSIAO-HAN 1
  • Can't change the appreance

    Can't change the appreance

    Thanks for making this library. I am not able to figure it out how to change the appearance such as 'bar width', 'Bar gap'. I am using the following code in viewDidLoad method

    ` func initChartUI() {
        chartView.displayConfig = CoreBarChartsDisplayConfig(barWidth: 10.0,
                                                             barSpace: 10.0,
                                                             bottomSpace: 20.0,
                                                             topSpace: 20.0,
                                                             backgroundColor: UIColor.red,
                                                             titleFontSize: 12,
                                                             valueFontSize: 14,
                                                             titleFont: UIFont(),
                                                             valueFont: UIFont(),
                                                             titleLength: 12)
    }`
    

    The output is : https://ibb.co/gvyk7Z1 How can I change the bar gap and bar width?

    help wanted 
    opened by amixpal 1
  • Two view as coreChats in the same view controller

    Two view as coreChats in the same view controller

    Hi i am using two view as coreChats in the same view controller. please let me know how to handle this situation. i am only getting same value in both the views.i want to show different values there.

    Thanks & Regards Tapan Raut

    opened by TapanRaut 0
Releases(1.0.7)
Owner
Çağrı ÇOLAK
iOS Developer
Çağrı ÇOLAK
SwiftUI library to easily render diagrams given a tree of objects. Similar to ring chart, sunburst chart, multilevel pie chart.

Swift Sunburst Diagram Sunburst diagram is a library written with SwiftUI to easily render diagrams given a tree of objects. Similar to ring chart, su

Ludovic Landry 494 Dec 19, 2022
Dr-Charts Easy to use, customizable and interactive charts library for iOS in Objective-C

dr-charts Easy to use, customizable and interactive charts library for iOS in Objective-C Features: Multiple chart types Line / Multiple lines / Lines

Zomato 93 Oct 10, 2022
An overview of the different types of charts you can make with Swift Charts

Swift Charts Examples This repo aims to provide sample code for lots of different chart types for you to use as inspiration for your own projects. We

Jordi Bruin 1.2k Dec 30, 2022
A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.

⚡ A powerful & easy to use chart library for Android ⚡ Charts is the iOS version of this library Table of Contents Quick Start Gradle Maven Documentat

Philipp Jahoda 36k Jan 5, 2023
Using Swift Charts and Voiceover Chart Descriptor to compose music. 🤯

Chart de lune ?? Using Swift Charts and Voiceover Chart Descriptor to compose music. ?? Image source: https://hadikarimi.com/portfolio/claude-debussy-

An Trinh 31 Nov 21, 2022
SwiftCharts - Easy to use and highly customizable charts library for iOS

SwiftCharts Easy to use and highly customizable charts library for iOS Features: Bars - plain, stacked, grouped, horizontal, vertical Scatter Lines (s

Ivan Schütz 2.4k Jan 4, 2023
Easy to use and highly customizable pie charts library for iOS

PieCharts Easy to use and highly customizable pie charts library for iOS Swift 4.2, iOS 8+ Video Features: Customizable slices Add overlays using simp

null 503 Dec 6, 2022
FLCharts: Easy to use and highly customizable charts library for iOS

FLCharts Requirements Xcode 11 / Swift 5 iOS >= 11.0 Installation FLCharts is av

Francesco Leoni 250 Dec 26, 2022
Easy to use and highly customizable pie charts library for iOS

PieCharts Easy to use and highly customizable pie charts library for iOS Swift 4.2, iOS 8+ Video Features: Customizable slices Add overlays using simp

null 503 Dec 6, 2022
An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift.

ScrollableGraphView Announcements 9-7-2017 - Version 4: Version 4 was released which adds multiple plots, dynamic reloading of values, more reference

Phillip 5.3k Jan 5, 2023