watchOS繪制自定義圖表
作者:ccsupport
watchOS沒有UIView類,因此 YOChartImageKit 被用來實(shí)現(xiàn)為自定義值的圖表繪制UIImage。
可繪制包括折線圖、柱狀圖、環(huán)形圖等,分別可以調(diào)整顯示選項(xiàng)。
源碼簡介:watchOS沒有UIView類,因此 YOChartImageKit 被用來實(shí)現(xiàn)為自定義值的圖表繪制UIImage。
可繪制包括折線圖、柱狀圖、環(huán)形圖等,分別可以調(diào)整顯示選項(xiàng)。
源碼效果:
源碼片段:
- 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 a image
責(zé)任編輯:倪明
來源:
github