示例#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();
     }
 }
示例#2
0
 public void OnEndDrag(PointerEventData eventData)
 {
     if (chart == null)
     {
         return;
     }
     foreach (var dataZoom in chart.dataZooms)
     {
         if (dataZoom.runtimeDrag || dataZoom.runtimeStartDrag || dataZoom.runtimeEndDrag ||
             dataZoom.runtimeCoordinateDrag)
         {
             chart.RefreshChart();
         }
         dataZoom.runtimeDrag           = false;
         dataZoom.runtimeCoordinateDrag = false;
         dataZoom.runtimeStartDrag      = false;
         dataZoom.runtimeEndDrag        = false;
     }
 }