本文整理汇总了C#中Options.DefaultAxis方法的典型用法代码示例。如果您正苦于以下问题:C# Options.DefaultAxis方法的具体用法?C# Options.DefaultAxis怎么用?C# Options.DefaultAxis使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options.DefaultAxis方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: helper
private Axis helper(Options options, double m, double mincoverage = 0.8)
{
double snice = double.NegativeInfinity;
int intervals = (int)Math.Max(Math.Floor(m), 2) - 1;
List<Axis> possibilities = new List<Axis>();
Numeric v = options.symbol as Numeric;
decimal min = (decimal)v.Range.min;
decimal max = (decimal)v.Range.max;
List<decimal> Q = new List<decimal> { 1m, 10m, 5m, 2m, 2.5m, 3m, 4m, 1.5m, 7m, 6m, 8m, 9m };
int n = Q.Count();
decimal range = max - min;
decimal dc = range / intervals;
decimal dbase = pow10((int)Math.Floor(Math.Log10((double)dc)));
Axis best = null;
foreach (decimal q in Q)
{
decimal tdelta = q * dbase;
decimal tmin = Math.Floor(min / tdelta) * tdelta;
decimal tmax = tmin + intervals * tdelta;
int i = Q.IndexOf(q);
double roundness = 1.0 - ((i + 1) - ((tmin <= 0 && tmax >= 0) ? 1.0 : 0.0)) / Q.Count();
double coverage = (double)((max - min) / (tmax - tmin));
if (coverage > mincoverage && tmin <= min && tmax >= max)
{
double score = roundness + coverage;
if (score > snice)
{
List<decimal> stepSequence = Enumerable.Range(0, (int)intervals+1).Select(x => tmin + x * tdelta).ToList();
List<Tuple<decimal, string>> newlabels = stepSequence.Select(value => new Tuple<decimal, string>(value, value.ToString())).ToList();
Axis candidate = options.DefaultAxis();
candidate.score = score;
candidate.labels = newlabels;
best = candidate;
snice = score;
}
}
}
return best;
}