LineChart.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 
  2. /************************************************/
  3. /* */
  4. /* Copyright (c) 2018 - 2021 monitor1394 */
  5. /* https://github.com/monitor1394 */
  6. /* */
  7. /************************************************/
  8. using UnityEngine;
  9. namespace XCharts
  10. {
  11. [AddComponentMenu("XCharts/LineChart", 13)]
  12. [ExecuteInEditMode]
  13. [RequireComponent(typeof(RectTransform))]
  14. [DisallowMultipleComponent]
  15. public class LineChart : CoordinateChart
  16. {
  17. #if UNITY_EDITOR
  18. protected override void Reset()
  19. {
  20. base.Reset();
  21. title.text = "LineChart";
  22. tooltip.type = Tooltip.Type.Line;
  23. visualMap.enable = false;
  24. visualMap.show = false;
  25. visualMap.autoMinMax = true;
  26. visualMap.inRange.Clear();
  27. visualMap.inRange.Add(Color.blue);
  28. visualMap.inRange.Add(Color.red);
  29. RemoveData();
  30. SerieTemplate.AddDefaultLineSerie(this, "serie1");
  31. for (int i = 0; i < 5; i++)
  32. {
  33. AddXAxisData("x" + (i + 1));
  34. }
  35. }
  36. #endif
  37. }
  38. }