mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 15:30:09 +00:00
去掉MultiData接口,命名空间重命名
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using xcharts;
|
||||
using XCharts;
|
||||
|
||||
public class BarChartDemo : MonoBehaviour
|
||||
{
|
||||
@@ -14,7 +14,6 @@ public class BarChartDemo : MonoBehaviour
|
||||
private int dataCount = 0;
|
||||
private BarChart bigdataChart;
|
||||
|
||||
|
||||
void Awake()
|
||||
{
|
||||
var xchart = transform.Find("xchart");
|
||||
@@ -66,7 +65,7 @@ public class BarChartDemo : MonoBehaviour
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
chart.XAxis.AddMultiData(time.ToString("hh:mm:ss"));
|
||||
chart.XAxis.AddData(time.ToString("hh:mm:ss"));
|
||||
|
||||
smallBaseValue = i % 30 == 0
|
||||
? UnityEngine.Random.Range(0, 700)
|
||||
@@ -79,7 +78,7 @@ public class BarChartDemo : MonoBehaviour
|
||||
//var index = i % 100;
|
||||
//var value = (Mathf.Sin(index / 5) * (index / 5 - 10) + index / 6) * 5;
|
||||
value = Mathf.Abs(value);
|
||||
chart.AddMultiData(0, value);
|
||||
chart.AddData(0, value);
|
||||
time = time.AddSeconds(1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using xcharts;
|
||||
using XCharts;
|
||||
|
||||
public class Demo : MonoBehaviour
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace xcharts
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class BarInfo
|
||||
|
||||
@@ -4,7 +4,7 @@ using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace xcharts
|
||||
namespace XCharts
|
||||
{
|
||||
|
||||
[System.Serializable]
|
||||
@@ -46,16 +46,8 @@ namespace xcharts
|
||||
public bool boundaryGap = true;
|
||||
[SerializeField]
|
||||
private List<string> data;
|
||||
private List<string> multidata = new List<string>();
|
||||
|
||||
private List<string> Data
|
||||
{
|
||||
get
|
||||
{
|
||||
if (multidata.Count > 0) return multidata;
|
||||
else return data;
|
||||
}
|
||||
}
|
||||
private List<string> Data { get { return data; } }
|
||||
|
||||
public void AddData(string category)
|
||||
{
|
||||
@@ -66,15 +58,6 @@ namespace xcharts
|
||||
data.Add(category);
|
||||
}
|
||||
|
||||
public void AddMultiData(string category)
|
||||
{
|
||||
if (multidata.Count >= maxSplitNumber && maxSplitNumber != 0)
|
||||
{
|
||||
multidata.RemoveAt(0);
|
||||
}
|
||||
multidata.Add(category);
|
||||
}
|
||||
|
||||
public string GetData(int index)
|
||||
{
|
||||
return Data[index];
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using UnityEngine.UI;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace xcharts
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public enum ChartType
|
||||
@@ -174,11 +174,10 @@ namespace xcharts
|
||||
public int showDataNumber = 0;
|
||||
[SerializeField]
|
||||
private List<float> dataList = new List<float>();
|
||||
private List<float> multiDataList = new List<float>();
|
||||
|
||||
public List<float> DataList
|
||||
{
|
||||
get { return multiDataList.Count > 0 ? multiDataList : dataList; }
|
||||
get { return dataList; }
|
||||
}
|
||||
|
||||
public float Max
|
||||
@@ -219,15 +218,6 @@ namespace xcharts
|
||||
dataList.Add(value);
|
||||
}
|
||||
|
||||
public void AddMultiData(float value)
|
||||
{
|
||||
if (multiDataList.Count >= showDataNumber && showDataNumber != 0)
|
||||
{
|
||||
multiDataList.RemoveAt(0);
|
||||
}
|
||||
multiDataList.Add(value);
|
||||
}
|
||||
|
||||
public float GetData(int index)
|
||||
{
|
||||
if (index >= 0 && index <= DataList.Count - 1)
|
||||
@@ -244,14 +234,6 @@ namespace xcharts
|
||||
dataList[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateMultiData(int index, float value)
|
||||
{
|
||||
if (index >= 0 && index <= multiDataList.Count - 1)
|
||||
{
|
||||
multiDataList[index] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BaseChart : MaskableGraphic
|
||||
@@ -259,18 +241,13 @@ namespace xcharts
|
||||
private const string TILTE_TEXT = "title";
|
||||
private const string SUB_TILTE_TEXT = "sub_title";
|
||||
private const string LEGEND_TEXT = "legend";
|
||||
[SerializeField]
|
||||
protected Theme theme = Theme.Dark;
|
||||
[SerializeField]
|
||||
protected ThemeInfo themeInfo = new ThemeInfo();
|
||||
[SerializeField]
|
||||
protected Title title = new Title();
|
||||
[SerializeField]
|
||||
protected Legend legend = new Legend();
|
||||
[SerializeField]
|
||||
protected Tooltip tooltip = new Tooltip();
|
||||
[SerializeField]
|
||||
protected List<Series> seriesList = new List<Series>();
|
||||
|
||||
[SerializeField] protected Theme theme = Theme.Dark;
|
||||
[SerializeField] protected ThemeInfo themeInfo = new ThemeInfo();
|
||||
[SerializeField] protected Title title = new Title();
|
||||
[SerializeField] protected Legend legend = new Legend();
|
||||
[SerializeField] protected Tooltip tooltip = new Tooltip();
|
||||
[SerializeField] protected List<Series> seriesList = new List<Series>();
|
||||
|
||||
private Theme checkTheme = 0;
|
||||
private Title checkTitle = new Title();
|
||||
@@ -326,29 +303,11 @@ namespace xcharts
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public void AddMultiData(string legend, float value)
|
||||
{
|
||||
for (int i = 0; i < seriesList.Count; i++)
|
||||
{
|
||||
if (seriesList[i].name.Equals(legend))
|
||||
{
|
||||
seriesList[i].AddMultiData(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public void AddData(int legend,float value)
|
||||
{
|
||||
seriesList[legend].AddData(value);
|
||||
}
|
||||
|
||||
public void AddMultiData(int legend, float value)
|
||||
{
|
||||
seriesList[legend].AddMultiData(value);
|
||||
}
|
||||
|
||||
public void UpdateData(string legend, float value, int dataIndex = 0)
|
||||
{
|
||||
for (int i = 0; i < seriesList.Count; i++)
|
||||
@@ -375,32 +334,6 @@ namespace xcharts
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public void UpdateMultiData(string legend, float value, int dataIndex = 0)
|
||||
{
|
||||
for (int i = 0; i < seriesList.Count; i++)
|
||||
{
|
||||
if (seriesList[i].name.Equals(legend))
|
||||
{
|
||||
seriesList[i].UpdateMultiData(dataIndex, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public void UpdateMultiData(int legendIndex, float value, int dataIndex = 0)
|
||||
{
|
||||
for (int i = 0; i < seriesList.Count; i++)
|
||||
{
|
||||
if (i == legendIndex)
|
||||
{
|
||||
seriesList[i].UpdateMultiData(dataIndex, value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
RefreshChart();
|
||||
}
|
||||
|
||||
public void UpdateTheme(Theme theme)
|
||||
{
|
||||
this.theme = theme;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace xcharts
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public enum Theme
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace xcharts
|
||||
namespace XCharts
|
||||
{
|
||||
public static class ChartUtils
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace xcharts
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class LineInfo
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace xcharts
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class PieInfo
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Text;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace xcharts
|
||||
namespace XCharts
|
||||
{
|
||||
[System.Serializable]
|
||||
public class RadarIndicator
|
||||
|
||||
Reference in New Issue
Block a user