第九天 iOS 绘图

开源库 ios-charts


https://github.com/danielgindi/ios-charts https://github.com/PhilJay/MPAndroidChart

使用


iOS 8 以上可直接用pods安装。

$ pod search charts


-> CSChartsView (0.1.0)
A light weight line graph drawing framework
pod 'CSChartsView', '~> 0.1.0'
- Homepage: https://github.com/sk344208651/CSChartsView
- Source:   https://github.com/sk344208651/CSChartsView.git
- Versions: 0.1.0 [master repo]


-> Charts (2.1.0)
ios-charts is a powerful & easy to use chart library for iOS
pod 'Charts', '~> 2.1.0'
- Homepage: https://github.com/danielgindi/ios-charts
- Source:   https://github.com/danielgindi/ios-charts.git
- Versions: 2.1.0, 2.0.9 [master repo]

iOS 7 拖动所有.swift到xcode工程中。

If you want to compile for iOS 7:

  1. Drag the code itself (.swift files) to your project. As sadly, Swift currently does not support compiling Frameworks for iOS 7.
  2. Make sure that the files are added to the Target membership.
  3. When using Swift in an ObjC project: a. 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 :-) a. Under “Build Options”, mark “Embedded Content Contains Swift Code”

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) Y-Axis
  • Finger drawing (draw values into the chart with touch-gesture)
  • Highlighting values (with customizeable popup-views)
  • Multiple / Separate Axes
  • Save chart to camera-roll / export to PNG/JPEG
  • Predefined color templates
  • Legends (generated automatically, customizeable)
  • Customizeable Axes (both x- and y-axis)
  • Animations (build up animations, on both x- and y-axis)
  • Limit lines (providing additional information, maximums, …)
  • Fully customizeable (paints, typefaces, legends, colors, background, gestures, dashed lines, …)

Screenshots


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

  • LineChart (with legend, simple design)

1.png

  • LineChart (with legend, simple design)

2.png

  • LineChart (cubic lines)

3.png

  • LineChart (single DataSet)

4.png

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

5.png

  • BarChart (with legend, simple design)

6.png

  • BarChart (grouped DataSets)

7.png

  • Horizontal-BarChart

8.png

  • PieChart (with selection, …)

9.png

  • ScatterChart (with squares, triangles, circles, … and more)

10.png

  • CandleStickChart (for financial data)

11.png

  • BubbleChart (area covered by bubbles indicates the value)

12.png

  • RadarChart (spider web chart)

13.png

Documentation


Currently there’s no need for documentation for the iOS 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 ChartsDemo project and learn the how-tos from it.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值