示例#1
0
文件: DotSymbol.cs 项目: Daoting/dt
        internal override object Clone()
        {
            DotSymbol clone = new DotSymbol();

            base.CloneAttributes(clone);
            return(clone);
        }
示例#2
0
文件: ChartTypes.cs 项目: Daoting/dt
        static void Init()
        {
            Bar       bar    = new Bar();
            DotSymbol symbol = new DotSymbol();
            Lines     lines  = new Lines();

            lines.StrokeThickness = 3.0;
            ChartTypeInfo info     = new ChartTypeInfo("Column");
            ChartSubtype  subtype  = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None");
            ChartSubtype  subtype2 = new ChartSubtype("Stacked", "Renderer2D", "Inverted=false;Stacked=Stacked");
            ChartSubtype  subtype3 = new ChartSubtype("Stacked100pc", "Renderer2D", "Inverted=false;Stacked=Stacked100pc");

            subtype.Symbol  = bar;
            subtype2.Symbol = bar;
            subtype3.Symbol = bar;
            info.Subtypes.Add(subtype);
            info.Subtypes.Add(subtype2);
            info.Subtypes.Add(subtype3);
            _gallery.Add(info);

            ChartTypeInfo info2    = new ChartTypeInfo("Bar");
            ChartSubtype  subtype4 = new ChartSubtype("Default", "Renderer2D", "Inverted=true;Stacked=None");
            ChartSubtype  subtype5 = new ChartSubtype("Stacked", "Renderer2D", "Inverted=true;Stacked=Stacked");
            ChartSubtype  subtype6 = new ChartSubtype("Stacked100pc", "Renderer2D", "Inverted=true;Stacked=Stacked100pc");

            subtype4.Symbol = bar;
            subtype5.Symbol = bar;
            subtype6.Symbol = bar;
            info2.Subtypes.Add(subtype4);
            info2.Subtypes.Add(subtype5);
            info2.Subtypes.Add(subtype6);
            _gallery.Add(info2);

            PieSlice      slice     = new PieSlice();
            ChartTypeInfo info3     = new ChartTypeInfo("Pie");
            ChartSubtype  subtype7  = new ChartSubtype("Default", "Pie", "Offset=0;InnerRadius=0");
            ChartSubtype  subtype8  = new ChartSubtype("Exploded", "Pie", "Offset=0.2;InnerRadius=0");
            ChartSubtype  subtype9  = new ChartSubtype("Doughnut", "Pie", "Offset=0;InnerRadius=0.4");
            ChartSubtype  subtype10 = new ChartSubtype("ExplodedDoughnut", "Pie", "Offset=0.2;InnerRadius=0.4");
            ChartSubtype  subtype11 = new ChartSubtype("Stacked", "Pie", "Offset=0;InnerRadius=0");

            subtype7.Symbol  = slice.Clone();
            subtype8.Symbol  = slice.Clone();
            subtype9.Symbol  = slice.Clone();
            subtype10.Symbol = slice.Clone();
            subtype11.Symbol = slice.Clone();
            info3.Subtypes.Add(subtype7);
            info3.Subtypes.Add(subtype8);
            info3.Subtypes.Add(subtype9);
            info3.Subtypes.Add(subtype10);
            info3.Subtypes.Add(subtype11);
            _gallery.Add(info3);

            Lines lines2 = new Lines();

            lines2.StrokeThickness = 3.0;
            lines2.Smoothed        = true;
            ChartTypeInfo info4     = new ChartTypeInfo("Line");
            ChartSubtype  subtype12 = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None");
            ChartSubtype  subtype13 = new ChartSubtype("Stacked", "Renderer2D", "Inverted=false;Stacked=Stacked");
            ChartSubtype  subtype14 = new ChartSubtype("Stacked100pc", "Renderer2D", "Inverted=false;Stacked=Stacked100pc");

            subtype12.Connection = lines;
            subtype13.Connection = lines;
            subtype14.Connection = lines;
            ChartSubtype subtype15 = new ChartSubtype("Smoothed", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Connection = lines2
            };
            ChartSubtype subtype16 = new ChartSubtype("Symbols", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Connection = lines,
                Symbol     = symbol
            };
            ChartSubtype subtype17 = new ChartSubtype("SymbolsSmoothed", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Connection = lines2,
                Symbol     = symbol
            };
            ChartSubtype subtype18 = new ChartSubtype("SymbolsStacked", "Renderer2D", "Inverted=false;Stacked=Stacked")
            {
                Connection = lines,
                Symbol     = symbol
            };
            ChartSubtype subtype19 = new ChartSubtype("SymbolsStacked100pc", "Renderer2D", "Inverted=false;Stacked=Stacked100pc")
            {
                Connection = lines,
                Symbol     = symbol
            };

            info4.Subtypes.Add(subtype12);
            info4.Subtypes.Add(subtype13);
            info4.Subtypes.Add(subtype14);
            info4.Subtypes.Add(subtype15);
            info4.Subtypes.Add(subtype16);
            info4.Subtypes.Add(subtype17);
            info4.Subtypes.Add(subtype18);
            info4.Subtypes.Add(subtype19);
            _gallery.Add(info4);

            Area area  = new Area();
            Area area2 = new Area
            {
                Smoothed = true
            };
            ChartTypeInfo info5     = new ChartTypeInfo("Area");
            ChartSubtype  subtype20 = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None");
            ChartSubtype  subtype21 = new ChartSubtype("Stacked", "Renderer2D", "Inverted=false;Stacked=Stacked");
            ChartSubtype  subtype22 = new ChartSubtype("Stacked100pc", "Renderer2D", "Inverted=false;Stacked=Stacked100pc");

            subtype20.Connection = area;
            subtype21.Connection = area;
            subtype22.Connection = area;
            ChartSubtype subtype23 = new ChartSubtype("Smoothed", "Renderer2D", "Inverted=false;Stacked=None");
            ChartSubtype subtype24 = new ChartSubtype("SmoothedStacked", "Renderer2D", "Inverted=false;Stacked=Stacked");
            ChartSubtype subtype25 = new ChartSubtype("SmoothedStacked100pc", "Renderer2D", "Inverted=false;Stacked=Stacked100pc");

            subtype23.Connection = area2;
            subtype24.Connection = area2;
            subtype25.Connection = area2;
            info5.Subtypes.Add(subtype20);
            info5.Subtypes.Add(subtype21);
            info5.Subtypes.Add(subtype22);
            info5.Subtypes.Add(subtype23);
            info5.Subtypes.Add(subtype24);
            info5.Subtypes.Add(subtype25);
            _gallery.Add(info5);

            ChartTypeInfo info6     = new ChartTypeInfo("XYPlot");
            ChartSubtype  subtype26 = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Symbol = symbol
            };

            info6.Subtypes.Add(subtype26);
            _gallery.Add(info6);

            ChartTypeInfo info7     = new ChartTypeInfo("Bubble");
            ChartSubtype  subtype27 = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Symbol = symbol
            };

            info7.Subtypes.Add(subtype27);
            _gallery.Add(info7);

            ChartTypeInfo info8     = new ChartTypeInfo("Radar");
            ChartSubtype  subtype28 = new ChartSubtype("Default", "Radar", "Stacked=None;IsPolar=false")
            {
                Symbol     = null,
                Connection = lines
            };

            info8.Subtypes.Add(subtype28);
            ChartSubtype subtype29 = new ChartSubtype("Symbols", "Radar", "Stacked=None;IsPolar=false")
            {
                Symbol     = symbol,
                Connection = lines
            };

            info8.Subtypes.Add(subtype29);
            ChartSubtype subtype30 = new ChartSubtype("Filled", "Radar", "Stacked=None;IsPolar=false")
            {
                Symbol = null
            };
            Area area3 = new Area();

            subtype30.Connection = area3;
            info8.Subtypes.Add(subtype30);
            _gallery.Add(info8);

            ChartTypeInfo info9     = new ChartTypeInfo("HighLowOpenClose");
            ChartSubtype  subtype31 = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Symbol = new HLOC()
            };

            info9.Subtypes.Add(subtype31);
            _gallery.Add(info9);

            ChartTypeInfo info10    = new ChartTypeInfo("Candle");
            ChartSubtype  subtype32 = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None");
            HLOC          hloc      = new HLOC
            {
                Appearance = HLOCAppearance.Candle
            };

            subtype32.Symbol = hloc;
            info10.Subtypes.Add(subtype32);
            _gallery.Add(info10);

            ChartTypeInfo info11    = new ChartTypeInfo("Gantt");
            ChartSubtype  subtype33 = new ChartSubtype("Default", "Renderer2D", "Inverted=true;Stacked=None")
            {
                Symbol = new HLBar()
            };

            info11.Subtypes.Add(subtype33);
            _gallery.Add(info11);

            ChartTypeInfo info12 = new ChartTypeInfo("Step");
            StepLines     lines4 = new StepLines();

            lines4.StrokeThickness = 3.0;
            StepLines    lines3    = lines4;
            ChartSubtype subtype34 = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Connection = lines3
            };

            info12.Subtypes.Add(subtype34);
            ChartSubtype subtype35 = new ChartSubtype("Symbols", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Connection = lines3,
                Symbol     = symbol
            };

            info12.Subtypes.Add(subtype35);
            ChartSubtype subtype36 = new ChartSubtype("Area", "Renderer2D", "Inverted=false;Stacked=None")
            {
                Connection = new StepArea()
            };

            info12.Subtypes.Add(subtype36);
            ChartSubtype subtype37 = new ChartSubtype("AreaStacked", "Renderer2D", "Inverted=false;Stacked=Stacked")
            {
                Connection = new StepArea()
            };

            info12.Subtypes.Add(subtype37);
            _gallery.Add(info12);

            ChartTypeInfo info13    = new ChartTypeInfo("Polar");
            ChartSubtype  subtype38 = new ChartSubtype("Lines", "Radar", "Stacked=None;IsPolar=true")
            {
                Symbol     = null,
                Connection = lines
            };

            info13.Subtypes.Add(subtype38);
            ChartSubtype subtype39 = new ChartSubtype("Symbols", "Radar", "Stacked=None;IsPolar=true")
            {
                Symbol     = symbol,
                Connection = null
            };

            info13.Subtypes.Add(subtype39);
            ChartSubtype subtype40 = new ChartSubtype("LinesSymbols", "Radar", "Stacked=None;IsPolar=true")
            {
                Symbol     = symbol,
                Connection = lines
            };

            info13.Subtypes.Add(subtype40);
            _gallery.Add(info13);

            ChartTypeInfo info14    = new ChartTypeInfo("Polygon");
            ChartSubtype  subtype41 = new ChartSubtype("Default", "Renderer2D", "Inverted=false;Stacked=None");
            Lines         lines5    = new Lines
            {
                IsClosed = true
            };

            subtype41.Connection = lines5;
            info14.Subtypes.Add(subtype41);
            ChartSubtype subtype42 = new ChartSubtype("Filled", "Renderer2D", "Inverted=false;Stacked=None");
            Lines        lines6    = new Lines
            {
                IsClosed = true,
                IsFilled = true
            };

            subtype42.Connection = lines6;
            info14.Subtypes.Add(subtype42);
            _gallery.Add(info14);
        }
示例#3
0
        UIElement[] IView2DRenderer.Generate()
        {
            int nser = _dataInfo.nser;
            int npts = _dataInfo.npts;

            if ((nser == 0) || (npts == 0))
            {
                return(null);
            }

            List <UIElement> objects    = new List <UIElement>();
            Rect             dataBounds = CoordConverter.DataBounds;
            bool             isStacked  = base.IsStacked;
            StackedSum       sum        = null;
            StackedSum       sum2       = null;
            StackedSum       sum3       = null;
            int nsg = 1;

            if (isStacked)
            {
                nsg  = base.NStackGroups();
                sum  = new StackedSum(nsg);
                sum2 = new StackedSum(nsg);
                sum3 = new StackedSum(nsg);
            }

            double       num4  = GetClusterWidth() * _dataInfo.DeltaX;
            IPlotElement defel = null;

            if (base.Symbol is PlotElement)
            {
                defel = ((PlotElement)base.Symbol).Clone() as IPlotElement;
            }

            bool defval   = (defel != null) ? defel.IsClustered : false;
            bool inverted = base.Inverted;
            int  num5     = 0;

            int[] numArray  = null;
            int[] numArray2 = null;
            if (isStacked)
            {
                num5 = base.NStackGroups();
            }
            else
            {
                numArray  = NClustered(defval);
                numArray2 = new int[numArray.Length];
                num5      = numArray[0];
            }

            double d             = 0.0;
            double origin        = 0.0;
            double seriesOverlap = 0.0;
            Chart  visual        = Chart;
            string xformat       = null;
            string yformat       = null;
            bool   flag4         = false;
            bool   flag5         = false;

            if (visual != null)
            {
                origin        = BarColumnOptions.GetOrigin(visual);
                xformat       = visual.View.AxisX.AnnoFormatInternal;
                yformat       = visual.View.AxisY.AnnoFormatInternal;
                flag4         = !double.IsNaN(visual.View.AxisX.LogBase);
                flag5         = !double.IsNaN(visual.View.AxisY.LogBase);
                seriesOverlap = BarColumnOptions.GetSeriesOverlap(visual);
                if (seriesOverlap > 1.0)
                {
                    seriesOverlap = 1.0;
                }
                else if (seriesOverlap < -1.0)
                {
                    seriesOverlap = -1.0;
                }
            }

            int si    = 0;
            int num10 = 0;

            while (si < nser)
            {
                IDataSeriesInfo ds     = base.Series[si];
                DataSeries      series = (DataSeries)base.Series[si];
                series.Children.Clear();
                objects.Add(series);
                series.SetDefaultFormat(xformat, yformat);
                int stackGroup = 0;
                if (isStacked)
                {
                    stackGroup = BarColumnOptions.GetStackGroup(series);
                }
                if (series.SymbolShape == null)
                {
                    series.SymbolShape = base.StyleGen.Next();
                }
                ShapeStyle symbolShape = series.SymbolShape;
                bool?      nullable    = null;
                double[,] values = ds.GetValues();
                if (values != null)
                {
                    int           length = values.GetLength(1);
                    int           num13  = values.GetLength(0);
                    RenderContext rc     = new RenderContext(this, ds, length)
                    {
                        Bounds = CoordConverter.ViewBounds
                    };
                    Rect clipBounds = rc.ClipBounds;
                    clipBounds = new Rect(clipBounds.X - 1.0, clipBounds.Y - 1.0, clipBounds.Width + 2.0, clipBounds.Height + 2.0);
                    double naN = double.NaN;
                    if ((rc.OptimizationRadiusScope & OptimizationRadiusScope.Symbols) > ((OptimizationRadiusScope)0))
                    {
                        naN = rc.OptimizationRadius;
                    }
                    bool isClustered = defval;
                    bool flag7       = series.IsStacked;
                    int  num15       = 0;
                    int  num16       = length;
                    if (_dataInfo.incX && !inverted)
                    {
                        Rect rect2 = CoordConverter.DataBounds2D;
                        for (int j = 0; j < length; j++)
                        {
                            double num18 = (num13 >= 2) ? values[1, j] : ((double)j);
                            if (num18 >= rect2.Left)
                            {
                                num15 = Math.Max(0, j - 2);
                                break;
                            }
                        }
                        for (int k = num15; k < length; k++)
                        {
                            double num20 = (num13 >= 2) ? values[1, k] : ((double)k);
                            if (num20 > rect2.Right)
                            {
                                num16 = k;
                                break;
                            }
                        }
                        num16 = Math.Min(length, num16 + 2);
                    }
                    Point point = new Point();
                    for (int i = num15; i < num16; i++)
                    {
                        double       num22     = values[0, i];
                        double       x         = (num13 >= 2) ? values[1, i] : ((double)i);
                        double       y         = x;
                        Style        style     = null;
                        IPlotElement pe        = null;
                        bool?        nullable2 = nullable;
                        if (!nullable2.GetValueOrDefault() || !nullable2.HasValue)
                        {
                            if (base.ColorScheme == ColorScheme.Point)
                            {
                                symbolShape = base.StyleGen.GetStyle(i);
                            }
                            style = base.GetStyle(series, si, i);
                            pe    = base.CreateElement(series.Symbol, style);
                            if (pe == null)
                            {
                                pe = PlotElement.SymbolFromMarker(series.SymbolMarker);
                                if ((pe != null) && (style != null))
                                {
                                    pe.Style = style;
                                }
                            }
                            if ((pe == null) && series.ChartType.HasValue)
                            {
                                ChartSubtype subtype = ChartTypes.GetSubtype(series.ChartType.ToString());
                                if (subtype != null)
                                {
                                    pe = base.CreateElement(subtype.Symbol, style);
                                }
                            }
                            else if (pe == null)
                            {
                                if (series.IsDefaultSymbol && (defel != null))
                                {
                                    pe       = defel;
                                    pe.Style = style;
                                    defel    = ((PlotElement)base.Symbol).Clone() as IPlotElement;
                                }
                            }
                            else
                            {
                                isClustered = pe.IsClustered;
                            }
                            if (pe == null)
                            {
                                isClustered = false;
                                if ((series.PointLabelTemplate != null) || (series.PointTooltipTemplate != null))
                                {
                                    DotSymbol symbol = new DotSymbol();
                                    symbol.Fill   = TransparentBrush;
                                    symbol.Size   = new Size(5.0, 5.0);
                                    symbol.Stroke = TransparentBrush;
                                    pe            = symbol;
                                }
                                else
                                {
                                    nullable = true;
                                }
                            }
                            else
                            {
                                isClustered = pe.IsClustered;
                            }
                        }
                        bool flag8 = (flag4 && inverted) || (flag5 && !inverted);
                        if (!flag8)
                        {
                            if (nsg > 1)
                            {
                                if (flag7)
                                {
                                    x += ((-0.5 * num4) + ((0.5 * num4) / ((double)num5))) + ((stackGroup * num4) / ((double)num5));
                                }
                            }
                            else if (isClustered)
                            {
                                int clusterPlotAreaIndex = rc.ClusterPlotAreaIndex;
                                if (clusterPlotAreaIndex == 0)
                                {
                                    if (num5 > 1)
                                    {
                                        x += ((-0.5 * num4) + ((0.5 * num4) / ((double)num5))) + ((num10 * num4) / ((double)num5));
                                    }
                                }
                                else if (numArray[clusterPlotAreaIndex] > 1)
                                {
                                    x += ((-0.5 * num4) + ((0.5 * num4) / ((double)numArray[clusterPlotAreaIndex]))) + ((numArray2[clusterPlotAreaIndex] * num4) / ((double)numArray[clusterPlotAreaIndex]));
                                }
                            }
                        }
                        if (isStacked && flag7)
                        {
                            if (double.IsNaN(num22))
                            {
                                num22 = 0.0;
                            }
                            if (base.IsStacked100)
                            {
                                if (_dataInfo.Stacked[stackGroup, x] != 0.0)
                                {
                                    num22 = ((num22 * 100.0) / _dataInfo.Stacked[stackGroup, x]) + sum[stackGroup, x];
                                }
                            }
                            else
                            {
                                num22 += sum[stackGroup, x];
                            }
                        }
                        double num26 = x;
                        if (inverted)
                        {
                            double num27 = x;
                            x     = num22;
                            num22 = num27;
                        }
                        double num28 = rc.ConvertX(x);
                        double num29 = rc.ConvertY(num22);
                        if (((isStacked && flag7) && (si > 0)) && ((inverted && !double.IsNaN(num29)) || (!inverted && !double.IsNaN(num28))))
                        {
                            rc.SetPrevious(sum[stackGroup, num26]);
                        }
                        nullable2 = nullable;
                        if (!nullable2.GetValueOrDefault() || !nullable2.HasValue)
                        {
                            if (isClustered)
                            {
                                int num30 = num5;
                                if (rc.ClusterPlotAreaIndex > 0)
                                {
                                    num30 = numArray[rc.ClusterPlotAreaIndex];
                                }
                                if (num30 > 0)
                                {
                                    if (inverted)
                                    {
                                        d = Math.Abs((double)(CoordConverter.ConvertY((num4 / ((double)num30)) + num22) - CoordConverter.ConvertY(num22)));
                                    }
                                    else
                                    {
                                        d = Math.Abs((double)(CoordConverter.ConvertX((num4 / ((double)num30)) + x) - CoordConverter.ConvertX(x)));
                                    }
                                }
                            }
                            else if (inverted)
                            {
                                d = Math.Abs((double)(CoordConverter.ConvertY(num4 + num22) - CoordConverter.ConvertY(num22)));
                            }
                            else
                            {
                                d = Math.Abs((double)(CoordConverter.ConvertX(num4 + x) - CoordConverter.ConvertX(x)));
                            }
                            if (double.IsNaN(d))
                            {
                                d = inverted ? (base.SizeY * 20.0) : (base.SizeX * 20.0);
                            }
                        }
                        if (flag8)
                        {
                            double num31 = 0.0;
                            double num32 = d * num5;
                            if (nsg > 1)
                            {
                                if (flag7)
                                {
                                    num31 = ((-0.5 * num32) + ((0.5 * num32) / ((double)num5))) + ((stackGroup * num32) / ((double)num5));
                                }
                            }
                            else if ((num5 > 1) && isClustered)
                            {
                                num31 = ((-0.5 * num32) + ((0.5 * num32) / ((double)num5))) + ((num10 * num32) / ((double)num5));
                            }
                            if (num31 != 0.0)
                            {
                                if (inverted)
                                {
                                    num29 += num31;
                                }
                                else
                                {
                                    num28 += num31;
                                }
                            }
                        }
                        if (isStacked && flag7)
                        {
                            StackedSum sum4;
                            int        num63;
                            double     num64;
                            double     num33 = values[0, i];
                            if (double.IsNaN(num33))
                            {
                                num33 = 0.0;
                            }
                            double num34 = (num33 >= 0.0) ? sum2[stackGroup, num26] : sum3[stackGroup, num26];
                            double num35 = (num33 >= 0.0) ? (sum2[stackGroup, num26] + num33) : (sum3[stackGroup, num26] + num33);
                            if (base.IsStacked100)
                            {
                                num34 = (num34 * 100.0) / _dataInfo.Stacked[stackGroup, num26];
                                num35 = (num35 * 100.0) / _dataInfo.Stacked[stackGroup, num26];
                            }
                            if (inverted)
                            {
                                double num36;
                                double num37;
                                double num38;
                                if (flag4)
                                {
                                    double minX = rc.GetMinX(CoordConverter.DataBounds2D);
                                    num36 = CoordConverter.ConvertX(Math.Max(num35, minX));
                                    num37 = CoordConverter.ConvertX(Math.Max(num34, minX));
                                }
                                else
                                {
                                    num36 = CoordConverter.ConvertX(num35);
                                    num37 = CoordConverter.ConvertX(num34);
                                }
                                if (flag5)
                                {
                                    num38 = base.SizeY * 20.0;
                                }
                                else
                                {
                                    num38 = Math.Abs((double)(CoordConverter.ConvertY(num4 / ((double)nsg)) - CoordConverter.ConvertY(0.0)));
                                }
                                double width = Math.Abs((double)(num37 - num36));
                                rc.Rect = new Rect(Math.Min(num36, num37), num29 - (0.5 * num38), width, num38);
                                sum[stackGroup, num26] = x;
                            }
                            else
                            {
                                double num41;
                                double num42;
                                double num43;
                                if (flag5)
                                {
                                    double minY = rc.GetMinY(CoordConverter.DataBounds2D);
                                    num41 = CoordConverter.ConvertY(Math.Max(num35, minY));
                                    num42 = CoordConverter.ConvertY(Math.Max(num34, minY));
                                }
                                else
                                {
                                    num41 = CoordConverter.ConvertY(num35);
                                    num42 = CoordConverter.ConvertY(num34);
                                }
                                if (flag4)
                                {
                                    num43 = base.SizeX * 20.0;
                                }
                                else
                                {
                                    num43 = Math.Abs((double)(CoordConverter.ConvertX(num4 / ((double)nsg)) - CoordConverter.ConvertX(0.0)));
                                }
                                double height = Math.Abs((double)(num42 - num41));
                                rc.Rect = new Rect(num28 - (0.5 * num43), Math.Min(num41, num42), num43, height);
                                sum[stackGroup, num26] = num22;
                            }
                            if (num33 >= 0.0)
                            {
                                (sum4 = sum2)[num63 = stackGroup, num64 = num26] = sum4[num63, num64] + num33;
                            }
                            else
                            {
                                (sum4 = sum3)[num63 = stackGroup, num64 = num26] = sum4[num63, num64] + num33;
                            }
                        }
                        else
                        {
                            nullable2 = nullable;
                            if (!nullable2.GetValueOrDefault() || !nullable2.HasValue)
                            {
                                double num46 = origin;
                                if (inverted)
                                {
                                    double num47 = rc.GetMinX(CoordConverter.DataBounds2D);
                                    double maxX  = rc.GetMaxX(CoordConverter.DataBounds2D);
                                    if (num46 < num47)
                                    {
                                        num46 = num47;
                                    }
                                    else if (num46 > maxX)
                                    {
                                        num46 = maxX;
                                    }
                                    double num49 = rc.ConvertX(num46);
                                    double num50 = d;
                                    double num51 = Math.Abs((double)(num49 - num28));
                                    if (seriesOverlap != 0.0)
                                    {
                                        double num52 = rc.ConvertY(y);
                                        double num53 = d * num5;
                                        if (seriesOverlap > 0.0)
                                        {
                                            num50 = num53 / ((num5 - (num5 * seriesOverlap)) + seriesOverlap);
                                        }
                                        else
                                        {
                                            num50 *= 1.0 + seriesOverlap;
                                        }
                                        double num54 = (num53 - num50) / ((double)(num5 - 1));
                                        rc.Rect = new Rect(Math.Min(num28, num49), (num52 - (0.5 * num53)) + (((num5 - num10) - 1) * num54), num51, num50);
                                    }
                                    else
                                    {
                                        rc.Rect = new Rect(Math.Min(num28, num49), num29 - (0.5 * num50), num51, num50);
                                    }
                                }
                                else
                                {
                                    double num55 = rc.GetMinY(CoordConverter.DataBounds2D);
                                    double maxY  = rc.GetMaxY(CoordConverter.DataBounds2D);
                                    if (num46 < num55)
                                    {
                                        num46 = num55;
                                    }
                                    else if (num46 > maxY)
                                    {
                                        num46 = maxY;
                                    }
                                    double num57 = rc.ConvertY(num46);
                                    double num58 = d;
                                    double num59 = Math.Abs((double)(num57 - num29));
                                    if (seriesOverlap != 0.0)
                                    {
                                        double num60 = rc.ConvertX(y);
                                        double num61 = d * num5;
                                        if (seriesOverlap > 0.0)
                                        {
                                            num58 = num61 / ((num5 - (num5 * seriesOverlap)) + seriesOverlap);
                                        }
                                        else
                                        {
                                            num58 *= 1.0 + seriesOverlap;
                                        }
                                        double num62 = (num61 - num58) / ((double)(num5 - 1));
                                        rc.Rect = new Rect((num60 - (0.5 * num61)) + (num10 * num62), Math.Min(num29, num57), num58, num59);
                                    }
                                    else
                                    {
                                        rc.Rect = new Rect(num28 - (0.5 * num58), Math.Min(num29, num57), num58, num59);
                                    }
                                }
                            }
                        }
                        rc.SetPoint(i, num28, num29);
                        if (pe != null)
                        {
                            Point point2 = new Point(num28, num29);
                            if ((pe is ICustomClipping) || clipBounds.Contains(point2))
                            {
                                if (double.IsNaN(naN))
                                {
                                    DataPoint dp = series.CreateDataPoint(si, i);
                                    base.RenderElement(objects, pe, series, rc, symbolShape, dp);
                                }
                                else if (((i == 0) || (Math.Abs((double)(point2.X - point.X)) > naN)) || ((Math.Abs((double)(point2.Y - point.Y)) > naN) || (i == (num16 - 1))))
                                {
                                    DataPoint point4 = series.CreateDataPoint(si, i);
                                    base.RenderElement(objects, pe, series, rc, symbolShape, point4);
                                    point = point2;
                                }
                            }
                        }
                    }

                    PlotElement element3 = base.RenderConnection(series, rc, si);
                    if (element3 != null)
                    {
                        series.Children.Insert(0, element3);
                    }

                    if (isClustered)
                    {
                        if (rc.ClusterPlotAreaIndex == 0)
                        {
                            num10++;
                        }
                        else
                        {
                            numArray2[rc.ClusterPlotAreaIndex]++;
                        }
                    }
                }
                si++;
            }
            return(objects.ToArray());
        }
示例#4
0
        UIElement[] IView2DRenderer.Generate()
        {
            int nser = _dataInfo.nser;
            int npts = _dataInfo.npts;

            if ((nser == 0) || (npts == 0))
            {
                return(null);
            }
            IPlotElement element = null;

            if (base.Symbol is PlotElement)
            {
                element = ((PlotElement)base.Symbol).Clone() as IPlotElement;
            }
            List <UIElement> objects = new List <UIElement>();

            for (int i = 0; i < nser; i++)
            {
                DataSeries ds = (DataSeries)base.Series[i];
                ds.Children.Clear();
                objects.Add(ds);
                if (ds.SymbolShape == null)
                {
                    ds.SymbolShape = base.StyleGen.Next();
                }
                ShapeStyle symbolShape = ds.SymbolShape;
                double[,] values = ds.GetValues();
                if (values != null)
                {
                    int           length = values.GetLength(1);
                    int           num5   = values.GetLength(0);
                    RenderContext rc     = new RenderContext(this, ds, length)
                    {
                        Bounds = CoordConverter.ViewBounds
                    };
                    for (int j = 0; j < length; j++)
                    {
                        if (base.ColorScheme == ColorScheme.Point)
                        {
                            symbolShape = base.StyleGen.GetStyle(j);
                        }
                        double       y     = values[0, j];
                        double       x     = (num5 >= 2) ? values[1, j] : ((double)j);
                        bool         flag  = false;
                        Style        style = base.GetStyle(ds, i, j);
                        IPlotElement pe    = base.CreateElement(ds.Symbol, style);
                        if (pe == null)
                        {
                            pe = PlotElement.SymbolFromMarker(ds.SymbolMarker);
                            if ((pe != null) && (style != null))
                            {
                                pe.Style = style;
                            }
                        }
                        if ((pe == null) && ds.ChartType.HasValue)
                        {
                            ChartSubtype subtype = ChartTypes.GetSubtype(ds.ChartType.ToString());
                            if (subtype != null)
                            {
                                pe = base.CreateElement(subtype.Symbol, style);
                            }
                        }
                        else if (((pe == null) && ds.IsDefaultSymbol) && (element != null))
                        {
                            pe       = element;
                            pe.Style = style;
                            element  = ((PlotElement)base.Symbol).Clone() as IPlotElement;
                        }
                        if ((pe == null) && ((ds.PointLabelTemplate != null) || (ds.PointTooltipTemplate != null)))
                        {
                            DotSymbol symbol = new DotSymbol();
                            symbol.Fill   = TransparentBrush;
                            symbol.Size   = new Size(5.0, 5.0);
                            symbol.Stroke = TransparentBrush;
                            pe            = symbol;
                            flag          = true;
                        }
                        Point point   = CoordConverter.ConvertPoint(new Point(x, y));
                        Axis  auxAxis = GetAuxAxis(j);
                        if (auxAxis != null)
                        {
                            ChartViewport2D coordConverter = CoordConverter as ChartViewport2D;
                            if (coordConverter != null)
                            {
                                point = coordConverter.ConvertPoint(new Point(x, y), base.Chart.View.AxisX, auxAxis);
                            }
                        }
                        rc.SetPoint(j, point.X, point.Y);
                        if (!double.IsNaN(point.X) && !double.IsNaN(point.Y))
                        {
                            DataPoint dp       = ds.CreateDataPoint(i, j);
                            UIElement element3 = base.RenderElement(objects, pe, ds, rc, symbolShape, dp);
                            if ((element3 != null) && flag)
                            {
                                Canvas.SetZIndex(element3, 2);
                            }
                        }
                    }
                    PlotElement element4 = base.RenderConnection(ds, rc, i);
                    if (element4 != null)
                    {
                        element4.DataPoint = ds.CreateDataPoint(i, -1);
                        ds.Children.Insert(0, element4);
                    }
                }
            }
            return(objects.ToArray());
        }