修复区域平滑折线图显示异常的问题

This commit is contained in:
monitor1394
2019-08-07 07:59:00 +08:00
parent 6424a2c440
commit 4684affac6
5 changed files with 250 additions and 209 deletions

View File

@@ -244,18 +244,18 @@ namespace XCharts
public Color32 GetColor(int index)
{
if (index < 0) index = 0;
var customIndex = index < m_CustomColorPalette.Count ? index : index % m_CustomColorPalette.Count;
if (customIndex < m_CustomColorPalette.Count && m_CustomColorPalette[customIndex] != Color.clear)
if (m_CustomColorPalette.Count > 0)
{
return m_CustomColorPalette[customIndex];
}
else
{
var newIndex = index < m_ColorPalette.Length ? index : index % m_ColorPalette.Length;
if (newIndex < m_ColorPalette.Length)
return m_ColorPalette[newIndex];
else return Color.clear;
var customIndex = index < m_CustomColorPalette.Count ? index : index % m_CustomColorPalette.Count;
if (customIndex < m_CustomColorPalette.Count && m_CustomColorPalette[customIndex] != Color.clear)
{
return m_CustomColorPalette[customIndex];
}
}
var newIndex = index < m_ColorPalette.Length ? index : index % m_ColorPalette.Length;
if (newIndex < m_ColorPalette.Length)
return m_ColorPalette[newIndex];
else return Color.clear;
}
Dictionary<int, string> _colorDic = new Dictionary<int, string>();