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