暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

Serie.cs 67KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace XCharts.Runtime
  5. {
  6. /// <summary>
  7. /// Whether to show as Nightingale chart, which distinguishs data through radius.
  8. /// 是否展示成南丁格尔图,通过半径区分数据大小。
  9. /// </summary>
  10. public enum RoseType
  11. {
  12. /// <summary>
  13. /// Don't show as Nightingale chart.
  14. /// |不展示成南丁格尔玫瑰图。
  15. /// </summary>
  16. None,
  17. /// <summary>
  18. /// Use central angle to show the percentage of data, radius to show data size.
  19. /// |扇区圆心角展现数据的百分比,半径展现数据的大小。
  20. /// </summary>
  21. Radius,
  22. /// <summary>
  23. /// All the sectors will share the same central angle, the data size is shown only through radiuses.
  24. /// |所有扇区圆心角相同,仅通过半径展现数据大小。
  25. /// </summary>
  26. Area
  27. }
  28. /// <summary>
  29. /// the type of line chart.
  30. /// |折线图样式类型
  31. /// </summary>
  32. public enum LineType
  33. {
  34. /// <summary>
  35. /// the normal line chart,
  36. /// |普通折线图。
  37. /// </summary>
  38. Normal,
  39. /// <summary>
  40. /// the smooth line chart,
  41. /// |平滑曲线。
  42. /// </summary>
  43. Smooth,
  44. /// <summary>
  45. /// step line.
  46. /// |阶梯线图:当前点。
  47. /// </summary>
  48. StepStart,
  49. /// <summary>
  50. /// step line.
  51. /// |阶梯线图:当前点和下一个点的中间。
  52. /// </summary>
  53. StepMiddle,
  54. /// <summary>
  55. /// step line.
  56. /// |阶梯线图:下一个拐点。
  57. /// </summary>
  58. StepEnd
  59. }
  60. /// <summary>
  61. /// the type of bar. |柱状图类型。
  62. /// </summary>
  63. public enum BarType
  64. {
  65. /// <summary>
  66. /// normal bar.
  67. /// |普通柱形图。
  68. /// </summary>
  69. Normal,
  70. /// <summary>
  71. /// zebra bar.
  72. /// |斑马柱形图。
  73. /// </summary>
  74. Zebra,
  75. /// <summary>
  76. /// capsule bar.
  77. /// |胶囊柱形图。
  78. /// </summary>
  79. Capsule
  80. }
  81. /// <summary>
  82. /// the type of radar. |雷达图类型。
  83. /// </summary>
  84. public enum RadarType
  85. {
  86. /// <summary>
  87. /// multiple radar.
  88. /// |多圈雷达图。此时可一个雷达里绘制多个圈,一个serieData就可组成一个圈(多维数据)。
  89. /// </summary>
  90. Multiple,
  91. /// <summary>
  92. /// single radar.
  93. /// |单圈雷达图。此时一个雷达只能绘制一个圈,多个serieData组成一个圈,数据取自`data[1]`。
  94. /// </summary>
  95. Single
  96. }
  97. /// <summary>
  98. /// 采样类型
  99. /// </summary>
  100. public enum SampleType
  101. {
  102. /// <summary>
  103. /// Take a peak. When the average value of the filter point is greater than or equal to 'sampleAverage',
  104. /// take the maximum value; If you do it the other way around, you get the minimum.
  105. /// |取峰值。
  106. /// </summary>
  107. Peak,
  108. /// <summary>
  109. /// Take the average of the filter points.
  110. /// |取过滤点的平均值。
  111. /// </summary>
  112. Average,
  113. /// <summary>
  114. /// Take the maximum value of the filter point.
  115. /// |取过滤点的最大值。
  116. /// </summary>
  117. Max,
  118. /// <summary>
  119. /// Take the minimum value of the filter point.
  120. /// |取过滤点的最小值。
  121. /// </summary>
  122. Min,
  123. /// <summary>
  124. /// Take the sum of the filter points.
  125. /// |取过滤点的和。
  126. /// </summary>
  127. Sum
  128. }
  129. /// <summary>
  130. /// 数据排序方式
  131. /// </summary>
  132. public enum SerieDataSortType
  133. {
  134. /// <summary>
  135. /// 按 data 的顺序
  136. /// </summary>
  137. None,
  138. /// <summary>
  139. /// 升序
  140. /// </summary>
  141. Ascending,
  142. /// <summary>
  143. /// 降序
  144. /// </summary>
  145. Descending,
  146. }
  147. /// <summary>
  148. /// 对齐方式
  149. /// </summary>
  150. public enum Align
  151. {
  152. Center,
  153. Left,
  154. Right
  155. }
  156. /// <summary>
  157. /// Serie state. Supports normal, emphasis, blur, and select states.
  158. /// |Serie状态。支持正常、高亮、淡出、选中四种状态。
  159. /// </summary>
  160. public enum SerieState
  161. {
  162. /// <summary>
  163. /// Normal state.
  164. /// |正常状态。
  165. /// </summary>
  166. Normal,
  167. /// <summary>
  168. /// Emphasis state.
  169. /// |高亮状态。
  170. /// </summary>
  171. Emphasis,
  172. /// <summary>
  173. /// Blur state.
  174. /// |淡出状态。
  175. /// </summary>
  176. Blur,
  177. /// <summary>
  178. /// Select state.
  179. /// |选中状态。
  180. /// </summary>
  181. Select,
  182. /// <summary>
  183. /// Auto state.
  184. /// |自动保持和父节点一致。一般用在SerieData。
  185. /// </summary>
  186. Auto
  187. }
  188. /// <summary>
  189. /// The policy to take color from theme.
  190. /// |从主题中取色策略。
  191. /// </summary>
  192. public enum SerieColorBy
  193. {
  194. /// <summary>
  195. /// Select state.
  196. /// |默认策略。每种Serie都有自己的默认的取颜色策略。比如Line默认是Series策略,Pie默认是Data策略
  197. /// </summary>
  198. Default,
  199. /// <summary>
  200. /// assigns the colors in the palette by serie, so that all data in the same series are in the same color;.
  201. /// |按照系列分配调色盘中的颜色,同一系列中的所有数据都是用相同的颜色。
  202. /// </summary>
  203. Serie,
  204. /// <summary>
  205. /// assigns colors in the palette according to data items, with each data item using a different color..
  206. /// |按照数据项分配调色盘中的颜色,每个数据项都使用不同的颜色。
  207. /// </summary>
  208. Data
  209. }
  210. /// <summary>
  211. /// 系列。
  212. /// </summary>
  213. [System.Serializable]
  214. public partial class Serie : BaseSerie, IComparable
  215. {
  216. [SerializeField] private int m_Index;
  217. [SerializeField] private bool m_Show = true;
  218. [SerializeField] private string m_CoordSystem = "GridCoord";
  219. [SerializeField] private string m_SerieType = "";
  220. [SerializeField] private string m_SerieName;
  221. [SerializeField][Since("v3.2.0")] private SerieState m_State = SerieState.Normal;
  222. [SerializeField][Since("v3.2.0")] private SerieColorBy m_ColorBy = SerieColorBy.Default;
  223. [SerializeField] private string m_Stack;
  224. [SerializeField] private int m_XAxisIndex = 0;
  225. [SerializeField] private int m_YAxisIndex = 0;
  226. [SerializeField] private int m_RadarIndex = 0;
  227. [SerializeField] private int m_VesselIndex = 0;
  228. [SerializeField] private int m_PolarIndex = 0;
  229. [SerializeField] private int m_SingleAxisIndex = 0;
  230. [SerializeField] private int m_ParallelIndex = 0;
  231. [SerializeField] protected int m_MinShow;
  232. [SerializeField] protected int m_MaxShow;
  233. [SerializeField] protected int m_MaxCache;
  234. [SerializeField] private float m_SampleDist = 0;
  235. [SerializeField] private SampleType m_SampleType = SampleType.Average;
  236. [SerializeField] private float m_SampleAverage = 0;
  237. [SerializeField] private LineType m_LineType = LineType.Normal;
  238. [SerializeField][Since("v3.4.0")] private bool m_SmoothLimit = true;
  239. [SerializeField] private BarType m_BarType = BarType.Normal;
  240. [SerializeField] private bool m_BarPercentStack = false;
  241. [SerializeField] private float m_BarWidth = 0;
  242. [SerializeField][Since("v3.5.0")] private float m_BarMaxWidth = 0;
  243. [SerializeField] private float m_BarGap = 0.1f;
  244. [SerializeField] private float m_BarZebraWidth = 4f;
  245. [SerializeField] private float m_BarZebraGap = 2f;
  246. [SerializeField] private float m_Min;
  247. [SerializeField] private float m_Max;
  248. [SerializeField] private float m_MinSize = 0f;
  249. [SerializeField] private float m_MaxSize = 1f;
  250. [SerializeField] private float m_StartAngle;
  251. [SerializeField] private float m_EndAngle;
  252. [SerializeField] private float m_MinAngle;
  253. [SerializeField] private bool m_Clockwise = true;
  254. [SerializeField] private bool m_RoundCap;
  255. [SerializeField] private int m_SplitNumber;
  256. [SerializeField] private bool m_ClickOffset = true;
  257. [SerializeField] private RoseType m_RoseType = RoseType.None;
  258. [SerializeField] private float m_Gap;
  259. [SerializeField] private float[] m_Center = new float[2] { 0.5f, 0.48f };
  260. [SerializeField] private float[] m_Radius = new float[2] { 0, 0.28f };
  261. [SerializeField][Range(2, 10)] private int m_ShowDataDimension;
  262. [SerializeField] private bool m_ShowDataName;
  263. [SerializeField] private bool m_Clip = false;
  264. [SerializeField] private bool m_Ignore = false;
  265. [SerializeField] private double m_IgnoreValue = 0;
  266. [SerializeField] private bool m_IgnoreLineBreak = false;
  267. [SerializeField] private bool m_ShowAsPositiveNumber = false;
  268. [SerializeField] private bool m_Large = true;
  269. [SerializeField] private int m_LargeThreshold = 200;
  270. [SerializeField] private bool m_AvoidLabelOverlap = false;
  271. [SerializeField] private RadarType m_RadarType = RadarType.Multiple;
  272. [SerializeField] private bool m_PlaceHolder = false;
  273. [SerializeField] private SerieDataSortType m_DataSortType = SerieDataSortType.Descending;
  274. [SerializeField] private Orient m_Orient = Orient.Vertical;
  275. [SerializeField] private Align m_Align = Align.Center;
  276. [SerializeField] private float m_Left;
  277. [SerializeField] private float m_Right;
  278. [SerializeField] private float m_Top;
  279. [SerializeField] private float m_Bottom;
  280. [SerializeField] private bool m_InsertDataToHead;
  281. [SerializeField] private LineStyle m_LineStyle = new LineStyle();
  282. [SerializeField] private SerieSymbol m_Symbol = new SerieSymbol();
  283. [SerializeField] private AnimationStyle m_Animation = new AnimationStyle();
  284. [SerializeField] private ItemStyle m_ItemStyle = new ItemStyle();
  285. [SerializeField] private List<SerieData> m_Data = new List<SerieData>();
  286. [NonSerialized] internal int m_FilterStart;
  287. [NonSerialized] internal int m_FilterEnd;
  288. [NonSerialized] internal double m_FilterStartValue;
  289. [NonSerialized] internal double m_FilterEndValue;
  290. [NonSerialized] internal int m_FilterMinShow;
  291. [NonSerialized] internal bool m_NeedUpdateFilterData;
  292. [NonSerialized] public List<SerieData> m_FilterData = new List<SerieData>();
  293. [NonSerialized] private bool m_NameDirty;
  294. /// <summary>
  295. /// The index of serie.
  296. /// |系列索引。
  297. /// </summary>
  298. public int index { get { return m_Index; } internal set { m_Index = value; } }
  299. /// <summary>
  300. /// Whether to show serie in chart.
  301. /// |系列是否显示在图表上。
  302. /// </summary>
  303. public bool show
  304. {
  305. get { return m_Show; }
  306. set { if (PropertyUtil.SetStruct(ref m_Show, value)) { SetVerticesDirty(); SetSerieNameDirty(); } }
  307. }
  308. /// <summary>
  309. /// the chart coord system of serie.
  310. /// |使用的坐标系。
  311. /// </summary>
  312. public string coordSystem
  313. {
  314. get { return m_CoordSystem; }
  315. set { if (PropertyUtil.SetClass(ref m_CoordSystem, value, true)) SetVerticesDirty(); }
  316. }
  317. /// <summary>
  318. /// the type of serie.
  319. /// |系列类型。
  320. /// </summary>
  321. public string serieType
  322. {
  323. get { return m_SerieType; }
  324. set { if (PropertyUtil.SetClass(ref m_SerieType, value, true)) SetVerticesDirty(); }
  325. }
  326. /// <summary>
  327. /// Series name used for displaying in tooltip and filtering with legend.
  328. /// |系列名称,用于 tooltip 的显示,legend 的图例筛选。
  329. /// </summary>
  330. public string serieName
  331. {
  332. get { return m_SerieName; }
  333. set { if (PropertyUtil.SetClass(ref m_SerieName, value)) { SetVerticesDirty(); SetSerieNameDirty(); } }
  334. }
  335. /// <summary>
  336. /// Legend name. When the serie name is not empty, the legend name is the series name; Otherwise, it is index.
  337. /// |图例名称。当系列名称不为空时,图例名称即为系列名称;反之则为索引index。
  338. /// </summary>
  339. public string legendName { get { return string.IsNullOrEmpty(serieName) ? ChartCached.IntToStr(index) : serieName; } }
  340. /// <summary>
  341. /// The default state of a serie.
  342. /// |系列的默认状态。
  343. /// </summary>
  344. public SerieState state
  345. {
  346. get { return m_State; }
  347. set { if (PropertyUtil.SetStruct(ref m_State, value)) { SetAllDirty(); } }
  348. }
  349. /// <summary>
  350. /// The policy to take color from theme.
  351. /// |从主题中取色的策略。
  352. /// </summary>
  353. public SerieColorBy colorBy
  354. {
  355. //get { return m_ColorBy; }
  356. get { return m_ColorBy == SerieColorBy.Default ? defaultColorBy : m_ColorBy; }
  357. set { if (PropertyUtil.SetStruct(ref m_ColorBy, value)) { SetAllDirty(); } }
  358. }
  359. /// <summary>
  360. /// If stack the value. On the same category axis, the series with the same stack name would be put on top of each other.
  361. /// |数据堆叠,同个类目轴上系列配置相同的stack值后,后一个系列的值会在前一个系列的值上相加。
  362. /// </summary>
  363. public string stack
  364. {
  365. get { return m_Stack; }
  366. set { if (PropertyUtil.SetClass(ref m_Stack, value)) SetVerticesDirty(); }
  367. }
  368. /// <summary>
  369. /// the index of XAxis.
  370. /// |使用X轴的index。
  371. /// </summary>
  372. public int xAxisIndex
  373. {
  374. get { return m_XAxisIndex; }
  375. set { if (PropertyUtil.SetStruct(ref m_XAxisIndex, value)) SetVerticesDirty(); }
  376. }
  377. /// <summary>
  378. /// the index of YAxis.
  379. /// |使用Y轴的index。
  380. /// </summary>
  381. public int yAxisIndex
  382. {
  383. get { return m_YAxisIndex; }
  384. set { if (PropertyUtil.SetStruct(ref m_YAxisIndex, value)) SetVerticesDirty(); }
  385. }
  386. /// <summary>
  387. /// Index of radar component that radar chart uses.
  388. /// |雷达图所使用的 radar 组件的 index。
  389. /// </summary>
  390. public int radarIndex
  391. {
  392. get { return m_RadarIndex; }
  393. set { if (PropertyUtil.SetStruct(ref m_RadarIndex, value)) SetVerticesDirty(); }
  394. }
  395. /// <summary>
  396. /// Index of vesel component that liquid chart uses.
  397. /// |水位图所使用的 vessel 组件的 index。
  398. /// </summary>
  399. public int vesselIndex
  400. {
  401. get { return m_VesselIndex; }
  402. set { if (PropertyUtil.SetStruct(ref m_VesselIndex, value)) SetVerticesDirty(); }
  403. }
  404. /// <summary>
  405. /// Index of polar component that serie uses.
  406. /// |所使用的 polar 组件的 index。
  407. /// </summary>
  408. public int polarIndex
  409. {
  410. get { return m_PolarIndex; }
  411. set { if (PropertyUtil.SetStruct(ref m_PolarIndex, value)) SetVerticesDirty(); }
  412. }
  413. /// <summary>s
  414. /// Index of single axis component that serie uses.
  415. /// |所使用的 singleAxis 组件的 index。
  416. /// </summary>
  417. public int singleAxisIndex
  418. {
  419. get { return m_SingleAxisIndex; }
  420. set { if (PropertyUtil.SetStruct(ref m_SingleAxisIndex, value)) SetAllDirty(); }
  421. }
  422. /// <summary>s
  423. /// Index of parallel coord component that serie uses.
  424. /// |所使用的 parallel coord 组件的 index。
  425. /// </summary>
  426. public int parallelIndex
  427. {
  428. get { return m_ParallelIndex; }
  429. set { if (PropertyUtil.SetStruct(ref m_ParallelIndex, value)) SetAllDirty(); }
  430. }
  431. /// <summary>
  432. /// The min number of data to show in chart.
  433. /// |系列所显示数据的最小索引
  434. /// </summary>
  435. public int minShow
  436. {
  437. get { return m_MinShow; }
  438. set { if (PropertyUtil.SetStruct(ref m_MinShow, value < 0 ? 0 : value)) { SetVerticesDirty(); } }
  439. }
  440. /// <summary>
  441. /// The max number of data to show in chart.
  442. /// |系列所显示数据的最大索引
  443. /// </summary>
  444. public int maxShow
  445. {
  446. get { return m_MaxShow; }
  447. set { if (PropertyUtil.SetStruct(ref m_MaxShow, value < 0 ? 0 : value)) { SetVerticesDirty(); } }
  448. }
  449. /// <summary>
  450. /// The max number of serie data cache.
  451. /// The first data will be remove when the size of serie data is larger then maxCache.
  452. /// |系列中可缓存的最大数据量。默认为0没有限制,大于0时超过指定值会移除旧数据再插入新数据。
  453. /// </summary>
  454. public int maxCache
  455. {
  456. get { return m_MaxCache; }
  457. set { if (PropertyUtil.SetStruct(ref m_MaxCache, value < 0 ? 0 : value)) { SetVerticesDirty(); } }
  458. }
  459. /// <summary>
  460. /// the symbol of serie data item.
  461. /// |标记的图形。
  462. /// </summary>
  463. public SerieSymbol symbol
  464. {
  465. get { return m_Symbol; }
  466. set { if (PropertyUtil.SetClass(ref m_Symbol, value, true)) SetVerticesDirty(); }
  467. }
  468. /// <summary>
  469. /// The type of line chart.
  470. /// |折线图样式类型。
  471. /// </summary>
  472. public LineType lineType
  473. {
  474. get { return m_LineType; }
  475. set { if (PropertyUtil.SetStruct(ref m_LineType, value)) SetVerticesDirty(); }
  476. }
  477. /// <summary>
  478. /// Whether to restrict the curve. When true, the curve between two continuous data of the same value
  479. /// is restricted to not exceed the data point, and is flat to the data point.
  480. /// |是否限制曲线。当为true时,两个连续相同数值的数据间的曲线会限制为不超出数据点,和数据点是平直的。
  481. /// </summary>
  482. public bool smoothLimit
  483. {
  484. get { return m_SmoothLimit; }
  485. set { if (PropertyUtil.SetStruct(ref m_SmoothLimit, value)) { SetVerticesDirty(); } }
  486. }
  487. /// <summary>
  488. /// the min pixel dist of sample.
  489. /// |采样的最小像素距离,默认为0时不采样。当两个数据点间的水平距离小于改值时,开启采样,保证两点间的水平距离不小于改值。
  490. /// </summary>
  491. public float sampleDist
  492. {
  493. get { return m_SampleDist; }
  494. set { if (PropertyUtil.SetStruct(ref m_SampleDist, value < 0 ? 0 : value)) SetVerticesDirty(); }
  495. }
  496. /// <summary>
  497. /// the type of sample.
  498. /// |采样类型。当sampleDist大于0时有效。
  499. /// </summary>
  500. public SampleType sampleType
  501. {
  502. get { return m_SampleType; }
  503. set { if (PropertyUtil.SetStruct(ref m_SampleType, value)) SetVerticesDirty(); }
  504. }
  505. /// <summary>
  506. /// 设定的采样平均值。当sampleType 为 Peak 时,用于和过滤数据的平均值做对比是取最大值还是最小值。默认为0时会实时计算所有数据的平均值。
  507. /// </summary>
  508. public float sampleAverage
  509. {
  510. get { return m_SampleAverage; }
  511. set { if (PropertyUtil.SetStruct(ref m_SampleAverage, value)) SetVerticesDirty(); }
  512. }
  513. /// <summary>
  514. /// The style of line.
  515. /// |线条样式。
  516. /// </summary>
  517. public LineStyle lineStyle
  518. {
  519. get { return m_LineStyle; }
  520. set { if (PropertyUtil.SetClass(ref m_LineStyle, value, true)) SetVerticesDirty(); }
  521. }
  522. /// <summary>
  523. /// 柱形图类型。
  524. /// </summary>
  525. public BarType barType
  526. {
  527. get { return m_BarType; }
  528. set { if (PropertyUtil.SetStruct(ref m_BarType, value)) SetVerticesDirty(); }
  529. }
  530. /// <summary>
  531. /// 柱形图是否为百分比堆积。相同stack的serie只要有一个barPercentStack为true,则就显示成百分比堆叠柱状图。
  532. /// </summary>
  533. public bool barPercentStack
  534. {
  535. get { return m_BarPercentStack; }
  536. set { if (PropertyUtil.SetStruct(ref m_BarPercentStack, value)) SetVerticesDirty(); }
  537. }
  538. /// <summary>
  539. /// The width of the bar. Adaptive when default 0.
  540. /// |柱条的宽度,不设时自适应。支持设置成相对于类目宽度的百分比。
  541. /// </summary>
  542. public float barWidth
  543. {
  544. get { return m_BarWidth; }
  545. set { if (PropertyUtil.SetStruct(ref m_BarWidth, value)) SetVerticesDirty(); }
  546. }
  547. /// <summary>
  548. /// The max width of the bar. Adaptive when default 0.
  549. /// |柱条的最大宽度,默认为0为不限制最大宽度。支持设置成相对于类目宽度的百分比。
  550. /// </summary>
  551. public float barMaxWidth
  552. {
  553. get { return m_BarMaxWidth; }
  554. set { if (PropertyUtil.SetStruct(ref m_BarMaxWidth, value)) SetVerticesDirty(); }
  555. }
  556. /// <summary>
  557. /// The gap between bars between different series, is a percent value like '0.3f' , which means 30% of the bar width, can be set as a fixed value.
  558. /// Set barGap as '-1' can overlap bars that belong to different series, which is useful when making a series of bar be background.
  559. /// In a single coodinate system, this attribute is shared by multiple 'bar' series.
  560. /// This attribute should be set on the last 'bar' series in the coodinate system,
  561. /// then it will be adopted by all 'bar' series in the coordinate system.
  562. /// |不同系列的柱间距离。为百分比(如 '0.3f',表示柱子宽度的 30%)
  563. /// 如果想要两个系列的柱子重叠,可以设置 barGap 为 '-1f'。这在用柱子做背景的时候有用。
  564. /// 在同一坐标系上,此属性会被多个 'bar' 系列共享。此属性应设置于此坐标系中最后一个 'bar' 系列上才会生效,并且是对此坐标系中所有 'bar' 系列生效。
  565. /// </summary>
  566. public float barGap
  567. {
  568. get { return m_BarGap; }
  569. set { if (PropertyUtil.SetStruct(ref m_BarGap, value)) SetVerticesDirty(); }
  570. }
  571. /// <summary>
  572. /// 斑马线的粗细。
  573. /// </summary>
  574. public float barZebraWidth
  575. {
  576. get { return m_BarZebraWidth; }
  577. set { if (PropertyUtil.SetStruct(ref m_BarZebraWidth, value < 0 ? 0 : value)) SetVerticesDirty(); }
  578. }
  579. /// <summary>
  580. /// 斑马线的间距。
  581. /// </summary>
  582. public float barZebraGap
  583. {
  584. get { return m_BarZebraGap; }
  585. set { if (PropertyUtil.SetStruct(ref m_BarZebraGap, value < 0 ? 0 : value)) SetVerticesDirty(); }
  586. }
  587. /// <summary>
  588. /// Whether offset when mouse click pie chart item.
  589. /// |鼠标点击时是否开启偏移,一般用在PieChart图表中。
  590. /// </summary>
  591. public bool pieClickOffset
  592. {
  593. get { return m_ClickOffset; }
  594. set { if (PropertyUtil.SetStruct(ref m_ClickOffset, value)) SetVerticesDirty(); }
  595. }
  596. /// <summary>
  597. /// Whether to show as Nightingale chart.
  598. /// |是否展示成南丁格尔图,通过半径区分数据大小。
  599. /// </summary>
  600. public RoseType pieRoseType
  601. {
  602. get { return m_RoseType; }
  603. set { if (PropertyUtil.SetStruct(ref m_RoseType, value)) SetVerticesDirty(); }
  604. }
  605. /// <summary>
  606. /// gap of item.
  607. /// |间距。
  608. /// </summary>
  609. public float gap
  610. {
  611. get { return m_Gap; }
  612. set { if (PropertyUtil.SetStruct(ref m_Gap, value)) SetVerticesDirty(); }
  613. }
  614. /// <summary>
  615. /// the center of chart.
  616. /// |中心点。
  617. /// </summary>
  618. public float[] center
  619. {
  620. get { return m_Center; }
  621. set { if (value != null && value.Length == 2) { m_Center = value; SetVerticesDirty(); } }
  622. }
  623. /// <summary>
  624. /// the radius of chart.
  625. /// |半径。radius[0]表示内径,radius[1]表示外径。
  626. /// </summary>
  627. public float[] radius
  628. {
  629. get { return m_Radius; }
  630. set { if (value != null && value.Length == 2) { m_Radius = value; SetVerticesDirty(); } }
  631. }
  632. /// <summary>
  633. /// 最小值。
  634. /// </summary>
  635. public float min
  636. {
  637. get { return m_Min; }
  638. set { if (PropertyUtil.SetStruct(ref m_Min, value)) SetVerticesDirty(); }
  639. }
  640. /// <summary>
  641. /// 最大值。
  642. /// </summary>
  643. public float max
  644. {
  645. get { return m_Max; }
  646. set { if (PropertyUtil.SetStruct(ref m_Max, value)) SetVerticesDirty(); }
  647. }
  648. /// <summary>
  649. /// 数据最小值 min 映射的宽度。
  650. /// </summary>
  651. public float minSize
  652. {
  653. get { return m_MinSize; }
  654. set { if (PropertyUtil.SetStruct(ref m_MinSize, value)) SetVerticesDirty(); }
  655. }
  656. /// <summary>
  657. /// 数据最大值 max 映射的宽度。
  658. /// </summary>
  659. public float maxSize
  660. {
  661. get { return m_MaxSize; }
  662. set { if (PropertyUtil.SetStruct(ref m_MaxSize, value)) SetVerticesDirty(); }
  663. }
  664. /// <summary>
  665. /// 起始角度。和时钟一样,12点钟位置是0度,顺时针到360度。
  666. /// </summary>
  667. public float startAngle
  668. {
  669. get { return m_StartAngle; }
  670. set { if (PropertyUtil.SetStruct(ref m_StartAngle, value)) SetVerticesDirty(); }
  671. }
  672. /// <summary>
  673. /// 结束角度。和时钟一样,12点钟位置是0度,顺时针到360度。
  674. /// </summary>
  675. public float endAngle
  676. {
  677. get { return m_EndAngle; }
  678. set { if (PropertyUtil.SetStruct(ref m_EndAngle, value)) SetVerticesDirty(); }
  679. }
  680. /// <summary>
  681. /// The minimum angle of sector(0-360). It prevents some sector from being too small when value is small.
  682. /// |最小的扇区角度(0-360)。用于防止某个值过小导致扇区太小影响交互。
  683. /// </summary>
  684. public float minAngle
  685. {
  686. get { return m_MinAngle; }
  687. set { if (PropertyUtil.SetStruct(ref m_MinAngle, value)) SetVerticesDirty(); }
  688. }
  689. /// <summary>
  690. /// 是否顺时针。
  691. /// </summary>
  692. public bool clockwise
  693. {
  694. get { return m_Clockwise; }
  695. set { if (PropertyUtil.SetStruct(ref m_Clockwise, value)) SetVerticesDirty(); }
  696. }
  697. /// <summary>
  698. /// 刻度分割段数。最大可设置36。
  699. /// </summary>
  700. public int splitNumber
  701. {
  702. get { return m_SplitNumber; }
  703. set { if (PropertyUtil.SetStruct(ref m_SplitNumber, value > 36 ? 36 : value)) SetVerticesDirty(); }
  704. }
  705. /// <summary>
  706. /// 是否开启圆弧效果。
  707. /// </summary>
  708. public bool roundCap
  709. {
  710. get { return m_RoundCap; }
  711. set { if (PropertyUtil.SetStruct(ref m_RoundCap, value)) SetVerticesDirty(); }
  712. }
  713. /// <summary>
  714. /// 是否开启忽略数据。当为 true 时,数据值为 ignoreValue 时不进行绘制。
  715. /// </summary>
  716. public bool ignore
  717. {
  718. get { return m_Ignore; }
  719. set { if (PropertyUtil.SetStruct(ref m_Ignore, value)) SetVerticesDirty(); }
  720. }
  721. /// <summary>
  722. /// 忽略数据的默认值。当ignore为true才有效。
  723. /// </summary>
  724. public double ignoreValue
  725. {
  726. get { return m_IgnoreValue; }
  727. set { if (PropertyUtil.SetStruct(ref m_IgnoreValue, value)) SetVerticesDirty(); }
  728. }
  729. /// <summary>
  730. /// 忽略数据时折线是断开还是连接。默认false为连接。
  731. /// </summary>
  732. /// <value></value>
  733. public bool ignoreLineBreak
  734. {
  735. get { return m_IgnoreLineBreak; }
  736. set { if (PropertyUtil.SetStruct(ref m_IgnoreLineBreak, value)) SetVerticesDirty(); }
  737. }
  738. /// <summary>
  739. /// 雷达图类型。
  740. /// </summary>
  741. public RadarType radarType
  742. {
  743. get { return m_RadarType; }
  744. set { if (PropertyUtil.SetStruct(ref m_RadarType, value)) SetVerticesDirty(); }
  745. }
  746. /// <summary>
  747. /// The start animation.
  748. /// |起始动画。
  749. /// </summary>
  750. public AnimationStyle animation
  751. {
  752. get { return m_Animation; }
  753. set { if (PropertyUtil.SetClass(ref m_Animation, value, true)) SetVerticesDirty(); }
  754. }
  755. /// <summary>
  756. /// The style of data item.
  757. /// |图形样式。
  758. /// </summary>
  759. public ItemStyle itemStyle
  760. {
  761. get { return m_ItemStyle; }
  762. set { if (PropertyUtil.SetClass(ref m_ItemStyle, value, true)) SetVerticesDirty(); }
  763. }
  764. /// <summary>
  765. /// 数据项里的数据维数。
  766. /// </summary>
  767. public int showDataDimension { get { return m_ShowDataDimension; } set { m_ShowDataDimension = Mathf.Clamp(2, 10, value); } }
  768. /// <summary>
  769. /// 在Editor的inpsector上是否显示name参数
  770. /// </summary>
  771. public bool showDataName { get { return m_ShowDataName; } set { m_ShowDataName = value; } }
  772. /// <summary>
  773. /// If clip the overflow on the coordinate system.
  774. /// |是否裁剪超出坐标系部分的图形。
  775. /// </summary>
  776. public bool clip
  777. {
  778. get { return m_Clip; }
  779. set { if (PropertyUtil.SetStruct(ref m_Clip, value)) SetVerticesDirty(); }
  780. }
  781. /// <summary>
  782. /// Show negative number as positive number.
  783. /// |将负数数值显示为正数。一般和`AxisLabel`的`showAsPositiveNumber`配合使用。仅在折线图和柱状图中有效。
  784. /// </summary>
  785. public bool showAsPositiveNumber
  786. {
  787. get { return m_ShowAsPositiveNumber; }
  788. set { if (PropertyUtil.SetStruct(ref m_ShowAsPositiveNumber, value)) SetComponentDirty(); }
  789. }
  790. /// <summary>
  791. /// 是否开启大数据量优化,在数据图形特别多而出现卡顿时候可以开启。
  792. /// 开启后配合 largeThreshold 在数据量大于指定阈值的时候对绘制进行优化。
  793. /// 缺点:优化后不能自定义设置单个数据项的样式,不能显示Label。
  794. /// </summary>
  795. public bool large
  796. {
  797. get { return m_Large; }
  798. set { if (PropertyUtil.SetStruct(ref m_Large, value)) SetAllDirty(); }
  799. }
  800. /// <summary>
  801. /// 开启大数量优化的阈值。只有当开启了large并且数据量大于该阀值时才进入性能模式。
  802. /// </summary>
  803. public int largeThreshold
  804. {
  805. get { return m_LargeThreshold; }
  806. set { if (PropertyUtil.SetStruct(ref m_LargeThreshold, value)) SetAllDirty(); }
  807. }
  808. /// <summary>
  809. /// 在饼图且标签外部显示的情况下,是否启用防止标签重叠策略,默认关闭,在标签拥挤重叠的情况下会挪动各个标签的位置,防止标签间的重叠。
  810. /// </summary>
  811. public bool avoidLabelOverlap
  812. {
  813. get { return m_AvoidLabelOverlap; }
  814. set { if (PropertyUtil.SetStruct(ref m_AvoidLabelOverlap, value)) SetVerticesDirty(); }
  815. }
  816. /// <summary>
  817. /// Distance between component and the left side of the container.
  818. /// |组件离容器左侧的距离。
  819. /// </summary>
  820. public float left
  821. {
  822. get { return m_Left; }
  823. set { if (PropertyUtil.SetStruct(ref m_Left, value)) SetAllDirty(); }
  824. }
  825. /// <summary>
  826. /// Distance between component and the right side of the container.
  827. /// |组件离容器右侧的距离。
  828. /// </summary>
  829. public float right
  830. {
  831. get { return m_Right; }
  832. set { if (PropertyUtil.SetStruct(ref m_Right, value)) SetAllDirty(); }
  833. }
  834. /// <summary>
  835. /// Distance between component and the top side of the container.
  836. /// |组件离容器上侧的距离。
  837. /// </summary>
  838. public float top
  839. {
  840. get { return m_Top; }
  841. set { if (PropertyUtil.SetStruct(ref m_Top, value)) SetAllDirty(); }
  842. }
  843. /// <summary>
  844. /// Distance between component and the bottom side of the container.
  845. /// |组件离容器下侧的距离。
  846. /// </summary>
  847. public float bottom
  848. {
  849. get { return m_Bottom; }
  850. set { if (PropertyUtil.SetStruct(ref m_Bottom, value)) SetAllDirty(); }
  851. }
  852. /// <summary>
  853. /// Whether to add new data at the head or at the end of the list.
  854. /// |添加新数据时是在列表的头部还是尾部加入。
  855. /// </summary>
  856. public bool insertDataToHead
  857. {
  858. get { return m_InsertDataToHead; }
  859. set { if (PropertyUtil.SetStruct(ref m_InsertDataToHead, value)) SetAllDirty(); }
  860. }
  861. /// <summary>
  862. /// 组件的数据排序。
  863. /// </summary>
  864. public SerieDataSortType dataSortType
  865. {
  866. get { return m_DataSortType; }
  867. set { if (PropertyUtil.SetStruct(ref m_DataSortType, value)) SetVerticesDirty(); }
  868. }
  869. /// <summary>
  870. /// 组件的朝向。
  871. /// </summary>
  872. public Orient orient
  873. {
  874. get { return m_Orient; }
  875. set { if (PropertyUtil.SetStruct(ref m_Orient, value)) SetVerticesDirty(); }
  876. }
  877. /// <summary>
  878. /// 组件水平方向对齐方式。
  879. /// </summary>
  880. public Align align
  881. {
  882. get { return m_Align; }
  883. set { if (PropertyUtil.SetStruct(ref m_Align, value)) SetVerticesDirty(); }
  884. }
  885. /// <summary>
  886. /// 占位模式。占位模式时,数据有效但不参与渲染和显示。
  887. /// </summary>
  888. public bool placeHolder
  889. {
  890. get { return m_PlaceHolder; }
  891. set { if (PropertyUtil.SetStruct(ref m_PlaceHolder, value)) SetAllDirty(); }
  892. }
  893. /// <summary>
  894. /// 系列中的数据内容数组。SerieData可以设置1到n维数据。
  895. /// </summary>
  896. public List<SerieData> data { get { return m_Data; } }
  897. /// <summary>
  898. /// 取色策略是否为按数据项分配。
  899. /// </summary>
  900. public bool colorByData { get { return colorBy == SerieColorBy.Data; } }
  901. public override bool vertsDirty
  902. {
  903. get
  904. {
  905. return m_VertsDirty ||
  906. symbol.vertsDirty ||
  907. lineStyle.vertsDirty ||
  908. itemStyle.vertsDirty ||
  909. IsVertsDirty(lineArrow) ||
  910. IsVertsDirty(areaStyle) ||
  911. IsVertsDirty(label) ||
  912. IsVertsDirty(labelLine) ||
  913. IsVertsDirty(titleStyle) ||
  914. IsVertsDirty(emphasisStyle) ||
  915. IsVertsDirty(blurStyle) ||
  916. IsVertsDirty(selectStyle) ||
  917. AnySerieDataVerticesDirty();
  918. }
  919. }
  920. public override bool componentDirty
  921. {
  922. get
  923. {
  924. return m_ComponentDirty ||
  925. symbol.componentDirty ||
  926. IsComponentDirty(titleStyle) ||
  927. IsComponentDirty(label) ||
  928. IsComponentDirty(labelLine) ||
  929. IsComponentDirty(emphasisStyle) ||
  930. IsComponentDirty(blurStyle) ||
  931. IsComponentDirty(selectStyle);
  932. }
  933. }
  934. public override void ClearVerticesDirty()
  935. {
  936. base.ClearVerticesDirty();
  937. if (!IsPerformanceMode())
  938. {
  939. foreach (var serieData in m_Data)
  940. serieData.ClearVerticesDirty();
  941. }
  942. symbol.ClearVerticesDirty();
  943. lineStyle.ClearVerticesDirty();
  944. itemStyle.ClearVerticesDirty();
  945. ClearVerticesDirty(areaStyle);
  946. ClearVerticesDirty(label);
  947. ClearVerticesDirty(emphasisStyle);
  948. ClearVerticesDirty(blurStyle);
  949. ClearVerticesDirty(selectStyle);
  950. ClearVerticesDirty(lineArrow);
  951. ClearVerticesDirty(titleStyle);
  952. }
  953. public override void ClearComponentDirty()
  954. {
  955. base.ClearComponentDirty();
  956. if (!IsPerformanceMode())
  957. {
  958. foreach (var serieData in m_Data)
  959. serieData.ClearComponentDirty();
  960. }
  961. symbol.ClearComponentDirty();
  962. lineStyle.ClearComponentDirty();
  963. itemStyle.ClearComponentDirty();
  964. ClearComponentDirty(areaStyle);
  965. ClearComponentDirty(label);
  966. ClearComponentDirty(emphasisStyle);
  967. ClearComponentDirty(blurStyle);
  968. ClearComponentDirty(selectStyle);
  969. ClearComponentDirty(lineArrow);
  970. ClearComponentDirty(titleStyle);
  971. }
  972. public override void SetAllDirty()
  973. {
  974. base.SetAllDirty();
  975. labelDirty = true;
  976. titleDirty = true;
  977. }
  978. private bool AnySerieDataVerticesDirty()
  979. {
  980. if (IsPerformanceMode())
  981. return false;
  982. if (this is ISimplifiedSerie)
  983. return false;
  984. foreach (var serieData in m_Data)
  985. if (serieData.vertsDirty) return true;
  986. return false;
  987. }
  988. private bool AnySerieDataComponentDirty()
  989. {
  990. if (IsPerformanceMode())
  991. return false;
  992. if (this is ISimplifiedSerie)
  993. return false;
  994. foreach (var serieData in m_Data)
  995. if (serieData.componentDirty) return true;
  996. return false;
  997. }
  998. /// <summary>
  999. /// Whether the serie is highlighted.
  1000. /// |该系列是否高亮,一般由图例悬停触发。
  1001. /// </summary>
  1002. public bool highlight { get; internal set; }
  1003. /// <summary>
  1004. /// the count of data list.
  1005. /// |数据项个数。
  1006. /// </summary>
  1007. public int dataCount { get { return m_Data.Count; } }
  1008. public bool nameDirty { get { return m_NameDirty; } }
  1009. public bool labelDirty { get; set; }
  1010. public bool titleDirty { get; set; }
  1011. public bool dataDirty { get; set; }
  1012. private void SetSerieNameDirty()
  1013. {
  1014. m_NameDirty = true;
  1015. }
  1016. public void ClearSerieNameDirty()
  1017. {
  1018. m_NameDirty = false;
  1019. }
  1020. public override void ClearDirty()
  1021. {
  1022. base.ClearDirty();
  1023. }
  1024. /// <summary>
  1025. /// 维度Y对应数据中最大值。
  1026. /// </summary>
  1027. public double yMax
  1028. {
  1029. get
  1030. {
  1031. var max = double.MinValue;
  1032. foreach (var sdata in data)
  1033. {
  1034. if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1]) && sdata.data[1] > max)
  1035. {
  1036. max = sdata.data[1];
  1037. }
  1038. }
  1039. return max;
  1040. }
  1041. }
  1042. /// <summary>
  1043. /// 维度X对应数据中的最大值。
  1044. /// </summary>
  1045. public double xMax
  1046. {
  1047. get
  1048. {
  1049. var max = double.MinValue;
  1050. foreach (var sdata in data)
  1051. {
  1052. if (sdata.show && !IsIgnoreValue(sdata, sdata.data[0]) && sdata.data[0] > max)
  1053. {
  1054. max = sdata.data[0];
  1055. }
  1056. }
  1057. return max;
  1058. }
  1059. }
  1060. /// <summary>
  1061. /// 维度Y对应数据的最小值。
  1062. /// </summary>
  1063. public double yMin
  1064. {
  1065. get
  1066. {
  1067. var min = double.MaxValue;
  1068. foreach (var sdata in data)
  1069. {
  1070. if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1]) && sdata.data[1] < min)
  1071. {
  1072. min = sdata.data[1];
  1073. }
  1074. }
  1075. return min;
  1076. }
  1077. }
  1078. /// <summary>
  1079. /// 维度X对应数据的最小值。
  1080. /// </summary>
  1081. public double xMin
  1082. {
  1083. get
  1084. {
  1085. var min = double.MaxValue;
  1086. foreach (var sdata in data)
  1087. {
  1088. if (sdata.show && !IsIgnoreValue(sdata, sdata.data[0]) && sdata.data[0] < min)
  1089. {
  1090. min = sdata.data[0];
  1091. }
  1092. }
  1093. return min;
  1094. }
  1095. }
  1096. /// <summary>
  1097. /// 维度Y数据的总和。
  1098. /// </summary>
  1099. public double yTotal
  1100. {
  1101. get
  1102. {
  1103. double total = 0;
  1104. if (IsPerformanceMode())
  1105. {
  1106. foreach (var sdata in data)
  1107. {
  1108. if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1]))
  1109. total += sdata.data[1];
  1110. }
  1111. }
  1112. else
  1113. {
  1114. var duration = animation.GetUpdateAnimationDuration();
  1115. var unscaledTime = animation.unscaledTime;
  1116. foreach (var sdata in data)
  1117. {
  1118. if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1]))
  1119. total += sdata.GetCurrData(1, duration, unscaledTime);
  1120. }
  1121. }
  1122. return total;
  1123. }
  1124. }
  1125. /// <summary>
  1126. /// 维度X数据的总和。
  1127. /// </summary>
  1128. public double xTotal
  1129. {
  1130. get
  1131. {
  1132. double total = 0;
  1133. foreach (var sdata in data)
  1134. {
  1135. if (sdata.show && !IsIgnoreValue(sdata, sdata.data[1]))
  1136. total += sdata.data[0];
  1137. }
  1138. return total;
  1139. }
  1140. }
  1141. public void ResetInteract()
  1142. {
  1143. interact.Reset();
  1144. foreach (var serieData in m_Data)
  1145. serieData.interact.Reset();
  1146. }
  1147. /// <summary>
  1148. /// 重置数据项索引。避免部分数据项的索引异常。
  1149. /// </summary>
  1150. public bool ResetDataIndex()
  1151. {
  1152. var flag = false;
  1153. for (int i = 0; i < m_Data.Count; i++)
  1154. {
  1155. if (m_Data[i].index != i)
  1156. {
  1157. m_Data[i].index = i;
  1158. flag = true;
  1159. }
  1160. }
  1161. return flag;
  1162. }
  1163. /// <summary>
  1164. /// 清空所有数据
  1165. /// </summary>
  1166. public override void ClearData()
  1167. {
  1168. while (m_Data.Count > 0)
  1169. {
  1170. RemoveData(0);
  1171. }
  1172. m_Data.Clear();
  1173. m_NeedUpdateFilterData = true;
  1174. dataDirty = true;
  1175. SetVerticesDirty();
  1176. }
  1177. /// <summary>
  1178. /// 移除指定索引的数据
  1179. /// </summary>
  1180. /// <param name="index"></param>
  1181. public void RemoveData(int index)
  1182. {
  1183. if (index >= 0 && index < m_Data.Count)
  1184. {
  1185. if (!string.IsNullOrEmpty(m_Data[index].name))
  1186. {
  1187. SetSerieNameDirty();
  1188. }
  1189. SetVerticesDirty();
  1190. var serieData = m_Data[index];
  1191. SerieDataPool.Release(serieData);
  1192. if (serieData.labelObject != null)
  1193. {
  1194. SerieLabelPool.Release(serieData.labelObject.gameObject);
  1195. }
  1196. m_Data.RemoveAt(index);
  1197. m_NeedUpdateFilterData = true;
  1198. labelDirty = true;
  1199. dataDirty = true;
  1200. }
  1201. }
  1202. /// <summary>
  1203. /// 添加一个数据到维度Y(此时维度X对应的数据是索引)
  1204. /// </summary>
  1205. /// <param name="value"></param>
  1206. /// <param name="dataName"></param>
  1207. /// <param name="dataId">the unique id of data</param>
  1208. public SerieData AddYData(double value, string dataName = null, string dataId = null)
  1209. {
  1210. CheckMaxCache();
  1211. int xValue = m_Data.Count;
  1212. var serieData = SerieDataPool.Get();
  1213. serieData.data.Add(xValue);
  1214. serieData.data.Add(value);
  1215. serieData.name = dataName;
  1216. serieData.index = xValue;
  1217. serieData.id = dataId;
  1218. AddSerieData(serieData);
  1219. m_ShowDataDimension = 2;
  1220. SetVerticesDirty();
  1221. CheckDataName(dataName);
  1222. labelDirty = true;
  1223. dataDirty = true;
  1224. return serieData;
  1225. }
  1226. public void AddSerieData(SerieData serieData)
  1227. {
  1228. if (m_InsertDataToHead)
  1229. m_Data.Insert(0, serieData);
  1230. else
  1231. m_Data.Add(serieData);
  1232. SetVerticesDirty();
  1233. dataDirty = true;
  1234. m_NeedUpdateFilterData = true;
  1235. }
  1236. private void CheckDataName(string dataName)
  1237. {
  1238. if (string.IsNullOrEmpty(dataName))
  1239. SetSerieNameDirty();
  1240. else
  1241. m_ShowDataName = true;
  1242. }
  1243. /// <summary>
  1244. /// 添加(x,y)数据到维度X和维度Y
  1245. /// </summary>
  1246. /// <param name="xValue"></param>
  1247. /// <param name="yValue"></param>
  1248. /// <param name="dataName"></param>
  1249. /// <param name="dataId">the unique id of data</param>
  1250. public SerieData AddXYData(double xValue, double yValue, string dataName = null, string dataId = null)
  1251. {
  1252. CheckMaxCache();
  1253. var serieData = SerieDataPool.Get();
  1254. serieData.data.Clear();
  1255. serieData.data.Add(xValue);
  1256. serieData.data.Add(yValue);
  1257. serieData.name = dataName;
  1258. serieData.index = m_Data.Count;
  1259. serieData.id = dataId;
  1260. AddSerieData(serieData);
  1261. m_ShowDataDimension = 2;
  1262. SetVerticesDirty();
  1263. CheckDataName(dataName);
  1264. labelDirty = true;
  1265. return serieData;
  1266. }
  1267. /// <summary>
  1268. /// 添加 (open, close, lowest, heighest) 数据
  1269. /// </summary>
  1270. /// <param name="open"></param>
  1271. /// <param name="close"></param>
  1272. /// <param name="lowest"></param>
  1273. /// <param name="heighest"></param>
  1274. /// <param name="dataName"></param>
  1275. /// <param name="dataId">the unique id of data</param>
  1276. /// <returns></returns>
  1277. public SerieData AddData(double indexOrTimestamp, double open, double close, double lowest, double heighest, string dataName = null, string dataId = null)
  1278. {
  1279. CheckMaxCache();
  1280. var serieData = SerieDataPool.Get();
  1281. serieData.data.Clear();
  1282. serieData.data.Add(indexOrTimestamp);
  1283. serieData.data.Add(open);
  1284. serieData.data.Add(close);
  1285. serieData.data.Add(lowest);
  1286. serieData.data.Add(heighest);
  1287. serieData.name = dataName;
  1288. serieData.index = m_Data.Count;
  1289. serieData.id = dataId;
  1290. AddSerieData(serieData);
  1291. m_ShowDataDimension = 5;
  1292. SetVerticesDirty();
  1293. CheckDataName(dataName);
  1294. labelDirty = true;
  1295. return serieData;
  1296. }
  1297. /// <summary>
  1298. /// 将一组数据添加到系列中。
  1299. /// 如果数据只有一个,默认添加到维度Y中。
  1300. /// </summary>
  1301. /// <param name="valueList"></param>
  1302. /// <param name="dataName"></param>
  1303. /// <param name="dataId">the unique id of data</param>
  1304. public SerieData AddData(List<double> valueList, string dataName = null, string dataId = null)
  1305. {
  1306. if (valueList == null || valueList.Count == 0) return null;
  1307. if (valueList.Count == 1)
  1308. return AddYData(valueList[0], dataName, dataId);
  1309. else if (valueList.Count == 2)
  1310. return AddXYData(valueList[0], valueList[1], dataName, dataId);
  1311. else
  1312. {
  1313. CheckMaxCache();
  1314. m_ShowDataDimension = valueList.Count;
  1315. var serieData = SerieDataPool.Get();
  1316. serieData.name = dataName;
  1317. serieData.index = m_Data.Count;
  1318. serieData.id = dataId;
  1319. for (int i = 0; i < valueList.Count; i++)
  1320. {
  1321. serieData.data.Add(valueList[i]);
  1322. }
  1323. AddSerieData(serieData);
  1324. SetVerticesDirty();
  1325. CheckDataName(dataName);
  1326. labelDirty = true;
  1327. return serieData;
  1328. }
  1329. }
  1330. /// <summary>
  1331. /// 添加任意维数据到系列中。
  1332. /// </summary>
  1333. /// <param name="values">任意维数据</param>
  1334. /// <returns></returns>
  1335. public SerieData AddData(params double[] values)
  1336. {
  1337. if (values == null || values.Length == 0) return null;
  1338. string dataName = null;
  1339. string dataId = null;
  1340. if (values.Length == 1)
  1341. return AddYData(values[0], dataName, dataId);
  1342. else if (values.Length == 2)
  1343. return AddXYData(values[0], values[1], dataName, dataId);
  1344. else
  1345. {
  1346. CheckMaxCache();
  1347. m_ShowDataDimension = values.Length;
  1348. var serieData = SerieDataPool.Get();
  1349. serieData.name = dataName;
  1350. serieData.index = m_Data.Count;
  1351. serieData.id = dataId;
  1352. for (int i = 0; i < values.Length; i++)
  1353. {
  1354. serieData.data.Add(values[i]);
  1355. }
  1356. AddSerieData(serieData);
  1357. SetVerticesDirty();
  1358. CheckDataName(dataName);
  1359. labelDirty = true;
  1360. return serieData;
  1361. }
  1362. }
  1363. public SerieData AddChildData(SerieData parent, double value, string name, string id)
  1364. {
  1365. var serieData = new SerieData();
  1366. serieData.name = name;
  1367. serieData.index = m_Data.Count;
  1368. serieData.id = id;
  1369. serieData.data = new List<double>() { m_Data.Count, value };
  1370. AddChildData(parent, serieData);
  1371. return serieData;
  1372. }
  1373. public SerieData AddChildData(SerieData parent, List<double> value, string name, string id)
  1374. {
  1375. var serieData = new SerieData();
  1376. serieData.name = name;
  1377. serieData.index = m_Data.Count;
  1378. serieData.id = id;
  1379. serieData.data = new List<double>(value);
  1380. AddChildData(parent, serieData);
  1381. return serieData;
  1382. }
  1383. public void AddChildData(SerieData parent, SerieData serieData)
  1384. {
  1385. serieData.parentId = parent.id;
  1386. serieData.context.parent = parent;
  1387. if (!m_Data.Contains(serieData))
  1388. AddSerieData(serieData);
  1389. if (!parent.context.children.Contains(serieData))
  1390. {
  1391. parent.context.children.Add(serieData);
  1392. }
  1393. }
  1394. private void CheckMaxCache()
  1395. {
  1396. if (m_MaxCache <= 0) return;
  1397. while (m_Data.Count >= m_MaxCache)
  1398. {
  1399. m_NeedUpdateFilterData = true;
  1400. if (m_InsertDataToHead) RemoveData(m_Data.Count - 1);
  1401. else RemoveData(0);
  1402. }
  1403. }
  1404. /// <summary>
  1405. /// 获得指定index指定维数的数据
  1406. /// </summary>
  1407. /// <param name="index"></param>
  1408. /// <param name="dimension"></param>
  1409. /// <param name="dataZoom"></param>
  1410. /// <returns></returns>
  1411. public double GetData(int index, int dimension, DataZoom dataZoom = null)
  1412. {
  1413. if (index < 0 || dimension < 0) return 0;
  1414. var serieData = GetSerieData(index, dataZoom);
  1415. if (serieData != null && dimension < serieData.data.Count)
  1416. {
  1417. var value = serieData.GetData(dimension);
  1418. if (showAsPositiveNumber)
  1419. value = Math.Abs(value);
  1420. return value;
  1421. }
  1422. else
  1423. {
  1424. return 0;
  1425. }
  1426. }
  1427. /// <summary>
  1428. /// 获得维度Y索引对应的数据
  1429. /// </summary>
  1430. /// <param name="index"></param>
  1431. /// <param name="dataZoom"></param>
  1432. /// <returns></returns>
  1433. public double GetYData(int index, DataZoom dataZoom = null)
  1434. {
  1435. if (index < 0) return 0;
  1436. var serieData = GetDataList(dataZoom);
  1437. if (index < serieData.Count)
  1438. {
  1439. var value = serieData[index].data[1];
  1440. if (showAsPositiveNumber)
  1441. value = Math.Abs(value);
  1442. return value;
  1443. }
  1444. return 0;
  1445. }
  1446. public double GetYCurrData(int index, DataZoom dataZoom = null)
  1447. {
  1448. if (index < 0) return 0;
  1449. var serieData = GetDataList(dataZoom);
  1450. if (index < serieData.Count)
  1451. {
  1452. var value = serieData[index].GetCurrData(1, animation.GetUpdateAnimationDuration(), animation.unscaledTime);
  1453. if (showAsPositiveNumber)
  1454. value = Math.Abs(value);
  1455. return value;
  1456. }
  1457. return 0;
  1458. }
  1459. /// <summary>
  1460. /// 获得维度Y索引对应的数据和数据名
  1461. /// </summary>
  1462. /// <param name="index">索引</param>
  1463. /// <param name="yData">对应的数据值</param>
  1464. /// <param name="dataName">对应的数据名</param>
  1465. /// <param name="dataZoom">区域缩放</param>
  1466. public void GetYData(int index, out double yData, out string dataName, DataZoom dataZoom = null)
  1467. {
  1468. yData = 0;
  1469. dataName = null;
  1470. if (index < 0) return;
  1471. var serieData = GetDataList(dataZoom);
  1472. if (index < serieData.Count)
  1473. {
  1474. yData = serieData[index].data[1];
  1475. if (showAsPositiveNumber)
  1476. yData = Math.Abs(yData);
  1477. dataName = serieData[index].name;
  1478. }
  1479. }
  1480. /// <summary>
  1481. /// 获得指定索引的数据项
  1482. /// </summary>
  1483. /// <param name="index"></param>
  1484. /// <param name="dataZoom"></param>
  1485. /// <returns></returns>
  1486. public SerieData GetSerieData(int index, DataZoom dataZoom = null)
  1487. {
  1488. var data = GetDataList(dataZoom);
  1489. if (index >= 0 && index <= data.Count - 1)
  1490. return data[index];
  1491. return null;
  1492. }
  1493. public SerieData GetSerieData(string id, DataZoom dataZoom = null)
  1494. {
  1495. var data = GetDataList(dataZoom);
  1496. foreach (var serieData in data)
  1497. {
  1498. var target = GetSerieData(serieData, id);
  1499. if (target != null) return target;
  1500. }
  1501. return null;
  1502. }
  1503. public SerieData GetSerieData(SerieData parent, string id)
  1504. {
  1505. if (id.Equals(parent.id)) return parent;
  1506. foreach (var child in parent.context.children)
  1507. {
  1508. var data = GetSerieData(child, id);
  1509. if (data != null)
  1510. {
  1511. return data;
  1512. }
  1513. }
  1514. return null;
  1515. }
  1516. /// <summary>
  1517. /// 获得指定索引的维度X和维度Y的数据
  1518. /// </summary>
  1519. /// <param name="index"></param>
  1520. /// <param name="dataZoom"></param>
  1521. /// <param name="xValue"></param>
  1522. /// <param name="yVlaue"></param>
  1523. public void GetXYData(int index, DataZoom dataZoom, out double xValue, out double yVlaue)
  1524. {
  1525. xValue = 0;
  1526. yVlaue = 0;
  1527. if (index < 0) return;
  1528. var showData = GetDataList(dataZoom);
  1529. if (index < showData.Count)
  1530. {
  1531. var serieData = showData[index];
  1532. xValue = serieData.data[0];
  1533. yVlaue = serieData.data[1];
  1534. if (showAsPositiveNumber)
  1535. {
  1536. xValue = Math.Abs(xValue);
  1537. yVlaue = Math.Abs(yVlaue);
  1538. }
  1539. }
  1540. }
  1541. public virtual double GetDataTotal(int dimension, SerieData serieData = null)
  1542. {
  1543. if (m_Max > 0) return m_Max;
  1544. double total = 0;
  1545. foreach (var sdata in data)
  1546. {
  1547. if (sdata.show)
  1548. total += sdata.GetData(dimension);
  1549. }
  1550. return total;
  1551. }
  1552. /// <summary>
  1553. /// 获得系列的数据列表
  1554. /// </summary>
  1555. /// <param name="dataZoom"></param>
  1556. /// <returns></returns>
  1557. public List<SerieData> GetDataList(DataZoom dataZoom = null)
  1558. {
  1559. if (dataZoom != null && dataZoom.enable &&
  1560. (dataZoom.IsContainsXAxis(xAxisIndex) || dataZoom.IsContainsYAxis(yAxisIndex)))
  1561. {
  1562. SerieHelper.UpdateFilterData(this, dataZoom);
  1563. return m_FilterData;
  1564. }
  1565. else
  1566. {
  1567. return useSortData && context.sortedData.Count > 0 ? context.sortedData : m_Data;
  1568. }
  1569. }
  1570. /// <summary>
  1571. /// 更新指定索引的维度Y数据
  1572. /// </summary>
  1573. /// <param name="index"></param>
  1574. /// <param name="value"></param>
  1575. public bool UpdateYData(int index, double value)
  1576. {
  1577. UpdateData(index, 1, value);
  1578. return true;
  1579. }
  1580. /// <summary>
  1581. /// 更新指定索引的维度X和维度Y的数据
  1582. /// </summary>
  1583. /// <param name="index"></param>
  1584. /// <param name="xValue"></param>
  1585. /// <param name="yValue"></param>
  1586. public bool UpdateXYData(int index, double xValue, double yValue)
  1587. {
  1588. var flag1 = UpdateData(index, 0, xValue);
  1589. var flag2 = UpdateData(index, 1, yValue);
  1590. return flag1 || flag2;
  1591. }
  1592. /// <summary>
  1593. /// 更新指定索引指定维数的数据
  1594. /// </summary>
  1595. /// <param name="index">要更新数据的索引</param>
  1596. /// <param name="dimension">要更新数据的维数</param>
  1597. /// <param name="value">新的数据值</param>
  1598. public bool UpdateData(int index, int dimension, double value)
  1599. {
  1600. if (index >= 0 && index < m_Data.Count)
  1601. {
  1602. var animationOpen = animation.enable;
  1603. var animationDuration = animation.GetUpdateAnimationDuration();
  1604. var unscaledTime = animation.unscaledTime;
  1605. var flag = m_Data[index].UpdateData(dimension, value, animationOpen, unscaledTime, animationDuration);
  1606. if (flag)
  1607. {
  1608. SetVerticesDirty();
  1609. dataDirty = true;
  1610. }
  1611. return flag;
  1612. }
  1613. else
  1614. {
  1615. return false;
  1616. }
  1617. }
  1618. /// <summary>
  1619. /// 更新指定索引的数据项数据列表
  1620. /// </summary>
  1621. /// <param name="index"></param>
  1622. /// <param name="values"></param>
  1623. public bool UpdateData(int index, List<double> values)
  1624. {
  1625. if (index >= 0 && index < m_Data.Count && values != null)
  1626. {
  1627. var serieData = m_Data[index];
  1628. var animationOpen = animation.enable;
  1629. var animationDuration = animation.GetUpdateAnimationDuration();
  1630. var unscaledTime = animation.unscaledTime;
  1631. for (int i = 0; i < values.Count; i++)
  1632. serieData.UpdateData(i, values[i], animationOpen, unscaledTime, animationDuration);
  1633. SetVerticesDirty();
  1634. dataDirty = true;
  1635. return true;
  1636. }
  1637. return false;
  1638. }
  1639. public bool UpdateDataName(int index, string name)
  1640. {
  1641. if (index >= 0 && index < m_Data.Count)
  1642. {
  1643. var serieData = m_Data[index];
  1644. serieData.name = name;
  1645. SetSerieNameDirty();
  1646. if (serieData.labelObject != null)
  1647. {
  1648. serieData.labelObject.SetText(name == null ? "" : name);
  1649. }
  1650. return true;
  1651. }
  1652. return false;
  1653. }
  1654. /// <summary>
  1655. /// 清除所有数据的高亮标志
  1656. /// </summary>
  1657. public void ClearHighlight()
  1658. {
  1659. highlight = false;
  1660. foreach (var serieData in m_Data)
  1661. serieData.context.highlight = false;
  1662. }
  1663. /// <summary>
  1664. /// 设置指定索引的数据为高亮状态
  1665. /// </summary>
  1666. public void SetHighlight(int index, bool flag)
  1667. {
  1668. var serieData = GetSerieData(index);
  1669. if (serieData != null)
  1670. serieData.context.highlight = flag;
  1671. }
  1672. public float GetBarWidth(float categoryWidth, int barCount = 0)
  1673. {
  1674. var realWidth = 0f;
  1675. if (categoryWidth < 2)
  1676. {
  1677. realWidth = categoryWidth;
  1678. }
  1679. else if (m_BarWidth == 0)
  1680. {
  1681. var width = ChartHelper.GetActualValue(0.6f, categoryWidth);
  1682. if (barCount == 0)
  1683. realWidth = width < 1 ? categoryWidth : width;
  1684. else
  1685. realWidth = width / barCount;
  1686. }
  1687. else
  1688. {
  1689. realWidth = ChartHelper.GetActualValue(m_BarWidth, categoryWidth);
  1690. }
  1691. if (m_BarMaxWidth == 0)
  1692. {
  1693. return realWidth;
  1694. }
  1695. else
  1696. {
  1697. var maxWidth = ChartHelper.GetActualValue(m_BarMaxWidth, categoryWidth);
  1698. return realWidth > maxWidth ? maxWidth : realWidth;
  1699. }
  1700. }
  1701. public bool IsIgnoreIndex(int index, int dimension = 1)
  1702. {
  1703. var serieData = GetSerieData(index);
  1704. if (serieData != null)
  1705. return IsIgnoreValue(serieData, dimension);
  1706. return false;
  1707. }
  1708. public bool IsIgnoreValue(SerieData serieData, int dimension = 1)
  1709. {
  1710. return IsIgnoreValue(serieData, serieData.GetData(dimension));
  1711. }
  1712. public bool IsIgnoreValue(double value)
  1713. {
  1714. return m_Ignore && MathUtil.Approximately(value, m_IgnoreValue);
  1715. }
  1716. public bool IsIgnoreValue(SerieData serieData, double value)
  1717. {
  1718. return serieData.ignore || IsIgnoreValue(value);
  1719. }
  1720. public bool IsIgnorePoint(int index)
  1721. {
  1722. if (index >= 0 && index < dataCount)
  1723. {
  1724. return ChartHelper.IsIngore(data[index].context.position);
  1725. }
  1726. return false;
  1727. }
  1728. public bool IsSerie<T>() where T : Serie
  1729. {
  1730. return this is T;
  1731. }
  1732. public bool IsUseCoord<T>() where T : CoordSystem
  1733. {
  1734. return ChartCached.GetTypeName<T>().Equals(m_CoordSystem);
  1735. }
  1736. public bool SetCoord<T>() where T : CoordSystem
  1737. {
  1738. if (GetType().IsDefined(typeof(CoordOptionsAttribute), false))
  1739. {
  1740. var attribute = GetType().GetAttribute<CoordOptionsAttribute>();
  1741. if (attribute.Contains<T>())
  1742. {
  1743. m_CoordSystem = typeof(T).Name;
  1744. return true;
  1745. }
  1746. }
  1747. Debug.LogError("not support coord system:" + typeof(T));
  1748. return false;
  1749. }
  1750. /// <summary>
  1751. /// 是否为性能模式。性能模式下不绘制Symbol,不刷新Label,不单独设置数据项配置。
  1752. /// </summary>
  1753. public bool IsPerformanceMode()
  1754. {
  1755. return m_Large && m_Data.Count >= m_LargeThreshold;
  1756. }
  1757. public bool IsLegendName(string legendName)
  1758. {
  1759. if (colorBy == SerieColorBy.Data)
  1760. {
  1761. return IsSerieDataLegendName(legendName) || IsSerieLegendName(legendName);
  1762. }
  1763. else
  1764. {
  1765. return IsSerieLegendName(legendName);
  1766. }
  1767. }
  1768. public bool IsSerieLegendName(string legendName)
  1769. {
  1770. return legendName.Equals(this.legendName);
  1771. }
  1772. public bool IsSerieDataLegendName(string legendName)
  1773. {
  1774. foreach (var serieData in m_Data)
  1775. {
  1776. if (legendName.Equals(serieData.legendName))
  1777. return true;
  1778. }
  1779. return false;
  1780. }
  1781. /// <summary>
  1782. /// 启用或取消初始动画
  1783. /// </summary>
  1784. public void AnimationEnable(bool flag)
  1785. {
  1786. if (animation.enable) animation.enable = flag;
  1787. SetVerticesDirty();
  1788. }
  1789. /// <summary>
  1790. /// 渐入动画
  1791. /// </summary>
  1792. public void AnimationFadeIn()
  1793. {
  1794. if (animation.enable) animation.FadeIn();
  1795. SetVerticesDirty();
  1796. }
  1797. /// <summary>
  1798. /// 渐出动画
  1799. /// </summary>
  1800. public void AnimationFadeOut()
  1801. {
  1802. if (animation.enable) animation.FadeOut();
  1803. SetVerticesDirty();
  1804. }
  1805. /// <summary>
  1806. /// 暂停动画
  1807. /// </summary>
  1808. public void AnimationPause()
  1809. {
  1810. if (animation.enable) animation.Pause();
  1811. SetVerticesDirty();
  1812. }
  1813. /// <summary>
  1814. /// 继续动画
  1815. /// </summary>
  1816. public void AnimationResume()
  1817. {
  1818. if (animation.enable) animation.Resume();
  1819. SetVerticesDirty();
  1820. }
  1821. /// <summary>
  1822. /// 重置动画
  1823. /// </summary>
  1824. public void AnimationReset()
  1825. {
  1826. if (animation.enable) animation.Reset();
  1827. SetVerticesDirty();
  1828. }
  1829. /// <summary>
  1830. /// 重置动画
  1831. /// </summary>
  1832. public void AnimationRestart()
  1833. {
  1834. if (animation.enable) animation.Restart();
  1835. SetVerticesDirty();
  1836. }
  1837. public int CompareTo(object obj)
  1838. {
  1839. return index.CompareTo((obj as Serie).index);
  1840. }
  1841. public T Clone<T>() where T : Serie
  1842. {
  1843. var newSerie = Activator.CreateInstance<T>();
  1844. SerieHelper.CopySerie(this, newSerie);
  1845. return newSerie;
  1846. }
  1847. public Serie Clone()
  1848. {
  1849. var newSerie = Activator.CreateInstance(GetType()) as Serie;
  1850. SerieHelper.CopySerie(this, newSerie);
  1851. return newSerie;
  1852. }
  1853. }
  1854. }