Dhi*_*per -2 ios apple-watch watchkit
我正在研究POC,以在Apple Watch(商业/企业数据分析)中实施图表。
例如 :
我怎样才能做到这一点 ?
我发现了YOChartImageKit。使用此库,您可以在监视操作系统中创建图表。
可可豆
use_frameworks!
pod 'YOChartImageKit', '~> 1.1'
Run Code Online (Sandbox Code Playgroud)
迦太基
github "yasuoza/YOChartImageKit" ~> 1.1
Run Code Online (Sandbox Code Playgroud)
可可子
# For both iOS and watchOS framework
target 'YOChartImageKit' do
github 'yasuoza/YOChartImageKit', '1.1.0', files: 'Source/YOChartImageKit/*.{h,m}'
end
Run Code Online (Sandbox Code Playgroud)
折线图固体
let image = YOLineChartImage()
image.strokeWidth = 4.0 // width of line
image.strokeColor = randomColor() // color of line
image.values = [0.0, 1.0, 2.0] // chart values
image.smooth = false // disable smooth line
image.drawImage(frame, scale: scale) // draw an image
Run Code Online (Sandbox Code Playgroud)
折线图平滑
let image = YOLineChartImage()
image.strokeWidth = 4.0 // width of line
image.fillColor = randomColor() // color of area
image.values = [0.0, 1.0, 2.0] // chart values
// image.smooth = true // [default] draws a smooth line
image.drawImage(frame, scale: scale) // draw an image
Run Code Online (Sandbox Code Playgroud)
垂直条形图
let image = YOBarChartImage()
image.values = [0.0, 1.0, 2.0] // chart values
image.fillColor = randomColor() // color of bars
// image.barPadding = 2.0 // [optional] padding of bars
// image.barStyle = .Vertical // [default] draws a vertical bars
image.drawImage(frame, scale: scale) // draw an image
Run Code Online (Sandbox Code Playgroud)
条形图水平
let image = YOBarChartImage()
image.values = [0.0, 1.0, 2.0] // chart values
image.fillColor = randomColor() // color of bars
// image.barPadding = 2.0 // [optional] padding of bars
image.barStyle = .Horizontal // draws a horizontal bars
image.drawImage(frame, scale: scale) // draw an image
Run Code Online (Sandbox Code Playgroud)
甜甜圈图
let image = YODonutChartImage()
image.donutWidth = 16.0 // width of donut
// image.labelText = "LABEL" // [optional] center label text
// image.labelColor = UIColor.whiteColor() // [optional] center label color
image.values = [10.0, 20.0, 70.0] // chart values
image.colors = (0..<3).map { _ in randomColor() } // colors of pieces
image.drawImage(frame, scale: scale) // draw an image
Run Code Online (Sandbox Code Playgroud)
watchOS ~> 2.0
Run Code Online (Sandbox Code Playgroud)
Xcode >= 7.1
Run Code Online (Sandbox Code Playgroud)
示例应用程序可用于iOS和watchOS。您可以在这里找到所有文件
pod try YOChartImageKit
或YOChartImageKit.xcodeproj使用Xcode 打开并构建演示应用。
您可以在GitHub自述文件中找到所有文档。
| 归档时间: |
|
| 查看次数: |
889 次 |
| 最近记录: |