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.

SimplifiedLine.cs 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using UnityEngine;
  3. namespace XCharts.Runtime
  4. {
  5. [Serializable]
  6. [SerieHandler(typeof(SimplifiedLineHandler), true)]
  7. [SerieConvert(typeof(SimplifiedBar), typeof(Line))]
  8. [CoordOptions(typeof(GridCoord))]
  9. [DefaultAnimation(AnimationType.LeftToRight)]
  10. [SerieComponent(typeof(AreaStyle))]
  11. [SerieDataComponent()]
  12. [SerieDataExtraField()]
  13. public class SimplifiedLine : Serie, INeedSerieContainer, ISimplifiedSerie
  14. {
  15. public int containerIndex { get; internal set; }
  16. public int containterInstanceId { get; internal set; }
  17. public static Serie AddDefaultSerie(BaseChart chart, string serieName)
  18. {
  19. var serie = chart.AddSerie<SimplifiedLine>(serieName);
  20. serie.symbol.show = false;
  21. var lastValue = 0d;
  22. for (int i = 0; i < 50; i++)
  23. {
  24. if (i < 20)
  25. lastValue += UnityEngine.Random.Range(0, 5);
  26. else
  27. lastValue += UnityEngine.Random.Range(-3, 5);
  28. chart.AddData(serie.index, lastValue);
  29. }
  30. return serie;
  31. }
  32. public static SimplifiedLine ConvertSerie(Serie serie)
  33. {
  34. var newSerie = serie.Clone<SimplifiedLine>();
  35. return newSerie;
  36. }
  37. }
  38. }