Version 3.0.1, synced to MPAndroidChart #345b4bc

alt tag Supported Platforms Releases Latest pod release Carthage compatible Build Status codecov Join the chat at https://gitter.im/danielgindi/Charts

Just a heads up: Charts 3.0 has some breaking changes. Please read the release/migration notes.

  • Xcode 8.0 / Swift 3.0 (For Swift 2.3 support please use Charts 2.3.0)
  • iOS >= 8.0 (Use as an Embedded Framework)
  • tvOS >= 9.0
  • macOS >= 10.11

Okay so there's this beautiful library called MPAndroidChart by Philipp Jahoda which has become very popular amongst Android developers, and in the meanwhile there's no decent charting solution 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?

  • ChartsDemo/ChartsDemo.xcodeproj is the demo project for iOS/tvOS
  • ChartsDemo-OSX/ChartsDemo-OSX.xcodeproj is the demo project for macOS
  • Make sure you are running a supported version of Xcode.
    • Usually it is specified here a few lines above.
    • In most cases it will be the latest Xcode version.
  • Make sure that your project supports Swift 3.0
  • Run carthage checkout in the project folder, to fetch dependencies (i.e Realm).
    • Realm is not required for using Charts - it is just a feature. But as the demo demonstrates Realm - you have to have it when running the demo.
    • If you don't have Carthage - you can get it here.

Usage

In order to correctly compile:

  1. Drag the Charts.xcodeproj to your project
  2. Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select the Charts.framework
  3. @import Charts
  4. When using Swift in an ObjC project:
  • 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 :-)
  • (Xcode 8.1 and earlier) Under "Build Options", mark "Embedded Content Contains Swift Code"
  • (Xcode 8.2+) Under "Build Options", mark "Always Embed Swift Standard Libraries"
  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 Charts. We will do our best to always compile against the latest version.

3rd party tutorials

Troubleshooting

Can't compile?

  • Please note the difference between installing a compiled framework from CocoaPods or Carthage, and copying the source code.
  • If you are using Realm, please also #import <ChartsRealm/ChartsRealm.h>
  • If you are compiling the source code and want to use Realm, please make sure to include the code from ChartsRealm project.
  • Please read the Usage section again.
  • Search in the issues
  • Try to politely ask in the issues section

Other problems / feature requests

  • Search in the issues
  • Try to politely ask in the issues section

CocoaPods Install

Add pod 'Charts' to your Podfile. "Charts" is the name of the library.

For Realm support you can specify the subspec in your Podfile as follows:

pod 'Charts/Realm'

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.0.1
github "danielgindi/Charts" ~> 3.0.1

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

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:

  • Contribute code, issues and pull requests
  • Let people know this library exists (



版本3.0.1 同步到 MPAndroidChart#345b4bc

alt 支持的平台 唱片集 / A> 迦太基兼容 建立状态 codecov 在https://gitter.im/danielgindi/Charts

只是一个头脑:图表3.0有一些突破性的变化。请阅读发布/迁移说明

  • Xcode 8.0 / Swift 3.0(对于Swift 2.3支持,请使用图表2.3.0 ) li>
  • iOS&gt; = 8.0(用作嵌入式框架)
  • tvOS&gt; = 9.0
  • macOS&gt; = 10.11
好吧,这个美丽的图书馆由 MPAndroidChart 通过 Philipp Jahoda ,它在Android开发人员中非常受欢迎,同时还没有适合iOS的体面图表解决方案。

我选择将它写入 Swift ,因为它可以被编译器高度优化,并且可以在 Swift ObjC </代码>项目。演示项目以 ObjC 编写,以演示它的工作原理。

这个图书馆的一个惊人的功能现在是Android,iOS,tvOS和macOS,它是为两个平台开发时节省的时间,因为学习曲线是单一的 - 只发生一次,并且代码保持非常相似,所以开发人员不用去重新创建应用程序来生成与不同库相同的输出。 (甚至没有考虑到现在还没有真正的另外一个好的选择…)

无法运行演示?

  • ChartsDemo / ChartsDemo.xcodeproj 是iOS / tvOS的演示项目
  • ChartsDemo-OSX / ChartsDemo-OSX.xcodeproj 是macOS的演示项目
  • 确保您正在运行受支持的Xcode版本。
    • 通常这里指定了上面几行。
    • 在大多数情况下,它将是最新的Xcode版本。
  • 确保您的项目支持Swift 3.0
  • 在项目文件夹中运行 carthage checkout ,以获取依赖关系(即Realm)。
    • 使用图表不需要领域 - 这只是一个功能。但是,演示演示了Realm - 您必须在运行演示时才能使用它。
    • 如果您没有Carthage - 您可以获取此处

用法

为了正确编译:

  1. Drag the Charts.xcodeproj to your project
  2. Go to your target's settings, hit the "+" under the "Embedded Binaries" section, and select the Charts.framework
  3. @import Charts
  4. When using Swift in an ObjC project:
    您需要导入桥接头。通常它是 YourProject-Swift.h ,所以在ChartsDemo中它是 ChartsDemo-Swift.h 。不要在您的项目中实际包含 ChartsDemo-Swift.h : - )
  • (Xcode 8.1及更早版本)在构建选项下,标记嵌入内容包含Swift代码
  • (Xcode 8.2+)在Build Options下,标记Always Embed Swift Standard Libraries
  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 Charts. We will do our best to always compile against the latest version.

第三方教程

故障排除

Can't compile?

  • 请注意,从CocoaPods或Carthage安装编译框架以及复制源代码之间的区别。
  • 如果您使用的是领域,请另附 #import&lt; ChartsRealm / ChartsRealm.h&gt;
  • 如果您正在编译源代码并想要使用领域,请确保包含 ChartsRealm 项目中的代码。
  • 请再次阅读使用部分。
  • 搜索问题
  • 尝试在问题部分
  • 中礼貌地问

Other problems / feature requests

  • 搜索问题
  • 尝试在问题部分
  • 中礼貌地问

CocoaPods安装

pod’Charts’添加到您的Podfile中。 图表是图书馆的名称。

对于 Realm 支持,您可以在Podfile中指定子选项,如下所示:

pod 'Charts/Realm'

注意: pod’ios-charts’ 不是正确的库,而是由其他人引用另一个项目。 p>

迦太基安装

现在的图表包括迦太基预制二进制文件。

github "danielgindi/Charts" == 3.0.1
github "danielgindi/Charts" ~> 3.0.1

为了构建新版本的二进制文件,请使用 carthage build –no-skip-current&amp; amp;&amp;迦太基档案图表&amp;&amp;迦太基档案ChartsRealm

第三方绑定

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

帮助

如果您喜欢这里所看到的内容,并希望支持在此存储库中完成的工作,您可以:

  • Contribute code, issues and pull requests
  • Let people know this library exists (