为了账号安全,请及时绑定邮箱和手机立即绑定

HXCharts使用详解

标签:
Html5

标注值

  • 标注值指的是下图红色标记的地方:

https://img1.sycdn.imooc.com//5d5e83dc0001804f04920881.png

Snip20170904_123.png

https://img1.sycdn.imooc.com//5d5e83e20001ec9204730765.png

Snip20170904_126.png

https://img1.sycdn.imooc.com//5d5e83e70001888204690861.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;///标注值个数

颜色

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

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

  • 效果:

https://img1.sycdn.imooc.com//5d5e83ed0001156004870794.png

Snip20170904_133.png

https://img1.sycdn.imooc.com//5d5e83f40001bc1004700783.png

Snip20170904_134.png

  • 设置方法:
    1.渐变色:

///渐变色数组@property (nonatomic, strong) NSArray *colorArray;///渐变色数组所占位置@property (nonatomic, strong) NSArray *locations;

2.单色:

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

柱状图的横竖向设置

https://img1.sycdn.imooc.com//5d5e83f90001ea7d04740808.png

Snip20170904_136.png

https://img1.sycdn.imooc.com//5d5e83fd0001f8be04630805.png

Snip20170904_137.png

  • 只要在初始化方法的地方选择OrientationType即可

typedef NS_ENUM(NSInteger, OrientationType) {
    OrientationHorizontal = 0,///横向
    OrientationVertical = 1,///竖向};

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

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



作者:H的幻想世界
链接:https://www.jianshu.com/p/e478636d7718


点击查看更多内容
TA 点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
  • 推荐
  • 评论
  • 收藏
  • 共同学习,写下你的评论
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

举报

0/150
提交
取消