using System.Collections; using System.Collections.Generic; using UnityEngine; using XCharts.Runtime; public class CheckCanvas : MonoBehaviour { public LineChart Line; public LineChart Line2; // Start is called before the first frame update void Start() { //StartCoroutine("xian1"); //StartCoroutine("xian2"); } IEnumerator xian1() { while (true) { yield return new WaitForSeconds(Random.Range(1, 4)); if (Line) { SerieData list = Line.series[0].data[0]; Line.series[0].data[0].data[1] = Random.Range(65f, 70f); Line.series[0].data[1].data[1] = Random.Range(20f, 25f); Line.series[0].data[2].data[1] = Random.Range(20f, 25f); Line.series[0].data[3].data[1] = Random.Range(20f, 25f); Line.series[0].data[4].data[1] = Random.Range(20f, 25f); // Debug.Log("刷新"); Line.RefreshChart(); } } } IEnumerator xian2() { while (true) { yield return new WaitForSeconds(Random.Range(1, 4)); if (Line) { SerieData list = Line2.series[0].data[0]; Line2.series[0].data[0].data[1] = Random.Range(80f, 85f); Line2.series[0].data[1].data[1] = Random.Range(80f, 85f); Line2.series[0].data[2].data[1] = Random.Range(80f, 85f); Line2.series[0].data[3].data[1] = Random.Range(80f, 85f); Line2.series[0].data[4].data[1] = Random.Range(80f, 85f); // Debug.Log("刷新2"); Line2.RefreshChart(); } } } //������ת���Ƕ����� public int yMinLimit = -20; public int yMaxLimit = 80; //��ת�ٶ� public float xSpeed = 250.0f;//������ת�ٶ� public float ySpeed = 120.0f;//������ת�ٶ� //��ת�Ƕ� private float x = 0.0f; private float y = 0.0f; //���ű������� public float MinScale = 0.2f; public float MaxScale = 3.0f; //���ű��� private float scale = 1.0f; void Update() { if (ModelDataManager.Instance.isLoadModel) { if (Input.GetMouseButton(0)) { //Input.GetAxis("MouseX")��ȡ����ƶ���X��ľ��� x += Input.GetAxis("Mouse X") * xSpeed * 0.02f; y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02f; y = ClampAngle(y, yMinLimit, yMaxLimit); //ŷ����ת��Ϊ��Ԫ�� Quaternion rotation = Quaternion.Euler(-y, -x, 0); transform.rotation = rotation; } if (Input.GetAxis("Mouse ScrollWheel") != 0) { scale += Input.GetAxis("Mouse ScrollWheel"); scale = Mathf.Clamp(scale, MinScale, MaxScale); transform.localScale = new Vector3(scale, scale, scale); } } } //�Ƕȷ�Χֵ�޶� static float ClampAngle(float angle, float min, float max) { if (angle < -360) angle += 360; if (angle > 360) angle -= 360; return Mathf.Clamp(angle, min, max); } }