62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
![]() |
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using CPF.Drawing;
|
|||
|
|
|||
|
namespace CPF.ReoGrid.Chart
|
|||
|
{
|
|||
|
internal class ChartUtility
|
|||
|
{
|
|||
|
public static double CalcLevelStride(double min, double max, int count, out int scaler)
|
|||
|
{
|
|||
|
double num = (max - min) / (double)count;
|
|||
|
scaler = (int)Math.Floor(Math.Log10(num));
|
|||
|
double num2 = Math.Pow(10.0, (double)scaler);
|
|||
|
double num3 = num % num2;
|
|||
|
return (num3 == 0.0) ? num : (num - num3 + num2);
|
|||
|
}
|
|||
|
|
|||
|
public static Color GetDefaultDataSerialFillColor(int index)
|
|||
|
{
|
|||
|
bool flag = ChartUtility.defaultDataSerialColors == null;
|
|||
|
if (flag)
|
|||
|
{
|
|||
|
ChartUtility.defaultDataSerialColors = new List<Color>
|
|||
|
{
|
|||
|
Color.FromRgb(91, 155, 213),
|
|||
|
Color.FromRgb(237, 125, 49),
|
|||
|
Color.FromRgb(165, 165, 165),
|
|||
|
Color.FromRgb(byte.MaxValue, 192, 0),
|
|||
|
Color.FromRgb(22, 191, 177),
|
|||
|
Color.FromRgb(165, 196, 86),
|
|||
|
Color.FromRgb(69, 35, 163),
|
|||
|
Color.FromRgb(212, 98, 117),
|
|||
|
Color.FromRgb(241, 131, 151),
|
|||
|
Color.FromRgb(208, 199, 6),
|
|||
|
Color.FromRgb(byte.MaxValue, 50, 50)
|
|||
|
};
|
|||
|
}
|
|||
|
bool flag2 = index >= ChartUtility.defaultDataSerialColors.Count;
|
|||
|
if (flag2)
|
|||
|
{
|
|||
|
bool flag3 = index < 100;
|
|||
|
if (flag3)
|
|||
|
{
|
|||
|
for (int i = ChartUtility.defaultDataSerialColors.Count; i <= index; i++)
|
|||
|
{
|
|||
|
ChartUtility.defaultDataSerialColors.Add(Color.Randomly());
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
index %= 100;
|
|||
|
}
|
|||
|
}
|
|||
|
return ChartUtility.defaultDataSerialColors[index];
|
|||
|
}
|
|||
|
|
|||
|
public const int MaxDataSerials = 100;
|
|||
|
|
|||
|
public static List<Color> defaultDataSerialColors;
|
|||
|
}
|
|||
|
}
|