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


C# Series.IsCustomPropertySet方法代码示例

本文整理汇总了C#中Series.IsCustomPropertySet方法的典型用法代码示例。如果您正苦于以下问题:C# Series.IsCustomPropertySet方法的具体用法?C# Series.IsCustomPropertySet怎么用?C# Series.IsCustomPropertySet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Series的用法示例。


在下文中一共展示了Series.IsCustomPropertySet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PositionChartAreas

        /// <summary>
        /// Position new chart areas with mini-chart over the data points
        /// </summary>
        /// <param name="chart">Chart object.</param>
        /// <param name="series">Original data series.</param>
        public void PositionChartAreas(Chart chart, Series series)
        {
            //****************************************************
            //** Check if series uses X values or they all set
            //** to zeros (in this case use point index as X value)
            //****************************************************
            bool	zeroXValues = true;
            foreach(DataPoint point in series.Points)
            {
                if(point.XValue != 0.0)
                {
                    zeroXValues = false;
                    break;
                }
            }

            //****************************************************
            //** Calculate bubble scaling variables required to
            //** for the bubble size calculations.
            //****************************************************
            bool	bubbleChart = false;

            // Minimum/Maximum bubble size
            double	maxPossibleBubbleSize = 15F;
            double	minPossibleBubbleSize = 3F;
            float	maxBubleSize = 0f;
            float	minBubleSize = -20f;

            // Current min/max size of the bubble size
            double	minAll = double.MaxValue;
            double	maxAll = double.MinValue;

            // Bubble size difference value
            double	valueDiff = 0;
            double	valueScale = 1;

            // Check for the Bubble chart type
            if( series.ChartType == SeriesChartType.Bubble )
            {
                bubbleChart = true;

                // Check if custom attributes are set to specify scale
                if(series.IsCustomPropertySet("BubbleScaleMin"))
                {
                    minAll = Math.Min(minAll, Double.Parse(series["BubbleScaleMin"]));
                }
                if(series.IsCustomPropertySet("BubbleScaleMax"))
                {
                    maxAll = Math.Max(maxAll, Double.Parse(series["BubbleScaleMax"]));
                }

                // Calculate bubble scale
                double	minSer = double.MaxValue;
                double	maxSer = double.MinValue;
                foreach( Series ser in chart.Series )
                {
                    if( ser.ChartType == SeriesChartType.Bubble && ser.ChartArea == series.ChartArea )
                    {
                        foreach(DataPoint point in ser.Points)
                        {
                            minSer = Math.Min(minSer, point.YValues[1]);
                            maxSer = Math.Max(maxSer, point.YValues[1]);
                        }
                    }
                }
                if(minAll == double.MaxValue)
                {
                    minAll = minSer;
                }
                if(maxAll == double.MinValue)
                {
                    maxAll = maxSer;
                }

                // Calculate maximum bubble size
                SizeF areaSize = chart.ChartAreas[series.ChartArea].Position.Size;

                // Convert relative coordinates to absolute coordinates
                areaSize.Width = (float)(areaSize.Width * (chart.Width.Value - 1)) / 100F;
                areaSize.Height = (float)(areaSize.Height * (chart.Height.Value - 1)) / 100F;
                maxBubleSize = (float)(Math.Min(areaSize.Width, areaSize.Height) / (100.0/maxPossibleBubbleSize));
                minBubleSize = (float)(Math.Min(areaSize.Width, areaSize.Height) / (100.0/minPossibleBubbleSize));

                // Calculate scaling variables depending on the Min/Max values
                if(maxAll == minAll)
                {
                    valueScale = 1;
                    valueDiff = minAll - (maxBubleSize - minBubleSize)/2f;
                }
                else
                {
                    valueScale = (maxBubleSize - minBubleSize) / (maxAll - minAll);
                    valueDiff = minAll;
                }
            }
//.........这里部分代码省略.........
开发者ID:samuellin124,项目名称:cms,代码行数:101,代码来源:ChartInDataPoint.aspx.cs


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