No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BaseChart.API.cs 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.EventSystems;
  5. using UnityEngine.UI;
  6. namespace XCharts.Runtime
  7. {
  8. /// <summary>
  9. /// The base class of all charts.
  10. /// |所有Chart的基类。
  11. /// </summary>
  12. public partial class BaseChart
  13. {
  14. /// <summary>
  15. /// The name of chart.
  16. /// |</summary>
  17. public string chartName
  18. {
  19. get { return m_ChartName; }
  20. set
  21. {
  22. if (!string.IsNullOrEmpty(value) && XChartsMgr.ContainsChart(value))
  23. {
  24. Debug.LogError("chartName repeated:" + value);
  25. }
  26. else
  27. {
  28. m_ChartName = value;
  29. }
  30. }
  31. }
  32. /// <summary>
  33. /// The theme.
  34. /// |</summary>
  35. public ThemeStyle theme { get { return m_Theme; } set { m_Theme = value; } }
  36. /// <summary>
  37. /// Global parameter setting component.
  38. /// |全局设置组件。
  39. /// </summary>
  40. public Settings settings { get { return m_Settings; } }
  41. /// <summary>
  42. /// The x of chart.
  43. /// |图表的X
  44. /// </summary>
  45. public float chartX { get { return m_ChartX; } }
  46. /// <summary>
  47. /// The y of chart.
  48. /// |图表的Y
  49. /// </summary>
  50. public float chartY { get { return m_ChartY; } }
  51. /// <summary>
  52. /// The width of chart.
  53. /// |图表的宽
  54. /// </summary>
  55. public float chartWidth { get { return m_ChartWidth; } }
  56. /// <summary>
  57. /// The height of chart.
  58. /// |图表的高
  59. /// </summary>
  60. public float chartHeight { get { return m_ChartHeight; } }
  61. public Vector2 chartMinAnchor { get { return m_ChartMinAnchor; } }
  62. public Vector2 chartMaxAnchor { get { return m_ChartMaxAnchor; } }
  63. public Vector2 chartPivot { get { return m_ChartPivot; } }
  64. public Vector2 chartSizeDelta { get { return m_ChartSizeDelta; } }
  65. /// <summary>
  66. /// The position of chart.
  67. /// |图表的左下角起始坐标。
  68. /// </summary>
  69. public Vector3 chartPosition { get { return m_ChartPosition; } }
  70. public Rect chartRect { get { return m_ChartRect; } }
  71. /// <summary>
  72. /// The callback function of chart init.
  73. /// |图表的初始化完成回调。
  74. /// </summary>
  75. public Action onInit { set { m_OnInit = value; } }
  76. /// <summary>
  77. /// The callback function of chart update.
  78. /// |图表的Update回调。
  79. /// </summary>
  80. public Action onUpdate { set { m_OnUpdate = value; } }
  81. /// <summary>
  82. /// 自定义绘制回调。在绘制Serie前调用。
  83. /// </summary>
  84. public Action<VertexHelper> onDraw { set { m_OnDrawBase = value; } }
  85. /// <summary>
  86. /// 自定义Serie绘制回调。在每个Serie绘制完前调用。
  87. /// </summary>
  88. public Action<VertexHelper, Serie> onDrawBeforeSerie { set { m_OnDrawSerieBefore = value; } }
  89. /// <summary>
  90. /// 自定义Serie绘制回调。在每个Serie绘制完后调用。
  91. /// </summary>
  92. public Action<VertexHelper, Serie> onDrawAfterSerie { set { m_OnDrawSerieAfter = value; } }
  93. /// <summary>
  94. /// 自定义Upper层绘制回调。在绘制Tooltip前调用。
  95. /// </summary>
  96. public Action<VertexHelper> onDrawUpper { set { m_OnDrawUpper = value; } }
  97. /// <summary>
  98. /// 自定义Top层绘制回调。在绘制Tooltip前调用。
  99. /// </summary>
  100. public Action<VertexHelper> onDrawTop { set { m_OnDrawTop = value; } }
  101. /// <summary>
  102. /// 自定义仪表盘指针绘制委托。
  103. /// </summary>
  104. public CustomDrawGaugePointerFunction customDrawGaugePointerFunction { set { m_CustomDrawGaugePointerFunction = value; } get { return m_CustomDrawGaugePointerFunction; } }
  105. /// <summary>
  106. /// the callback function of pointer click serie.
  107. /// |鼠标点击Serie回调。
  108. /// </summary>
  109. [Since("v3.6.0")]
  110. public Action<SerieEventData> onSerieClick { set { m_OnSerieClick = value; m_ForceOpenRaycastTarget = true; } get { return m_OnSerieClick; } }
  111. /// <summary>
  112. /// the callback function of pointer down serie.
  113. /// |鼠标按下Serie回调。
  114. /// </summary>
  115. [Since("v3.6.0")]
  116. public Action<SerieEventData> onSerieDown { set { m_OnSerieDown = value; m_ForceOpenRaycastTarget = true; } get { return m_OnSerieDown; } }
  117. /// <summary>
  118. /// the callback function of pointer enter serie.
  119. /// |鼠标进入Serie回调。
  120. /// </summary>
  121. [Since("v3.6.0")]
  122. public Action<SerieEventData> onSerieEnter { set { m_OnSerieEnter = value; m_ForceOpenRaycastTarget = true; } get { return m_OnSerieEnter; } }
  123. /// <summary>
  124. /// the callback function of pointer exit serie.
  125. /// |鼠标离开Serie回调。
  126. /// </summary>
  127. [Since("v3.6.0")]
  128. public Action<SerieEventData> onSerieExit { set { m_OnSerieExit = value; m_ForceOpenRaycastTarget = true; } get { return m_OnSerieExit; } }
  129. /// <summary>
  130. /// the callback function of pointer click pie area.
  131. /// |点击饼图区域回调。参数:PointerEventData,SerieIndex,SerieDataIndex
  132. /// </summary>
  133. [Obsolete("Use \"onSerieClick\" instead", true)]
  134. public Action<PointerEventData, int, int> onPointerClickPie { get; set; }
  135. /// <summary>
  136. /// the callback function of pointer enter pie area.
  137. /// |鼠标进入和离开饼图区域回调,SerieDataIndex为-1时表示离开。参数:PointerEventData,SerieIndex,SerieDataIndex
  138. /// </summary>
  139. [Since("v3.3.0")]
  140. [Obsolete("Use \"onSerieEnter\" instead", true)]
  141. public Action<int, int> onPointerEnterPie { set { m_OnPointerEnterPie = value; m_ForceOpenRaycastTarget = true; } get { return m_OnPointerEnterPie; } }
  142. /// <summary>
  143. /// the callback function of click bar.
  144. /// |点击柱形图柱条回调。参数:eventData, dataIndex
  145. /// </summary>
  146. [Obsolete("Use \"onSerieClick\" instead", true)]
  147. public Action<PointerEventData, int> onPointerClickBar { get; set; }
  148. /// <summary>
  149. /// 坐标轴变更数据索引时回调。参数:axis, dataIndex/dataValue
  150. /// </summary>
  151. public Action<Axis, double> onAxisPointerValueChanged { set { m_OnAxisPointerValueChanged = value; } get { return m_OnAxisPointerValueChanged; } }
  152. /// <summary>
  153. /// the callback function of click legend.
  154. /// |点击图例按钮回调。参数:legendIndex, legendName, show
  155. /// </summary>
  156. public Action<Legend, int, string, bool> onLegendClick { set { m_OnLegendClick = value; } internal get { return m_OnLegendClick; } }
  157. /// <summary>
  158. /// the callback function of enter legend.
  159. /// |鼠标进入图例回调。参数:legendIndex, legendName
  160. /// </summary>
  161. public Action<Legend, int, string> onLegendEnter { set { m_OnLegendEnter = value; } internal get { return m_OnLegendEnter; } }
  162. /// <summary>
  163. /// the callback function of exit legend.
  164. /// |鼠标退出图例回调。参数:legendIndex, legendName
  165. /// </summary>
  166. public Action<Legend, int, string> onLegendExit { set { m_OnLegendExit = value; } internal get { return m_OnLegendExit; } }
  167. public void Init(bool defaultChart = true)
  168. {
  169. if (defaultChart)
  170. {
  171. OnInit();
  172. DefaultChart();
  173. }
  174. else
  175. {
  176. OnBeforeSerialize();
  177. }
  178. }
  179. /// <summary>
  180. /// Redraw chart in next frame.
  181. /// |在下一帧刷新整个图表。
  182. /// </summary>
  183. public void RefreshChart()
  184. {
  185. foreach (var serie in m_Series)
  186. serie.ResetInteract();
  187. m_RefreshChart = true;
  188. if (m_Painter) m_Painter.Refresh();
  189. foreach (var painter in m_PainterList) painter.Refresh();
  190. if (m_PainterUpper) m_PainterUpper.Refresh();
  191. if (m_PainterTop) m_PainterTop.Refresh();
  192. }
  193. public override void RefreshGraph()
  194. {
  195. RefreshChart();
  196. }
  197. /// <summary>
  198. /// Redraw chart serie in next frame.
  199. /// |在下一帧刷新图表的指定serie。
  200. /// </summary>
  201. public void RefreshChart(int serieIndex)
  202. {
  203. RefreshPainter(GetSerie(serieIndex));
  204. }
  205. /// <summary>
  206. /// Redraw chart serie in next frame.
  207. /// |在下一帧刷新图表的指定serie。
  208. /// </summary>
  209. public void RefreshChart(Serie serie)
  210. {
  211. if (serie == null) return;
  212. serie.ResetInteract();
  213. RefreshPainter(serie);
  214. }
  215. /// <summary>
  216. /// Clear all components and series data. Note: serie only empties the data and does not remove serie.
  217. /// |清空所有组件和Serie的数据。注意:Serie只是清空数据,不会移除Serie。
  218. /// </summary>
  219. public virtual void ClearData()
  220. {
  221. ClearSerieData();
  222. ClearComponentData();
  223. }
  224. [Since("v3.4.0")]
  225. /// <summary>
  226. /// Clear the data of all series.
  227. /// |清空所有serie的数据。
  228. /// </summary>
  229. public virtual void ClearSerieData()
  230. {
  231. foreach (var serie in m_Series)
  232. serie.ClearData();
  233. m_CheckAnimation = false;
  234. RefreshChart();
  235. }
  236. [Since("v3.4.0")]
  237. /// <summary>
  238. /// Clear the data of all components.
  239. /// |清空所有组件的数据。
  240. /// </summary>
  241. public virtual void ClearComponentData()
  242. {
  243. foreach (var component in m_Components)
  244. component.ClearData();
  245. m_CheckAnimation = false;
  246. RefreshChart();
  247. }
  248. /// <summary>
  249. /// Empty all component data and remove all series. Use the chart again and again to tell the truth.
  250. /// Note: The component only clears the data part, and the parameters are retained and not reset.
  251. /// |清空所有组件数据,并移除所有Serie。一般在图表重新初始化时使用。
  252. /// 注意:组件只清空数据部分,参数会保留不会被重置。
  253. /// </summary>
  254. public virtual void RemoveData()
  255. {
  256. foreach (var component in m_Components)
  257. component.ClearData();
  258. m_Series.Clear();
  259. m_SerieHandlers.Clear();
  260. m_CheckAnimation = false;
  261. RefreshChart();
  262. }
  263. /// <summary>
  264. /// Remove all of them Serie. This interface is used when Serie needs to be removed only, and RemoveData() is generally used in other cases.
  265. /// |移除所有的Serie。当确认只需要移除Serie时使用该接口,其他情况下一般用RemoveData()。
  266. /// </summary>
  267. [Since("v3.2.0")]
  268. public virtual void RemoveAllSerie()
  269. {
  270. m_Series.Clear();
  271. m_SerieHandlers.Clear();
  272. m_CheckAnimation = false;
  273. RefreshChart();
  274. }
  275. /// <summary>
  276. /// Remove legend and serie by name.
  277. /// |清除指定系列名称的数据。
  278. /// </summary>
  279. /// <param name="serieName">the name of serie</param>
  280. public virtual void RemoveData(string serieName)
  281. {
  282. RemoveSerie(serieName);
  283. foreach (var component in m_Components)
  284. {
  285. if (component is Legend)
  286. {
  287. var legend = component as Legend;
  288. legend.RemoveData(serieName);
  289. }
  290. }
  291. RefreshChart();
  292. }
  293. public virtual void UpdateLegendColor(string legendName, bool active)
  294. {
  295. var legendIndex = m_LegendRealShowName.IndexOf(legendName);
  296. if (legendIndex >= 0)
  297. {
  298. foreach (var component in m_Components)
  299. {
  300. if (component is Legend)
  301. {
  302. var legend = component as Legend;
  303. var iconColor = LegendHelper.GetIconColor(this, legend, legendIndex, legendName, active);
  304. var contentColor = LegendHelper.GetContentColor(this, legendIndex, legendName, legend, m_Theme, active);
  305. legend.UpdateButtonColor(legendName, iconColor);
  306. legend.UpdateContentColor(legendName, contentColor);
  307. }
  308. }
  309. }
  310. }
  311. /// <summary>
  312. /// Whether serie is activated.
  313. /// |获得指定图例名字的系列是否显示。
  314. /// </summary>
  315. /// <param name="legendName"></param>
  316. /// <returns></returns>
  317. public virtual bool IsActiveByLegend(string legendName)
  318. {
  319. foreach (var serie in m_Series)
  320. {
  321. if (serie.show && legendName.Equals(serie.serieName))
  322. {
  323. return true;
  324. }
  325. else
  326. {
  327. foreach (var serieData in serie.data)
  328. {
  329. if (serieData.show && legendName.Equals(serieData.name))
  330. {
  331. return true;
  332. }
  333. }
  334. }
  335. }
  336. return false;
  337. }
  338. /// <summary>
  339. /// Update chart theme.
  340. /// |切换内置主题。
  341. /// </summary>
  342. /// <param name="theme">theme</param>
  343. public bool UpdateTheme(ThemeType theme)
  344. {
  345. if (theme == ThemeType.Custom)
  346. {
  347. Debug.LogError("UpdateTheme: not support switch to Custom theme.");
  348. return false;
  349. }
  350. if (m_Theme.sharedTheme == null)
  351. m_Theme.sharedTheme = XCThemeMgr.GetTheme(ThemeType.Default);
  352. m_Theme.sharedTheme.CopyTheme(theme);
  353. return true;
  354. }
  355. /// <summary>
  356. /// Update chart theme info.
  357. /// |切换图表主题。
  358. /// </summary>
  359. /// <param name="theme">theme</param>
  360. public void UpdateTheme(Theme theme)
  361. {
  362. m_Theme.sharedTheme = theme;
  363. SetAllComponentDirty();
  364. #if UNITY_EDITOR
  365. UnityEditor.EditorUtility.SetDirty(this);
  366. #endif
  367. }
  368. /// <summary>
  369. /// Whether series animation enabel.
  370. /// |启用或关闭起始动画。
  371. /// </summary>
  372. /// <param name="flag"></param>
  373. public void AnimationEnable(bool flag)
  374. {
  375. foreach (var serie in m_Series) serie.AnimationEnable(flag);
  376. }
  377. /// <summary>
  378. /// fadeIn animation.
  379. /// |开始渐入动画。
  380. /// </summary>
  381. public void AnimationFadeIn(bool reset = true)
  382. {
  383. if (reset)
  384. AnimationReset();
  385. foreach (var serie in m_Series) serie.AnimationFadeIn();
  386. }
  387. /// <summary>
  388. /// fadeIn animation.
  389. /// |开始渐出动画。
  390. /// </summary>
  391. public void AnimationFadeOut()
  392. {
  393. foreach (var serie in m_Series) serie.AnimationFadeOut();
  394. }
  395. /// <summary>
  396. /// Pause animation.
  397. /// |暂停动画。
  398. /// </summary>
  399. public void AnimationPause()
  400. {
  401. foreach (var serie in m_Series) serie.AnimationPause();
  402. }
  403. /// <summary>
  404. /// Stop play animation.
  405. /// |继续动画。
  406. /// </summary>
  407. public void AnimationResume()
  408. {
  409. foreach (var serie in m_Series) serie.AnimationResume();
  410. }
  411. /// <summary>
  412. /// Reset animation.
  413. /// |重置动画。
  414. /// </summary>
  415. public void AnimationReset()
  416. {
  417. foreach (var serie in m_Series) serie.AnimationReset();
  418. }
  419. /// <summary>
  420. /// 点击图例按钮
  421. /// </summary>
  422. /// <param name="legendIndex">图例按钮索引</param>
  423. /// <param name="legendName">图例按钮名称</param>
  424. /// <param name="show">显示还是隐藏</param>
  425. public void ClickLegendButton(int legendIndex, string legendName, bool show)
  426. {
  427. OnLegendButtonClick(legendIndex, legendName, show);
  428. RefreshChart();
  429. }
  430. /// <summary>
  431. /// 坐标是否在图表范围内
  432. /// </summary>
  433. /// <param name="local"></param>
  434. /// <returns></returns>
  435. public bool IsInChart(Vector2 local)
  436. {
  437. return IsInChart(local.x, local.y);
  438. }
  439. public bool IsInChart(float x, float y)
  440. {
  441. if (x < m_ChartX || x > m_ChartX + m_ChartWidth ||
  442. y < m_ChartY || y > m_ChartY + m_ChartHeight)
  443. {
  444. return false;
  445. }
  446. return true;
  447. }
  448. public void ClampInChart(ref Vector3 pos)
  449. {
  450. if (!IsInChart(pos.x, pos.y))
  451. {
  452. if (pos.x < m_ChartX) pos.x = m_ChartX;
  453. if (pos.x > m_ChartX + m_ChartWidth) pos.x = m_ChartX + m_ChartWidth;
  454. if (pos.y < m_ChartY) pos.y = m_ChartY;
  455. if (pos.y > m_ChartY + m_ChartHeight) pos.y = m_ChartY + m_ChartHeight;
  456. }
  457. }
  458. public Vector3 ClampInGrid(GridCoord grid, Vector3 pos)
  459. {
  460. if (grid.Contains(pos)) return pos;
  461. else
  462. {
  463. // var pos = new Vector3(pos.x, pos.y);
  464. if (pos.x < grid.context.x) pos.x = grid.context.x;
  465. if (pos.x > grid.context.x + grid.context.width) pos.x = grid.context.x + grid.context.width;
  466. if (pos.y < grid.context.y) pos.y = grid.context.y;
  467. if (pos.y > grid.context.y + grid.context.height) pos.y = grid.context.y + grid.context.height;
  468. return pos;
  469. }
  470. }
  471. /// <summary>
  472. /// 转换X轴和Y轴的配置
  473. /// </summary>
  474. /// <param name="index">坐标轴索引,0或1</param>
  475. public void ConvertXYAxis(int index)
  476. {
  477. List<MainComponent> m_XAxes;
  478. List<MainComponent> m_YAxes;
  479. m_ComponentMaps.TryGetValue(typeof(XAxis), out m_XAxes);
  480. m_ComponentMaps.TryGetValue(typeof(YAxis), out m_YAxes);
  481. if (index >= 0 && index <= 1)
  482. {
  483. var xAxis = m_XAxes[index] as XAxis;
  484. var yAxis = m_YAxes[index] as YAxis;
  485. var tempX = xAxis.Clone();
  486. xAxis.Copy(yAxis);
  487. yAxis.Copy(tempX);
  488. xAxis.context.offset = 0;
  489. yAxis.context.offset = 0;
  490. xAxis.context.minValue = 0;
  491. xAxis.context.maxValue = 0;
  492. yAxis.context.minValue = 0;
  493. yAxis.context.maxValue = 0;
  494. RefreshChart();
  495. }
  496. }
  497. /// <summary>
  498. /// 在下一帧刷新DataZoom
  499. /// </summary>
  500. public void RefreshDataZoom()
  501. {
  502. foreach (var handler in m_ComponentHandlers)
  503. {
  504. if (handler is DataZoomHandler)
  505. {
  506. (handler as DataZoomHandler).RefreshDataZoomLabel();
  507. }
  508. }
  509. }
  510. /// <summary>
  511. /// 设置可缓存的最大数据量。当数据量超过该值时,会自动删除第一个值再加入最新值。
  512. /// </summary>
  513. public void SetMaxCache(int maxCache)
  514. {
  515. foreach (var serie in m_Series)
  516. serie.maxCache = maxCache;
  517. foreach (var component in m_Components)
  518. {
  519. if (component is Axis)
  520. {
  521. (component as Axis).maxCache = maxCache;
  522. }
  523. }
  524. }
  525. public Vector3 GetTitlePosition(Title title)
  526. {
  527. return chartPosition + title.location.GetPosition(chartWidth, chartHeight);
  528. }
  529. public int GetLegendRealShowNameIndex(string name)
  530. {
  531. return m_LegendRealShowName.IndexOf(name);
  532. }
  533. public Color32 GetLegendRealShowNameColor(string name)
  534. {
  535. var index = GetLegendRealShowNameIndex(name);
  536. return theme.GetColor(index);
  537. }
  538. /// <summary>
  539. /// 设置Base Painter的材质球
  540. /// </summary>
  541. /// <param name="material"></param>
  542. public void SetBasePainterMaterial(Material material)
  543. {
  544. settings.basePainterMaterial = material;
  545. if (m_Painter != null)
  546. {
  547. m_Painter.material = material;
  548. }
  549. }
  550. /// <summary>
  551. /// 设置Serie Painter的材质球
  552. /// </summary>
  553. /// <param name="material"></param>
  554. public void SetSeriePainterMaterial(Material material)
  555. {
  556. settings.basePainterMaterial = material;
  557. if (m_PainterList != null)
  558. {
  559. foreach (var painter in m_PainterList)
  560. painter.material = material;
  561. }
  562. }
  563. /// <summary>
  564. /// 设置Upper Painter的材质球
  565. /// </summary>
  566. /// <param name="material"></param>
  567. public void SetUpperPainterMaterial(Material material)
  568. {
  569. settings.upperPainterMaterial = material;
  570. if (m_PainterUpper != null)
  571. {
  572. m_PainterUpper.material = material;
  573. }
  574. }
  575. /// <summary>
  576. /// 设置Top Painter的材质球
  577. /// </summary>
  578. /// <param name="material"></param>
  579. public void SetTopPainterMaterial(Material material)
  580. {
  581. settings.topPainterMaterial = material;
  582. if (m_PainterTop != null)
  583. {
  584. m_PainterTop.material = material;
  585. }
  586. }
  587. public Color32 GetChartBackgroundColor()
  588. {
  589. var background = GetChartComponent<Background>();
  590. return theme.GetBackgroundColor(background);
  591. }
  592. [Since("v3.4.0")]
  593. /// <summary>
  594. /// 获得Serie的标识颜色。
  595. /// </summary>
  596. /// <param name="serie"></param>
  597. /// <param name="serieData"></param>
  598. /// <returns></returns>
  599. public Color32 GetMarkColor(Serie serie, SerieData serieData)
  600. {
  601. var itemStyle = SerieHelper.GetItemStyle(serie, serieData);
  602. if (ChartHelper.IsClearColor(itemStyle.markColor))
  603. {
  604. return GetItemColor(serie, serieData);
  605. }
  606. else
  607. {
  608. return itemStyle.markColor;
  609. }
  610. }
  611. public Color32 GetItemColor(Serie serie, SerieData serieData)
  612. {
  613. Color32 color, toColor;
  614. SerieHelper.GetItemColor(out color, out toColor, serie, serieData, m_Theme);
  615. return color;
  616. }
  617. public Color32 GetItemColor(Serie serie, SerieData serieData, int colorIndex)
  618. {
  619. Color32 color, toColor;
  620. SerieHelper.GetItemColor(out color, out toColor, serie, serieData, m_Theme, colorIndex);
  621. return color;
  622. }
  623. public Color32 GetItemColor(Serie serie)
  624. {
  625. Color32 color, toColor;
  626. SerieHelper.GetItemColor(out color, out toColor, serie, null, m_Theme);
  627. return color;
  628. }
  629. }
  630. }