Example50_Scatter.cs 669 B

1234567891011121314151617181920212223242526272829
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using XCharts.Runtime;
  5. namespace XCharts.Example
  6. {
  7. [DisallowMultipleComponent]
  8. [ExecuteInEditMode]
  9. public class Example50_Scatter : MonoBehaviour
  10. {
  11. private ScatterChart chart;
  12. void Awake()
  13. {
  14. chart = gameObject.GetComponent<ScatterChart>();
  15. if (chart == null) return;
  16. foreach (var serie in chart.series)
  17. {
  18. serie.symbol.sizeFunction = SymbolSize;
  19. }
  20. }
  21. float SymbolSize(List<double> data)
  22. {
  23. return (float) (Math.Sqrt(data[2]) / 6e2);
  24. }
  25. }
  26. }