using System.Collections;
using System.Collections.Generic;
using ChartAndGraph;
using UnityEngine;
using System;
using UnityEngine.UI;
public class GraphDraw : MonoBehaviour {
public GraphChart No1_Grahp;
public BarChart No2_Grahp;
[Header("새로생긴 데이터 한번에 뿌려주기 위한용")]
public BarChart No2_Graph_1;
public BarChart No2_Graph_2;
public BarChart No2_Graph_3;
public BarChart No2_Graph_4;
//public BarChart No3_Grahp;//그래프 3번이 사라지고 txt_GuidancePredict,txt_TGT로 대체
public Text txt_GuidancePredict;
public Text txt_TGT;
public GraphChart PredictValue_Graph;
public GraphChart PredictPrice_Graph;
public GraphChart GuidanceValue_Graph;
public GraphChart GuidancePrice_Graph;
[Space]
[Header("Category Porperty")]
public Material linematerial;
public MaterialTiling lineTiling;
public Material pointmaterial;
public ChartItemEffect lineHoverPrefab;
public ChartItemEffect pointHoverPrefab;
public void AddCategory_for_ManualGraph(GraphChart graphChart, string categoryName, Material linemat,float lineThickness = 2, float pointsize = 3)
{
graphChart.DataSource.RemoveCategory(categoryName);
graphChart.DataSource.AddCategory(categoryName, linemat, 1, lineTiling, null, false, pointmaterial, 0);
graphChart.DataSource.Set2DCategoryPrefabs(categoryName, lineHoverPrefab, pointHoverPrefab);
}
public void AddCategory(GraphChart graphChart, string categoryName,float lineThickness =2,float pointsize =3)
{
graphChart.DataSource.RemoveCategory(categoryName);
graphChart.DataSource.AddCategory(categoryName, linematerial, lineThickness, lineTiling, null, false, pointmaterial, pointsize);
graphChart.DataSource.Set2DCategoryPrefabs(categoryName, lineHoverPrefab, pointHoverPrefab);
}
//Graph1 Point
public IEnumerator addPoint(GraphChart graphChart,string categoryName, DateTime x, float y)
{
graphChart.DataSource.StartBatch();
//double xVal = ChartDateUtility.DateToValue_New(x); //기존 하루만 그릴때
double xVal = ChartDateUtility.DateToValue(x); //오케이 완벽해!!
//double xVal = x.Second;
StartCoroutine(graphChart.DataSource.AddPointToCategory_Ver2_IEnumerator(categoryName, (float)xVal, y));
graphChart.DataSource.EndBatch();
yield return new WaitForEndOfFrame();
}
public IEnumerator addPoint(BarChart barChart,string categoryName,string groupName,double value)
{
//if (!barChart.DataSource.AutomaticMaxValue)
// barChart.DataSource.AutomaticMaxValue = true;
barChart.DataSource.StartBatch();
barChart.DataSource.SetValue(categoryName, groupName, value);
barChart.DataSource.EndBatch();
yield return new WaitForEndOfFrame();
}
public void FCE_GraphClear()
{
No1_Grahp.DataSource.ClearCategory("SKID");
No1_Grahp.DataSource.ClearCategory("NSKD");
No1_Grahp.DataSource.ClearCategory("TGT");
NewGraphClear(No2_Grahp);
txt_GuidancePredict.text = "";
txt_TGT.text = "";
//No3_Grahp.DataSource.SetValue("SKID", "가이던스 예측 온도", 0);
//No3_Grahp.DataSource.SetValue("NSKD", "가이던스 예측 온도", 0);
//No3_Grahp.DataSource.SetValue("SKID", "현재 예측 온도", 0);
//No3_Grahp.DataSource.SetValue("NSKD", "현재 예측 온도", 0);
}
public void FCE_Zone_GraphClear()
{
NewGraphClear(No2_Graph_1);
NewGraphClear(No2_Graph_2);
NewGraphClear(No2_Graph_3);
NewGraphClear(No2_Graph_4);
}
public void NewGraphClear(BarChart newGraph)
{
newGraph.DataSource.SetValue("GSV", "예열대T", 0);
newGraph.DataSource.SetValue("GSV", "예열대B", 0);
newGraph.DataSource.SetValue("GSV", "가열대T", 0);
newGraph.DataSource.SetValue("GSV", "가열대B", 0);
newGraph.DataSource.SetValue("GSV", "균열대T", 0);
newGraph.DataSource.SetValue("GSV", "균열대B", 0);
newGraph.DataSource.SetValue("SV", "예열대T", 0);
newGraph.DataSource.SetValue("SV", "예열대B", 0);
newGraph.DataSource.SetValue("SV", "가열대T", 0);
newGraph.DataSource.SetValue("SV", "가열대B", 0);
newGraph.DataSource.SetValue("SV", "균열대T", 0);
newGraph.DataSource.SetValue("SV", "균열대B", 0);
}
//Graph1 Point
}
댓글 없음:
댓글 쓰기