可以分成六个文件夹: Base[基础组件]、Line[折线]、Radar[雷达]、Circle[圆圈]、Pie[饼状图]、Bar[]
1.Base[基础组件]
PNColor:定义常用颜色 和 一个函数 imageFromColor
PNChartLabel:可交互、多行、根据宽自动调整字体大小
PNChartDelegate:可选。
折线图:点击某个折线图含点、
柱状图:点击柱状图
饼状图:点击、取消
PNGenericChart:
视图基类。定义枚举类型: 图表方向[上下左右]、图标风格[]
2.Line[折线图]
2.1showCoordinateAxis:是否坐标系
showLabel:X坐标轴刻度label
showYGridLines: 横网格线 ,颜色:yGridLinesColor
坐标系和画箭头 都是CGContextAddLineToPoint这个函数。
画箭头代码如下:
CGContextMoveToPoint(ctx, _chartMarginBottom + yAxisOffset - 3, 6);
CGContextAddLineToPoint(ctx, _chartMarginBottom + yAxisOffset, 0);
CGContextAddLineToPoint(ctx, _chartMarginBottom + yAxisOffset + 3, 6);
CGContextStrokePath(ctx);
PNLineChartData类:
setXLabels:
3.柱状图
点击柱状图 代理出来,实现是通过CABasicAnimation @"transform.scale"
CABasicAnimation @"strokeEnd"
背景色 用drawrect 处理。动画是for循环。。。