dkahgld

AAChartModel.m 6.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // AAChartModel.m
  3. // AAChartKit
  4. //
  5. // Created by An An on 17/1/20.
  6. // Copyright © 2017年 An An. All rights reserved.
  7. // source code ----*** https://github.com/AAChartModel/AAChartKit ***--- source code
  8. //
  9. /*
  10. * -------------------------------------------------------------------------------
  11. *
  12. * ❀❀❀ WARM TIPS!!! ❀❀❀
  13. *
  14. * Please contact me on GitHub,if there are any problems encountered in use.
  15. * GitHub Issues : https://github.com/AAChartModel/AAChartKit/issues
  16. * -------------------------------------------------------------------------------
  17. * And if you want to contribute for this project, please contact me as well
  18. * GitHub : https://github.com/AAChartModel
  19. * StackOverflow : https://stackoverflow.com/users/7842508/codeforu
  20. * JianShu : http://www.jianshu.com/u/f1e6753d4254
  21. * SegmentFault : https://segmentfault.com/u/huanghunbieguan
  22. *
  23. * -------------------------------------------------------------------------------
  24. */
  25. #import "AAChartModel.h"
  26. @implementation AAChartModel
  27. -(instancetype)init {
  28. self = [super init];
  29. if (self) {
  30. self.chartType = AAChartTypeColumn;
  31. self.animationType = AAChartAnimationLinear;//默认使用非easing.js中的'linear'线性渐变效果
  32. self.animationDuration = @500;//默认动画时长为500毫秒
  33. self.subtitleAlign = AAChartSubtitleAlignTypeLeft;
  34. self.inverted = NO;
  35. self.stacking = AAChartStackingTypeFalse;
  36. self.xAxisReversed = NO;
  37. self.yAxisReversed = NO;
  38. self.zoomType = AAChartZoomTypeX;
  39. self.colorsTheme = @[@"#b5282a",@"#e7a701",@"#50c18d",@"#fd4800",@"#f1c6c5"];//默认颜色主题
  40. self.gradientColorEnable = NO;
  41. self.polar = NO;
  42. self.options3dEnable = NO;
  43. self.crosshairs = YES;
  44. self.xAxisLabelsEnabled = YES;
  45. self.xAxisGridLineWidth = @0;
  46. self.yAxisLabelsEnabled = YES;
  47. self.yAxisGridLineWidth = @1;
  48. self.legendEnabled = YES;
  49. self.borderRadius = @0;//柱状图长条图头部圆角半径(可用于设置头部的形状,仅对条形图,柱状图有效,设置为1000时,柱形图或者条形图头部为楔形)
  50. self.markerRadius = @5;//折线连接点的半径长度,如果值设置为0,这样就相当于不显示了
  51. self.yAllowDecimals = YES; //默认y轴显示小数
  52. }
  53. return self;
  54. }
  55. AAPropSetFuncImplementation(AAChartModel, NSString *, title);//标题内容
  56. AAPropSetFuncImplementation(AAChartModel, NSString *, subtitle);//副标题内容
  57. AAPropSetFuncImplementation(AAChartModel, AAChartSubtitleAlignType, subtitleAlign);//图表副标题文本水平对齐方式。可选的值有 “left”,”center“和“right”。 默认是:center.
  58. AAPropSetFuncImplementation(AAChartModel, AAChartType, chartType);//图表类型
  59. AAPropSetFuncImplementation(AAChartModel, AAChartStackingType, stacking);//堆积样式
  60. AAPropSetFuncImplementation(AAChartModel, AAChartSymbolType, symbol);//折线曲线连接点的类型:"circle", "square", "diamond", "triangle","triangle-down",默认是"circle"
  61. AAPropSetFuncImplementation(AAChartModel, AAChartSymbolStyleType, symbolStyle);
  62. AAPropSetFuncImplementation(AAChartModel, AAChartZoomType, zoomType);//缩放类型 AAChartZoomTypeX 表示可沿着 x 轴进行手势缩放
  63. AAPropSetFuncImplementation(AAChartModel, AAChartAnimation, animationType);//设置图表的渲染动画类型
  64. AAPropSetFuncImplementation(AAChartModel, NSNumber *, animationDuration);//设置图表的渲染动画时长
  65. AAPropSetFuncImplementation(AAChartModel, BOOL, inverted);//x 轴是否垂直
  66. AAPropSetFuncImplementation(AAChartModel, BOOL, xAxisReversed);// x 轴翻转
  67. AAPropSetFuncImplementation(AAChartModel, BOOL, yAxisReversed);//y 轴翻转
  68. AAPropSetFuncImplementation(AAChartModel, BOOL, crosshairs);//是否显示准星线(默认显示)
  69. AAPropSetFuncImplementation(AAChartModel, BOOL, gradientColorEnable);//是否要为渐变色
  70. AAPropSetFuncImplementation(AAChartModel, BOOL, polar);//是否极化图形(变为雷达图)
  71. AAPropSetFuncImplementation(AAChartModel, BOOL, dataLabelEnabled);//是否显示数据
  72. AAPropSetFuncImplementation(AAChartModel, BOOL, xAxisLabelsEnabled);//x 轴是否显示数据
  73. AAPropSetFuncImplementation(AAChartModel, NSArray *, categories);//图表横坐标每个点对应的名称
  74. AAPropSetFuncImplementation(AAChartModel, NSNumber *, xAxisGridLineWidth);//x 轴网格线的宽度
  75. AAPropSetFuncImplementation(AAChartModel, BOOL, yAxisLabelsEnabled);//y 轴是否显示数据
  76. AAPropSetFuncImplementation(AAChartModel, NSString *, yAxisTitle);//y 轴标题
  77. AAPropSetFuncImplementation(AAChartModel, NSNumber *, yAxisGridLineWidth);//y轴网格线的宽度
  78. AAPropSetFuncImplementation(AAChartModel, NSArray <NSString *>*, colorsTheme);//图表主题颜色数组
  79. AAPropSetFuncImplementation(AAChartModel, NSArray *, series);
  80. AAPropSetFuncImplementation(AAChartModel, BOOL, connectNulls);//设置折线是否断点重连(是否连接空值点)
  81. AAPropSetFuncImplementation(AAChartModel, BOOL, legendEnabled);//是否显示图例 lengend(图表底部可点按的圆点和文字)
  82. AAPropSetFuncImplementation(AAChartModel, NSString *, backgroundColor);//图表背景色(必须为十六进制的颜色色值如红色"#FF0000")
  83. AAPropSetFuncImplementation(AAChartModel, BOOL, options3dEnable);//是否 3D 化图形(仅对条形图,柱状图有效)
  84. AAPropSetFuncImplementation(AAChartModel, NSNumber *, options3dAlpha);
  85. AAPropSetFuncImplementation(AAChartModel, NSNumber *, options3dBeta);
  86. AAPropSetFuncImplementation(AAChartModel, NSNumber *, options3dDepth);//3D 图形深度
  87. AAPropSetFuncImplementation(AAChartModel, NSNumber *, borderRadius);//柱状图长条图头部圆角半径(可用于设置头部的形状,仅对条形图,柱状图有效)
  88. AAPropSetFuncImplementation(AAChartModel, NSNumber *, markerRadius);//折线连接点的半径长度
  89. AAPropSetFuncImplementation(AAChartModel, BOOL, yAllowDecimals);//是否允许 y 轴显示小数
  90. AAPropSetFuncImplementation(AAChartModel, NSArray *, yPlotLines);//y 轴基线的配置
  91. AAPropSetFuncImplementation(AAChartModel, NSNumber *, yMax);//y 轴最大值
  92. AAPropSetFuncImplementation(AAChartModel, NSNumber *, yMin);//y 轴最小值(设置为0就不会有负数)
  93. AAPropSetFuncImplementation(AAChartModel, NSArray *, yTickPositions);//自定义 y 轴坐标(如:[@(0), @(25), @(50), @(75) , (100)])
  94. @end