Charts README

The project's README from github.com/ChartsOrg/Charts. As one markdown file: README.md.

Version 4.0.0, synced to MPAndroidChart #f6a398b

alt tag

Build Supported Platforms Releases Latest pod release Carthage compatible

Just a heads up: Charts 5.0 has some breaking changes. Charts has now been renamed DGCharts to prevent conflicts with Apple's new Swift Charts. Please read the release/migration notes.

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.

Okay so there's this beautiful library called MPAndroidChart by Philipp Jahoda which has become very popular amongst Android developers, but there was no decent solution to create charts for iOS.

I've chosen to write it in Swift as it can be highly optimized by the compiler, and can be used in both Swift and ObjC project. The demo project is written in ObjC to demonstrate how it works.

An amazing feature of this library now, for Android, iOS, tvOS and macOS, is the time it saves you when developing for both platforms, as the learning curve is singleton- it happens only once, and the code stays very similar so developers don't have to go around and re-invent the app to produce the same output with a different library. (And that's not even considering the fact that there's not really another good choice out there currently...)

Having trouble running the demo?

Usage

In order to correctly compile:

  1. Drag the DGCharts.xcodeproj to your project
  2. Go to your target's settings, hit the "+" under the "Frameworks, Libraries, and Embedded Content" section, and select the DGCharts.framework
  3. @import DGCharts
  4. When using Swift in an ObjC project:
  1. 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 DGCharts. We will do our best to always compile against the latest version.
    • You'll need to add ChartsRealm as a dependency too.

3rd party tutorials

Video tutorials

Blog posts

Want your tutorial to show here? Create a PR!

Troubleshooting

Can't compile?

Other problems / feature requests

CocoaPods Install

Add pod 'DGCharts' to your Podfile. "DGCharts" is the name of the library.
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

DGCharts now include Carthage prebuilt binaries.

github "ChartsOrg/Charts" == 5.1.0
github "ChartsOrg/Charts" ~> 5.1.0

In order to build the binaries for a new release, use carthage build --no-skip-current && carthage archive Charts.

Swift Package Manager Install

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/ChartsOrg/Charts.git", .upToNextMajor(from: "5.1.0"))
]

3rd party bindings

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

Help

If you like what you see here, and want to support the work being done in this repository, you could:

Note: The author of MPAndroidChart is the reason that this library exists, and is accepting donations on his page. He deserves them!

Questions & Issues

If you are having questions or problems, you should:

Features

Core features:

Chart types:

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

alt tag

alt tag

alt tag

alt tag

alt tag

alt tag

alt tag

alt tag

Documentation

Currently there's no need for documentation for the iOS/tvOS/macOS version, as the API is 95% the same as on Android.
You can read the official MPAndroidChart documentation here: Wiki

Or you can see the Charts Demo project in both Objective-C and Swift (ChartsDemo-iOS, as well as macOS ChartsDemo-macOS) and learn the how-tos from it.

Special Thanks

Goes to @liuxuan30, @pmairoldi, @jjatie and @AlBirdie for new features, bugfixes, and lots and lots of involvement in our open-sourced community! You guys are a huge help to all of those coming here with questions and issues, and I couldn't respond to all of those without you.

Our amazing sponsors

Debricked: Use open source securely

debricked

License

Copyright 2016 Daniel Cohen Gindi & Philipp Jahoda

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Charts (ChartsOrg/Charts)

Searching Database…

28K ·GitHub
这是什么?Charts(现已更名为 DGCharts)是一个适用于苹果平台(iOS、tvOS 和 macOS)的图表库,可以让你在应用中绘制折线图、柱状图、饼图、散点图、K 线图、气泡图和雷达图。它是安卓平台热门库 MPAndroidChart 在苹果端的对应版本,两者的 API 几乎完全相同。
它是框架还是库?它是一个 Swift 框架/库,需要嵌入你自己的应用中,本身并不是独立应用。你需要把 DGCharts.xcodeproj 拖进你的项目,并链接 DGCharts.framework。
我该如何把它添加到项目中?你可以通过 CocoaPods(pod 'DGCharts')、Carthage(包含预编译二进制文件)、Swift Package Manager 安装,也可以手动把 Xcode 项目拖入并嵌入框架;如果是 Objective-C 项目,还需要导入桥接头文件。
我需要特定版本的 Xcode 或 Swift 吗?master 分支需要 Xcode 14 / Swift 5.7,支持 iOS 12+、tvOS 12+ 和 macOS 10.13+;如果你使用较旧的 Swift 编译器,应检出带标签的发布版本,而不是 master。
CocoaPods 上的 'ios-charts' 是正确的 pod 吗?不是。名为 'ios-charts' 的 pod 是另一个毫不相关的项目;正确的 pod 是 'DGCharts'(如果需要 Realm.io 数据绑定支持,还需安装 'ChartsRealm')。
这个库适合谁使用?适合需要在应用中实现图表功能的 iOS、tvOS 和 macOS 开发者(使用 Swift 或 Objective-C),尤其适合已在安卓上使用 MPAndroidChart、并希望在苹果平台获得几乎相同 API 的团队。
除了 iOS,它也支持 macOS 和 tvOS 吗?支持。它分别提供了 iOS/tvOS 和 macOS 的独立示例项目,可在全部三个苹果平台上运行。
开箱即用包含哪些图表类型?八种图表类型:折线图、柱状图(包括分组柱状图和水平柱状图)、饼图、散点图、K 线图、气泡图、雷达图,以及可在同一视图中混合柱状图、折线图、散点图、K 线图和气泡图的组合图表。
我能把图表数据直接绑定到数据库吗?可以,通过单独的 ChartsRealm 依赖,它支持直接绘制来自 Realm.io 移动数据库的数据。
这个库为什么改名为 DGCharts?为了避免与苹果自家的 Swift Charts 框架产生命名冲突,它从 Charts 更名为 DGCharts。该更名随 5.0 版本推出,并包含一些不兼容的改动。
API 有书面文档吗?没有专门针对 iOS 的文档,因为该 API 与 MPAndroidChart 约有 95% 相同;建议你查阅安卓库的 wiki 以及所附的 Objective-C/Swift 示例项目。
Creator
ChartsOrg
Size
189.5 MB
Stars
28K
Age
11y
Commits · 90 Days