44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using ChartAndGraph;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using WI;
|
|
using static ChartAndGraph.BarChart;
|
|
|
|
public class UI_BarChart : UIBase
|
|
{
|
|
BarChart barChart;
|
|
|
|
public bool isCycleTimeChart;
|
|
public List<BarChartData> barChartDatas = new List<BarChartData>();
|
|
|
|
public UI_BarChartData barChartData;
|
|
public override void AfterAwake()
|
|
{
|
|
barChart = GetComponentInChildren<BarChart>();
|
|
barChartData = GetComponentInChildren<UI_BarChartData>(true);
|
|
}
|
|
public void SetChartData(List<BarChartData> barChartData)
|
|
{
|
|
this.barChartDatas.Clear();
|
|
barChart.DataSource.ClearGroups();
|
|
|
|
barChart.DataSource.AutomaticMaxValue = true;
|
|
|
|
for (int i = 0; i < barChartData.Count; i++)
|
|
{
|
|
barChart.DataSource.AddGroup(i.ToString());
|
|
barChart.DataSource.SetValue("TargetCycleTime", i.ToString(), barChartData[i].targetCycleTime);
|
|
barChart.DataSource.SetValue("CycleTime", i.ToString(), barChartData[i].cycleTime);
|
|
}
|
|
this.barChartDatas.AddRange(barChartData);
|
|
}
|
|
|
|
public void OnClickItem(BarEventArgs arg)
|
|
{
|
|
int.TryParse(arg.Group, out var index);
|
|
barChartData.SetData(barChartDatas[index]);
|
|
}
|
|
}
|