Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetDefaultDataSerialFillColor error when the index==defaultDataSerialColors.Count #40

Closed
ScorpioQian opened this issue Aug 21, 2017 · 0 comments

Comments

@ScorpioQian
Copy link
Contributor

ScorpioQian commented Aug 21, 2017

The GetDefaultDataSerialFillColor function in ReoGrid\Chart\Utility.cs will cause exception when the parameter index==defaultDataSerialColors.Count

Below is the code of the GetDefaultDataSerialFillColor function:

     public static SolidColor GetDefaultDataSerialFillColor(int index)
	{
		if (defaultDataSerialColors == null)
		{
			defaultDataSerialColors = new List<SolidColor>()
			{
				new SolidColor(91,155,213),
				new SolidColor(237,125,49),
				new SolidColor(165, 165, 165),
				new SolidColor(255,192,0),
				new SolidColor(22,191,177),
				new SolidColor(165,196,86),
				new SolidColor(69,35,163),
				new SolidColor(212,98,117),
				new SolidColor(241,131,151),
				new SolidColor(208,199,6),
				new SolidColor(255,50,50),
			};
		}

		if (index >= defaultDataSerialColors.Count)
		{
			if (index < MaxDataSerials)
			{
				for (int i = defaultDataSerialColors.Count; i < index; i++)
				{
					defaultDataSerialColors.Add(SolidColor.Randomly());
				}
			}
			else
			{
				index = index % MaxDataSerials;
			}
		}

		return defaultDataSerialColors[index];
	}
	#endregion // Shared Row Colors

The loop for (int i = defaultDataSerialColors.Count; i < index; i++) should change to for (int i = defaultDataSerialColors.Count; i <= index; i++) .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants