HXCharts使用详解

作者: H的幻想世界 | 来源:发表于2017-09-04 09:47 被阅读463次

接上文

本文主要介绍一些HXCharts的使用细节

标注值

  • 标注值指的是下图红色标记的地方:
Snip20170904_123.png Snip20170904_126.png Snip20170904_127.png
  • 仪表盘与圆形图标注值的最大值需要自己传

  • 折线图与柱状图标注值的最大值是根据传入的valueArray中的最大值向上取整自动计算的(向上取整就是比如value是360,最大值则向上取整到400)

  • 在折线图、柱状图、仪表盘中都可以自定义标注值个数,因为图表实现方式有差异,设置标注值的方式也不同,下面是设置的地方

///折线图
- (void)setValue:(NSArray *)valueArray withYLineCount:(int)count;  ///count设置标注值个数

///柱状图
- (instancetype)initWithFrame:(CGRect)frame withMarkLabelCount:(int)markLabelCount withOrientationType:(OrientationType)type;  ///markLabelCount设置标注值个数

///仪表盘
@property (nonatomic, assign) int markLabelCount;///标注值个数

颜色

  • 柱状图 仪表盘 圆形图支持渐变色和单色 折线图只支持单色(没想好折线图的渐变色怎么使用好看)

  • 下面是渐变色和单色的效果及设置方法

  • 效果:

Snip20170904_133.png Snip20170904_134.png
  • 设置方法:
    1.渐变色:
///渐变色数组
@property (nonatomic, strong) NSArray *colorArray;
///渐变色数组所占位置
@property (nonatomic, strong) NSArray *locations;

2.单色:

///单色
@property (nonatomic, strong) UIColor *singleColor;

柱状图的横竖向设置

Snip20170904_136.png Snip20170904_137.png
  • 只要在初始化方法的地方选择OrientationType即可
typedef NS_ENUM(NSInteger, OrientationType) {
    OrientationHorizontal = 0,///横向
    OrientationVertical = 1,///竖向
};

- (instancetype)initWithFrame:(CGRect)frame withMarkLabelCount:(int)markLabelCount withOrientationType:(OrientationType)type;

更多属性请到.h文件查看,还有什么问题或者建议或者好的设计思路请留言或者+QQ152882888我们一起讨论 感谢。

最后再发一遍demo地址:https://github.com/xuuhan/HXCharts

相关文章

网友评论

  • iOS小虫下米:厉害了 我滴哥 不错哦
  • cyhai:只能作为展示,无法获取某个点或条形位置
    H的幻想世界:你急的话可以进源代码里添加点击事件,或者等我不忙了会更新这个功能。
  • 写代码的八爪鱼:作者你好,我在使用该图表过程中发现,如果折线图所有数值均<1,如0.85,则图表折线图不显示 ,只要有一个数值>1,就显示正常,是怎么回事
    H的幻想世界:我发现了这个问题了 尽快解决

本文标题:HXCharts使用详解

本文链接:https://www.haomeiwen.com/subject/aywljxtx.html