private void round(ref double min, ref double max)
{
min = sigfig(min, 6);
max = sigfig(max, 6);
if (min == max)
{
min--;
max++;
}
else
{
double range = System.Math.Abs(max - min) / borderScale;
double mean = System.Math.Abs(max + min) / 2.0;
if (range < 1.0e-6 * mean) range = 1.0e-6 * mean;
min -= range;
max += range;
}
double power = System.Math.Max(System.Math.Abs(min), System.Math.Abs(max));
power = System.Math.Pow(10.0, System.Math.Ceiling(System.Math.Log10(power)) - resolution);
min = power * System.Math.Floor(min / power);
max = power * System.Math.Ceiling(max / power);
}