Ejemplo n.º 1
0
 void Update()
 {
     if (initCount < maxCacheDataNumber)
     {
         int count = (int)(maxCacheDataNumber / initDataTime * Time.deltaTime);
         for (int i = 0; i < count; i++)
         {
             timeNow = timeNow.AddSeconds(1);
             string category = timeNow.ToString("hh:mm:ss");
             float  value    = UnityEngine.Random.Range(60, 150);
             chart.AddXAxisData(category);
             chart.AddData(0, value);
             initCount++;
             if (initCount > maxCacheDataNumber)
             {
                 break;
             }
         }
         chart.RefreshChart();
     }
     updateTime += Time.deltaTime;
     if (updateTime >= 1)
     {
         updateTime = 0;
         count++;
         string category = DateTime.Now.ToString("hh:mm:ss");
         float  value    = UnityEngine.Random.Range(60, 150);
         chart.AddXAxisData(category);
         chart.AddData(0, value);
         chart.RefreshChart();
     }
 }
Ejemplo n.º 2
0
        private void Update()
        {
            if (initCount < maxCacheDataNumber)
            {
                for (int i = 0; i < 10; i++)
                {
                    initCount++;
                    if (initCount > maxCacheDataNumber)
                    {
                        break;
                    }
                    chart.title.text = initCount + "数据";
                    timeNow          = timeNow.AddSeconds(1);
                    float xvalue = Mathf.PI / 180 * initCount;
                    float yvalue = Mathf.Sin(xvalue);

                    chart.AddData(0, 15 + yvalue * 2);
                    chart.AddXAxisData(timeNow.ToString("hh:mm:ss"));
                }
            }
        }