CHRadarGraph
用法
要运行示例项目,请克隆仓库,然后首先在 Example 目录中运行 pod install
要求
- iOS 9+
- Swift 3+
即将推出...
- 标签偏移的控制更加完善
- 扇区中的阴影/图案
示例
安装
CHRadarGraph可通过CocoaPods获取。要安装,只需将以下行添加到您的Podfile
pod "CHRadarGraph", "~> 0.2.1"
更新日志
- v0.2.1: 转换为Swift 3.0
- v0.1.5: 转换为Swift 2.3
- v0.1.4: 添加了更多的单元测试
- v0.1.3: 添加了单元测试
- v0.1.1: 删除了dataSource方法
positionOfGraph
和sizeOfGraph
文档
代理方法(Swift 3.x)
在图形渲染之前调用
func willDisplayGraph(graphView: CHRadarGraphView)
在图形渲染之后调用
func didDisplayGraph(graphView: CHRadarGraphView)
在每次渲染圆圈之前调用
func willDisplayRing(graphView: CHRadarGraphView, index: Int)
在每次渲染圆圈之后调用
func didDisplayRing(graphView: CHRadarGraphView, index: Int)
在每次渲染扇区之前调用
func willDisplaySector(graphView: CHRadarGraphView, sector: CHSectorCell, index: Int)
在每次渲染扇区之后调用
func didDisplaySector(graphView: CHRadarGraphView, sector: CHSectorCell, index: Int)
###数据源方法(Swift 3.x)
图形的位置和大小自动由中心点和半径确定
func centerOfGraph(graphView: CHRadarGraphView) -> CGPoint
func radiusOfGraph(graphView: CHRadarGraphView) -> CGFloat
最大扇区单元格的高度。这将是经典柱状图中最大的Y值。
func largestHeightForSectorCell(graphView: CHRadarGraphView) -> CGFloat
可以在图形上显示的数据点的总数。
func numberOfSectors(graphView: CHRadarGraphView) -> Int
将在图形上显示的数据点的总数。对于一个显示完整360度数据的图形,此数字应该等于:func numberOfSectors(graphView: CHRadarGraphView) -> Int
func numberOfDataSectors(graphView: CHRadarGraphView) -> Int
图形上的Y点数。例如,如果您的最大Y点为10,则至少应显示10个环。
func numberOfRings(graphView: CHRadarGraphView) -> Int
第一个数据点在图形上渲染的角度。默认为0。
func startingAngleInDegrees(graphView: CHRadarGraphView) -> CGFloat
类似于tableView#cellForRowAtIndexPath
,在特定位置渲染数据图的回调。
线条颜色和线宽
func sectorCellForPositionAtIndex(graph: CHRadarGraphView, index: Int) -> CHSectorCell?
func backgroundColorOfGraph(graphView: CHRadarGraphView) -> UIColor
func strokeColorOfRings(graphView: CHRadarGraphView) -> UIColor
func strokeWidthOfRings(graphView: CHRadarGraphView) -> CGFloat
func strokeColorOfSectorLines(graphView: CHRadarGraphView) -> UIColor
func strokeWidthOfSectorLines(graphView: CHRadarGraphView) -> CGFloat
作者
Christopher Harris,[email protected]
许可证
CHRadarGraph遵循MIT许可证。更详细的信息请参阅LICENSE文件。