Charts in Swift 5

Charts

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

 BarChart (with legend, simple design)


  • language: Swift 5
  • platform: ios | tvos | osx
  • device: iphone/ipad | Mac
  • license: Apache

Tag

Download

Installation

Cocoapods

use_frameworks!
pod 'Charts'
For Realm support, please add pod 'ChartsRealm' too.
Note: pod 'ios-charts' is not the correct library, and refers to a different project by someone else.

Carthage Install

Charts now include Carthage prebuilt binaries.

github "danielgindi/Charts" == 3.5.0
github "danielgindi/Charts" ~> 3.5.0
In order to build the binaries for a new release, use carthage build --no-skip-current && carthage archive Charts.

3rd party bindings

Xamarin (by @Flash3001): iOS - GitHub/NuGetAndroid - GitHub/NuGet.

Chart types:

Screenshots are currently taken from the original repository, as they render exactly the same :-)

LineChart (with legend, simple design)



LineChart (with legend, simple design)



LineChart (cubic lines)



LineChart (gradient fill)



Combined-Chart (bar- and linechart in this case)




BarChart (grouped DataSets)



Horizontal-BarChart



PieChart (with selection, ...)



ScatterChart (with squares, triangles, circles, ... and more)



CandleStickChart (for financial data)




BubbleChart (area covered by bubbles indicates the value)



RadarChart (spider web chart)



Usage

In order to correctly compile:

  1. 1. Drag the Charts.xcodeproj to your project
  2. 2. Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select the Charts.framework
  3. 3. When using Swift in an ObjC project:
  4. 4. You need to import your Bridging Header. Usually it is "YourProject-Swift.h", so in ChartsDemo it's "ChartsDemo-Swift.h". Do not try to actually include "ChartsDemo-Swift.h" in your project :-)
  5. 5. (Xcode 8.1 and earlier) Under "Build Options", mark "Embedded Content Contains Swift Code"
  6. 6. (Xcode 8.2+) Under "Build Options", mark "Always Embed Swift Standard Libraries"

When using Realm.io:

  • Note that the Realm framework is not linked with Charts - it is only there for optional bindings. Which means that you need to have the framework in your project, and in a compatible version to whatever is compiled with Charts. We will do our best to always compile against the latest version.
  • You'll need to add ChartsRealm as a dependency too.
  • @import Charts

Features

Core features:

  • 8 different chart types
  • Scaling on both axes (with touch-gesture, axes separately or pinch-zoom)
  • Dragging / Panning (with touch-gesture)
  • Combined-Charts (line-, bar-, scatter-, candle-stick-, bubble-)
  • Dual (separate) Axes
  • Customizable Axes (both x- and y-axis)
  • Highlighting values (with customizable popup-views)
  • Save chart to camera-roll / export to PNG/JPEG
  • Predefined color templates
  • Legends (generated automatically, customizable)
  • Animations (build up animations, on both x- and y-axis)
  • Limit lines (providing additional information, maximums, ...)
  • Fully customizable (paints, typefaces, legends, colors, background, gestures, dashed lines, ...)
  • Plotting data directly from Realm.io mobile database (here)

0 Comments: