修复Font无法自定义问题,优化代码

This commit is contained in:
monitor1394
2019-07-24 23:38:23 +08:00
parent 78123b74ae
commit a54415059e
10 changed files with 53 additions and 43 deletions

View File

@@ -82,13 +82,13 @@ namespace XCharts
public SymbolSizeCallback sizeCallback { get { return m_SizeCallback; } set { m_SizeCallback = value; } }
public SymbolSizeCallback selectedSizeCallback { get { return m_SelectedSizeCallback; } set { m_SelectedSizeCallback = value; } }
private List<float> m_AnimationSize = new List<float>(){0,5,10};
public List<float> animationSize { get{return m_AnimationSize;}}
private List<float> m_AnimationSize = new List<float>() { 0, 5, 10 };
public List<float> animationSize { get { return m_AnimationSize; } }
public Color animationColor { get; set; }
public float GetSize(List<float> data)
{
if(data == null) return size;
if (data == null) return size;
switch (m_SizeType)
{
case SerieSymbolSizeType.Custom:
@@ -111,7 +111,7 @@ namespace XCharts
public float GetSelectedSize(List<float> data)
{
if(data == null) return selectedSize;
if (data == null) return selectedSize;
switch (m_SizeType)
{
case SerieSymbolSizeType.Custom:
@@ -311,7 +311,8 @@ namespace XCharts
return 0;
}
public SerieData GetSerieData(int index,DataZoom dataZoom = null){
public SerieData GetSerieData(int index, DataZoom dataZoom = null)
{
var data = GetDataList(dataZoom);
if (index >= 0 && index <= data.Count - 1)
{
@@ -387,7 +388,7 @@ namespace XCharts
}
}
public void UpdateFilterData(DataZoom dataZoom)
{
@@ -457,12 +458,16 @@ namespace XCharts
public override void ParseJsonData(string jsonData)
{
if (string.IsNullOrEmpty(jsonData) || !m_DataFromJson) return;
ClearData();
jsonData = jsonData.Replace("\r\n", "");
jsonData = jsonData.Replace(" ", "");
jsonData = jsonData.Replace("\n", "");
int startIndex = jsonData.IndexOf("[");
int endIndex = jsonData.LastIndexOf("]");
if (startIndex == -1 || endIndex == -1){
Debug.LogError("json data need include in [ ]");
return;
}
ClearData();
string temp = jsonData.Substring(startIndex + 1, endIndex - startIndex - 1);
if (temp.IndexOf("],") > -1 || temp.IndexOf("] ,") > -1)
{

View File

@@ -110,7 +110,6 @@ namespace XCharts
txt.horizontalOverflow = HorizontalWrapMode.Overflow;
txt.verticalOverflow = VerticalWrapMode.Overflow;
txt.color = color;
txt.fontStyle = fontStyle;
if (rotate > 0)
{
txtObj.transform.localEulerAngles = new Vector3(0, 0, rotate);