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

Related tags

Charts Graphs
Overview

#Graphs Badge w/ Version Carthage compatible MIT License

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

Graphs mock

Requirements

  • iOS 8.0+
  • XCode 7.3+

Installation

CocoaPods

$ pod init

specify it in your Podfile

platform :ios, '8.0'

target 'TargetName' do

  use_frameworks!
  pod 'Graphs', '~> 0.1.2'

end

And run CocoaPods

$ pod install

--

Carthage

You can install Carthage with Homebrew.

$ brew update
$ brew install carthage

specify it in your Cartfile

github "recruit-mtl/Graphs"

And run carthage

$ carthage update --platform ios

Usage

#####import Graphs

import Graphs
Range -> GraphView (Bar)
let view = (1 ... 10).barGraph(GraphRange(min: 0, max: 11)).view(viewFrame)

Array -> GraphView (Line)
let view = [10, 20, 4, 8, 25, 18, 21, 24, 8, 15].lineGraph(GraphRange(min: 0, max: 30)).view(viewFrame)

Dictionary -> GraphView (Pie)
let view = ["a": 3, "b": 8, "c": 9, "d": 20].pieGraph().view(viewFrame)
GraphData protocol -> GraphView (Pie)
import Graphs

struct Data<T: Hashable, U: NumericType>: GraphData {
    typealias GraphDataKey = T
    typealias GraphDataValue = U
    
    private let _key: T
    private let _value: U
    
    init(key: T, value: U) {
        self._key = key
        self._value = value
    }
    
    var key: T { get{ return self._key } }
    var value: U { get{ return self._value } }
}

let data = [
    Data(key: "John", value: 18.9),
    Data(key: "Ken", value: 32.9),
    Data(key: "Taro", value: 15.3),
    Data(key: "Micheal", value: 22.9),
    Data(key: "Jun", value: 12.9),
    Data(key: "Hanako", value: 32.2),
    Data(key: "Kent", value: 3.8)
]

let view = data.pieGraph() { (unit, totalValue) -> String? in
    return unit.key! + "\n" + String(format: "%.0f%%", unit.value / totalValue * 100.0)
}.view(viewFrame)

More detail

-> Read Playgrounds

Demo

$ git clone https://github.com/recruit-mtl/Graphs.git
$ cd /path/to/Graphs/GraphsExample
$ pod install

And Open GraphsExample.xcworkspace

Issues

GraphView doesn't work on Interface builder.

Interface Builder talks to code through the ObjC runtime. And ObjC doesn't do generics.

Licence

MIT

Author

You might also like...
FLCharts: Easy to use and highly customizable charts library for iOS
FLCharts: Easy to use and highly customizable charts library for iOS

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

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

Easy to use and highly customizable pie charts library for iOS
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

Health Sample app using Swift, RxSwift, Anchorage, Charts
Health Sample app using Swift, RxSwift, Anchorage, Charts

HealthSample First run pod install, then build the project and run in your devices or simulators. This project has used RIBs, Swift, RxSwift, Anchorag

Using Swift Charts and Voiceover Chart Descriptor to compose music. 🤯
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-

SwiftUI Charts with custom styles
SwiftUI Charts with custom styles

SwiftUI Charts Build custom charts with SwiftUI Styles Line Chart(data: [0.1, 0.3, 0.2, 0.5, 0.4, 0.9, 0.1]) .chartStyle( LineChartStyle(.

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.

An adaptive scrollable graph view for iOS to visualise simple discrete datasets. Written in Swift.
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

Comments
  • Upgraded to Swift 4, Fixed Example, Fixed strings (working with Xcode Version 9.4 (9F1027a))

    Upgraded to Swift 4, Fixed Example, Fixed strings (working with Xcode Version 9.4 (9F1027a))

    Please clone.

    pod install under example directory.

    Run example and if all works out please merge.

    I have tested this with latest Xcode and Swift symbols.

    opened by allnash 0
  •  Showing Recent Issues Command failed due to signal: Segmentation fault: 11

    Showing Recent Issues Command failed due to signal: Segmentation fault: 11

    Showing Recent Issues
    Check dependencies
    
    Write auxiliary files
    
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-generated-files.hmap
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/module.modulemap
    /bin/mkdir -p /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Objects-normal/x86_64
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Objects-normal/x86_64/Graphs.LinkFileList
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-all-non-framework-target-headers.hmap
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/swift-overrides.hmap
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/unextended-module.modulemap
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-project-headers.hmap
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Objects-normal/x86_64/Graphs-OutputFileMap.json
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-all-target-headers.hmap
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-own-target-headers.hmap
    /bin/mkdir -p /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/DerivedSources
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/DerivedSources/Graphs_vers.c
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/unextended-module-overlay.yaml
    write-file /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs.hmap
    
    Create product structure
    
    /bin/mkdir -p /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Products/Debug-iphonesimulator/Graphs/Graphs.framework/Modules
    /bin/mkdir -p /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Products/Debug-iphonesimulator/Graphs/Graphs.framework/Headers
    
    ProcessInfoPlistFile /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Products/Debug-iphonesimulator/Graphs/Graphs.framework/Info.plist Target\ Support\ Files/Graphs/Info.plist
        cd "/Users/Liguo_Jiao/Programming project/GymWorkoutManager/Pods"
        export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
        builtin-infoPlistUtility /Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Target\ Support\ Files/Graphs/Info.plist -expandbuildsettings -format binary -platform iphonesimulator -o /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Products/Debug-iphonesimulator/Graphs/Graphs.framework/Info.plist
    
    CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
        cd "/Users/Liguo_Jiao/Programming project/GymWorkoutManager/Pods"
        export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
        export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
        export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk
        /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name Graphs -Onone -D COCOAPODS -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -target x86_64-apple-ios8.0 -g -module-cache-path /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/ModuleCache -Xfrontend -serialize-debugging-options -enable-testing -I /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Products/Debug-iphonesimulator/Graphs -F /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Products/Debug-iphonesimulator/Graphs -c -j8 /Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Graphs/Graphs/BarGraphView.swift /Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Graphs/Graphs/Graph.swift /Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Graphs/Graphs/GraphsExtensions.swift /Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Graphs/Graphs/GraphView.swift /Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Graphs/Graphs/LineGraphView.swift /Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Graphs/Graphs/MultiBarGraphView.swift /Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Graphs/Graphs/PieGraphView.swift -output-file-map /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Objects-normal/x86_64/Graphs-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Objects-normal/x86_64/Graphs.swiftmodule -Xcc -I/Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-generated-files.hmap -Xcc -I/Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-own-target-headers.hmap -Xcc -I/Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Graphs-project-headers.hmap -Xcc -I/Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Products/Debug-iphonesimulator/Graphs/include -Xcc -I/Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Headers/Private -Xcc -I/Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods/Headers/Public -Xcc -I/Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/DerivedSources/x86_64 -Xcc -I/Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/DerivedSources -Xcc -DPOD_CONFIGURATION_DEBUG=1 -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -emit-objc-header -emit-objc-header-path /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/Objects-normal/x86_64/Graphs-Swift.h -import-underlying-module -Xcc -ivfsoverlay -Xcc /Users/Liguo_Jiao/Library/Developer/Xcode/DerivedData/GymWorkoutManager-acwsmghbukvzhicjjiawbwtrhtxf/Build/Intermediates/Pods.build/Debug-iphonesimulator/Graphs.build/unextended-module-overlay.yaml -Xcc -working-directory/Users/Liguo_Jiao/Programming\ project/GymWorkoutManager/Pods
    
    <unknown>:0: error: unable to execute command: Segmentation fault: 11
    <unknown>:0: error: compile command failed due to signal (use -v to see invocation)
    
    
    
    Activity Log Complete    29/03/17, 4:28 PM
    
    opened by iceman201 0
Owner
Recruit Holdings. Media Technology Lab
Recruit Holdings. Media Technology Lab
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
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.

Daniel Cohen Gindi 26.3k Jan 3, 2023
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
🎉 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

Dennis Concepción Martín 94 Dec 26, 2022
🎉 SwiftUI stock charts for iOS

?? SwiftUI stock charts for iOS

Dennis Concepción Martín 94 Dec 26, 2022
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

Michelangelo Chasseur 363 Nov 28, 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
Core Charts | Basic Scrollable Chart Library for iOS

Core Charts | Basic Chart Library for iOS HCoreBarChart VCoreBarChart Requirements Installation Usage Appearance Customization Getting Started You nee

Çağrı ÇOLAK 71 Nov 17, 2022