优化切换主题显示效果

This commit is contained in:
monitor1394
2018-10-02 08:57:47 +08:00
parent b38e758351
commit 16754d1a49
5 changed files with 72 additions and 61 deletions

View File

@@ -196,6 +196,13 @@ namespace xcharts
RefreshChart();
}
public void UpdateTheme(Theme theme)
{
this.theme = theme;
OnThemeChanged();
SetAllDirty();
}
protected void HideChild(string match = null)
{
for (int i = 0; i < transform.childCount; i++)

View File

@@ -3,13 +3,6 @@ using UnityEngine.UI;
namespace xcharts
{
[System.Serializable]
public enum PointType
{
square,
cicle
}
[System.Serializable]
public class LineInfo
{
@@ -17,9 +10,7 @@ namespace xcharts
[Header("Point")]
public bool showPoint = true;
public PointType pointType = PointType.square;
public float pointWid = 1.0f;
public Color pointColor = Color.white;
public float pointWid = 2.5f;
[Header("Smooth")]
public bool smooth = false;
@@ -107,15 +98,15 @@ namespace xcharts
SeriesData data = series.dataList[i];
Vector3 p = new Vector3(startX + i * scaleWid, zeroY + data.value * coordinateHig / max);
switch (lineInfo.pointType)
if(theme == Theme.Dark)
{
case PointType.square:
ChartUtils.DrawPolygon(vh, p, lineInfo.pointWid, lineInfo.pointColor);
break;
case PointType.cicle:
ChartUtils.DrawCricle(vh, p, lineInfo.pointWid, lineInfo.pointColor,
(int)lineInfo.pointWid * 5);
break;
ChartUtils.DrawCricle(vh, p, lineInfo.pointWid, color, (int)lineInfo.pointWid * 5);
}
else
{
ChartUtils.DrawCricle(vh, p, lineInfo.pointWid, Color.white);
ChartUtils.DrawDoughnut(vh, p, lineInfo.pointWid - lineInfo.tickness,
lineInfo.pointWid, 0, 360, color);
}
}
}

View File

@@ -174,6 +174,7 @@ namespace xcharts
radarInfo.backgroundColorList.Add(ThemeInfo.GetColor("#e7e7e7"));
break;
}
InitIndicator();
}
private void DrawData(VertexHelper vh)