Bar.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. namespace XCharts.Runtime
  2. {
  3. [System.Serializable]
  4. [SerieHandler(typeof(BarHandler), true)]
  5. [SerieConvert(typeof(Line), typeof(Pie))]
  6. [CoordOptions(typeof(GridCoord), typeof(PolarCoord))]
  7. [DefaultAnimation(AnimationType.BottomToTop)]
  8. [DefaultTooltip(Tooltip.Type.Shadow, Tooltip.Trigger.Axis)]
  9. [SerieComponent(typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
  10. [SerieDataComponent(typeof(ItemStyle), typeof(LabelStyle), typeof(EmphasisStyle), typeof(BlurStyle), typeof(SelectStyle))]
  11. [SerieDataExtraField("m_Ignore")]
  12. public class Bar : Serie, INeedSerieContainer
  13. {
  14. public int containerIndex { get; internal set; }
  15. public int containterInstanceId { get; internal set; }
  16. public static Serie AddDefaultSerie(BaseChart chart, string serieName)
  17. {
  18. var serie = chart.AddSerie<Bar>(serieName);
  19. for (int i = 0; i < 5; i++)
  20. {
  21. chart.AddData(serie.index, UnityEngine.Random.Range(10, 90));
  22. }
  23. return serie;
  24. }
  25. public static Bar ConvertSerie(Serie serie)
  26. {
  27. var newSerie = SerieHelper.CloneSerie<Bar>(serie);
  28. return newSerie;
  29. }
  30. }
  31. }