本文整理汇总了C#中IAxis.GetPlotAreaCoordinate方法的典型用法代码示例。如果您正苦于以下问题:C# IAxis.GetPlotAreaCoordinate方法的具体用法?C# IAxis.GetPlotAreaCoordinate怎么用?C# IAxis.GetPlotAreaCoordinate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAxis
的用法示例。
在下文中一共展示了IAxis.GetPlotAreaCoordinate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetMarginForNonCategoryAxis
/// <summary>
/// Gets the margin to use for an independent axis that does not implement ICategoryAxis.
/// </summary>
/// <param name="axis">Axis to get the margin for.</param>
/// <returns>Margin for axis.</returns>
private double GetMarginForNonCategoryAxis(IAxis axis)
{
Debug.Assert(!(axis is ICategoryAxis), "This method is unnecessary for ICategoryAxis.");
// Find the smallest distance between two independent value plot area coordinates
double smallestDistance = double.MaxValue;
double lastCoordinate = double.NaN;
foreach (double coordinate in
IndependentValueGroupsOrderedByIndependentValue
.Select(g => axis.GetPlotAreaCoordinate(g.IndependentValue).Value)
.Where(v => ValueHelper.CanGraph(v)))
{
if (!double.IsNaN(lastCoordinate))
{
double distance = coordinate - lastCoordinate;
if (distance < smallestDistance)
{
smallestDistance = distance;
}
}
lastCoordinate = coordinate;
}
// Return the margin
if (double.MaxValue == smallestDistance)
{
// No smallest distance because <= 1 independent values to plot
FrameworkElement element = axis as FrameworkElement;
if (null != element)
{
// Use width of provided axis so single column scenario looks good
return element.GetMargin(axis);
}
else
{
// No information to work with; no idea what margin to return
throw new NotSupportedException();
}
}
else
{
// Found the smallest distance; margin is half of that
return smallestDistance / 2;
}
}