修复serie系列数超过调色盘颜色数时获取的颜色异常的问题

This commit is contained in:
monitor1394
2019-08-06 18:19:38 +08:00
parent 3a84776a52
commit 3b94653a3b

View File

@@ -244,14 +244,14 @@ namespace XCharts
public Color32 GetColor(int index)
{
if (index < 0) index = 0;
var customIndex = index >= m_CustomColorPalette.Count ? index : index % m_CustomColorPalette.Count;
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];
}
else
{
var newIndex = index >= m_ColorPalette.Length ? index : index % m_ColorPalette.Length;
var newIndex = index < m_ColorPalette.Length ? index : index % m_ColorPalette.Length;
if (newIndex < m_ColorPalette.Length)
return m_ColorPalette[newIndex];
else return Color.clear;