当前位置: 首页>>代码示例>>C#>>正文


C# IAxis.GetPlotAreaCoordinate方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:stavrianosy,项目名称:BudgetManagementAssistant,代码行数:49,代码来源:StackedBarColumnSeries.cs


注:本文中的IAxis.GetPlotAreaCoordinate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。