Line.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using System;
  2. namespace XCharts.Runtime
  3. {
  4. [Serializable]
  5. [SerieHandler(typeof(LineHandler), true)]
  6. [SerieConvert(typeof(Bar), typeof(Pie))]
  7. [CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
  8. [DefaultAnimation(AnimationType.LeftToRight, false)]
  9. [DefaultTooltip(Tooltip.Type.Line, Tooltip.Trigger.Axis)]
  10. [SerieDataExtraField("m_State", "m_Ignore")]
  11. [SerieComponent(typeof(LabelStyle), typeof(EndLabelStyle), typeof(LineArrow), typeof(AreaStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
  12. [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(SerieSymbol), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
  13. public class Line : Serie, INeedSerieContainer
  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<Line>(serieName);
  20. serie.symbol.show = true;
  21. serie.animation.interaction.radius.value = 1.5f;
  22. for (int i = 0; i < 5; i++)
  23. {
  24. chart.AddData(serie.index, UnityEngine.Random.Range(10, 90));
  25. }
  26. return serie;
  27. }
  28. public static Line ConvertSerie(Serie serie)
  29. {
  30. var newSerie = serie.Clone<Line>();
  31. return newSerie;
  32. }
  33. }
  34. }