ChartView.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  1. //
  2. // ChartView.h
  3. // ChartView
  4. //
  5. // Created by Simon Zhou on 14-6-11.
  6. // Copyright (c) 2014年 muchinfo. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. /**
  10. * @brief 图表类型枚举
  11. * - 枚举列表:
  12. * -# ChartTyeTSPlan - 分时图
  13. * -# ChartViewTypeKL - K线图
  14. * -# ChartViewTypeImmediately - 瞬时图
  15. */
  16. typedef enum ChartViewType {
  17. ChartViewTypeTSPlan,
  18. ChartViewTypeKL,
  19. ChartViewTypeImmediately
  20. } ChartViewType;
  21. /**
  22. * @brief 图表指标类型枚举
  23. */
  24. typedef enum ChartTargetType {
  25. /// MACD指标
  26. MACD,
  27. /// 成交量指标
  28. VOL,
  29. /// KDJ指标
  30. KDJ,
  31. /// RSI指标
  32. RSI,
  33. /// CCI指标
  34. CCI,
  35. /// DMA指标
  36. DMA,
  37. /// KD指标
  38. KD,
  39. /// BIAS指标
  40. BIAS,
  41. /// CR指标
  42. CR,
  43. /// WR指标
  44. WR,
  45. /// PSY指标
  46. PSY,
  47. /// ASI指标
  48. ASI,
  49. /// VR指标
  50. VR,
  51. /// BOLL指标
  52. BOLL,
  53. /// OBV指标
  54. OBV,
  55. /// VOLHS指标
  56. VOLHS
  57. } ChartTargetType;
  58. /**
  59. * @brief 图表错误枚举
  60. */
  61. typedef enum ChartErrorType {
  62. /// 无错误
  63. ChartErrorTypeNone = 0,
  64. /// 行情数据超时
  65. ChartErrorTypeQuotaTimeout = -80001,
  66. /// 数据周期间隔秒数
  67. ChartErrorTypeNotSetCycleInterval = -80002,
  68. /// 行情数据比图表最后时间还要早
  69. ChartErrorTypeQuotaTimeOldest = -80003
  70. } ChartErrorType;
  71. @class ChartData;
  72. @protocol ChartViewDelegate;
  73. /**
  74. * @brief 本地化图表视图
  75. */
  76. @interface ChartView : UIView <UIGestureRecognizerDelegate>
  77. @property (nonatomic,weak) id<ChartViewDelegate> delegate;
  78. #pragma mark - 数据成员
  79. /// K线数据
  80. @property (nonatomic, strong, setter = setChartDataArray:) NSMutableArray *chartDataArray;
  81. /// 商品最小变动单位
  82. @property (nonatomic, strong) NSDecimalNumber *minUnit;
  83. /// 最小交易数量小数位
  84. @property (nonatomic, strong) NSDecimalNumber *numMinUnit;
  85. /// 图表类型,默认为分时图
  86. @property (nonatomic, assign) ChartViewType chartViewType;
  87. /// 数据周期间隔秒数,比如1分钟K线为60.0f,1日线为1440.0f
  88. @property (nonatomic, assign) NSTimeInterval cycleInterval;
  89. /// 图表指标类型,默认为MACD
  90. @property (nonatomic, assign) ChartTargetType chartTargetType;
  91. /**
  92. 分时图相关清除的数据,比如休市期补的数据等,正确设置此值以保证数据能够正确到达x轴最后
  93. */
  94. /// 传分时图结算计划
  95. @property (nonatomic, strong) NSArray<NSDictionary<NSString *, NSDate *> *> *reckonDetails;
  96. /// 交易日应有数据个数
  97. @property (nonatomic, assign) NSInteger tsCount;
  98. #pragma mark - 显示成员
  99. /// 图表绘制底色红色
  100. @property (nonatomic,assign) CGFloat bgRed;
  101. /// 图表绘制底色绿色
  102. @property (nonatomic,assign) CGFloat bgGreen;
  103. /// 图表绘制底色蓝色
  104. @property (nonatomic,assign) CGFloat bgBlue;
  105. /// 轴线颜色
  106. @property (nonatomic,strong) UIColor *lineColor;
  107. /// 字体颜色
  108. @property (nonatomic,strong) UIColor *titleColor;
  109. /// 文本的字体
  110. @property (nonatomic,strong) UIFont *titleFont;
  111. /// 是否显示现价的判断标志,默认为YES
  112. @property (nonatomic,assign) BOOL isShowPrice;
  113. /// K线阴块红色值
  114. @property (nonatomic,assign) CGFloat decKRed;
  115. /// K线阴块绿色值
  116. @property (nonatomic,assign) CGFloat decKGreen;
  117. /// K线阴块蓝色值
  118. @property (nonatomic,assign) CGFloat decKBlue;
  119. /// K线阴块alpha值
  120. @property (nonatomic,assign) CGFloat decKAlpha;
  121. /// K线阳块红色值
  122. @property (nonatomic,assign) CGFloat aesKRed;
  123. /// K线阳块绿色值
  124. @property (nonatomic,assign) CGFloat aesKGreen;
  125. /// K线阳块蓝色值
  126. @property (nonatomic,assign) CGFloat aesKBlue;
  127. /// K线阳块alpha值
  128. @property (nonatomic,assign) CGFloat aesKAlpha;
  129. /// K线平块红色值
  130. @property (nonatomic,assign) CGFloat samKRed;
  131. /// K线平块绿色值
  132. @property (nonatomic,assign) CGFloat samKGreen;
  133. /// K线平块蓝色值
  134. @property (nonatomic,assign) CGFloat samKBlue;
  135. /// K线平块alpha值
  136. @property (nonatomic,assign) CGFloat samKAlpha;
  137. /// 十字线红色值
  138. @property (nonatomic,assign) CGFloat tipRed;
  139. /// 十字线绿色值
  140. @property (nonatomic,assign) CGFloat tipGreen;
  141. /// 十字线蓝色值
  142. @property (nonatomic,assign) CGFloat tipBlue;
  143. /// 十字线alpha值
  144. @property (nonatomic,assign) CGFloat tipAlpha;
  145. /// 十字线标题颜色对象
  146. @property (nonatomic,strong) UIColor *tipTitleColor;
  147. /// priceGreenColor
  148. @property (nonatomic,strong) UIColor *priceGreenColor;
  149. /// K线MA5平均线红色值
  150. @property (nonatomic,assign) CGFloat kMA5Red;
  151. /// K线MA5平均线绿色值
  152. @property (nonatomic,assign) CGFloat kMA5Green;
  153. /// K线MA5平均线蓝色值
  154. @property (nonatomic,assign) CGFloat kMA5Blue;
  155. /// K线MA5平均线alpha值
  156. @property (nonatomic,assign) CGFloat kMA5Alpha;
  157. /// K线MA10平均线红色值
  158. @property (nonatomic,assign) CGFloat kMA10Red;
  159. /// K线MA10平均线绿色值
  160. @property (nonatomic,assign) CGFloat kMA10Green;
  161. /// K线MA10平均线蓝色值
  162. @property (nonatomic,assign) CGFloat kMA10Blue;
  163. /// K线MA10平均线alpha值
  164. @property (nonatomic,assign) CGFloat kMA10Alpha;
  165. /// K线MA15平均线红色值
  166. @property (nonatomic,assign) CGFloat kMA15Red;
  167. /// K线MA15平均线绿色值
  168. @property (nonatomic,assign) CGFloat kMA15Green;
  169. /// K线MA15平均线蓝色值
  170. @property (nonatomic,assign) CGFloat kMA15Blue;
  171. /// K线MA15平均线alpha值
  172. @property (nonatomic,assign) CGFloat kMA15Alpha;
  173. /// 分时线红色值
  174. @property (nonatomic,assign) CGFloat tsRed;
  175. /// 分时线绿色值
  176. @property (nonatomic,assign) CGFloat tsGreen;
  177. /// 分时线蓝色值
  178. @property (nonatomic,assign) CGFloat tsBlue;
  179. /// 分时线alpha值
  180. @property (nonatomic,assign) CGFloat tsAlpha;
  181. /// 分时MA线红色值
  182. @property (nonatomic,assign) CGFloat tsMARed;
  183. /// 分时MA线绿色值
  184. @property (nonatomic,assign) CGFloat tsMAGreen;
  185. /// 分时MA线蓝色值
  186. @property (nonatomic,assign) CGFloat tsMABlue;
  187. /// 分时MA线alpha值
  188. @property (nonatomic,assign) CGFloat tsMAAlpha;
  189. /// 分时昨收线红色值
  190. @property (nonatomic,assign) CGFloat preCloseLineRed;
  191. /// 分时昨收线绿色值
  192. @property (nonatomic,assign) CGFloat preCloseLineGreen;
  193. /// 分时昨收线蓝色值
  194. @property (nonatomic,assign) CGFloat preCloseLineBlue;
  195. /// 分时昨收线alpha值
  196. @property (nonatomic,assign) CGFloat preCloseLineAlpha;
  197. /// MACD DIF线红色值
  198. @property (nonatomic,assign) CGFloat macdDIFRed;
  199. /// MACD DIF线绿色值
  200. @property (nonatomic,assign) CGFloat macdDIFGreen;
  201. /// MACD DIF线蓝色值
  202. @property (nonatomic,assign) CGFloat macdDIFBlue;
  203. /// MACD DIF线alpha值
  204. @property (nonatomic,assign) CGFloat macdDIFAlpha;
  205. /// MACD DEA线红色值
  206. @property (nonatomic,assign) CGFloat macdDEARed;
  207. /// MACD DEA线绿色值
  208. @property (nonatomic,assign) CGFloat macdDEAGreen;
  209. /// MACD DEA线蓝色值
  210. @property (nonatomic,assign) CGFloat macdDEABlue;
  211. /// MACD DEA线alpha值
  212. @property (nonatomic,assign) CGFloat macdDEAAlpha;
  213. /// RSI RSI1线红色值
  214. @property (nonatomic,assign) CGFloat rsi1Red;
  215. /// RSI RSI1线绿色值
  216. @property (nonatomic,assign) CGFloat rsi1Green;
  217. /// RSI RSI1线蓝色值
  218. @property (nonatomic,assign) CGFloat rsi1Blue;
  219. /// RSI RSI1线alpha值
  220. @property (nonatomic,assign) CGFloat rsi1Alpha;
  221. /// RSI RSI2线红色值
  222. @property (nonatomic,assign) CGFloat rsi2Red;
  223. /// RSI RSI2线绿色值
  224. @property (nonatomic,assign) CGFloat rsi2Green;
  225. /// RSI RSI2线蓝色值
  226. @property (nonatomic,assign) CGFloat rsi2Blue;
  227. /// RSI RSI2线alpha值
  228. @property (nonatomic,assign) CGFloat rsi2Alpha;
  229. /// KT KT线红色值
  230. @property (nonatomic,assign) CGFloat ktRed;
  231. /// KT KT线绿色值
  232. @property (nonatomic,assign) CGFloat ktGreen;
  233. /// KT KT线蓝色值
  234. @property (nonatomic,assign) CGFloat ktBlue;
  235. /// KT KT线alpha值
  236. @property (nonatomic,assign) CGFloat ktAlpha;
  237. /// JT JT线红色值
  238. @property (nonatomic,assign) CGFloat jtRed;
  239. /// JT JT线绿色值
  240. @property (nonatomic,assign) CGFloat jtGreen;
  241. /// JT JT线蓝色值
  242. @property (nonatomic,assign) CGFloat jtBlue;
  243. /// JT JT线alpha值
  244. @property (nonatomic,assign) CGFloat jtAlpha;
  245. /// DT DT线红色值
  246. @property (nonatomic,assign) CGFloat dtRed;
  247. /// DT DT线绿色值
  248. @property (nonatomic,assign) CGFloat dtGreen;
  249. /// DT DT线蓝色值
  250. @property (nonatomic,assign) CGFloat dtBlue;
  251. /// DT DT线alpha值
  252. @property (nonatomic,assign) CGFloat dtAlpha;
  253. /// RSI RSI3线红色值
  254. @property (nonatomic,assign) CGFloat rsi3Red;
  255. /// RSI RSI3线绿色值
  256. @property (nonatomic,assign) CGFloat rsi3Green;
  257. /// RSI RSI3线蓝色值
  258. @property (nonatomic,assign) CGFloat rsi3Blue;
  259. /// RSI RSI3线alpha值
  260. @property (nonatomic,assign) CGFloat rsi3Alpha;
  261. /// CCI线红色值
  262. @property (nonatomic,assign) CGFloat cciRed;
  263. /// CCI线绿色值
  264. @property (nonatomic,assign) CGFloat cciGreen;
  265. /// CCI线蓝色值
  266. @property (nonatomic,assign) CGFloat cciBlue;
  267. /// CCI线alpha值
  268. @property (nonatomic,assign) CGFloat cciAlpha;
  269. /// DAM线红色值
  270. @property (nonatomic,assign) CGFloat dmaRed;
  271. /// DAM线绿色值
  272. @property (nonatomic,assign) CGFloat dmaGreen;
  273. /// DAM线蓝色值
  274. @property (nonatomic,assign) CGFloat dmaBlue;
  275. /// DAM线alpha值
  276. @property (nonatomic,assign) CGFloat dmaAlpha;
  277. /// AMA线红色值
  278. @property (nonatomic,assign) CGFloat amaRed;
  279. /// AMA线绿色值
  280. @property (nonatomic,assign) CGFloat amaGreen;
  281. /// AMA线蓝色值
  282. @property (nonatomic,assign) CGFloat amaBlue;
  283. /// AMA线alpha值
  284. @property (nonatomic,assign) CGFloat amaAlpha;
  285. /// BIAS BIAS1线红色值
  286. @property (nonatomic,assign) CGFloat bias1Red;
  287. /// BIAS BIAS1线绿色值
  288. @property (nonatomic,assign) CGFloat bias1Green;
  289. /// BIAS BIAS1线蓝色值
  290. @property (nonatomic,assign) CGFloat bias1Blue;
  291. /// BIAS BIAS1线alpha值
  292. @property (nonatomic,assign) CGFloat bias1Alpha;
  293. /// BIAS BIAS2线红色值
  294. @property (nonatomic,assign) CGFloat bias2Red;
  295. /// BIAS BIAS2线绿色值
  296. @property (nonatomic,assign) CGFloat bias2Green;
  297. /// BIAS BIAS2线蓝色值
  298. @property (nonatomic,assign) CGFloat bias2Blue;
  299. /// BIAS BIAS2线alpha值
  300. @property (nonatomic,assign) CGFloat bias2Alpha;
  301. /// BIAS BIAS3线红色值
  302. @property (nonatomic,assign) CGFloat bias3Red;
  303. /// BIAS BIAS3线绿色值
  304. @property (nonatomic,assign) CGFloat bias3Green;
  305. /// BIAS BIAS3线蓝色值
  306. @property (nonatomic,assign) CGFloat bias3Blue;
  307. /// BIAS BIAS3线alpha值
  308. @property (nonatomic,assign) CGFloat bias3Alpha;
  309. /// PSY PSY线红色值
  310. @property (nonatomic,assign) CGFloat psyRed;
  311. /// PSY PSY线绿色值
  312. @property (nonatomic,assign) CGFloat psyGreen;
  313. /// PSY PSY线蓝色值
  314. @property (nonatomic,assign) CGFloat psyBlue;
  315. /// PSY PSY线alpha值
  316. @property (nonatomic,assign) CGFloat psyAlpha;
  317. /// PSYMA PSYMA线红色值
  318. @property (nonatomic,assign) CGFloat psymaRed;
  319. /// PSYMA PSYMA线绿色值
  320. @property (nonatomic,assign) CGFloat psymaGreen;
  321. /// PSYMA PSYMA线蓝色值
  322. @property (nonatomic,assign) CGFloat psymaBlue;
  323. /// PSYMA PSYMA线alpha值
  324. @property (nonatomic,assign) CGFloat psymaAlpha;
  325. #pragma mark - 位置成员
  326. /// Y轴上边距,默认为10.0f
  327. @property (nonatomic,assign) CGFloat yAxisPaddingTop;
  328. /// Y轴下边距,默认为25.0f
  329. @property (nonatomic,assign) CGFloat yAxisPaddingBottom;
  330. #pragma mark - 交互成员
  331. /// 移动手势递增量
  332. @property (nonatomic,assign) NSInteger panGestureIncrement;
  333. #pragma mark - 分时图专用
  334. /// 昨收价
  335. @property (nonatomic, strong) NSDecimalNumber *preClose;
  336. /// 开盘时间字符串
  337. @property (nonatomic, strong) NSDate *tsStartTime;
  338. /// 收盘时间字符串
  339. @property (nonatomic, strong) NSDate *tsCloseTime;
  340. #pragma mark - 指标专用
  341. /// 指标框高度
  342. @property (nonatomic, assign) CGFloat indicatorHight;
  343. /// 是否显示指标,默认为YES
  344. @property (nonatomic, assign, setter=setIsShowIndicator:) BOOL isShowIndicator;
  345. #pragma mark - 开高低收专用
  346. /// 是否显示开高低收,默认为NO (不是用来长按十字线的)
  347. @property (nonatomic,assign,setter=setIsShowOHLP:) BOOL isShowOHLP;
  348. /// 是否是币币的商品
  349. @property (nonatomic,assign,setter=setIsBBGoods:) BOOL isBBGoods;
  350. #pragma mark - 公开方法
  351. /**
  352. * @brief 初始化方法,一般在buildView时调用
  353. *
  354. * @param chartViewType 图表类型
  355. * @param frame frame
  356. *
  357. * @return self
  358. */
  359. - (instancetype)initWithType:(ChartViewType)chartViewType frame:(CGRect)frame;
  360. /**
  361. * @brief 初始化图表 (图表初始化时调用)
  362. */
  363. - (void)initChartView;
  364. /**
  365. * @brief 切换图表类型的方法,一般在用户点击分时图或K线周期时调用
  366. *
  367. * @param chartViewType 目标切换图表类型
  368. * @param chartDataArray 图表数据
  369. */
  370. - (void)changeChartType:(ChartViewType)chartViewType chartDataArray:(NSMutableArray *)chartDataArray;
  371. /**
  372. * @brief 追加图表数据的方法,一般在图表刷新(包括自动刷新)时调用
  373. *
  374. * @param appendChartDataArray 追加的图表数据
  375. */
  376. - (void)appendChartDataArray:(NSMutableArray *)appendChartDataArray;
  377. /**
  378. * @brief 让图表恢复正常状态的方法。可在十字线显示时离开ViewController等情况下调用。
  379. */
  380. - (void)restoreNormalState;
  381. /**
  382. 清空图表的方法
  383. */
  384. - (void)clear;
  385. #pragma mark - 手势相关
  386. /**
  387. * @brief 初始化和图标进行交互的相关手势
  388. */
  389. - (void)initGestureRecognizer;
  390. #pragma mark - 指标切换
  391. /**
  392. * @brief 切换图表指标类型的方法
  393. */
  394. - (void)changeChartTargetType:(ChartTargetType)chartTargetType;
  395. #pragma mark - 追加行情
  396. /**
  397. * @brief 追加行情现价的方法。
  398. *
  399. * @param price 行情现价
  400. * @param priceTime 行情时间
  401. * @param lastVolume 成交量
  402. *
  403. */
  404. - (ChartErrorType)appendQuotaPrice:(NSDecimalNumber *)price priceTime:(NSDate *)priceTime lastVolume:(NSDecimalNumber *)lastVolume;
  405. #pragma mark - 颜色设置
  406. /**
  407. * @brief 设置K线阴块颜色的方法
  408. *
  409. * @param decKRed K线阴块红色值
  410. * @param decKGreen K线阴块绿色值
  411. * @param decKBlue K线阴块蓝色值
  412. * @param decKAlpha K线阴块alpha值
  413. */
  414. - (void)setDecKRed:(CGFloat)decKRed decKGreen:(CGFloat)decKGreen decKBlue:(CGFloat)decKBlue decKAlpha:(CGFloat)decKAlpha;
  415. /**
  416. * @brief 设置K线阳块颜色的方法
  417. *
  418. * @param aesKRed K线阳块红色值
  419. * @param aesKGreen K线阳块绿色值
  420. * @param aesKBlue K线阳块蓝色值
  421. * @param aesKAlpha K线阳块alpha值
  422. */
  423. - (void)setAesKRed:(CGFloat)aesKRed aesKGreen:(CGFloat)aesKGreen aesKBlue:(CGFloat)aesKBlue aesKAlpha:(CGFloat)aesKAlpha;
  424. /**
  425. * @brief 设置K线平块颜色的方法
  426. *
  427. * @param samKRed K线平块红色值
  428. * @param samKGreen K线平块绿色值
  429. * @param samKBlue K线平块蓝色值
  430. * @param samKAlpha K线平块alpha值
  431. */
  432. - (void)setSamKRed:(CGFloat)samKRed samKGreen:(CGFloat)samKGreen samKBlue:(CGFloat)samKBlue samKAlpha:(CGFloat)samKAlpha;
  433. /**
  434. * @brief 设置十字线颜色的方法
  435. *
  436. * @param tipRed 十字线红色值
  437. * @param tipGreen 十字线绿色值
  438. * @param tipBlue 十字线蓝色值
  439. * @param tipAlpha 十字线alpha值
  440. * @param tipTitleColor 十字线标题颜色对象
  441. */
  442. - (void)setTipRed:(CGFloat)tipRed tipGreen:(CGFloat)tipGreen tipBlue:(CGFloat)tipBlue tipAlpha:(CGFloat)tipAlpha tipTitleColor:(UIColor *)tipTitleColor;
  443. /**
  444. * @brief 设置分时图昨收线颜色的方法
  445. *
  446. * @param preCloseLineRed 昨收线红色值
  447. * @param preCloseLineGreen 昨收线绿色值
  448. * @param preCloseLineBlue 昨收线蓝色值
  449. * @param preCloseLineAlpha 昨收线alpha值
  450. */
  451. - (void)setPreCloseLineRed:(CGFloat)preCloseLineRed preCloseLineGreen:(CGFloat)preCloseLineGreen preCloseLineBlue:(CGFloat)preCloseLineBlue preCloseLineAlpha:(CGFloat)preCloseLineAlpha;
  452. /**
  453. * @brief 设置K线MA5平均线颜色的方法
  454. *
  455. * @param kMA5Red K线MA5平均线红色值
  456. * @param kMA5Green K线MA5平均线绿色值
  457. * @param kMA5Blue K线MA5平均线蓝色值
  458. * @param kMA5Alpha K线MA5平均线alpha值
  459. */
  460. - (void)setkMA5Red:(CGFloat)kMA5Red kMA5Green:(CGFloat)kMA5Green kMA5Blue:(CGFloat)kMA5Blue kMA5Alpha:(CGFloat)kMA5Alpha;
  461. /**
  462. * @brief 设置K线MA10平均线颜色的方法
  463. *
  464. * @param kMA10Red K线MA10平均线红色值
  465. * @param kMA10Green K线MA10平均线绿色值
  466. * @param kMA10Blue K线MA10平均线蓝色值
  467. * @param kMA10Alpha K线MA10平均线alpha值
  468. */
  469. - (void)setkMA10Red:(CGFloat)kMA10Red kMA10Green:(CGFloat)kMA10Green kMA10Blue:(CGFloat)kMA10Blue kMA10Alpha:(CGFloat)kMA10Alpha;
  470. /**
  471. * @brief 设置K线MA15平均线颜色的方法
  472. *
  473. * @param kMA15Red K线MA15平均线红色值
  474. * @param kMA15Green K线MA15平均线绿色值
  475. * @param kMA15Blue K线MA15平均线蓝色值
  476. * @param kMA15Alpha K线MA15平均线alpha值
  477. */
  478. - (void)setkMA15Red:(CGFloat)kMA15Red kMA15Green:(CGFloat)kMA15Green kMA15Blue:(CGFloat)kMA15Blue kMA15Alpha:(CGFloat)kMA15Alpha;
  479. /**
  480. * @brief 设置开高低收报价字体颜色为绿色时的颜色
  481. */
  482. - (void)setPriceGreenColor:(UIColor *)priceGreenColor;
  483. /**
  484. * @brief 设置分时线颜色的方法
  485. *
  486. * @param tsRed 分时线红色值
  487. * @param tsGreen 分时线绿色值
  488. * @param tsBlue 分时线蓝色值
  489. * @param tsAlpha 分时线alpha值
  490. */
  491. - (void)setTsRed:(CGFloat)tsRed tsGreen:(CGFloat)tsGreen tsBlue:(CGFloat)tsBlue tsAlpha:(CGFloat)tsAlpha;
  492. /**
  493. * @brief 设置分时MA线颜色的方法
  494. *
  495. * @param tsMARed 分时MA线红色值
  496. * @param tsMAGreen 分时MA线绿色值
  497. * @param tsMABlue 分时MA线蓝色值
  498. * @param tsMAAlpha 分时MA线alpha值
  499. */
  500. - (void)setTsMARed:(CGFloat)tsMARed tsMAGreen:(CGFloat)tsMAGreen tsMABlue:(CGFloat)tsMABlue tsMAAlpha:(CGFloat)tsMAAlpha;
  501. /**
  502. * @brief 设置MACD DIF线颜色的方法
  503. *
  504. * @param macdDIFRed MACD DIF线红色值
  505. * @param macdDIFGreen MACD DIF线绿色值
  506. * @param macdDIFBlue MACD DIF线蓝色值
  507. * @param macdDIFAlpha MACD DIF线alpha值
  508. */
  509. - (void)setMacdDIFRed:(CGFloat)macdDIFRed macdDIFGreen:(CGFloat)macdDIFGreen macdDIFBlue:(CGFloat)macdDIFBlue macdDIFAlpha:(CGFloat)macdDIFAlpha;
  510. /**
  511. * @brief 设置MACD DEA线颜色的方法
  512. *
  513. * @param macdDEARed MACD DEA线红色值
  514. * @param macdDEAGreen MACD DEA线绿色值
  515. * @param macdDEABlue MACD DEA线蓝色值
  516. * @param macdDEAAlpha MACD DEA线alpha值
  517. */
  518. - (void)setMacdDEARed:(CGFloat)macdDEARed macdDEAGreen:(CGFloat)macdDEAGreen macdDEABlue:(CGFloat)macdDEABlue macdDEAAlpha:(CGFloat)macdDEAAlpha;
  519. /**
  520. * @brief 设置RSI RSI1线颜色的方法
  521. *
  522. * @param rsi1Red RSI RSI1线红色值
  523. * @param rsi1Green RSI RSI1线绿色值
  524. * @param rsi1Blue RSI RSI1线蓝色值
  525. * @param rsi1Alpha RSI RSI1线alpha值
  526. */
  527. - (void)setRSI1Red:(CGFloat)rsi1Red rsi1Green:(CGFloat)rsi1Green rsi1Blue:(CGFloat)rsi1Blue rsi1Alpha:(CGFloat)rsi1Alpha;
  528. /**
  529. * @brief 设置RSI RSI2线颜色的方法
  530. *
  531. * @param rsi2Red RSI RSI2线红色值
  532. * @param rsi2Green RSI RSI2线绿色值
  533. * @param rsi2Blue RSI RSI2线蓝色值
  534. * @param rsi2Alpha RSI RSI2线alpha值
  535. */
  536. - (void)setRSI2Red:(CGFloat)rsi2Red rsi2Green:(CGFloat)rsi2Green rsi2Blue:(CGFloat)rsi2Blue rsi2Alpha:(CGFloat)rsi2Alpha;
  537. /**
  538. * @brief 设置RSI3线颜色的方法
  539. *
  540. * @param rsi3Red RSI3线红色值
  541. * @param rsi3Green RSI RSI3线绿色值
  542. * @param rsi3Blue RSI3线蓝色值
  543. * @param rsi3Alpha RSI3线alpha值
  544. */
  545. - (void)setRSI3Red:(CGFloat)rsi3Red rsi3Green:(CGFloat)rsi3Green rsi3Blue:(CGFloat)rsi3Blue rsi3Alpha:(CGFloat)rsi3Alpha;
  546. /**
  547. * @brief 设置KT KT线颜色的方法
  548. *
  549. * @param ktRed KT线红色值
  550. * @param ktGreen KT线绿色值
  551. * @param ktBlue KT线蓝色值
  552. * @param ktAlpha KT线alpha值
  553. */
  554. - (void)setKTRed:(CGFloat)ktRed ktGreen:(CGFloat)ktGreen ktBlue:(CGFloat)ktBlue ktAlpha:(CGFloat)ktAlpha;
  555. /**
  556. * @brief 设置DT DT线颜色的方法
  557. *
  558. * @param dtRed DT DT线红色值
  559. * @param dtGreen DT DT线绿色值
  560. * @param dtBlue DT DT线蓝色值
  561. * @param dtAlpha DT DT线alpha值
  562. */
  563. - (void)setDTRed:(CGFloat)dtRed dtGreen:(CGFloat)dtGreen dtBlue:(CGFloat)dtBlue dtAlpha:(CGFloat)dtAlpha;
  564. /**
  565. * @brief 设置JT JT线颜色的方法
  566. *
  567. * @param jtRed JT JT线红色值
  568. * @param jtGreen JT JT线绿色值
  569. * @param jtBlue JT JT线蓝色值
  570. * @param jtAlpha JT JT线alpha值
  571. */
  572. - (void)setJTRed:(CGFloat)jtRed jtGreen:(CGFloat)jtGreen jtBlue:(CGFloat)jtBlue jtAlpha:(CGFloat)jtAlpha;
  573. /**
  574. * @brief 设置CCI CCI线颜色的方法
  575. *
  576. * @param cciRed CCI CCI线红色值
  577. * @param cciGreen CCI CCI线绿色值
  578. * @param cciBlue CCI CCI线蓝色值
  579. * @param cciAlpha CCI CCI线alpha值
  580. */
  581. - (void)setCCIRed:(CGFloat)cciRed cciGreen:(CGFloat)cciGreen cciBlue:(CGFloat)cciBlue cciAlpha:(CGFloat)cciAlpha;
  582. /**
  583. * @brief 设置DMA线颜色的方法
  584. *
  585. * @param dmaRed DMA线红色值
  586. * @param dmaGreen DMA线绿色值
  587. * @param dmaBlue DMA线蓝色值
  588. * @param dmaAlpha DMA线alpha值
  589. */
  590. - (void)setDMARed:(CGFloat)dmaRed dmaGreen:(CGFloat)dmaGreen cciBlue:(CGFloat)dmaBlue cciAlpha:(CGFloat)dmaAlpha;
  591. /**
  592. * @brief 设置AMA线颜色的方法
  593. *
  594. * @param amaRed AMA线红色值
  595. * @param amaGreen AMA线绿色值
  596. * @param amaBlue AMA线蓝色值
  597. * @param amaAlpha AMA线alpha值
  598. */
  599. - (void)setAMARed:(CGFloat)amaRed amaGreen:(CGFloat)amaGreen cciBlue:(CGFloat)amaBlue cciAlpha:(CGFloat)amaAlpha;
  600. /**
  601. * @brief 设置BIAS BIAS1线颜色的方法
  602. *
  603. * @param bias1Red BIAS BIAS1线红色值
  604. * @param bias1Green BIAS BIAS1线绿色值
  605. * @param bias1Blue BIAS BIAS1线蓝色值
  606. * @param bias1Alpha BIAS BIAS1线alpha值
  607. */
  608. - (void)setBIAS1Red:(CGFloat)bias1Red bias1Green:(CGFloat)bias1Green bias1Blue:(CGFloat)bias1Blue bias1Alpha:(CGFloat)bias1Alpha;
  609. /**
  610. * @brief 设置BIAS BIAS2线颜色的方法
  611. *
  612. * @param bias2Red BIAS BIAS2线红色值
  613. * @param bias2Green BIAS BIAS2线绿色值
  614. * @param bias2Blue BIAS BIAS2线蓝色值
  615. * @param bias2Alpha BIAS BIAS2线alpha值
  616. */
  617. - (void)setBIAS2Red:(CGFloat)bias2Red bias2Green:(CGFloat)bias2Green bias2Blue:(CGFloat)bias2Blue bias2Alpha:(CGFloat)bias2Alpha;
  618. /**
  619. * @brief 设置BIAS BIAS3线颜色的方法
  620. *
  621. * @param bias3Red BIAS BIAS3线红色值
  622. * @param bias3Green BIAS BIAS3线绿色值
  623. * @param bias3Blue BIAS BIAS3线蓝色值
  624. * @param bias3Alpha BIAS BIAS3线alpha值
  625. */
  626. - (void)setBIAS3Red:(CGFloat)bias3Red bias3Green:(CGFloat)bias3Green bias3Blue:(CGFloat)bias3Blue bias3Alpha:(CGFloat)bias3Alpha;
  627. /**
  628. * @brief 设置PSY PSY线颜色的方法
  629. *
  630. * @param psyRed PSY PSY线红色值
  631. * @param psyGreen PSY PSY线绿色值
  632. * @param psyBlue PSY PSY线蓝色值
  633. * @param psyAlpha PSY PSY线alpha值
  634. */
  635. - (void)setPSYRed:(CGFloat)psyRed psyGreen:(CGFloat)psyGreen psyBlue:(CGFloat)psyBlue psyAlpha:(CGFloat)psyAlpha;
  636. /**
  637. * @brief 设置PSYMA PSYMA线颜色的方法
  638. *
  639. * @param psymaRed PSYMA PSYMA线红色值
  640. * @param psymaGreen PSYMA PSYMA线绿色值
  641. * @param psymaBlue PSYMA PSYMA线蓝色值
  642. * @param psymaAlpha PSYMA PSYMA线alpha值
  643. */
  644. - (void)setPSYMARed:(CGFloat)psymaRed psymaGreen:(CGFloat)psymaGreen psymaBlue:(CGFloat)psymaBlue psymaAlpha:(CGFloat)psymaAlpha;
  645. @end
  646. #pragma mark - ChartViewDelegate
  647. /**
  648. * @brief 图表委托协议
  649. */
  650. @protocol ChartViewDelegate <NSObject>
  651. /**
  652. * @brief 图表请求上层使用者刷新图表数据(从行情历史)的方法,一般在数据出现异常时触发(比如追加行情时间与图表最新数据块已经超时一个时间周期等)
  653. *
  654. * @param errorCode 异常代码
  655. */
  656. - (void)requestRefreshChartDataWithErrorCode:(ChartErrorType)errorCode;
  657. /**
  658. * @brief 由于处理行情而造成图表数据最新时间变动时触发
  659. *
  660. * @param lasttime 图表数据最新时间
  661. */
  662. - (void)onChangeDataLasttime:(NSDate *)lasttime;
  663. @optional
  664. /**
  665. * @brief 拖到图表到达第一个数据的时候触发
  666. */
  667. - (void)onPanChartDataToTop;
  668. @optional
  669. /**
  670. 当第一次完成数据初始化时回调
  671. @param targets 有数据的指标类型数组
  672. */
  673. - (void)onFinishInitDataWithTargets:(NSArray<NSString *> *)targets;
  674. @end