コード例 #1
0
        internal ArrayList GetDataPointDrawingOrder(ArrayList seriesNamesList, IChartType chartType, bool selection, COPCoordinates coord, IComparer comparer, int mainYValueIndex, bool sideBySide)
        {
            ChartArea chartArea = (ChartArea)this;
            ArrayList arrayList = new ArrayList();
            double    num       = 1.0;

            if (chartArea.Area3DStyle.Clustered && !chartType.Stacked && sideBySide)
            {
                num = seriesNamesList.Count;
            }
            if (chartType.SupportStackedGroups)
            {
                int numberOfStackGroups = GetNumberOfStackGroups(seriesNamesList);
                if (Area3DStyle.Clustered && seriesNamesList.Count > 0)
                {
                    num = numberOfStackGroups;
                }
            }
            bool flag = chartArea.IndexedSeries((string[])seriesNamesList.ToArray(typeof(string)));
            int  num2 = 0;

            foreach (object seriesNames in seriesNamesList)
            {
                Series series = base.Common.DataManager.Series[(string)seriesNames];
                if (chartType.SupportStackedGroups && stackGroupNames != null)
                {
                    string stackGroupName = string.Empty;
                    num2 = GetSeriesStackGroupIndex(series, ref stackGroupName);
                    if (chartType is StackedColumnChart)
                    {
                        ((StackedColumnChart)chartType).currentStackGroup = stackGroupName;
                    }
                    else if (chartType is StackedBarChart)
                    {
                        ((StackedBarChart)chartType).currentStackGroup = stackGroupName;
                    }
                }
                Axis axis  = (series.YAxisType == AxisType.Primary) ? chartArea.AxisY : chartArea.AxisY2;
                Axis axis2 = (series.XAxisType == AxisType.Primary) ? chartArea.AxisX : chartArea.AxisX2;
                axis2.GetViewMinimum();
                axis2.GetViewMaximum();
                axis.GetViewMinimum();
                axis.GetViewMaximum();
                bool   sameInterval = true;
                double interval     = 1.0;
                if (!flag)
                {
                    interval = chartArea.GetPointsInterval(seriesNamesList, axis2.Logarithmic, axis2.logarithmBase, checkSameInterval: true, out sameInterval);
                }
                double num3 = series.GetPointWidth(chartArea.Common.graph, axis2, interval, 0.8) / num;
                GetSeriesZPositionAndDepth(series, out float depth, out float positionZ);
                int num4 = 0;
                foreach (DataPoint point in series.Points)
                {
                    num4++;
                    double xPosition;
                    double position;
                    if (flag)
                    {
                        xPosition = axis2.GetPosition(num4) - num3 * num / 2.0 + num3 / 2.0 + (double)num2 * num3;
                        position  = axis2.GetPosition(num4);
                    }
                    else if (sameInterval)
                    {
                        xPosition = axis2.GetPosition(point.XValue) - num3 * num / 2.0 + num3 / 2.0 + (double)num2 * num3;
                        position  = axis2.GetPosition(point.XValue);
                    }
                    else
                    {
                        xPosition = axis2.GetPosition(point.XValue);
                        position  = axis2.GetPosition(point.XValue);
                    }
                    DataPoint3D dataPoint3D = new DataPoint3D();
                    dataPoint3D.indexedSeries = flag;
                    dataPoint3D.dataPoint     = point;
                    dataPoint3D.index         = num4;
                    dataPoint3D.xPosition     = xPosition;
                    dataPoint3D.xCenterVal    = position;
                    dataPoint3D.width         = series.GetPointWidth(chartArea.Common.graph, axis2, interval, 0.8) / num;
                    dataPoint3D.depth         = depth;
                    dataPoint3D.zPosition     = positionZ;
                    double yValue = chartType.GetYValue(base.Common, chartArea, series, point, num4 - 1, mainYValueIndex);
                    dataPoint3D.yPosition = axis.GetPosition(yValue);
                    dataPoint3D.height    = axis.GetPosition(yValue - chartType.GetYValue(base.Common, chartArea, series, point, num4 - 1, -1));
                    arrayList.Add(dataPoint3D);
                }
                if (num > 1.0 && sideBySide)
                {
                    num2++;
                }
            }
            if (comparer == null)
            {
                comparer = new PointsDrawingOrderComparer((ChartArea)this, selection, coord);
            }
            arrayList.Sort(comparer);
            return(arrayList);
        }
コード例 #2
0
            public int Compare(object o1, object o2)
            {
                DataPoint3D dataPoint3D  = (DataPoint3D)o1;
                DataPoint3D dataPoint3D2 = (DataPoint3D)o2;
                int         num          = 0;

                if (dataPoint3D.xPosition < dataPoint3D2.xPosition)
                {
                    num = -1;
                }
                else if (dataPoint3D.xPosition > dataPoint3D2.xPosition)
                {
                    num = 1;
                }
                else
                {
                    if (dataPoint3D.yPosition < dataPoint3D2.yPosition)
                    {
                        num = 1;
                    }
                    else if (dataPoint3D.yPosition > dataPoint3D2.yPosition)
                    {
                        num = -1;
                    }
                    if (!float.IsNaN(areaProjectionCenter.Y))
                    {
                        double num2 = Math.Min(dataPoint3D.yPosition, dataPoint3D.height);
                        double num3 = Math.Max(dataPoint3D.yPosition, dataPoint3D.height);
                        double num4 = Math.Min(dataPoint3D2.yPosition, dataPoint3D2.height);
                        double num5 = Math.Max(dataPoint3D2.yPosition, dataPoint3D2.height);
                        if (!area.IsBottomSceneWallVisible())
                        {
                            num = ((num3 >= (double)areaProjectionCenter.Y && num5 >= (double)areaProjectionCenter.Y) ? num : ((num3 >= (double)areaProjectionCenter.Y) ? 1 : (num * -1)));
                        }
                        else if (num2 <= (double)areaProjectionCenter.Y && num4 <= (double)areaProjectionCenter.Y)
                        {
                            num *= -1;
                        }
                        else if (num2 <= (double)areaProjectionCenter.Y)
                        {
                            num = 1;
                        }
                    }
                    else if (!area.IsBottomSceneWallVisible())
                    {
                        num *= -1;
                    }
                }
                if (dataPoint3D.xPosition != dataPoint3D2.xPosition)
                {
                    if (!float.IsNaN(areaProjectionCenter.X))
                    {
                        if (dataPoint3D.xPosition + dataPoint3D.width / 2.0 >= (double)areaProjectionCenter.X && dataPoint3D2.xPosition + dataPoint3D2.width / 2.0 >= (double)areaProjectionCenter.X)
                        {
                            num *= -1;
                        }
                    }
                    else if (area.DrawPointsInReverseOrder())
                    {
                        num *= -1;
                    }
                }
                if (!selection)
                {
                    return(num);
                }
                return(-num);
            }