graph优化

# Conflicts:
#	Assets/Scripts/UI/Prefab/Panel/RowerHomeScript.cs
This commit is contained in:
lishuo authored and CaiYanPeng committed 2022-06-06 19:55:08 +08:00
1 parent bfc56dded5
commit b236e939f4
5 files changed
+90 -27

No files matched your search

@@ -7,10 +7,12 @@ using System.Collections.Generic;
public class RowerGraphChartFeed : MonoBehaviour
{
GraphChartBase graph { get; set; }
GraphData dataSource { get; set; }
void Start ()
{
graph = GetComponent<GraphChartBase>();
dataSource = graph.DataSource;
//GraphChartBase graph = GetComponent<GraphChartBase>();
//if (graph != null)
//{
@@ -34,6 +36,31 @@ public class RowerGraphChartFeed : MonoBehaviour
//}
// StartCoroutine(ClearAll());
}
public void SetPrePoint(double x, double y)
{
dataSource?.AddPointToCategoryRealtime("Player 1", x, y);
}
public void SetCurrentPoint(double x,double y)
{
dataSource?.AddPointToCategoryRealtime("Player 2", x, y);
}
public void ClearChart(string cat = "Player 2")
{
dataSource?.ClearCategory(cat);
}
public void SetHistoryData(List<DoubleVector2> list2 = null)
{
if (list2 != null)
{
dataSource?.ClearCategory("Player 1");
for (int i = 0; i < list2.Count; i++)
{
var item = list2[i];
graph.DataSource.AddPointToCategoryRealtime("Player 1", item.x, item.y);
}
}
}
public void SetData(List<DoubleVector2> list,List<DoubleVector2> list2 = null)
{
@@ -42,10 +69,9 @@ public class RowerGraphChartFeed : MonoBehaviour
graph.Scrollable = false;
//graph.HorizontalValueToStringMap[0.0] = "Zero"; // example of how to set custom axis strings
//graph.DataSource.StartBatch();
graph.DataSource.ClearCategory("Player 1");
graph.DataSource.ClearCategory("Player 2");
graph.ClearCache();
//graph.DataSource.ClearCategory("Player 1");
//graph.DataSource.ClearCategory("Player 2");
//graph.ClearCache();
for (int i = 0; i < list.Count; i++)
{
var item = list[i];